From d16800522fffefa43ad738b40808f5298e572886 Mon Sep 17 00:00:00 2001 From: Maurelian Date: Fri, 28 May 2021 07:56:36 -0400 Subject: [PATCH 001/125] chore: reduce hardhat timeout to 20 seconds (#968) --- .changeset/cold-cows-cross.md | 5 +++++ integration-tests/hardhat.config.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/cold-cows-cross.md diff --git a/.changeset/cold-cows-cross.md b/.changeset/cold-cows-cross.md new file mode 100644 index 000000000000..cc67cf4d950d --- /dev/null +++ b/.changeset/cold-cows-cross.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/integration-tests': patch +--- + +Reduce test timeout from 100 to 20 seconds diff --git a/integration-tests/hardhat.config.ts b/integration-tests/hardhat.config.ts index b68e8646ba7b..0fcc9b23325f 100644 --- a/integration-tests/hardhat.config.ts +++ b/integration-tests/hardhat.config.ts @@ -10,7 +10,7 @@ const enableGasReport = !!process.env.ENABLE_GAS_REPORT const config: HardhatUserConfig = { mocha: { - timeout: 100000, + timeout: 20000, }, networks: { optimism: { From 245136f14afed2a731a5ca5f9b5b071a3131961b Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Fri, 28 May 2021 13:00:15 -0400 Subject: [PATCH 002/125] fix: force LF line endings for scripts to avoid docker problems on Windows (#974) * fix: use correct line endings for windows * chore: add changeset --- .changeset/thin-waves-bathe.md | 5 +++++ .gitattributes | 1 + packages/contracts/bin/deploy.ts | 2 -- packages/contracts/package.json | 4 ++-- 4 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 .changeset/thin-waves-bathe.md create mode 100644 .gitattributes diff --git a/.changeset/thin-waves-bathe.md b/.changeset/thin-waves-bathe.md new file mode 100644 index 000000000000..605e410ac5df --- /dev/null +++ b/.changeset/thin-waves-bathe.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/contracts': patch +--- + +Minor change to how deploy.ts is invoked diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000000..dfdb8b771ce0 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.sh text eol=lf diff --git a/packages/contracts/bin/deploy.ts b/packages/contracts/bin/deploy.ts index 719ac691c4fa..7ac14d6615e1 100755 --- a/packages/contracts/bin/deploy.ts +++ b/packages/contracts/bin/deploy.ts @@ -1,5 +1,3 @@ -#!/usr/bin/env ts-node-script - import { Wallet } from 'ethers' import path from 'path' import dirtree from 'directory-tree' diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 0dd1f1c288c4..e8f750f6d7a3 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -38,13 +38,13 @@ "lint:check": "yarn run lint:typescript", "lint:typescript": "tslint --format stylish --project .", "clean": "rm -rf ./dist ./artifacts ./artifacts-ovm ./cache ./cache-ovm ./tsconfig.build.tsbuildinfo", - "deploy": "./bin/deploy.ts && yarn generate-markdown", + "deploy": "ts-node \"./bin/deploy.ts\" && yarn generate-markdown", "serve": "./bin/serve_dump.sh", "prepublishOnly": "yarn copyfiles -u 2 \"contracts/optimistic-ethereum/**/*\" ./", "postpublish": "rimraf OVM iOVM libraries mockOVM", "prepack": "yarn prepublishOnly", "postpack": "yarn postpublish", - "generate-markdown": "node scripts/generate-markdown.js" + "generate-markdown": "node \"./scripts/generate-markdown.js\"" }, "dependencies": { "@eth-optimism/core-utils": "^0.4.4", From b284dc39ff186fde7ec88c17cbc154e65804d976 Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Fri, 7 May 2021 19:08:57 -0400 Subject: [PATCH 003/125] refactor[contracts]: Turn ExecutionManagerWrapper into a predeployed contract (#808) * wip: Started working on L2 contract testing revamp * test: clean tests for ProxyEOA * style: clean imports for ProxyEOA tests * test: port tests for ECDSAContractAccount * fix tests and add wrapper to dump * fix: add em wrapper to l2 deploy * ffix: add comments to wrapper contract * fix: add more comments * fix: add smock comment for unbind * Update packages/smock/src/smockit/binding.ts --- .../OVM/accounts/OVM_ECDSAContractAccount.sol | 4 +- .../OVM/accounts/OVM_ProxyEOA.sol | 5 +- .../OVM_ExecutionManagerWrapper.sol | 44 +++ .../predeploys/OVM_SequencerEntrypoint.sol | 1 - .../wrappers/Lib_ExecutionManagerWrapper.sol | 64 ++-- .../src/contract-deployment/config.ts | 7 + packages/contracts/src/predeploys.ts | 1 + .../contracts/src/state-dump/make-dump.ts | 4 +- .../accounts/OVM_ECDSAContractAccount.spec.ts | 318 ++++-------------- .../OVM/accounts/OVM_ProxyEOA.spec.ts | 147 +++----- .../OVM_SequencerEntrypoint.spec.ts | 173 ++++------ packages/smock/src/smockit/binding.ts | 44 ++- packages/smock/src/smockit/smockit.ts | 21 +- 13 files changed, 336 insertions(+), 497 deletions(-) create mode 100644 packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_ExecutionManagerWrapper.sol diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol index e9cd8be923d0..0d5c5133741b 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol @@ -1,5 +1,4 @@ // SPDX-License-Identifier: MIT -// @unsupported: evm pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; @@ -74,7 +73,7 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount { // recovered address of the user who signed this message. This is how we manage to shim // account abstraction even though the user isn't a contract. require( - transaction.sender() == address(this), + transaction.sender() == Lib_ExecutionManagerWrapper.ovmADDRESS(), "Signature provided for EOA transaction execution is invalid." ); @@ -138,6 +137,7 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount { ), "Value could not be transferred to recipient." ); + return (true, bytes("")); } else { return transaction.to.call(transaction.data); diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol index d158d15d5b4e..785b92b872a5 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT -// @unsupported: evm pragma solidity >0.5.0 <0.8.0; /* Library Imports */ import { Lib_Bytes32Utils } from "../../libraries/utils/Lib_Bytes32Utils.sol"; +import { Lib_ExecutionManagerWrapper } from "../../libraries/wrappers/Lib_ExecutionManagerWrapper.sol"; /** * @title OVM_ProxyEOA @@ -72,7 +72,7 @@ contract OVM_ProxyEOA { external { require( - msg.sender == address(this), + msg.sender == Lib_ExecutionManagerWrapper.ovmADDRESS(), "EOAs can only upgrade their own EOA implementation" ); @@ -86,6 +86,7 @@ contract OVM_ProxyEOA { */ function getImplementation() public + view returns ( address ) diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_ExecutionManagerWrapper.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_ExecutionManagerWrapper.sol new file mode 100644 index 000000000000..e7b2c151b8ae --- /dev/null +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_ExecutionManagerWrapper.sol @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: MIT +// @unsupported: evm +pragma solidity >0.5.0 <0.8.0; + +/* Library Imports */ +import { Lib_ErrorUtils } from "../../libraries/utils/Lib_ErrorUtils.sol"; + +/** + * @title OVM_ExecutionManagerWrapper + * @dev This contract is a thin wrapper around the `kall` builtin. By making this contract a + * predeployed contract, we can restrict evm solc incompatibility to this one contract. Other + * contracts will typically call this contract via `Lib_ExecutionManagerWrapper`. + * + * Compiler used: optimistic-solc + * Runtime target: OVM + */ +contract OVM_ExecutionManagerWrapper { + + /********************* + * Fallback Function * + *********************/ + + fallback() + external + { + bytes memory data = msg.data; + assembly { + // kall is a custom yul builtin within optimistic-solc that allows us to directly call + // the execution manager (since `call` would be compiled). + kall(add(data, 0x20), mload(data), 0x0, 0x0) + + // Standard returndata loading code. + let size := returndatasize() + let returndata := mload(0x40) + mstore(0x40, add(returndata, and(add(add(size, 0x20), 0x1f), not(0x1f)))) + mstore(returndata, size) + returndatacopy(add(returndata, 0x20), 0x0, size) + + // kall automatically reverts if the underlying call fails, so we only need to handle + // the success case. + return(add(returndata, 0x20), mload(returndata)) + } + } +} diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerEntrypoint.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerEntrypoint.sol index 0be33bd2b98a..895e68a658f0 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerEntrypoint.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerEntrypoint.sol @@ -1,5 +1,4 @@ // SPDX-License-Identifier: MIT -// @unsupported: evm pragma solidity >0.5.0 <0.8.0; /* Library Imports */ diff --git a/packages/contracts/contracts/optimistic-ethereum/libraries/wrappers/Lib_ExecutionManagerWrapper.sol b/packages/contracts/contracts/optimistic-ethereum/libraries/wrappers/Lib_ExecutionManagerWrapper.sol index 80fa0a86d851..695cdaa86306 100644 --- a/packages/contracts/contracts/optimistic-ethereum/libraries/wrappers/Lib_ExecutionManagerWrapper.sol +++ b/packages/contracts/contracts/optimistic-ethereum/libraries/wrappers/Lib_ExecutionManagerWrapper.sol @@ -1,5 +1,4 @@ // SPDX-License-Identifier: MIT -// @unsupported: evm pragma solidity >0.5.0 <0.8.0; /* Library Imports */ @@ -7,6 +6,9 @@ import { Lib_ErrorUtils } from "../utils/Lib_ErrorUtils.sol"; /** * @title Lib_ExecutionManagerWrapper + * @dev This library acts as a utility for easily calling the OVM_ExecutionManagerWrapper, the + * predeployed contract which exposes the `kall` builtin. Effectively, this contract allows the + * user to trigger OVM opcodes by directly calling the OVM_ExecutionManger. * * Compiler used: solc * Runtime target: OVM @@ -20,7 +22,7 @@ library Lib_ExecutionManagerWrapper { /** * Performs a safe ovmCREATE call. * @param _bytecode Code for the new contract. - * @return _contract Address of the created contract. + * @return Address of the created contract. */ function ovmCREATE( bytes memory _bytecode @@ -31,7 +33,7 @@ library Lib_ExecutionManagerWrapper { bytes memory ) { - bytes memory returndata = _safeExecutionManagerInteraction( + bytes memory returndata = _callWrapperContract( abi.encodeWithSignature( "ovmCREATE(bytes)", _bytecode @@ -43,15 +45,15 @@ library Lib_ExecutionManagerWrapper { /** * Performs a safe ovmGETNONCE call. - * @return _nonce Result of calling ovmGETNONCE. + * @return Result of calling ovmGETNONCE. */ function ovmGETNONCE() internal returns ( - uint256 _nonce + uint256 ) { - bytes memory returndata = _safeExecutionManagerInteraction( + bytes memory returndata = _callWrapperContract( abi.encodeWithSignature( "ovmGETNONCE()" ) @@ -66,7 +68,7 @@ library Lib_ExecutionManagerWrapper { function ovmINCREMENTNONCE() internal { - _safeExecutionManagerInteraction( + _callWrapperContract( abi.encodeWithSignature( "ovmINCREMENTNONCE()" ) @@ -88,7 +90,7 @@ library Lib_ExecutionManagerWrapper { ) internal { - _safeExecutionManagerInteraction( + _callWrapperContract( abi.encodeWithSignature( "ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)", _messageHash, @@ -109,7 +111,7 @@ library Lib_ExecutionManagerWrapper { address ) { - bytes memory returndata = _safeExecutionManagerInteraction( + bytes memory returndata = _callWrapperContract( abi.encodeWithSignature( "ovmL1TXORIGIN()" ) @@ -128,7 +130,7 @@ library Lib_ExecutionManagerWrapper { uint256 ) { - bytes memory returndata = _safeExecutionManagerInteraction( + bytes memory returndata = _callWrapperContract( abi.encodeWithSignature( "ovmCHAINID()" ) @@ -137,6 +139,25 @@ library Lib_ExecutionManagerWrapper { return abi.decode(returndata, (uint256)); } + /** + * Performs a safe ovmADDRESS call. + * @return Result of calling ovmADDRESS. + */ + function ovmADDRESS() + internal + returns ( + address + ) + { + bytes memory returndata = _callWrapperContract( + abi.encodeWithSignature( + "ovmADDRESS()" + ) + ); + + return abi.decode(returndata, (address)); + } + /********************* * Private Functions * @@ -145,9 +166,9 @@ library Lib_ExecutionManagerWrapper { /** * Performs an ovm interaction and the necessary safety checks. * @param _calldata Data to send to the OVM_ExecutionManager (encoded with sighash). - * @return _returndata Data sent back by the OVM_ExecutionManager. + * @return Data sent back by the OVM_ExecutionManager. */ - function _safeExecutionManagerInteraction( + function _callWrapperContract( bytes memory _calldata ) private @@ -155,17 +176,14 @@ library Lib_ExecutionManagerWrapper { bytes memory ) { - bytes memory returndata; - assembly { - // kall is a custom yul builtin within optimistic-solc that allows us to directly call - // the execution manager (since `call` would be compiled). - kall(add(_calldata, 0x20), mload(_calldata), 0x0, 0x0) - let size := returndatasize() - returndata := mload(0x40) - mstore(0x40, add(returndata, and(add(add(size, 0x20), 0x1f), not(0x1f)))) - mstore(returndata, size) - returndatacopy(add(returndata, 0x20), 0x0, size) + (bool success, bytes memory returndata) = 0x420000000000000000000000000000000000000B.delegatecall(_calldata); + + if (success == true) { + return returndata; + } else { + assembly { + revert(add(returndata, 0x20), mload(returndata)) + } } - return returndata; } } diff --git a/packages/contracts/src/contract-deployment/config.ts b/packages/contracts/src/contract-deployment/config.ts index 4f1ad42a9b79..f1661862e32b 100644 --- a/packages/contracts/src/contract-deployment/config.ts +++ b/packages/contracts/src/contract-deployment/config.ts @@ -251,5 +251,12 @@ export const makeContractDeployConfig = async ( OVM_ProxyEOA: { factory: getContractFactory('OVM_ProxyEOA', undefined, true), }, + OVM_ExecutionManagerWrapper: { + factory: getContractFactory( + 'OVM_ExecutionManagerWrapper', + undefined, + true + ), + }, } } diff --git a/packages/contracts/src/predeploys.ts b/packages/contracts/src/predeploys.ts index 05bc306ea752..5467e66f4c12 100644 --- a/packages/contracts/src/predeploys.ts +++ b/packages/contracts/src/predeploys.ts @@ -17,5 +17,6 @@ export const predeploys = { OVM_L2CrossDomainMessenger: '0x4200000000000000000000000000000000000007', Lib_AddressManager: '0x4200000000000000000000000000000000000008', OVM_ProxyEOA: '0x4200000000000000000000000000000000000009', + OVM_ExecutionManagerWrapper: '0x420000000000000000000000000000000000000B', ERC1820Registry: '0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24', } diff --git a/packages/contracts/src/state-dump/make-dump.ts b/packages/contracts/src/state-dump/make-dump.ts index 42179e516bc2..7e253ea6d943 100644 --- a/packages/contracts/src/state-dump/make-dump.ts +++ b/packages/contracts/src/state-dump/make-dump.ts @@ -136,6 +136,7 @@ export const makeStateDump = async (cfg: RollupDeployConfig): Promise => { 'OVM_ExecutionManager', 'OVM_StateManager', 'OVM_ETH', + 'OVM_ExecutionManagerWrapper', ], deployOverrides: {}, waitForReceipts: false, @@ -152,6 +153,7 @@ export const makeStateDump = async (cfg: RollupDeployConfig): Promise => { 'OVM_ETH', 'OVM_ECDSAContractAccount', 'OVM_ProxyEOA', + 'OVM_ExecutionManagerWrapper', ] const deploymentResult = await deploy(config) @@ -174,7 +176,7 @@ export const makeStateDump = async (cfg: RollupDeployConfig): Promise => { for (let i = 0; i < Object.keys(deploymentResult.contracts).length; i++) { const name = Object.keys(deploymentResult.contracts)[i] const contract = deploymentResult.contracts[name] - let code + let code: string if (ovmCompiled.includes(name)) { const ovmDeployedBytecode = getContractDefinition(name, true) .deployedBytecode diff --git a/packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts b/packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts index c3a09d32c4ff..9145d9e2b746 100644 --- a/packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts +++ b/packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts @@ -4,129 +4,49 @@ import { expect } from '../../../setup' import { ethers, waffle } from 'hardhat' import { ContractFactory, Contract, Wallet, BigNumber } from 'ethers' import { MockContract, smockit } from '@eth-optimism/smock' -import { fromHexString, toHexString } from '@eth-optimism/core-utils' +import { toPlainObject } from 'lodash' /* Internal Imports */ -import { - NON_ZERO_ADDRESS, - DEFAULT_EIP155_TX, - decodeSolidityError, -} from '../../../helpers' -import { - getContractFactory, - getContractInterface, - predeploys, -} from '../../../../src' - -const callPredeploy = async ( - Helper_PredeployCaller: Contract, - predeploy: Contract, - functionName: string, - functionParams?: any[], - gasLimit?: number -): Promise => { - if (gasLimit) { - return Helper_PredeployCaller.callPredeploy( - predeploy.address, - predeploy.interface.encodeFunctionData( - functionName, - functionParams || [] - ), - { gasLimit } - ) - } - return Helper_PredeployCaller.callPredeploy( - predeploy.address, - predeploy.interface.encodeFunctionData(functionName, functionParams || []) - ) -} - -const iOVM_ETH = getContractInterface('OVM_ETH') +import { DEFAULT_EIP155_TX } from '../../../helpers' +import { predeploys } from '../../../../src' describe('OVM_ECDSAContractAccount', () => { let wallet: Wallet - let badWallet: Wallet before(async () => { const provider = waffle.provider - ;[wallet, badWallet] = provider.getWallets() + ;[wallet] = provider.getWallets() }) let Mock__OVM_ExecutionManager: MockContract - let Helper_PredeployCaller: Contract + let Mock__OVM_ETH: MockContract before(async () => { - Mock__OVM_ExecutionManager = await smockit( - await ethers.getContractFactory('OVM_ExecutionManager') - ) - - Helper_PredeployCaller = await ( - await ethers.getContractFactory('Helper_PredeployCaller') - ).deploy() - - Helper_PredeployCaller.setTarget(Mock__OVM_ExecutionManager.address) + Mock__OVM_ExecutionManager = await smockit('OVM_ExecutionManager', { + address: predeploys.OVM_ExecutionManagerWrapper, + }) + Mock__OVM_ETH = await smockit('OVM_ETH', { + address: predeploys.OVM_ETH, + }) }) let Factory__OVM_ECDSAContractAccount: ContractFactory before(async () => { - Factory__OVM_ECDSAContractAccount = getContractFactory( - 'OVM_ECDSAContractAccount', - wallet, - true + Factory__OVM_ECDSAContractAccount = await ethers.getContractFactory( + 'OVM_ECDSAContractAccount' ) }) let OVM_ECDSAContractAccount: Contract beforeEach(async () => { OVM_ECDSAContractAccount = await Factory__OVM_ECDSAContractAccount.deploy() + }) - Mock__OVM_ExecutionManager.smocked.ovmADDRESS.will.return.with( - await wallet.getAddress() - ) - Mock__OVM_ExecutionManager.smocked.ovmEXTCODESIZE.will.return.with(1) + beforeEach(async () => { Mock__OVM_ExecutionManager.smocked.ovmCHAINID.will.return.with(420) Mock__OVM_ExecutionManager.smocked.ovmGETNONCE.will.return.with(100) - Mock__OVM_ExecutionManager.smocked.ovmCALL.will.return.with( - (gasLimit, target, data) => { - if (target === predeploys.OVM_ETH) { - return [ - true, - '0x0000000000000000000000000000000000000000000000000000000000000001', - ] - } else { - return [true, '0x'] - } - } - ) - Mock__OVM_ExecutionManager.smocked.ovmSTATICCALL.will.return.with( - (gasLimit, target, data) => { - // Duplicating the behavior of the ecrecover precompile. - if (target === '0x0000000000000000000000000000000000000001') { - const databuf = fromHexString(data) - - let addr: string - try { - addr = ethers.utils.recoverAddress(databuf.slice(0, 32), { - v: BigNumber.from(databuf.slice(32, 64)).toNumber(), - r: toHexString(databuf.slice(64, 96)), - s: toHexString(databuf.slice(96, 128)), - }) - } catch (err) { - addr = ethers.constants.AddressZero - } - - const ret = ethers.utils.defaultAbiCoder.encode(['address'], [addr]) - return [true, ret] - } else { - return [true, '0x'] - } - } - ) - Mock__OVM_ExecutionManager.smocked.ovmCREATE.will.return.with([ - NON_ZERO_ADDRESS, - '0x', - ]) - Mock__OVM_ExecutionManager.smocked.ovmCALLER.will.return.with( - NON_ZERO_ADDRESS + Mock__OVM_ExecutionManager.smocked.ovmADDRESS.will.return.with( + await wallet.getAddress() ) + Mock__OVM_ETH.smocked.transfer.will.return.with(true) }) describe('fallback()', () => { @@ -134,29 +54,14 @@ describe('OVM_ECDSAContractAccount', () => { const transaction = DEFAULT_EIP155_TX const encodedTransaction = await wallet.signTransaction(transaction) - await callPredeploy( - Helper_PredeployCaller, - OVM_ECDSAContractAccount, - 'execute', - [encodedTransaction] - ) - - // The ovmCALL is the 2nd call because the first call transfers the fee. - const ovmCALL: any = Mock__OVM_ExecutionManager.smocked.ovmCALL.calls[1] - expect(ovmCALL._address).to.equal(DEFAULT_EIP155_TX.to) - expect(ovmCALL._calldata).to.equal(DEFAULT_EIP155_TX.data) + await OVM_ECDSAContractAccount.execute(encodedTransaction) }) it(`should ovmCREATE if EIP155Transaction.to is zero address`, async () => { const transaction = { ...DEFAULT_EIP155_TX, to: '' } const encodedTransaction = await wallet.signTransaction(transaction) - await callPredeploy( - Helper_PredeployCaller, - OVM_ECDSAContractAccount, - 'execute', - [encodedTransaction] - ) + await OVM_ECDSAContractAccount.execute(encodedTransaction) const ovmCREATE: any = Mock__OVM_ExecutionManager.smocked.ovmCREATE.calls[0] @@ -170,15 +75,9 @@ describe('OVM_ECDSAContractAccount', () => { '0x' + '00'.repeat(65) ) - await callPredeploy( - Helper_PredeployCaller, - OVM_ECDSAContractAccount, - 'execute', - [encodedTransaction] - ) - const ovmREVERT: any = - Mock__OVM_ExecutionManager.smocked.ovmREVERT.calls[0] - expect(decodeSolidityError(ovmREVERT._data)).to.equal( + await expect( + OVM_ECDSAContractAccount.execute(encodedTransaction) + ).to.be.revertedWith( 'Signature provided for EOA transaction execution is invalid.' ) }) @@ -187,15 +86,9 @@ describe('OVM_ECDSAContractAccount', () => { const transaction = { ...DEFAULT_EIP155_TX, nonce: 99 } const encodedTransaction = await wallet.signTransaction(transaction) - await callPredeploy( - Helper_PredeployCaller, - OVM_ECDSAContractAccount, - 'execute', - [encodedTransaction] - ) - const ovmREVERT: any = - Mock__OVM_ExecutionManager.smocked.ovmREVERT.calls[0] - expect(decodeSolidityError(ovmREVERT._data)).to.equal( + await expect( + OVM_ECDSAContractAccount.execute(encodedTransaction) + ).to.be.revertedWith( 'Transaction nonce does not match the expected nonce.' ) }) @@ -204,15 +97,9 @@ describe('OVM_ECDSAContractAccount', () => { const transaction = { ...DEFAULT_EIP155_TX, chainId: 421 } const encodedTransaction = await wallet.signTransaction(transaction) - await callPredeploy( - Helper_PredeployCaller, - OVM_ECDSAContractAccount, - 'execute', - [encodedTransaction] - ) - const ovmREVERT: any = - Mock__OVM_ExecutionManager.smocked.ovmREVERT.calls[0] - expect(decodeSolidityError(ovmREVERT._data)).to.equal( + await expect( + OVM_ECDSAContractAccount.execute(encodedTransaction) + ).to.be.revertedWith( 'Lib_EIP155Tx: Transaction signed with wrong chain ID' ) }) @@ -222,155 +109,72 @@ describe('OVM_ECDSAContractAccount', () => { const transaction = { ...DEFAULT_EIP155_TX, gasLimit: 200000000 } const encodedTransaction = await wallet.signTransaction(transaction) - await callPredeploy( - Helper_PredeployCaller, - OVM_ECDSAContractAccount, - 'execute', - [encodedTransaction], - 40000000 - ) - - const ovmREVERT: any = - Mock__OVM_ExecutionManager.smocked.ovmREVERT.calls[0] - expect(decodeSolidityError(ovmREVERT._data)).to.equal( - 'Gas is not sufficient to execute the transaction.' - ) + await expect( + OVM_ECDSAContractAccount.execute(encodedTransaction, { + gasLimit: 40000000, + }) + ).to.be.revertedWith('Gas is not sufficient to execute the transaction.') }) it(`should revert if fee is not transferred to the relayer`, async () => { const transaction = DEFAULT_EIP155_TX const encodedTransaction = await wallet.signTransaction(transaction) - Mock__OVM_ExecutionManager.smocked.ovmCALL.will.return.with( - (gasLimit, target, data) => { - if (target === predeploys.OVM_ETH) { - return [ - true, - '0x0000000000000000000000000000000000000000000000000000000000000000', - ] - } else { - return [true, '0x'] - } - } - ) - - await callPredeploy( - Helper_PredeployCaller, - OVM_ECDSAContractAccount, - 'execute', - [encodedTransaction], - 40000000 - ) + Mock__OVM_ETH.smocked.transfer.will.return.with(false) - const ovmREVERT: any = - Mock__OVM_ExecutionManager.smocked.ovmREVERT.calls[0] - expect(decodeSolidityError(ovmREVERT._data)).to.equal( - 'Fee was not transferred to relayer.' - ) + await expect( + OVM_ECDSAContractAccount.execute(encodedTransaction) + ).to.be.revertedWith('Fee was not transferred to relayer.') }) it(`should transfer value if value is greater than 0`, async () => { const transaction = { ...DEFAULT_EIP155_TX, value: 1234, data: '0x' } const encodedTransaction = await wallet.signTransaction(transaction) - await callPredeploy( - Helper_PredeployCaller, - OVM_ECDSAContractAccount, - 'execute', - [encodedTransaction], - 40000000 - ) + await OVM_ECDSAContractAccount.execute(encodedTransaction) // First call transfers fee, second transfers value (since value > 0). - const ovmCALL: any = Mock__OVM_ExecutionManager.smocked.ovmCALL.calls[1] - expect(ovmCALL._address).to.equal(predeploys.OVM_ETH) - expect(ovmCALL._calldata).to.equal( - iOVM_ETH.encodeFunctionData('transfer', [ - transaction.to, - transaction.value, - ]) - ) + expect( + toPlainObject(Mock__OVM_ETH.smocked.transfer.calls[1]) + ).to.deep.include({ + to: transaction.to, + value: BigNumber.from(transaction.value), + }) }) it(`should revert if the value is not transferred to the recipient`, async () => { const transaction = { ...DEFAULT_EIP155_TX, value: 1234, data: '0x' } const encodedTransaction = await wallet.signTransaction(transaction) - Mock__OVM_ExecutionManager.smocked.ovmCALL.will.return.with( - (gasLimit, target, data) => { - if (target === predeploys.OVM_ETH) { - const [recipient, amount] = iOVM_ETH.decodeFunctionData( - 'transfer', - data - ) - if (recipient === transaction.to) { - return [ - true, - '0x0000000000000000000000000000000000000000000000000000000000000000', - ] - } else { - return [ - true, - '0x0000000000000000000000000000000000000000000000000000000000000001', - ] - } - } else { - return [true, '0x'] - } + Mock__OVM_ETH.smocked.transfer.will.return.with((to, value) => { + if (to === transaction.to) { + return false + } else { + return true } - ) - - await callPredeploy( - Helper_PredeployCaller, - OVM_ECDSAContractAccount, - 'execute', - [encodedTransaction], - 40000000 - ) + }) - const ovmREVERT: any = - Mock__OVM_ExecutionManager.smocked.ovmREVERT.calls[0] - expect(decodeSolidityError(ovmREVERT._data)).to.equal( - 'Value could not be transferred to recipient.' - ) + await expect( + OVM_ECDSAContractAccount.execute(encodedTransaction) + ).to.be.revertedWith('Value could not be transferred to recipient.') }) it(`should revert if trying to send value with a contract creation`, async () => { const transaction = { ...DEFAULT_EIP155_TX, value: 1234, to: '' } const encodedTransaction = await wallet.signTransaction(transaction) - await callPredeploy( - Helper_PredeployCaller, - OVM_ECDSAContractAccount, - 'execute', - [encodedTransaction], - 40000000 - ) - - const ovmREVERT: any = - Mock__OVM_ExecutionManager.smocked.ovmREVERT.calls[0] - expect(decodeSolidityError(ovmREVERT._data)).to.equal( - 'Value transfer in contract creation not supported.' - ) + await expect( + OVM_ECDSAContractAccount.execute(encodedTransaction) + ).to.be.revertedWith('Value transfer in contract creation not supported.') }) it(`should revert if trying to send value with non-empty transaction data`, async () => { - const transaction = { ...DEFAULT_EIP155_TX, value: 1234, to: '' } + const transaction = { ...DEFAULT_EIP155_TX, value: 1234, data: '0x1234' } const encodedTransaction = await wallet.signTransaction(transaction) - await callPredeploy( - Helper_PredeployCaller, - OVM_ECDSAContractAccount, - 'execute', - [encodedTransaction], - 40000000 - ) - - const ovmREVERT: any = - Mock__OVM_ExecutionManager.smocked.ovmREVERT.calls[0] - expect(decodeSolidityError(ovmREVERT._data)).to.equal( - 'Value transfer in contract creation not supported.' - ) + await expect( + OVM_ECDSAContractAccount.execute(encodedTransaction) + ).to.be.revertedWith('Value is nonzero but input data was provided.') }) }) }) diff --git a/packages/contracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts b/packages/contracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts index b292372f5024..a80e97a48cdc 100644 --- a/packages/contracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts +++ b/packages/contracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts @@ -1,150 +1,95 @@ import { expect } from '../../../setup' /* External Imports */ -import { ethers, waffle } from 'hardhat' -import { ContractFactory, Contract, Wallet } from 'ethers' +import { ethers } from 'hardhat' +import { ContractFactory, Contract, Signer } from 'ethers' import { MockContract, smockit } from '@eth-optimism/smock' -import { remove0x } from '@eth-optimism/core-utils' +import { toPlainObject } from 'lodash' /* Internal Imports */ -import { decodeSolidityError } from '../../../helpers' -import { getContractInterface, getContractFactory } from '../../../../src' - -const callPredeploy = async ( - Helper_PredeployCaller: Contract, - predeploy: Contract, - functionName: string, - functionParams?: any[], - ethCall: boolean = false -): Promise => { - if (ethCall) { - return Helper_PredeployCaller.callStatic.callPredeployAbi( - predeploy.address, - predeploy.interface.encodeFunctionData(functionName, functionParams || []) - ) - } - return Helper_PredeployCaller.callPredeploy( - predeploy.address, - predeploy.interface.encodeFunctionData(functionName, functionParams || []) - ) -} - -const addrToBytes32 = (addr: string) => '0x' + '00'.repeat(12) + remove0x(addr) - -const eoaDefaultAddr = '0x4200000000000000000000000000000000000003' +import { getContractInterface, predeploys } from '../../../../src' describe('OVM_ProxyEOA', () => { - let wallet: Wallet + let signer: Signer before(async () => { - const provider = waffle.provider - ;[wallet] = provider.getWallets() + ;[signer] = await ethers.getSigners() }) let Mock__OVM_ExecutionManager: MockContract let Mock__OVM_ECDSAContractAccount: MockContract - let Helper_PredeployCaller: Contract before(async () => { - Mock__OVM_ExecutionManager = await smockit( - await ethers.getContractFactory('OVM_ExecutionManager') - ) - - Helper_PredeployCaller = await ( - await ethers.getContractFactory('Helper_PredeployCaller') - ).deploy() - - Helper_PredeployCaller.setTarget(Mock__OVM_ExecutionManager.address) - - Mock__OVM_ECDSAContractAccount = await smockit( - getContractInterface('OVM_ECDSAContractAccount', true) - ) + Mock__OVM_ExecutionManager = await smockit('OVM_ExecutionManager', { + address: predeploys.OVM_ExecutionManagerWrapper, + }) + Mock__OVM_ECDSAContractAccount = await smockit('OVM_ECDSAContractAccount', { + address: predeploys.OVM_ECDSAContractAccount, + }) }) - let OVM_ProxyEOAFactory: ContractFactory + let Factory__OVM_ProxyEOA: ContractFactory before(async () => { - OVM_ProxyEOAFactory = getContractFactory('OVM_ProxyEOA', wallet, true) + Factory__OVM_ProxyEOA = await ethers.getContractFactory('OVM_ProxyEOA') }) let OVM_ProxyEOA: Contract beforeEach(async () => { - OVM_ProxyEOA = await OVM_ProxyEOAFactory.deploy() - - Mock__OVM_ExecutionManager.smocked.ovmADDRESS.will.return.with( - OVM_ProxyEOA.address - ) - Mock__OVM_ExecutionManager.smocked.ovmCALLER.will.return.with( - OVM_ProxyEOA.address - ) + OVM_ProxyEOA = await Factory__OVM_ProxyEOA.deploy() }) describe('getImplementation()', () => { it(`should be created with implementation at predeploy address`, async () => { - const eoaDefaultAddrBytes32 = addrToBytes32(eoaDefaultAddr) - Mock__OVM_ExecutionManager.smocked.ovmSLOAD.will.return.with( - eoaDefaultAddrBytes32 - ) - const implAddrBytes32 = await callPredeploy( - Helper_PredeployCaller, - OVM_ProxyEOA, - 'getImplementation', - [], - true + expect(await OVM_ProxyEOA.getImplementation()).to.equal( + predeploys.OVM_ECDSAContractAccount ) - expect(implAddrBytes32).to.equal(eoaDefaultAddrBytes32) }) }) + describe('upgrade()', () => { - const implSlotKey = - '0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc' //bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1) it(`should upgrade the proxy implementation`, async () => { const newImpl = `0x${'81'.repeat(20)}` - const newImplBytes32 = addrToBytes32(newImpl) - await callPredeploy(Helper_PredeployCaller, OVM_ProxyEOA, 'upgrade', [ - newImpl, - ]) - const ovmSSTORE: any = - Mock__OVM_ExecutionManager.smocked.ovmSSTORE.calls[0] - expect(ovmSSTORE._key).to.equal(implSlotKey) - expect(ovmSSTORE._value).to.equal(newImplBytes32) + Mock__OVM_ExecutionManager.smocked.ovmADDRESS.will.return.with( + await signer.getAddress() + ) + await expect(OVM_ProxyEOA.upgrade(newImpl)).to.not.be.reverted + expect(await OVM_ProxyEOA.getImplementation()).to.equal(newImpl) }) + it(`should not allow upgrade of the proxy implementation by another account`, async () => { - Mock__OVM_ExecutionManager.smocked.ovmCALLER.will.return.with( - await wallet.getAddress() - ) const newImpl = `0x${'81'.repeat(20)}` - await callPredeploy(Helper_PredeployCaller, OVM_ProxyEOA, 'upgrade', [ - newImpl, - ]) - const ovmREVERT: any = - Mock__OVM_ExecutionManager.smocked.ovmREVERT.calls[0] - expect(decodeSolidityError(ovmREVERT._data)).to.equal( + Mock__OVM_ExecutionManager.smocked.ovmADDRESS.will.return.with( + ethers.constants.AddressZero + ) + await expect(OVM_ProxyEOA.upgrade(newImpl)).to.be.revertedWith( 'EOAs can only upgrade their own EOA implementation' ) }) }) + describe('fallback()', () => { it(`should call delegateCall with right calldata`, async () => { - Mock__OVM_ExecutionManager.smocked.ovmSLOAD.will.return.with( - addrToBytes32(Mock__OVM_ECDSAContractAccount.address) + const data = Mock__OVM_ECDSAContractAccount.interface.encodeFunctionData( + 'execute', + ['0x12341234'] ) - Mock__OVM_ExecutionManager.smocked.ovmDELEGATECALL.will.return.with([ - true, - '0x1234', - ]) - const calldata = '0xdeadbeef' - await Helper_PredeployCaller.callPredeploy(OVM_ProxyEOA.address, calldata) - const ovmDELEGATECALL: any = - Mock__OVM_ExecutionManager.smocked.ovmDELEGATECALL.calls[0] - expect(ovmDELEGATECALL._address).to.equal( - Mock__OVM_ECDSAContractAccount.address - ) - expect(ovmDELEGATECALL._calldata).to.equal(calldata) + await signer.sendTransaction({ + to: OVM_ProxyEOA.address, + data, + }) + + expect( + toPlainObject(Mock__OVM_ECDSAContractAccount.smocked.execute.calls[0]) + ).to.deep.include({ + _encodedTransaction: '0x12341234', + }) }) + it.skip(`should return data from fallback`, async () => { - //TODO test return data from fallback + // TODO: test return data from fallback }) + it.skip(`should revert in fallback`, async () => { - //TODO test reversion from fallback + // TODO: test reversion from fallback }) }) }) diff --git a/packages/contracts/test/contracts/OVM/precompiles/OVM_SequencerEntrypoint.spec.ts b/packages/contracts/test/contracts/OVM/precompiles/OVM_SequencerEntrypoint.spec.ts index 6406943a6cd0..8510e7d09958 100644 --- a/packages/contracts/test/contracts/OVM/precompiles/OVM_SequencerEntrypoint.spec.ts +++ b/packages/contracts/test/contracts/OVM/precompiles/OVM_SequencerEntrypoint.spec.ts @@ -2,154 +2,113 @@ import { expect } from '../../../setup' /* External Imports */ import { waffle, ethers } from 'hardhat' -import { ContractFactory, Wallet, Contract, BigNumber } from 'ethers' -import { smockit, MockContract } from '@eth-optimism/smock' -import { fromHexString, toHexString } from '@eth-optimism/core-utils' +import { ContractFactory, Wallet, Contract, Signer } from 'ethers' +import { smockit, MockContract, unbind } from '@eth-optimism/smock' +import { toPlainObject } from 'lodash' /* Internal Imports */ import { DEFAULT_EIP155_TX } from '../../../helpers' -import { getContractInterface, getContractFactory } from '../../../../src' +import { getContractInterface, predeploys } from '../../../../src' describe('OVM_SequencerEntrypoint', () => { + const iOVM_ECDSAContractAccount = getContractInterface( + 'OVM_ECDSAContractAccount' + ) + let wallet: Wallet before(async () => { const provider = waffle.provider ;[wallet] = provider.getWallets() }) + let signer: Signer + before(async () => { + ;[signer] = await ethers.getSigners() + }) + let Mock__OVM_ExecutionManager: MockContract - let Helper_PredeployCaller: Contract before(async () => { - Mock__OVM_ExecutionManager = await smockit( - await ethers.getContractFactory('OVM_ExecutionManager') - ) + Mock__OVM_ExecutionManager = await smockit('OVM_ExecutionManager', { + address: predeploys.OVM_ExecutionManagerWrapper, + }) Mock__OVM_ExecutionManager.smocked.ovmCHAINID.will.return.with(420) - Mock__OVM_ExecutionManager.smocked.ovmCALL.will.return.with( - (gasLimit, target, data) => { - if (target === wallet.address) { - return [ - true, - iOVM_ECDSAContractAccount.encodeFunctionResult('execute', [ - true, - '0x', - ]), - ] - } else { - return [true, '0x'] - } - } - ) - Mock__OVM_ExecutionManager.smocked.ovmSTATICCALL.will.return.with( - (gasLimit, target, data) => { - // Duplicating the behavior of the ecrecover precompile. - if (target === '0x0000000000000000000000000000000000000001') { - const databuf = fromHexString(data) - const addr = ethers.utils.recoverAddress(databuf.slice(0, 32), { - v: BigNumber.from(databuf.slice(32, 64)).toNumber(), - r: toHexString(databuf.slice(64, 96)), - s: toHexString(databuf.slice(96, 128)), - }) - const ret = ethers.utils.defaultAbiCoder.encode(['address'], [addr]) - return [true, ret] - } else { - return [true, '0x'] - } - } - ) - - Helper_PredeployCaller = await ( - await ethers.getContractFactory('Helper_PredeployCaller') - ).deploy() - - Helper_PredeployCaller.setTarget(Mock__OVM_ExecutionManager.address) + Mock__OVM_ExecutionManager.smocked.ovmCREATEEOA.will.return() }) - let OVM_SequencerEntrypointFactory: ContractFactory + let Factory__OVM_SequencerEntrypoint: ContractFactory before(async () => { - OVM_SequencerEntrypointFactory = getContractFactory( - 'OVM_SequencerEntrypoint', - wallet, - true + Factory__OVM_SequencerEntrypoint = await ethers.getContractFactory( + 'OVM_SequencerEntrypoint' ) }) - const iOVM_ECDSAContractAccount = getContractInterface( - 'OVM_ECDSAContractAccount', - true - ) - let OVM_SequencerEntrypoint: Contract beforeEach(async () => { - OVM_SequencerEntrypoint = await OVM_SequencerEntrypointFactory.deploy() - Mock__OVM_ExecutionManager.smocked.ovmEXTCODESIZE.will.return.with(1) - Mock__OVM_ExecutionManager.smocked.ovmREVERT.will.revert() + OVM_SequencerEntrypoint = await Factory__OVM_SequencerEntrypoint.deploy() }) describe('fallback()', async () => { - it('should call EIP155', async () => { + it('should call ovmCREATEEOA when ovmEXTCODESIZE returns 0', async () => { const transaction = DEFAULT_EIP155_TX const encodedTransaction = await wallet.signTransaction(transaction) - await Helper_PredeployCaller.callPredeploy( - OVM_SequencerEntrypoint.address, - encodedTransaction - ) - - const expectedEOACalldata = iOVM_ECDSAContractAccount.encodeFunctionData( - 'execute', - [encodedTransaction] - ) - const ovmCALL: any = Mock__OVM_ExecutionManager.smocked.ovmCALL.calls[0] - expect(ovmCALL._address).to.equal(await wallet.getAddress()) - expect(ovmCALL._calldata).to.equal(expectedEOACalldata) + // Just unbind the smock in case it's there during this test for some reason. + await unbind(await wallet.getAddress()) + + await signer.sendTransaction({ + to: OVM_SequencerEntrypoint.address, + data: encodedTransaction, + }) + + const call: any = Mock__OVM_ExecutionManager.smocked.ovmCREATEEOA.calls[0] + const eoaAddress = ethers.utils.recoverAddress(call._messageHash, { + v: call._v + 27, + r: call._r, + s: call._s, + }) + + expect(eoaAddress).to.equal(await wallet.getAddress()) }) - it('should send correct calldata if tx is a create', async () => { - const transaction = { ...DEFAULT_EIP155_TX, to: '' } + it('should call EIP155', async () => { + const transaction = DEFAULT_EIP155_TX const encodedTransaction = await wallet.signTransaction(transaction) - await Helper_PredeployCaller.callPredeploy( - OVM_SequencerEntrypoint.address, - encodedTransaction - ) - - const expectedEOACalldata = iOVM_ECDSAContractAccount.encodeFunctionData( - 'execute', - [encodedTransaction] - ) - const ovmCALL: any = Mock__OVM_ExecutionManager.smocked.ovmCALL.calls[0] - expect(ovmCALL._address).to.equal(await wallet.getAddress()) - expect(ovmCALL._calldata).to.equal(expectedEOACalldata) - }) + const Mock__wallet = await smockit(iOVM_ECDSAContractAccount, { + address: await wallet.getAddress(), + }) - it(`should call ovmCreateEOA when ovmEXTCODESIZE returns 0`, async () => { - let isFirstCheck = true - Mock__OVM_ExecutionManager.smocked.ovmEXTCODESIZE.will.return.with(() => { - if (isFirstCheck) { - isFirstCheck = false - return 0 - } else { - return 1 - } + await signer.sendTransaction({ + to: OVM_SequencerEntrypoint.address, + data: encodedTransaction, }) - const transaction = DEFAULT_EIP155_TX + expect( + toPlainObject(Mock__wallet.smocked.execute.calls[0]) + ).to.deep.include({ + _encodedTransaction: encodedTransaction, + }) + }) + + it('should send correct calldata if tx is a create', async () => { + const transaction = { ...DEFAULT_EIP155_TX, to: '' } const encodedTransaction = await wallet.signTransaction(transaction) - await Helper_PredeployCaller.callPredeploy( - OVM_SequencerEntrypoint.address, - encodedTransaction - ) + const Mock__wallet = await smockit(iOVM_ECDSAContractAccount, { + address: await wallet.getAddress(), + }) - const call: any = Mock__OVM_ExecutionManager.smocked.ovmCREATEEOA.calls[0] - const eoaAddress = ethers.utils.recoverAddress(call._messageHash, { - v: call._v + 27, - r: call._r, - s: call._s, + await signer.sendTransaction({ + to: OVM_SequencerEntrypoint.address, + data: encodedTransaction, }) - expect(eoaAddress).to.equal(await wallet.getAddress()) + expect( + toPlainObject(Mock__wallet.smocked.execute.calls[0]) + ).to.deep.include({ + _encodedTransaction: encodedTransaction, + }) }) }) }) diff --git a/packages/smock/src/smockit/binding.ts b/packages/smock/src/smockit/binding.ts index 3436d6390cff..f1a664059746 100644 --- a/packages/smock/src/smockit/binding.ts +++ b/packages/smock/src/smockit/binding.ts @@ -63,7 +63,12 @@ const initializeSmock = (provider: HardhatNetworkProvider): void => { return } - const target = fromFancyAddress(message.to) + let target: string + if (message.delegatecall) { + target = fromFancyAddress(message._codeAddress) + } else { + target = fromFancyAddress(message.to) + } // Check if the target address is a smocked contract. if (!(target in vm._smockState.mocks)) { @@ -103,7 +108,13 @@ const initializeSmock = (provider: HardhatNetworkProvider): void => { // contracts never create new sub-calls (meaning this `afterMessage` event corresponds directly // to a `beforeMessage` event emitted during a call to a smock contract). const message = vm._smockState.messages.pop() - const target = fromFancyAddress(message.to) + + let target: string + if (message.delegatecall) { + target = fromFancyAddress(message._codeAddress) + } else { + target = fromFancyAddress(message.to) + } // Not sure if this can ever actually happen? Just being safe. if (!(target in vm._smockState.mocks)) { @@ -181,3 +192,32 @@ export const bindSmock = async ( Buffer.from('00', 'hex') ) } + +/** + * Detaches a smocked contract from a hardhat network provider. + * @param mock Smocked contract to detach to a provider, or an address. + * @param provider Hardhat network provider to detatch the contract from. + */ +export const unbindSmock = async ( + mock: MockContract | string, + provider: HardhatNetworkProvider +): Promise => { + if (!isSmockInitialized(provider)) { + initializeSmock(provider) + } + + const vm: SmockedVM = (provider as any)._node._vm + const pStateManager = vm.pStateManager || vm.stateManager + + // Add mock to our list of mocks currently attached to the VM. + const address = typeof mock === 'string' ? mock : mock.address.toLowerCase() + delete vm._smockState.mocks[address] + + // Set the contract code for our mock to 0x00 == STOP. Need some non-empty contract code because + // Solidity will sometimes throw if it's calling something without code (I forget the exact + // scenario that causes this throw). + await pStateManager.putContractCode( + toFancyAddress(address), + Buffer.from('', 'hex') + ) +} diff --git a/packages/smock/src/smockit/smockit.ts b/packages/smock/src/smockit/smockit.ts index 9ca98ba8c087..db549d492fa8 100644 --- a/packages/smock/src/smockit/smockit.ts +++ b/packages/smock/src/smockit/smockit.ts @@ -16,7 +16,7 @@ import { SmockOptions, SmockSpec, } from './types' -import { bindSmock } from './binding' +import { bindSmock, unbindSmock } from './binding' import { makeRandomAddress } from '../utils' import { findBaseHardhatProvider } from '../common' @@ -304,3 +304,22 @@ export const smockit = async ( return contract } + +/** + * Unbinds a mock contract (meaning the contract will no longer behave as a mock). + * @param mock Mock contract or address to unbind. + */ +export const unbind = async (mock: MockContract | string): Promise => { + // Only support native hardhat runtime, haven't bothered to figure it out for anything else. + if (hre.network.name !== 'hardhat') { + throw new Error( + `[smock]: smock is only compatible with the "hardhat" network, got: ${hre.network.name}` + ) + } + + // Find the provider object. See comments for `findBaseHardhatProvider` + const provider = findBaseHardhatProvider(hre) + + // Unbind the contract. + await unbindSmock(mock, provider) +} From f87a2d00d4a24919bac19bbde20bd3d6db9ed393 Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Mon, 10 May 2021 14:49:32 -0400 Subject: [PATCH 004/125] maintenance[contracts]: use dashes in chain container names (#819) * maintenance: use dashes in chain container names * chore: add changeset --- .changeset/eight-bobcats-turn.md | 6 ++++++ .../src/batch-submitter/tx-batch-submitter.ts | 2 +- .../OVM/chain/OVM_CanonicalTransactionChain.sol | 4 ++-- .../OVM/chain/OVM_StateCommitmentChain.sol | 2 +- .../001-OVM_ChainStorageContainer_ctc_batches.deploy.ts | 2 +- .../002-OVM_ChainStorageContainer_ctc_queue.deploy.ts | 2 +- .../003-OVM_ChainStorageContainer_scc_batches.deploy.ts | 2 +- packages/contracts/src/contract-deployment/config.ts | 6 +++--- .../OVM/chain/OVM_CanonicalTransactionChain.gas.spec.ts | 4 ++-- .../OVM/chain/OVM_CanonicalTransactionChain.spec.ts | 4 ++-- .../contracts/OVM/chain/OVM_StateCommitmentChain.spec.ts | 2 +- 11 files changed, 21 insertions(+), 15 deletions(-) create mode 100644 .changeset/eight-bobcats-turn.md diff --git a/.changeset/eight-bobcats-turn.md b/.changeset/eight-bobcats-turn.md new file mode 100644 index 000000000000..7ade829f8fa5 --- /dev/null +++ b/.changeset/eight-bobcats-turn.md @@ -0,0 +1,6 @@ +--- +'@eth-optimism/batch-submitter': patch +'@eth-optimism/contracts': patch +--- + +Use dashes instead of colons in contract names diff --git a/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts b/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts index b52be781aa52..826ad1fcd6b3 100644 --- a/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts +++ b/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts @@ -619,7 +619,7 @@ export class TransactionBatchSubmitter extends BatchSubmitter { ) const addr = await manager.getAddress( - 'OVM_ChainStorageContainer:CTC:batches' + 'OVM_ChainStorageContainer-CTC-batches' ) const container = new Contract( addr, diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol index 5b97806e7045..e8e13735fc55 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol @@ -94,7 +94,7 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad ) { return iOVM_ChainStorageContainer( - resolve("OVM_ChainStorageContainer:CTC:batches") + resolve("OVM_ChainStorageContainer-CTC-batches") ); } @@ -111,7 +111,7 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad ) { return iOVM_ChainStorageContainer( - resolve("OVM_ChainStorageContainer:CTC:queue") + resolve("OVM_ChainStorageContainer-CTC-queue") ); } diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol index a860b7236f06..252aaf4907fd 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol @@ -72,7 +72,7 @@ contract OVM_StateCommitmentChain is iOVM_StateCommitmentChain, Lib_AddressResol ) { return iOVM_ChainStorageContainer( - resolve("OVM_ChainStorageContainer:SCC:batches") + resolve("OVM_ChainStorageContainer-SCC-batches") ); } diff --git a/packages/contracts/deploy/001-OVM_ChainStorageContainer_ctc_batches.deploy.ts b/packages/contracts/deploy/001-OVM_ChainStorageContainer_ctc_batches.deploy.ts index 95f88e754dc7..a52aaee79e63 100644 --- a/packages/contracts/deploy/001-OVM_ChainStorageContainer_ctc_batches.deploy.ts +++ b/packages/contracts/deploy/001-OVM_ChainStorageContainer_ctc_batches.deploy.ts @@ -15,7 +15,7 @@ const deployFn: DeployFunction = async (hre) => { await deployAndRegister({ hre, - name: 'OVM_ChainStorageContainer:CTC:batches', + name: 'OVM_ChainStorageContainer-CTC-batches', contract: 'OVM_ChainStorageContainer', args: [Lib_AddressManager.address, 'OVM_CanonicalTransactionChain'], }) diff --git a/packages/contracts/deploy/002-OVM_ChainStorageContainer_ctc_queue.deploy.ts b/packages/contracts/deploy/002-OVM_ChainStorageContainer_ctc_queue.deploy.ts index 02dd9918f00a..a3ce7c014703 100644 --- a/packages/contracts/deploy/002-OVM_ChainStorageContainer_ctc_queue.deploy.ts +++ b/packages/contracts/deploy/002-OVM_ChainStorageContainer_ctc_queue.deploy.ts @@ -15,7 +15,7 @@ const deployFn: DeployFunction = async (hre) => { await deployAndRegister({ hre, - name: 'OVM_ChainStorageContainer:CTC:queue', + name: 'OVM_ChainStorageContainer-CTC-queue', contract: 'OVM_ChainStorageContainer', args: [Lib_AddressManager.address, 'OVM_CanonicalTransactionChain'], }) diff --git a/packages/contracts/deploy/003-OVM_ChainStorageContainer_scc_batches.deploy.ts b/packages/contracts/deploy/003-OVM_ChainStorageContainer_scc_batches.deploy.ts index a3123ae62a5d..605e95ae4081 100644 --- a/packages/contracts/deploy/003-OVM_ChainStorageContainer_scc_batches.deploy.ts +++ b/packages/contracts/deploy/003-OVM_ChainStorageContainer_scc_batches.deploy.ts @@ -15,7 +15,7 @@ const deployFn: DeployFunction = async (hre) => { await deployAndRegister({ hre, - name: 'OVM_ChainStorageContainer:SCC:batches', + name: 'OVM_ChainStorageContainer-SCC-batches', contract: 'OVM_ChainStorageContainer', args: [Lib_AddressManager.address, 'OVM_StateCommitmentChain'], }) diff --git a/packages/contracts/src/contract-deployment/config.ts b/packages/contracts/src/contract-deployment/config.ts index f1661862e32b..a5ea59e29bd1 100644 --- a/packages/contracts/src/contract-deployment/config.ts +++ b/packages/contracts/src/contract-deployment/config.ts @@ -233,15 +233,15 @@ export const makeContractDeployConfig = async ( '0x0000000000000000000000000000000000000000', // will be overridden by geth when state dump is ingested. Storage key: 0x0000000000000000000000000000000000000000000000000000000000000008 ], }, - 'OVM_ChainStorageContainer:CTC:batches': { + 'OVM_ChainStorageContainer-CTC-batches': { factory: getContractFactory('OVM_ChainStorageContainer'), params: [AddressManager.address, 'OVM_CanonicalTransactionChain'], }, - 'OVM_ChainStorageContainer:CTC:queue': { + 'OVM_ChainStorageContainer-CTC-queue': { factory: getContractFactory('OVM_ChainStorageContainer'), params: [AddressManager.address, 'OVM_CanonicalTransactionChain'], }, - 'OVM_ChainStorageContainer:SCC:batches': { + 'OVM_ChainStorageContainer-SCC-batches': { factory: getContractFactory('OVM_ChainStorageContainer'), params: [AddressManager.address, 'OVM_StateCommitmentChain'], }, diff --git a/packages/contracts/test/contracts/OVM/chain/OVM_CanonicalTransactionChain.gas.spec.ts b/packages/contracts/test/contracts/OVM/chain/OVM_CanonicalTransactionChain.gas.spec.ts index fa70bc310808..87c84ff6356a 100644 --- a/packages/contracts/test/contracts/OVM/chain/OVM_CanonicalTransactionChain.gas.spec.ts +++ b/packages/contracts/test/contracts/OVM/chain/OVM_CanonicalTransactionChain.gas.spec.ts @@ -114,12 +114,12 @@ describe('[GAS BENCHMARK] OVM_CanonicalTransactionChain', () => { ) await AddressManager.setAddress( - 'OVM_ChainStorageContainer:CTC:batches', + 'OVM_ChainStorageContainer-CTC-batches', batches.address ) await AddressManager.setAddress( - 'OVM_ChainStorageContainer:CTC:queue', + 'OVM_ChainStorageContainer-CTC-queue', queue.address ) diff --git a/packages/contracts/test/contracts/OVM/chain/OVM_CanonicalTransactionChain.spec.ts b/packages/contracts/test/contracts/OVM/chain/OVM_CanonicalTransactionChain.spec.ts index 207cb8f7038e..4366bf78c829 100644 --- a/packages/contracts/test/contracts/OVM/chain/OVM_CanonicalTransactionChain.spec.ts +++ b/packages/contracts/test/contracts/OVM/chain/OVM_CanonicalTransactionChain.spec.ts @@ -164,12 +164,12 @@ describe('OVM_CanonicalTransactionChain', () => { ) await AddressManager.setAddress( - 'OVM_ChainStorageContainer:CTC:batches', + 'OVM_ChainStorageContainer-CTC-batches', batches.address ) await AddressManager.setAddress( - 'OVM_ChainStorageContainer:CTC:queue', + 'OVM_ChainStorageContainer-CTC-queue', queue.address ) diff --git a/packages/contracts/test/contracts/OVM/chain/OVM_StateCommitmentChain.spec.ts b/packages/contracts/test/contracts/OVM/chain/OVM_StateCommitmentChain.spec.ts index 9f83711210c1..d5151911f4fd 100644 --- a/packages/contracts/test/contracts/OVM/chain/OVM_StateCommitmentChain.spec.ts +++ b/packages/contracts/test/contracts/OVM/chain/OVM_StateCommitmentChain.spec.ts @@ -83,7 +83,7 @@ describe('OVM_StateCommitmentChain', () => { ) await AddressManager.setAddress( - 'OVM_ChainStorageContainer:SCC:batches', + 'OVM_ChainStorageContainer-SCC-batches', batches.address ) From db0dbfb205a43c3a59451a94df4737b54c2eaf2b Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Thu, 13 May 2021 17:10:50 -0400 Subject: [PATCH 005/125] feat[contracts]: temporarily disable EOA upgrades (#857) * feat[contracts]: disable eoa upgrades temporarily * chore: add changeset * Update OVM_ProxyEOA.sol * fix: turn upgrade into a noop * lint: fix --- .changeset/chatty-walls-rescue.md | 5 +++++ .../OVM/accounts/OVM_ProxyEOA.sol | 18 +++++++++++------- .../OVM/accounts/OVM_ProxyEOA.spec.ts | 4 +++- 3 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 .changeset/chatty-walls-rescue.md diff --git a/.changeset/chatty-walls-rescue.md b/.changeset/chatty-walls-rescue.md new file mode 100644 index 000000000000..6bd374c21536 --- /dev/null +++ b/.changeset/chatty-walls-rescue.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/contracts': minor +--- + +Disables EOA contract upgrades until further notice diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol index 785b92b872a5..a8dbc6c38c0f 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol @@ -19,7 +19,7 @@ contract OVM_ProxyEOA { /********** * Events * **********/ - + event Upgraded( address indexed implementation ); @@ -71,13 +71,17 @@ contract OVM_ProxyEOA { ) external { - require( - msg.sender == Lib_ExecutionManagerWrapper.ovmADDRESS(), - "EOAs can only upgrade their own EOA implementation" - ); + // NOTE: Upgrades are temporarily disabled because users can, in theory, modify their EOA + // so that they don't have to pay any fees to the sequencer. Function will remain disabled + // until a robust solution is in place. + + // require( + // msg.sender == Lib_ExecutionManagerWrapper.ovmADDRESS(), + // "EOAs can only upgrade their own EOA implementation" + // ); - _setImplementation(_implementation); - emit Upgraded(_implementation); + // _setImplementation(_implementation); + // emit Upgraded(_implementation); } /** diff --git a/packages/contracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts b/packages/contracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts index a80e97a48cdc..a5a6f35f736a 100644 --- a/packages/contracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts +++ b/packages/contracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts @@ -44,7 +44,9 @@ describe('OVM_ProxyEOA', () => { }) }) - describe('upgrade()', () => { + // NOTE: Upgrades are disabled for now but will be re-enabled at a later point in time. See + // comment in OVM_ProxyEOA.sol for additional information. + describe.skip('upgrade()', () => { it(`should upgrade the proxy implementation`, async () => { const newImpl = `0x${'81'.repeat(20)}` Mock__OVM_ExecutionManager.smocked.ovmADDRESS.will.return.with( From 2e72fd90dc421c0d21eca50f029d0637ace1ed04 Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Thu, 13 May 2021 17:11:09 -0400 Subject: [PATCH 006/125] feat[contracts]: Update Lib_AddressManager.AddressSet event to speed up data transport layer (#820) * feat: update and improve AddressSet event * chore: add changeset * Update Lib_AddressManager.sol --- .changeset/flat-bananas-perform.md | 6 ++++ .../libraries/resolver/Lib_AddressManager.sol | 12 +++++--- packages/core-utils/src/events.ts | 1 + .../src/services/l1-ingestion/service.ts | 29 +++++++------------ 4 files changed, 25 insertions(+), 23 deletions(-) create mode 100644 .changeset/flat-bananas-perform.md diff --git a/.changeset/flat-bananas-perform.md b/.changeset/flat-bananas-perform.md new file mode 100644 index 000000000000..620d6955ad06 --- /dev/null +++ b/.changeset/flat-bananas-perform.md @@ -0,0 +1,6 @@ +--- +'@eth-optimism/contracts': minor +'@eth-optimism/data-transport-layer': minor +--- + +Update AddressSet event to speed search up a bit. Breaks AddressSet API. diff --git a/packages/contracts/contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol b/packages/contracts/contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol index e123573f604f..865ddec49e74 100644 --- a/packages/contracts/contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol +++ b/packages/contracts/contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol @@ -14,8 +14,9 @@ contract Lib_AddressManager is Ownable { **********/ event AddressSet( - string _name, - address _newAddress + string indexed _name, + address _newAddress, + address _oldAddress ); @@ -42,11 +43,14 @@ contract Lib_AddressManager is Ownable { external onlyOwner { - addresses[_getNameHash(_name)] = _address; + bytes32 nameHash = _getNameHash(_name); + address oldAddress = addresses[nameHash]; + addresses[nameHash] = _address; emit AddressSet( _name, - _address + _address, + oldAddress ); } diff --git a/packages/core-utils/src/events.ts b/packages/core-utils/src/events.ts index c7fa940fb68d..b0a2306a171b 100644 --- a/packages/core-utils/src/events.ts +++ b/packages/core-utils/src/events.ts @@ -3,6 +3,7 @@ import { ethers } from 'ethers' export interface EventArgsAddressSet { _name: string _newAddress: string + _oldAddress: string } export interface EventArgsTransactionEnqueued { diff --git a/packages/data-transport-layer/src/services/l1-ingestion/service.ts b/packages/data-transport-layer/src/services/l1-ingestion/service.ts index 3bc862cf4feb..eaf1f37aa242 100644 --- a/packages/data-transport-layer/src/services/l1-ingestion/service.ts +++ b/packages/data-transport-layer/src/services/l1-ingestion/service.ts @@ -236,13 +236,11 @@ export class L1IngestionService extends BaseService { // We need to figure out how to make this work without Infura. Mark and I think that infura is // doing some indexing of events beyond Geth's native capabilities, meaning some event logic // will only work on Infura and not on a local geth instance. Not great. - const addressSetEvents = ((await this.state.contracts.Lib_AddressManager.queryFilter( - this.state.contracts.Lib_AddressManager.filters.AddressSet(), + const addressSetEvents = await this.state.contracts.Lib_AddressManager.queryFilter( + this.state.contracts.Lib_AddressManager.filters.AddressSet(contractName), fromL1Block, toL1Block - )) as TypedEthersEvent[]).filter((event) => { - return event.args._name === contractName - }) + ) // We're going to parse things out in ranges because the address of a given contract may have // changed in the range provided by the user. @@ -320,21 +318,14 @@ export class L1IngestionService extends BaseService { contractName: string, blockNumber: number ): Promise { - // TODO: Should be much easier than this. Need to change the params of this event. - const relevantAddressSetEvents = ( - await this.state.contracts.Lib_AddressManager.queryFilter( - this.state.contracts.Lib_AddressManager.filters.AddressSet(), - this.state.startingL1BlockNumber - ) - ).filter((event) => { - return ( - event.args._name === contractName && event.blockNumber < blockNumber - ) - }) + const events = await this.state.contracts.Lib_AddressManager.queryFilter( + this.state.contracts.Lib_AddressManager.filters.AddressSet(contractName), + this.state.startingL1BlockNumber, + blockNumber + ) - if (relevantAddressSetEvents.length > 0) { - return relevantAddressSetEvents[relevantAddressSetEvents.length - 1].args - ._newAddress + if (events.length > 0) { + return events[events.length - 1].args._newAddress } else { // Address wasn't set before this. return constants.AddressZero From 200a083e50ef1079d0548ec7d924651cd576fc85 Mon Sep 17 00:00:00 2001 From: Elena Gesheva Date: Wed, 12 May 2021 16:46:11 +0300 Subject: [PATCH 007/125] Reduce gas costs of deposits (#667) * Remove messageNonce from BaseCrossDomainMessenger and use CTC queue lenght instead Remove Abs_BaseCrossDomainMessenger and restore dedicated nonce generation in OVM_L2CrossDomainMessenger Fix typo * Remove sentMessages mapping from L1CrossDomainMessenger storage and use the nonce to check for existence of replayed transaction * Refactor out common library function for getting cross domain calldata * Post rebase fixes * Use the queueIndex to check the transaction was enqueued * Fix tests for L1CrossDomainMessenger.replayMessage Also make that test work with an actual CanonicalTransactionChain implementation rather than a smock * Lint fixes * Optimise the resolve calls into the AddressManager lib * Rename the nonce parameter to be clear * Update test name Co-authored-by: ben-chain * Rename getXDomainCalldata to encodeXDomainCalldata to match the new Lib_CrossDomainUtils Co-authored-by: ben-chain --- .../Abs_BaseCrossDomainMessenger.sol | 139 ------------------ .../messaging/OVM_L1CrossDomainMessenger.sol | 106 ++++++++++--- .../messaging/OVM_L2CrossDomainMessenger.sol | 75 ++++++++-- .../predeploys/OVM_L2ToL1MessagePasser.sol | 1 - .../messaging/iOVM_L1CrossDomainMessenger.sol | 4 +- .../libraries/bridge/Lib_CrossDomainUtils.sol | 40 +++++ .../base/OVM_L1CrossDomainMessenger.spec.ts | 129 ++++++++++++---- .../base/OVM_L2CrossDomainMessenger.spec.ts | 8 +- .../contracts/test/helpers/codec/bridge.ts | 2 +- 9 files changed, 302 insertions(+), 202 deletions(-) delete mode 100644 packages/contracts/contracts/optimistic-ethereum/OVM/bridge/messaging/Abs_BaseCrossDomainMessenger.sol create mode 100644 packages/contracts/contracts/optimistic-ethereum/libraries/bridge/Lib_CrossDomainUtils.sol diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/messaging/Abs_BaseCrossDomainMessenger.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/messaging/Abs_BaseCrossDomainMessenger.sol deleted file mode 100644 index b4b468b5d9d1..000000000000 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/messaging/Abs_BaseCrossDomainMessenger.sol +++ /dev/null @@ -1,139 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >0.5.0 <0.8.0; -pragma experimental ABIEncoderV2; - -/* Interface Imports */ -import { iAbs_BaseCrossDomainMessenger } from "../../../iOVM/bridge/messaging/iAbs_BaseCrossDomainMessenger.sol"; - -/** - * @title Abs_BaseCrossDomainMessenger - * @dev The Base Cross Domain Messenger is an abstract contract providing the interface and common - * functionality used in the L1 and L2 Cross Domain Messengers. It can also serve as a template for - * developers wishing to implement a custom bridge contract to suit their needs. - * - * Compiler used: defined by child contract - * Runtime target: defined by child contract - */ -abstract contract Abs_BaseCrossDomainMessenger is iAbs_BaseCrossDomainMessenger { - - /************* - * Constants * - *************/ - - // The default x-domain message sender being set to a non-zero value makes - // deployment a bit more expensive, but in exchange the refund on every call to - // `relayMessage` by the L1 and L2 messengers will be higher. - address internal constant DEFAULT_XDOMAIN_SENDER = 0x000000000000000000000000000000000000dEaD; - - - /************* - * Variables * - *************/ - - mapping (bytes32 => bool) public relayedMessages; - mapping (bytes32 => bool) public successfulMessages; - mapping (bytes32 => bool) public sentMessages; - uint256 public messageNonce; - address internal xDomainMsgSender = DEFAULT_XDOMAIN_SENDER; - - - /*************** - * Constructor * - ***************/ - - constructor() {} - - - /******************** - * Public Functions * - ********************/ - - function xDomainMessageSender() - public - override - view - returns ( - address - ) - { - require(xDomainMsgSender != DEFAULT_XDOMAIN_SENDER, "xDomainMessageSender is not set"); - return xDomainMsgSender; - } - - /** - * Sends a cross domain message to the target messenger. - * @param _target Target contract address. - * @param _message Message to send to the target. - * @param _gasLimit Gas limit for the provided message. - */ - function sendMessage( - address _target, - bytes memory _message, - uint32 _gasLimit - ) - override - public - { - bytes memory xDomainCalldata = _getXDomainCalldata( - _target, - msg.sender, - _message, - messageNonce - ); - - messageNonce += 1; - sentMessages[keccak256(xDomainCalldata)] = true; - - _sendXDomainMessage(xDomainCalldata, _gasLimit); - emit SentMessage(xDomainCalldata); - } - - - /********************** - * Internal Functions * - **********************/ - - /** - * Generates the correct cross domain calldata for a message. - * @param _target Target contract address. - * @param _sender Message sender address. - * @param _message Message to send to the target. - * @param _messageNonce Nonce for the provided message. - * @return ABI encoded cross domain calldata. - */ - function _getXDomainCalldata( - address _target, - address _sender, - bytes memory _message, - uint256 _messageNonce - ) - internal - pure - returns ( - bytes memory - ) - { - return abi.encodeWithSignature( - "relayMessage(address,address,bytes,uint256)", - _target, - _sender, - _message, - _messageNonce - ); - } - - /** - * Sends a cross domain message. - * param // Message to send. - * param // Gas limit for the provided message. - */ - function _sendXDomainMessage( - bytes memory, // _message, - uint256 // _gasLimit - ) - virtual - internal - { - revert("Implement me in child contracts!"); - } -} diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol index 445afd808509..0fa61807d07e 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol @@ -3,19 +3,17 @@ pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Library Imports */ -import { Lib_OVMCodec } from "../../../libraries/codec/Lib_OVMCodec.sol"; import { Lib_AddressResolver } from "../../../libraries/resolver/Lib_AddressResolver.sol"; +import { Lib_OVMCodec } from "../../../libraries/codec/Lib_OVMCodec.sol"; import { Lib_AddressManager } from "../../../libraries/resolver/Lib_AddressManager.sol"; import { Lib_SecureMerkleTrie } from "../../../libraries/trie/Lib_SecureMerkleTrie.sol"; +import { Lib_CrossDomainUtils } from "../../../libraries/bridge/Lib_CrossDomainUtils.sol"; /* Interface Imports */ import { iOVM_L1CrossDomainMessenger } from "../../../iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol"; import { iOVM_CanonicalTransactionChain } from "../../../iOVM/chain/iOVM_CanonicalTransactionChain.sol"; import { iOVM_StateCommitmentChain } from "../../../iOVM/chain/iOVM_StateCommitmentChain.sol"; -/* Contract Imports */ -import { Abs_BaseCrossDomainMessenger } from "./Abs_BaseCrossDomainMessenger.sol"; - /* External Imports */ import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import { PausableUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol"; @@ -32,7 +30,6 @@ import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/ */ contract OVM_L1CrossDomainMessenger is iOVM_L1CrossDomainMessenger, - Abs_BaseCrossDomainMessenger, Lib_AddressResolver, OwnableUpgradeable, PausableUpgradeable, @@ -51,11 +48,24 @@ contract OVM_L1CrossDomainMessenger is bytes32 indexed _xDomainCalldataHash ); + /************* + * Constants * + *************/ + + // The default x-domain message sender being set to a non-zero value makes + // deployment a bit more expensive, but in exchange the refund on every call to + // `relayMessage` by the L1 and L2 messengers will be higher. + address internal constant DEFAULT_XDOMAIN_SENDER = 0x000000000000000000000000000000000000dEaD; + /********************** * Contract Variables * **********************/ mapping (bytes32 => bool) public blockedMessages; + mapping (bytes32 => bool) public relayedMessages; + mapping (bytes32 => bool) public successfulMessages; + + address internal xDomainMsgSender = DEFAULT_XDOMAIN_SENDER; /*************** * Constructor * @@ -155,6 +165,48 @@ contract OVM_L1CrossDomainMessenger is emit MessageAllowed(_xDomainCalldataHash); } + function xDomainMessageSender() + public + override + view + returns ( + address + ) + { + require(xDomainMsgSender != DEFAULT_XDOMAIN_SENDER, "xDomainMessageSender is not set"); + return xDomainMsgSender; + } + + /** + * Sends a cross domain message to the target messenger. + * @param _target Target contract address. + * @param _message Message to send to the target. + * @param _gasLimit Gas limit for the provided message. + */ + function sendMessage( + address _target, + bytes memory _message, + uint32 _gasLimit + ) + override + public + { + address ovmCanonicalTransactionChain = resolve("OVM_CanonicalTransactionChain"); + // Use the CTC queue length as nonce + uint40 nonce = iOVM_CanonicalTransactionChain(ovmCanonicalTransactionChain).getQueueLength(); + + bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata( + _target, + msg.sender, + _message, + nonce + ); + + address l2CrossDomainMessenger = resolve("OVM_L2CrossDomainMessenger"); + _sendXDomainMessage(ovmCanonicalTransactionChain, l2CrossDomainMessenger, xDomainCalldata, _gasLimit); + emit SentMessage(xDomainCalldata); + } + /** * Relays a cross domain message to a contract. * @inheritdoc iOVM_L1CrossDomainMessenger @@ -172,7 +224,7 @@ contract OVM_L1CrossDomainMessenger is onlyRelayer whenNotPaused { - bytes memory xDomainCalldata = _getXDomainCalldata( + bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata( _target, _sender, _message, @@ -232,25 +284,40 @@ contract OVM_L1CrossDomainMessenger is address _target, address _sender, bytes memory _message, - uint256 _messageNonce, + uint256 _queueIndex, uint32 _gasLimit ) override public { - bytes memory xDomainCalldata = _getXDomainCalldata( - _target, - _sender, - _message, - _messageNonce + // Verify that the message is in the queue: + address canonicalTransactionChain = resolve("OVM_CanonicalTransactionChain"); + Lib_OVMCodec.QueueElement memory element = iOVM_CanonicalTransactionChain(canonicalTransactionChain).getQueueElement(_queueIndex); + + address l2CrossDomainMessenger = resolve("OVM_L2CrossDomainMessenger"); + // Compute the transactionHash + bytes32 transactionHash = keccak256( + abi.encode( + address(this), + l2CrossDomainMessenger, + _gasLimit, + _message + ) ); require( - sentMessages[keccak256(xDomainCalldata)] == true, - "Provided message has not already been sent." + transactionHash == element.transactionHash, + "Provided message has not been enqueued." + ); + + bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata( + _target, + _sender, + _message, + _queueIndex ); - _sendXDomainMessage(xDomainCalldata, _gasLimit); + _sendXDomainMessage(canonicalTransactionChain, l2CrossDomainMessenger, xDomainCalldata, _gasLimit); } @@ -364,18 +431,21 @@ contract OVM_L1CrossDomainMessenger is /** * Sends a cross domain message. + * @param _canonicalTransactionChain Address of the OVM_CanonicalTransactionChain instance. + * @param _l2CrossDomainMessenger Address of the OVM_L2CrossDomainMessenger instance. * @param _message Message to send. * @param _gasLimit OVM gas limit for the message. */ function _sendXDomainMessage( + address _canonicalTransactionChain, + address _l2CrossDomainMessenger, bytes memory _message, uint256 _gasLimit ) - override internal { - iOVM_CanonicalTransactionChain(resolve("OVM_CanonicalTransactionChain")).enqueue( - resolve("OVM_L2CrossDomainMessenger"), + iOVM_CanonicalTransactionChain(_canonicalTransactionChain).enqueue( + _l2CrossDomainMessenger, _gasLimit, _message ); diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L2CrossDomainMessenger.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L2CrossDomainMessenger.sol index dfd3d56d8be6..1294794bd139 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L2CrossDomainMessenger.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L2CrossDomainMessenger.sol @@ -4,14 +4,15 @@ pragma experimental ABIEncoderV2; /* Library Imports */ import { Lib_AddressResolver } from "../../../libraries/resolver/Lib_AddressResolver.sol"; +import { Lib_CrossDomainUtils } from "../../../libraries/bridge/Lib_CrossDomainUtils.sol"; /* Interface Imports */ import { iOVM_L2CrossDomainMessenger } from "../../../iOVM/bridge/messaging/iOVM_L2CrossDomainMessenger.sol"; import { iOVM_L1MessageSender } from "../../../iOVM/predeploys/iOVM_L1MessageSender.sol"; import { iOVM_L2ToL1MessagePasser } from "../../../iOVM/predeploys/iOVM_L2ToL1MessagePasser.sol"; -/* Contract Imports */ -import { Abs_BaseCrossDomainMessenger } from "./Abs_BaseCrossDomainMessenger.sol"; +/* External Imports */ +import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; /* External Imports */ import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; @@ -26,11 +27,29 @@ import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.s */ contract OVM_L2CrossDomainMessenger is iOVM_L2CrossDomainMessenger, - Abs_BaseCrossDomainMessenger, Lib_AddressResolver, ReentrancyGuard { + /************* + * Constants * + *************/ + + // The default x-domain message sender being set to a non-zero value makes + // deployment a bit more expensive, but in exchange the refund on every call to + // `relayMessage` by the L1 and L2 messengers will be higher. + address internal constant DEFAULT_XDOMAIN_SENDER = 0x000000000000000000000000000000000000dEaD; + + /************* + * Variables * + *************/ + + mapping (bytes32 => bool) public relayedMessages; + mapping (bytes32 => bool) public successfulMessages; + mapping (bytes32 => bool) public sentMessages; + uint256 public messageNonce; + address internal xDomainMsgSender = DEFAULT_XDOMAIN_SENDER; + /*************** * Constructor * ***************/ @@ -38,18 +57,53 @@ contract OVM_L2CrossDomainMessenger is /** * @param _libAddressManager Address of the Address Manager. */ - constructor( - address _libAddressManager - ) - Lib_AddressResolver(_libAddressManager) - ReentrancyGuard() - {} + constructor(address _libAddressManager) Lib_AddressResolver(_libAddressManager) ReentrancyGuard() {} /******************** * Public Functions * ********************/ + function xDomainMessageSender() + public + override + view + returns ( + address + ) + { + require(xDomainMsgSender != DEFAULT_XDOMAIN_SENDER, "xDomainMessageSender is not set"); + return xDomainMsgSender; + } + + /** + * Sends a cross domain message to the target messenger. + * @param _target Target contract address. + * @param _message Message to send to the target. + * @param _gasLimit Gas limit for the provided message. + */ + function sendMessage( + address _target, + bytes memory _message, + uint32 _gasLimit + ) + override + public + { + bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata( + _target, + msg.sender, + _message, + messageNonce + ); + + messageNonce += 1; + sentMessages[keccak256(xDomainCalldata)] = true; + + _sendXDomainMessage(xDomainCalldata, _gasLimit); + emit SentMessage(xDomainCalldata); + } + /** * Relays a cross domain message to a contract. * @inheritdoc iOVM_L2CrossDomainMessenger @@ -69,7 +123,7 @@ contract OVM_L2CrossDomainMessenger is "Provided message could not be verified." ); - bytes memory xDomainCalldata = _getXDomainCalldata( + bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata( _target, _sender, _message, @@ -150,7 +204,6 @@ contract OVM_L2CrossDomainMessenger is bytes memory _message, uint256 // _gasLimit ) - override internal { iOVM_L2ToL1MessagePasser(resolve("OVM_L2ToL1MessagePasser")).passMessageToL1(_message); diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_L2ToL1MessagePasser.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_L2ToL1MessagePasser.sol index cd9b2431bc5b..6e88c26e11c8 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_L2ToL1MessagePasser.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_L2ToL1MessagePasser.sol @@ -22,7 +22,6 @@ contract OVM_L2ToL1MessagePasser is iOVM_L2ToL1MessagePasser { mapping (bytes32 => bool) public sentMessages; - /******************** * Public Functions * ********************/ diff --git a/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol b/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol index 629e20e1d618..c560a623e115 100644 --- a/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol +++ b/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol @@ -51,14 +51,14 @@ interface iOVM_L1CrossDomainMessenger is iAbs_BaseCrossDomainMessenger { * @param _target Target contract address. * @param _sender Original sender address. * @param _message Message to send to the target. - * @param _messageNonce Nonce for the provided message. + * @param _queueIndex CTC Queue index for the message to replay. * @param _gasLimit Gas limit for the provided message. */ function replayMessage( address _target, address _sender, bytes memory _message, - uint256 _messageNonce, + uint256 _queueIndex, uint32 _gasLimit ) external; } diff --git a/packages/contracts/contracts/optimistic-ethereum/libraries/bridge/Lib_CrossDomainUtils.sol b/packages/contracts/contracts/optimistic-ethereum/libraries/bridge/Lib_CrossDomainUtils.sol new file mode 100644 index 000000000000..a4b8afff192e --- /dev/null +++ b/packages/contracts/contracts/optimistic-ethereum/libraries/bridge/Lib_CrossDomainUtils.sol @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: MIT +pragma solidity >0.5.0 <0.8.0; +pragma experimental ABIEncoderV2; + +/* Library Imports */ +import { Lib_RLPReader } from "../rlp/Lib_RLPReader.sol"; + +/** + * @title Lib_CrossDomainUtils + */ +library Lib_CrossDomainUtils { + /** + * Generates the correct cross domain calldata for a message. + * @param _target Target contract address. + * @param _sender Message sender address. + * @param _message Message to send to the target. + * @param _messageNonce Nonce for the provided message. + * @return ABI encoded cross domain calldata. + */ + function encodeXDomainCalldata( + address _target, + address _sender, + bytes memory _message, + uint256 _messageNonce + ) + internal + pure + returns ( + bytes memory + ) + { + return abi.encodeWithSignature( + "relayMessage(address,address,bytes,uint256)", + _target, + _sender, + _message, + _messageNonce + ); + } +} diff --git a/packages/contracts/test/contracts/OVM/bridge/base/OVM_L1CrossDomainMessenger.spec.ts b/packages/contracts/test/contracts/OVM/bridge/base/OVM_L1CrossDomainMessenger.spec.ts index 7ed33d551d4e..75ceaaa9bd51 100644 --- a/packages/contracts/test/contracts/OVM/bridge/base/OVM_L1CrossDomainMessenger.spec.ts +++ b/packages/contracts/test/contracts/OVM/bridge/base/OVM_L1CrossDomainMessenger.spec.ts @@ -14,12 +14,16 @@ import { NON_ZERO_ADDRESS, DUMMY_BATCH_HEADERS, DUMMY_BATCH_PROOFS, + FORCE_INCLUSION_PERIOD_SECONDS, + FORCE_INCLUSION_PERIOD_BLOCKS, TrieTestGenerator, getNextBlockNumber, - getXDomainCalldata, + encodeXDomainCalldata, } from '../../../../helpers' import { keccak256 } from 'ethers/lib/utils' +const MAX_GAS_LIMIT = 8_000_000 + const deployProxyXDomainMessenger = async ( addressManager: Contract, l1XDomainMessenger: Contract @@ -48,8 +52,13 @@ describe('OVM_L1CrossDomainMessenger', () => { let Mock__TargetContract: MockContract let Mock__OVM_L2CrossDomainMessenger: MockContract - let Mock__OVM_CanonicalTransactionChain: MockContract let Mock__OVM_StateCommitmentChain: MockContract + + let Factory__OVM_CanonicalTransactionChain: ContractFactory + let Factory__OVM_ChainStorageContainer: ContractFactory + let Factory__OVM_L1CrossDomainMessenger: ContractFactory + + let OVM_CanonicalTransactionChain: Contract before(async () => { Mock__TargetContract = await smockit( await ethers.getContractFactory('Helper_SimpleProxy') @@ -57,9 +66,6 @@ describe('OVM_L1CrossDomainMessenger', () => { Mock__OVM_L2CrossDomainMessenger = await smockit( await ethers.getContractFactory('OVM_L2CrossDomainMessenger') ) - Mock__OVM_CanonicalTransactionChain = await smockit( - await ethers.getContractFactory('OVM_CanonicalTransactionChain') - ) Mock__OVM_StateCommitmentChain = await smockit( await ethers.getContractFactory('OVM_StateCommitmentChain') ) @@ -69,23 +75,53 @@ describe('OVM_L1CrossDomainMessenger', () => { Mock__OVM_L2CrossDomainMessenger.address ) - await setProxyTarget( - AddressManager, - 'OVM_CanonicalTransactionChain', - Mock__OVM_CanonicalTransactionChain - ) await setProxyTarget( AddressManager, 'OVM_StateCommitmentChain', Mock__OVM_StateCommitmentChain ) - }) - let Factory__OVM_L1CrossDomainMessenger: ContractFactory - before(async () => { + Factory__OVM_CanonicalTransactionChain = await ethers.getContractFactory( + 'OVM_CanonicalTransactionChain' + ) + + Factory__OVM_ChainStorageContainer = await ethers.getContractFactory( + 'OVM_ChainStorageContainer' + ) + Factory__OVM_L1CrossDomainMessenger = await ethers.getContractFactory( 'OVM_L1CrossDomainMessenger' ) + OVM_CanonicalTransactionChain = await Factory__OVM_CanonicalTransactionChain.deploy( + AddressManager.address, + FORCE_INCLUSION_PERIOD_SECONDS, + FORCE_INCLUSION_PERIOD_BLOCKS, + MAX_GAS_LIMIT + ) + + const batches = await Factory__OVM_ChainStorageContainer.deploy( + AddressManager.address, + 'OVM_CanonicalTransactionChain' + ) + const queue = await Factory__OVM_ChainStorageContainer.deploy( + AddressManager.address, + 'OVM_CanonicalTransactionChain' + ) + + await AddressManager.setAddress( + 'OVM_ChainStorageContainer:CTC:batches', + batches.address + ) + + await AddressManager.setAddress( + 'OVM_ChainStorageContainer:CTC:queue', + queue.address + ) + + await AddressManager.setAddress( + 'OVM_CanonicalTransactionChain', + OVM_CanonicalTransactionChain.address + ) }) let OVM_L1CrossDomainMessenger: Contract @@ -117,6 +153,26 @@ describe('OVM_L1CrossDomainMessenger', () => { }) }) + const getTransactionHash = ( + sender: string, + target: string, + gasLimit: number, + data: string + ): string => { + return keccak256(encodeQueueTransaction(sender, target, gasLimit, data)) + } + + const encodeQueueTransaction = ( + sender: string, + target: string, + gasLimit: number, + data: string + ): string => { + return ethers.utils.defaultAbiCoder.encode( + ['address', 'address', 'uint256', 'bytes'], + [sender, target, gasLimit, data] + ) + } describe('sendMessage', () => { const target = NON_ZERO_ADDRESS const message = NON_NULL_BYTES32 @@ -127,13 +183,24 @@ describe('OVM_L1CrossDomainMessenger', () => { OVM_L1CrossDomainMessenger.sendMessage(target, message, gasLimit) ).to.not.be.reverted - expect( - Mock__OVM_CanonicalTransactionChain.smocked.enqueue.calls[0] - ).to.deep.equal([ + const calldata = encodeXDomainCalldata( + target, + await signer.getAddress(), + message, + 0 + ) + const transactionHash = getTransactionHash( + OVM_L1CrossDomainMessenger.address, Mock__OVM_L2CrossDomainMessenger.address, - BigNumber.from(gasLimit), - getXDomainCalldata(target, await signer.getAddress(), message, 0), - ]) + gasLimit, + calldata + ) + + const queueLength = await OVM_CanonicalTransactionChain.getQueueLength() + const queueElement = await OVM_CanonicalTransactionChain.getQueueElement( + queueLength - 1 + ) + expect(queueElement[0]).to.equal(transactionHash) }) it('should be able to send the same message twice', async () => { @@ -150,27 +217,37 @@ describe('OVM_L1CrossDomainMessenger', () => { const message = NON_NULL_BYTES32 const gasLimit = 100_000 - it('should revert if the message does not exist', async () => { + it('should revert if given the wrong queue index', async () => { + await OVM_L1CrossDomainMessenger.sendMessage(target, message, 100_001) + + const queueLength = await OVM_CanonicalTransactionChain.getQueueLength() await expect( OVM_L1CrossDomainMessenger.replayMessage( target, await signer.getAddress(), message, - 0, + queueLength - 1, gasLimit ) - ).to.be.revertedWith('Provided message has not already been sent.') + ).to.be.revertedWith('Provided message has not been enqueued.') }) it('should succeed if the message exists', async () => { await OVM_L1CrossDomainMessenger.sendMessage(target, message, gasLimit) + const queueLength = await OVM_CanonicalTransactionChain.getQueueLength() + const calldata = encodeXDomainCalldata( + target, + await signer.getAddress(), + message, + queueLength - 1 + ) await expect( OVM_L1CrossDomainMessenger.replayMessage( - target, + Mock__OVM_L2CrossDomainMessenger.address, await signer.getAddress(), - message, - 0, + calldata, + queueLength - 1, gasLimit ) ).to.not.be.reverted @@ -190,7 +267,7 @@ describe('OVM_L1CrossDomainMessenger', () => { ]) sender = await signer.getAddress() - calldata = getXDomainCalldata(target, sender, message, 0) + calldata = encodeXDomainCalldata(target, sender, message, 0) const precompile = '0x4200000000000000000000000000000000000000' diff --git a/packages/contracts/test/contracts/OVM/bridge/base/OVM_L2CrossDomainMessenger.spec.ts b/packages/contracts/test/contracts/OVM/bridge/base/OVM_L2CrossDomainMessenger.spec.ts index fa0baf0248d6..ebea649e9fed 100644 --- a/packages/contracts/test/contracts/OVM/bridge/base/OVM_L2CrossDomainMessenger.spec.ts +++ b/packages/contracts/test/contracts/OVM/bridge/base/OVM_L2CrossDomainMessenger.spec.ts @@ -11,7 +11,7 @@ import { setProxyTarget, NON_NULL_BYTES32, NON_ZERO_ADDRESS, - getXDomainCalldata, + encodeXDomainCalldata, getNextBlockNumber, } from '../../../../helpers' import { solidityKeccak256 } from 'ethers/lib/utils' @@ -89,7 +89,7 @@ describe('OVM_L2CrossDomainMessenger', () => { expect( Mock__OVM_L2ToL1MessagePasser.smocked.passMessageToL1.calls[0] ).to.deep.equal([ - getXDomainCalldata(target, await signer.getAddress(), message, 0), + encodeXDomainCalldata(target, await signer.getAddress(), message, 0), ]) }) @@ -193,7 +193,7 @@ describe('OVM_L2CrossDomainMessenger', () => { await OVM_L2CrossDomainMessenger.successfulMessages( solidityKeccak256( ['bytes'], - [getXDomainCalldata(target, sender, message, 0)] + [encodeXDomainCalldata(target, sender, message, 0)] ) ) ).to.be.true @@ -211,7 +211,7 @@ describe('OVM_L2CrossDomainMessenger', () => { // Calculate xDomainCallData used for indexing // (within the first call to the L2 Messenger). - const xDomainCallData = getXDomainCalldata( + const xDomainCallData = encodeXDomainCalldata( OVM_L2CrossDomainMessenger.address, sender, reentrantMessage, diff --git a/packages/contracts/test/helpers/codec/bridge.ts b/packages/contracts/test/helpers/codec/bridge.ts index bf36d24ec924..a96e280544c7 100644 --- a/packages/contracts/test/helpers/codec/bridge.ts +++ b/packages/contracts/test/helpers/codec/bridge.ts @@ -1,6 +1,6 @@ import { getContractInterface } from '../../../src/contract-defs' -export const getXDomainCalldata = ( +export const encodeXDomainCalldata = ( target: string, sender: string, message: string, From b7f3af23a28beb09287241243b3a9a54a77d8bf4 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Wed, 19 May 2021 10:00:49 -0700 Subject: [PATCH 008/125] optimism: bump gaslimit to 10 million #870 (#871) * optimism: bump gaslimit to 10million * chore: add changeset * optimism: bump max gaslimit to 10 mil * chore: add changeset * chore: remove unnecessary changeset * chore: remove unnecessary changeset Co-authored-by: Georgios Konstantopoulos --- l2geth/scripts/start.sh | 2 +- ops/envs/geth.env | 2 +- packages/contracts/src/state-dump/make-dump.ts | 2 +- packages/contracts/tasks/deploy.ts | 4 ++-- packages/data-transport-layer/src/utils/constants.ts | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/l2geth/scripts/start.sh b/l2geth/scripts/start.sh index cef5597044db..43803b00efc9 100755 --- a/l2geth/scripts/start.sh +++ b/l2geth/scripts/start.sh @@ -6,7 +6,7 @@ REPO=$DIR/.. IS_VERIFIER= ROLLUP_SYNC_SERVICE_ENABLE=true DATADIR=$HOME/.ethereum -TARGET_GAS_LIMIT=9000000 +TARGET_GAS_LIMIT=10000000 CHAIN_ID=10 ETH1_CTC_DEPLOYMENT_HEIGHT=12410807 ETH1_L1_GATEWAY_ADDRESS=0xe681F80966a8b1fFadECf8068bD6F99034791c95 diff --git a/ops/envs/geth.env b/ops/envs/geth.env index bf73226cf815..1bfd720333ab 100644 --- a/ops/envs/geth.env +++ b/ops/envs/geth.env @@ -31,5 +31,5 @@ IPC_DISABLE=true NETWORK_ID=420 NO_USB=true NO_DISCOVER=true -TARGET_GAS_LIMIT=9000000 +TARGET_GAS_LIMIT=10000000 USING_OVM=true diff --git a/packages/contracts/src/state-dump/make-dump.ts b/packages/contracts/src/state-dump/make-dump.ts index 7e253ea6d943..9b4339a4cdc6 100644 --- a/packages/contracts/src/state-dump/make-dump.ts +++ b/packages/contracts/src/state-dump/make-dump.ts @@ -99,7 +99,7 @@ export const makeStateDump = async (cfg: RollupDeployConfig): Promise => { deploymentSigner: signer, ovmGasMeteringConfig: { minTransactionGasLimit: 0, - maxTransactionGasLimit: 9_000_000, + maxTransactionGasLimit: 10_000_000, maxGasPerQueuePerEpoch: 1_000_000_000_000, secondsPerEpoch: 0, }, diff --git a/packages/contracts/tasks/deploy.ts b/packages/contracts/tasks/deploy.ts index 35d2e041b692..4e28e199b736 100644 --- a/packages/contracts/tasks/deploy.ts +++ b/packages/contracts/tasks/deploy.ts @@ -5,9 +5,9 @@ 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_MAX_TRANSACTION_GAS_LIMIT = 9_000_000 +const DEFAULT_CTC_MAX_TRANSACTION_GAS_LIMIT = 10_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_TRANSACTION_GAS_LIMIT = 10_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 diff --git a/packages/data-transport-layer/src/utils/constants.ts b/packages/data-transport-layer/src/utils/constants.ts index 39c6a2ec8053..b7655cc638fa 100644 --- a/packages/data-transport-layer/src/utils/constants.ts +++ b/packages/data-transport-layer/src/utils/constants.ts @@ -1,3 +1,3 @@ -export const SEQUENCER_GAS_LIMIT = 9_000_000 // TODO: Remove and use value from event. +export const SEQUENCER_GAS_LIMIT = 10_000_000 // TODO: Remove and use value from event. export const SEQUENCER_ENTRYPOINT_ADDRESS = '0x4200000000000000000000000000000000000005' From 07a6d3e1fb15e5b3313dd52a0fb91a3bbf0e4320 Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Wed, 19 May 2021 13:59:57 -0400 Subject: [PATCH 009/125] fix: use correct contract name in tests (#921) --- .../OVM/bridge/base/OVM_L1CrossDomainMessenger.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/contracts/test/contracts/OVM/bridge/base/OVM_L1CrossDomainMessenger.spec.ts b/packages/contracts/test/contracts/OVM/bridge/base/OVM_L1CrossDomainMessenger.spec.ts index 75ceaaa9bd51..f1291c79f933 100644 --- a/packages/contracts/test/contracts/OVM/bridge/base/OVM_L1CrossDomainMessenger.spec.ts +++ b/packages/contracts/test/contracts/OVM/bridge/base/OVM_L1CrossDomainMessenger.spec.ts @@ -109,12 +109,12 @@ describe('OVM_L1CrossDomainMessenger', () => { ) await AddressManager.setAddress( - 'OVM_ChainStorageContainer:CTC:batches', + 'OVM_ChainStorageContainer-CTC-batches', batches.address ) await AddressManager.setAddress( - 'OVM_ChainStorageContainer:CTC:queue', + 'OVM_ChainStorageContainer-CTC-queue', queue.address ) From 6b46c8ba1d9f8469b3899ab0c9adfe44efef1080 Mon Sep 17 00:00:00 2001 From: Karl Floersch Date: Wed, 19 May 2021 21:35:27 -0700 Subject: [PATCH 010/125] fix: disable upgradability from ECDSA Account (#885) --- .changeset/sharp-roses-admire.md | 5 +++++ .../OVM/accounts/OVM_ECDSAContractAccount.sol | 8 ++++++++ .../OVM/accounts/OVM_ProxyEOA.sol | 16 ++++++---------- .../accounts/OVM_ECDSAContractAccount.spec.ts | 13 +++++++++++++ .../contracts/OVM/accounts/OVM_ProxyEOA.spec.ts | 4 +--- 5 files changed, 33 insertions(+), 13 deletions(-) create mode 100644 .changeset/sharp-roses-admire.md diff --git a/.changeset/sharp-roses-admire.md b/.changeset/sharp-roses-admire.md new file mode 100644 index 000000000000..4d3244390799 --- /dev/null +++ b/.changeset/sharp-roses-admire.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/contracts': patch +--- + +Disable upgradability from the ECDSA account instead of the EOA proxy. diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol index 0d5c5133741b..37d267f72ca3 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol @@ -140,6 +140,14 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount { return (true, bytes("")); } else { + // NOTE: Upgrades are temporarily disabled because users can, in theory, modify their EOA + // so that they don't have to pay any fees to the sequencer. Function will remain disabled + // until a robust solution is in place. + require( + transaction.to != Lib_ExecutionManagerWrapper.ovmADDRESS(), + "Calls to self are disabled until upgradability is re-enabled." + ); + return transaction.to.call(transaction.data); } } diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol index a8dbc6c38c0f..5965ab317a5f 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol @@ -71,17 +71,13 @@ contract OVM_ProxyEOA { ) external { - // NOTE: Upgrades are temporarily disabled because users can, in theory, modify their EOA - // so that they don't have to pay any fees to the sequencer. Function will remain disabled - // until a robust solution is in place. + require( + msg.sender == Lib_ExecutionManagerWrapper.ovmADDRESS(), + "EOAs can only upgrade their own EOA implementation." + ); - // require( - // msg.sender == Lib_ExecutionManagerWrapper.ovmADDRESS(), - // "EOAs can only upgrade their own EOA implementation" - // ); - - // _setImplementation(_implementation); - // emit Upgraded(_implementation); + _setImplementation(_implementation); + emit Upgraded(_implementation); } /** diff --git a/packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts b/packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts index 9145d9e2b746..caaf33330025 100644 --- a/packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts +++ b/packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts @@ -176,5 +176,18 @@ describe('OVM_ECDSAContractAccount', () => { OVM_ECDSAContractAccount.execute(encodedTransaction) ).to.be.revertedWith('Value is nonzero but input data was provided.') }) + + // NOTE: Upgrades are disabled for now but will be re-enabled at a later point in time. See + // comment in OVM_ECDSAContractAccount.sol for additional information. + it(`should revert if trying call itself`, async () => { + const transaction = { ...DEFAULT_EIP155_TX, to: wallet.address } + const encodedTransaction = await wallet.signTransaction(transaction) + + await expect( + OVM_ECDSAContractAccount.execute(encodedTransaction) + ).to.be.revertedWith( + 'Calls to self are disabled until upgradability is re-enabled.' + ) + }) }) }) diff --git a/packages/contracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts b/packages/contracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts index a5a6f35f736a..a80e97a48cdc 100644 --- a/packages/contracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts +++ b/packages/contracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts @@ -44,9 +44,7 @@ describe('OVM_ProxyEOA', () => { }) }) - // NOTE: Upgrades are disabled for now but will be re-enabled at a later point in time. See - // comment in OVM_ProxyEOA.sol for additional information. - describe.skip('upgrade()', () => { + describe('upgrade()', () => { it(`should upgrade the proxy implementation`, async () => { const newImpl = `0x${'81'.repeat(20)}` Mock__OVM_ExecutionManager.smocked.ovmADDRESS.will.return.with( From 25a5dbdd2299d067d502352ac27beb1d74f4c20c Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Thu, 20 May 2021 03:07:00 -0700 Subject: [PATCH 011/125] l2geth: remove `SignatureHashType` (#752) * l2geth: remove tx type * l2geth: no longer parse type in rollup client * chore: add changeset * chore: remove extra sighash params * fix: do not check txtype in integration tests Co-authored-by: Georgios Konstantopoulos --- .changeset/six-seals-eat.md | 5 ++ .../test/queue-ingestion.spec.ts | 2 - integration-tests/test/rpc.spec.ts | 2 - .../accounts/abi/bind/backends/simulated.go | 7 ++- l2geth/core/rawdb/accessors_chain_test.go | 10 +--- l2geth/core/rawdb/accessors_indexes_test.go | 6 +-- l2geth/core/state_transition.go | 1 - l2geth/core/state_transition_ovm.go | 1 - l2geth/core/types/gen_tx_meta_json.go | 23 +++------ l2geth/core/types/transaction.go | 51 ++++++------------- l2geth/core/types/transaction_meta.go | 39 +++++--------- l2geth/core/types/transaction_meta_test.go | 43 +--------------- l2geth/core/types/transaction_test.go | 4 -- l2geth/interfaces.go | 7 ++- l2geth/internal/ethapi/api.go | 38 +++++--------- l2geth/les/odr_test.go | 4 +- l2geth/light/odr_test.go | 2 +- l2geth/miner/worker.go | 2 +- l2geth/rollup/client.go | 5 -- l2geth/rollup/sync_service_test.go | 3 -- l2geth/signer/core/types.go | 9 ++-- l2geth/tests/state_test_util.go | 2 +- packages/core-utils/src/l2context.ts | 1 - 23 files changed, 74 insertions(+), 193 deletions(-) create mode 100644 .changeset/six-seals-eat.md diff --git a/.changeset/six-seals-eat.md b/.changeset/six-seals-eat.md new file mode 100644 index 000000000000..89854eed54dc --- /dev/null +++ b/.changeset/six-seals-eat.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/l2geth': patch +--- + +Removes the SignatureHashType from l2geth as it is deprecated and no longer required. diff --git a/integration-tests/test/queue-ingestion.spec.ts b/integration-tests/test/queue-ingestion.spec.ts index bf252fcf0f0d..11dd4289677a 100644 --- a/integration-tests/test/queue-ingestion.spec.ts +++ b/integration-tests/test/queue-ingestion.spec.ts @@ -86,8 +86,6 @@ describe('Queue Ingestion', () => { // The `to` addresses are defined in the previous test and // increment sequentially. expect(tx.to).to.be.equal('0x' + `${i}`.repeat(40)) - // The transaction type is EIP155 - expect(tx.txType).to.be.equal('EIP155') // The queue origin is Layer 1 expect(tx.queueOrigin).to.be.equal('l1') // the L1TxOrigin is equal to the Layer one from diff --git a/integration-tests/test/rpc.spec.ts b/integration-tests/test/rpc.spec.ts index a65dcab5dfdf..7776b48a5c8e 100644 --- a/integration-tests/test/rpc.spec.ts +++ b/integration-tests/test/rpc.spec.ts @@ -249,7 +249,6 @@ describe('Basic RPC tests', () => { await result.wait() const transaction = (await provider.getTransaction(result.hash)) as any - expect(transaction.txType).to.equal('EIP155') expect(transaction.queueOrigin).to.equal('sequencer') expect(transaction.transactionIndex).to.be.eq(0) expect(transaction.gasLimit).to.be.deep.eq(BigNumber.from(tx.gasLimit)) @@ -270,7 +269,6 @@ describe('Basic RPC tests', () => { expect(block.number).to.not.equal(0) expect(typeof block.stateRoot).to.equal('string') expect(block.transactions.length).to.equal(1) - expect(block.transactions[0].txType).to.equal('EIP155') expect(block.transactions[0].queueOrigin).to.equal('sequencer') expect(block.transactions[0].l1TxOrigin).to.equal(null) }) diff --git a/l2geth/accounts/abi/bind/backends/simulated.go b/l2geth/accounts/abi/bind/backends/simulated.go index 243491799533..f00cad5055e6 100644 --- a/l2geth/accounts/abi/bind/backends/simulated.go +++ b/l2geth/accounts/abi/bind/backends/simulated.go @@ -601,10 +601,9 @@ func (m callmsg) Gas() uint64 { return m.CallMsg.Gas } func (m callmsg) Value() *big.Int { return m.CallMsg.Value } func (m callmsg) Data() []byte { return m.CallMsg.Data } -func (m callmsg) L1MessageSender() *common.Address { return m.CallMsg.L1MessageSender } -func (m callmsg) L1BlockNumber() *big.Int { return m.CallMsg.L1BlockNumber } -func (m callmsg) QueueOrigin() *big.Int { return m.CallMsg.QueueOrigin } -func (m callmsg) SignatureHashType() types.SignatureHashType { return m.CallMsg.SignatureHashType } +func (m callmsg) L1MessageSender() *common.Address { return m.CallMsg.L1MessageSender } +func (m callmsg) L1BlockNumber() *big.Int { return m.CallMsg.L1BlockNumber } +func (m callmsg) QueueOrigin() *big.Int { return m.CallMsg.QueueOrigin } // filterBackend implements filters.Backend to support filtering for logs without // taking bloom-bits acceleration structures into account. diff --git a/l2geth/core/rawdb/accessors_chain_test.go b/l2geth/core/rawdb/accessors_chain_test.go index 3c1ffa065ec2..6d81deb3be79 100644 --- a/l2geth/core/rawdb/accessors_chain_test.go +++ b/l2geth/core/rawdb/accessors_chain_test.go @@ -430,7 +430,7 @@ func TestBlockMetaStorage(t *testing.T) { index1 := uint64(1) tx1 := types.NewTransaction(1, common.HexToAddress("0x1"), big.NewInt(1), 1, big.NewInt(1), nil) - tx1Meta := types.NewTransactionMeta(nil, 0, nil, types.SighashEIP155, types.QueueOriginSequencer, &index1, nil, nil) + tx1Meta := types.NewTransactionMeta(nil, 0, nil, types.QueueOriginSequencer, &index1, nil, nil) tx1.SetTransactionMeta(tx1Meta) WriteTransactionMeta(db, index1, tx1.GetMeta()) @@ -442,9 +442,6 @@ func TestBlockMetaStorage(t *testing.T) { if meta.L1BlockNumber != nil { t.Fatalf("Could not recover L1BlockNumber") } - if meta.SignatureHashType != types.SighashEIP155 { - t.Fatalf("Could not recover sighash type") - } if meta.Index == nil { t.Fatalf("Could not recover index") } @@ -464,7 +461,7 @@ func TestBlockMetaStorage(t *testing.T) { index2 := uint64(2) tx2 := types.NewTransaction(2, common.HexToAddress("0x02"), big.NewInt(2), 2, big.NewInt(2), nil) - tx2Meta := types.NewTransactionMeta(l1BlockNumber, 0, &addr, types.SighashEthSign, types.QueueOriginSequencer, nil, nil, nil) + tx2Meta := types.NewTransactionMeta(l1BlockNumber, 0, &addr, types.QueueOriginSequencer, nil, nil, nil) tx2.SetTransactionMeta(tx2Meta) WriteTransactionMeta(db, index2, tx2.GetMeta()) @@ -477,7 +474,4 @@ func TestBlockMetaStorage(t *testing.T) { if meta2.L1BlockNumber.Cmp(l1BlockNumber) != 0 { t.Fatalf("Could not recover L1BlockNumber") } - if meta2.SignatureHashType != types.SighashEthSign { - t.Fatalf("Could not recover sighash type") - } } diff --git a/l2geth/core/rawdb/accessors_indexes_test.go b/l2geth/core/rawdb/accessors_indexes_test.go index f980bcf20976..74b3f08a71b8 100644 --- a/l2geth/core/rawdb/accessors_indexes_test.go +++ b/l2geth/core/rawdb/accessors_indexes_test.go @@ -73,15 +73,15 @@ func TestLookupStorage(t *testing.T) { l1BlockNumber2 := big.NewInt(2) tx1 := types.NewTransaction(1, common.BytesToAddress([]byte{0x11}), big.NewInt(111), 1111, big.NewInt(11111), []byte{0x11, 0x11, 0x11}) - tx1Meta := types.NewTransactionMeta(l1BlockNumber1, 0, &sender1, types.SighashEIP155, types.QueueOriginSequencer, nil, nil, nil) + tx1Meta := types.NewTransactionMeta(l1BlockNumber1, 0, &sender1, types.QueueOriginSequencer, nil, nil, nil) tx1.SetTransactionMeta(tx1Meta) tx2 := types.NewTransaction(2, common.BytesToAddress([]byte{0x22}), big.NewInt(222), 2222, big.NewInt(22222), []byte{0x22, 0x22, 0x22}) - tx2Meta := types.NewTransactionMeta(l1BlockNumber2, 0, &sender2, types.SighashEIP155, types.QueueOriginSequencer, nil, nil, nil) + tx2Meta := types.NewTransactionMeta(l1BlockNumber2, 0, &sender2, types.QueueOriginSequencer, nil, nil, nil) tx2.SetTransactionMeta(tx2Meta) tx3 := types.NewTransaction(3, common.BytesToAddress([]byte{0x33}), big.NewInt(333), 3333, big.NewInt(33333), []byte{0x33, 0x33, 0x33}) - tx3Meta := types.NewTransactionMeta(l1BlockNumber1, 0, nil, types.SighashEIP155, types.QueueOriginSequencer, nil, nil, nil) + tx3Meta := types.NewTransactionMeta(l1BlockNumber1, 0, nil, types.QueueOriginSequencer, nil, nil, nil) tx3.SetTransactionMeta(tx3Meta) txs := []*types.Transaction{tx1, tx2, tx3} diff --git a/l2geth/core/state_transition.go b/l2geth/core/state_transition.go index d5e839a757dc..933b0f8aa7a8 100644 --- a/l2geth/core/state_transition.go +++ b/l2geth/core/state_transition.go @@ -78,7 +78,6 @@ type Message interface { L1MessageSender() *common.Address L1BlockNumber() *big.Int QueueOrigin() *big.Int - SignatureHashType() types.SignatureHashType } // IntrinsicGas computes the 'intrinsic gas' for a message with the given data. diff --git a/l2geth/core/state_transition_ovm.go b/l2geth/core/state_transition_ovm.go index adba0fb257df..5da13437adba 100644 --- a/l2geth/core/state_transition_ovm.go +++ b/l2geth/core/state_transition_ovm.go @@ -156,7 +156,6 @@ func modMessage( msg.L1MessageSender(), msg.L1BlockNumber(), queueOrigin, - msg.SignatureHashType(), ) return outmsg, nil diff --git a/l2geth/core/types/gen_tx_meta_json.go b/l2geth/core/types/gen_tx_meta_json.go index 5bf2f763f36e..13a57551050f 100644 --- a/l2geth/core/types/gen_tx_meta_json.go +++ b/l2geth/core/types/gen_tx_meta_json.go @@ -13,16 +13,14 @@ import ( // MarshalJSON marshals as JSON. func (t TransactionMeta) MarshalJSON() ([]byte, error) { type TransactionMeta struct { - L1BlockNumber *big.Int `json:"l1BlockNumber"` - L1MessageSender *common.Address `json:"l1MessageSender" gencodec:"required"` - SignatureHashType SignatureHashType `json:"signatureHashType" gencodec:"required"` - QueueOrigin *big.Int `json:"queueOrigin" gencodec:"required"` - Index *uint64 `json:"index" gencodec:"required"` + L1BlockNumber *big.Int `json:"l1BlockNumber"` + L1MessageSender *common.Address `json:"l1MessageSender" gencodec:"required"` + QueueOrigin *big.Int `json:"queueOrigin" gencodec:"required"` + Index *uint64 `json:"index" gencodec:"required"` } var enc TransactionMeta enc.L1BlockNumber = t.L1BlockNumber enc.L1MessageSender = t.L1MessageSender - enc.SignatureHashType = t.SignatureHashType enc.QueueOrigin = t.QueueOrigin enc.Index = t.Index return json.Marshal(&enc) @@ -31,11 +29,10 @@ func (t TransactionMeta) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals from JSON. func (t *TransactionMeta) UnmarshalJSON(input []byte) error { type TransactionMeta struct { - L1BlockNumber *big.Int `json:"l1BlockNumber"` - L1MessageSender *common.Address `json:"l1MessageSender" gencodec:"required"` - SignatureHashType *SignatureHashType `json:"signatureHashType" gencodec:"required"` - QueueOrigin *big.Int `json:"queueOrigin" gencodec:"required"` - Index *uint64 `json:"index" gencodec:"required"` + L1BlockNumber *big.Int `json:"l1BlockNumber"` + L1MessageSender *common.Address `json:"l1MessageSender" gencodec:"required"` + QueueOrigin *big.Int `json:"queueOrigin" gencodec:"required"` + Index *uint64 `json:"index" gencodec:"required"` } var dec TransactionMeta if err := json.Unmarshal(input, &dec); err != nil { @@ -48,10 +45,6 @@ func (t *TransactionMeta) UnmarshalJSON(input []byte) error { return errors.New("missing required field 'l1MessageSender' for TransactionMeta") } t.L1MessageSender = dec.L1MessageSender - if dec.SignatureHashType == nil { - return errors.New("missing required field 'signatureHashType' for TransactionMeta") - } - t.SignatureHashType = *dec.SignatureHashType if dec.QueueOrigin == nil { return errors.New("missing required field 'queueOrigin' for TransactionMeta") } diff --git a/l2geth/core/types/transaction.go b/l2geth/core/types/transaction.go index a3fc9874acf6..c9a9a2b28280 100644 --- a/l2geth/core/types/transaction.go +++ b/l2geth/core/types/transaction.go @@ -35,15 +35,6 @@ var ( ErrInvalidSig = errors.New("invalid transaction v, r, s values") ) -// TODO(mark): migrate from sighash type to type -type SignatureHashType uint8 - -const ( - SighashEIP155 SignatureHashType = 0 - SighashEthSign SignatureHashType = 1 - CreateEOA SignatureHashType = 2 -) - type Transaction struct { data txdata meta TransactionMeta @@ -85,7 +76,6 @@ func NewTransaction(nonce uint64, to common.Address, amount *big.Int, gasLimit u return newTransaction(nonce, &to, amount, gasLimit, gasPrice, data) } -// TODO: cannot deploy contracts with SighashEthSign right until SighashEIP155 is no longer hardcoded func NewContractCreation(nonce uint64, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte) *Transaction { return newTransaction(nonce, nil, amount, gasLimit, gasPrice, data) } @@ -95,7 +85,7 @@ func newTransaction(nonce uint64, to *common.Address, amount *big.Int, gasLimit data = common.CopyBytes(data) } - meta := NewTransactionMeta(nil, 0, nil, SighashEIP155, QueueOriginSequencer, nil, nil, nil) + meta := NewTransactionMeta(nil, 0, nil, QueueOriginSequencer, nil, nil, nil) d := txdata{ AccountNonce: nonce, @@ -231,14 +221,7 @@ func (tx *Transaction) Value() *big.Int { return new(big.Int).Set(tx.data.Amo func (tx *Transaction) Nonce() uint64 { return tx.data.AccountNonce } func (tx *Transaction) CheckNonce() bool { return true } -func (tx *Transaction) SetNonce(nonce uint64) { tx.data.AccountNonce = nonce } -func (tx *Transaction) SignatureHashType() SignatureHashType { return tx.meta.SignatureHashType } -func (tx *Transaction) SetSignatureHashType(sighashType SignatureHashType) { - tx.meta.SignatureHashType = sighashType -} -func (tx *Transaction) IsEthSignSighash() bool { - return tx.SignatureHashType() == SighashEthSign -} +func (tx *Transaction) SetNonce(nonce uint64) { tx.data.AccountNonce = nonce } // To returns the recipient address of the transaction. // It returns nil if the transaction is a contract creation. @@ -318,10 +301,9 @@ func (tx *Transaction) AsMessage(s Signer) (Message, error) { data: tx.data.Payload, checkNonce: true, - l1MessageSender: tx.meta.L1MessageSender, - l1BlockNumber: tx.meta.L1BlockNumber, - signatureHashType: tx.meta.SignatureHashType, - queueOrigin: tx.meta.QueueOrigin, + l1MessageSender: tx.meta.L1MessageSender, + l1BlockNumber: tx.meta.L1BlockNumber, + queueOrigin: tx.meta.QueueOrigin, } var err error @@ -534,13 +516,12 @@ type Message struct { data []byte checkNonce bool - l1MessageSender *common.Address - l1BlockNumber *big.Int - signatureHashType SignatureHashType - queueOrigin *big.Int + l1MessageSender *common.Address + l1BlockNumber *big.Int + queueOrigin *big.Int } -func NewMessage(from common.Address, to *common.Address, nonce uint64, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte, checkNonce bool, l1MessageSender *common.Address, l1BlockNumber *big.Int, queueOrigin QueueOrigin, signatureHashType SignatureHashType) Message { +func NewMessage(from common.Address, to *common.Address, nonce uint64, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte, checkNonce bool, l1MessageSender *common.Address, l1BlockNumber *big.Int, queueOrigin QueueOrigin) Message { return Message{ from: from, to: to, @@ -551,10 +532,9 @@ func NewMessage(from common.Address, to *common.Address, nonce uint64, amount *b data: data, checkNonce: checkNonce, - l1BlockNumber: l1BlockNumber, - l1MessageSender: l1MessageSender, - signatureHashType: signatureHashType, - queueOrigin: big.NewInt(int64(queueOrigin)), + l1BlockNumber: l1BlockNumber, + l1MessageSender: l1MessageSender, + queueOrigin: big.NewInt(int64(queueOrigin)), } } @@ -567,7 +547,6 @@ func (m Message) Nonce() uint64 { return m.nonce } func (m Message) Data() []byte { return m.data } func (m Message) CheckNonce() bool { return m.checkNonce } -func (m Message) L1MessageSender() *common.Address { return m.l1MessageSender } -func (m Message) L1BlockNumber() *big.Int { return m.l1BlockNumber } -func (m Message) SignatureHashType() SignatureHashType { return m.signatureHashType } -func (m Message) QueueOrigin() *big.Int { return m.queueOrigin } +func (m Message) L1MessageSender() *common.Address { return m.l1MessageSender } +func (m Message) L1BlockNumber() *big.Int { return m.l1BlockNumber } +func (m Message) QueueOrigin() *big.Int { return m.queueOrigin } diff --git a/l2geth/core/types/transaction_meta.go b/l2geth/core/types/transaction_meta.go index a475c53decc7..3d09cbd69bff 100644 --- a/l2geth/core/types/transaction_meta.go +++ b/l2geth/core/types/transaction_meta.go @@ -23,11 +23,10 @@ const ( //go:generate gencodec -type TransactionMeta -out gen_tx_meta_json.go type TransactionMeta struct { - L1BlockNumber *big.Int `json:"l1BlockNumber"` - L1Timestamp uint64 `json:"l1Timestamp"` - L1MessageSender *common.Address `json:"l1MessageSender" gencodec:"required"` - SignatureHashType SignatureHashType `json:"signatureHashType" gencodec:"required"` - QueueOrigin *big.Int `json:"queueOrigin" gencodec:"required"` + L1BlockNumber *big.Int `json:"l1BlockNumber"` + L1Timestamp uint64 `json:"l1Timestamp"` + L1MessageSender *common.Address `json:"l1MessageSender" gencodec:"required"` + QueueOrigin *big.Int `json:"queueOrigin" gencodec:"required"` // The canonical transaction chain index Index *uint64 `json:"index" gencodec:"required"` // The queue index, nil for queue origin sequencer transactions @@ -36,22 +35,20 @@ type TransactionMeta struct { } // NewTransactionMeta creates a TransactionMeta -func NewTransactionMeta(l1BlockNumber *big.Int, l1timestamp uint64, l1MessageSender *common.Address, sighashType SignatureHashType, queueOrigin QueueOrigin, index *uint64, queueIndex *uint64, rawTransaction []byte) *TransactionMeta { +func NewTransactionMeta(l1BlockNumber *big.Int, l1timestamp uint64, l1MessageSender *common.Address, queueOrigin QueueOrigin, index *uint64, queueIndex *uint64, rawTransaction []byte) *TransactionMeta { return &TransactionMeta{ - L1BlockNumber: l1BlockNumber, - L1Timestamp: l1timestamp, - L1MessageSender: l1MessageSender, - SignatureHashType: sighashType, - QueueOrigin: big.NewInt(int64(queueOrigin)), - Index: index, - QueueIndex: queueIndex, - RawTransaction: rawTransaction, + L1BlockNumber: l1BlockNumber, + L1Timestamp: l1timestamp, + L1MessageSender: l1MessageSender, + QueueOrigin: big.NewInt(int64(queueOrigin)), + Index: index, + QueueIndex: queueIndex, + RawTransaction: rawTransaction, } } // TxMetaDecode deserializes bytes as a TransactionMeta struct. // The schema is: -// varbytes(SignatureHashType) || // varbytes(L1BlockNumber) || // varbytes(L1MessageSender) || // varbytes(QueueOrigin) || @@ -61,14 +58,6 @@ func TxMetaDecode(input []byte) (*TransactionMeta, error) { meta := TransactionMeta{} b := bytes.NewReader(input) - sb, err := common.ReadVarBytes(b, 0, 1024, "SignatureHashType") - if err != nil { - return nil, err - } - var sighashType SignatureHashType - binary.Read(bytes.NewReader(sb), binary.LittleEndian, &sighashType) - meta.SignatureHashType = sighashType - lb, err := common.ReadVarBytes(b, 0, 1024, "l1BlockNumber") if err != nil { return nil, err @@ -138,10 +127,6 @@ func TxMetaDecode(input []byte) (*TransactionMeta, error) { func TxMetaEncode(meta *TransactionMeta) []byte { b := new(bytes.Buffer) - s := new(bytes.Buffer) - binary.Write(s, binary.LittleEndian, &meta.SignatureHashType) - common.WriteVarBytes(b, 0, s.Bytes()) - L1BlockNumber := meta.L1BlockNumber if L1BlockNumber == nil { common.WriteVarBytes(b, 0, getNullValue()) diff --git a/l2geth/core/types/transaction_meta_test.go b/l2geth/core/types/transaction_meta_test.go index 6471b5f77614..546d3cb99369 100644 --- a/l2geth/core/types/transaction_meta_test.go +++ b/l2geth/core/types/transaction_meta_test.go @@ -17,7 +17,6 @@ var ( l1BlockNumber *big.Int l1Timestamp uint64 msgSender *common.Address - sighashType SignatureHashType queueOrigin QueueOrigin rawTransaction []byte }{ @@ -25,7 +24,6 @@ var ( l1BlockNumber: l1BlockNumber, l1Timestamp: 100, msgSender: &addr, - sighashType: SighashEthSign, queueOrigin: QueueOriginL1ToL2, rawTransaction: []byte{255, 255, 255, 255}, }, @@ -33,7 +31,6 @@ var ( l1BlockNumber: nil, l1Timestamp: 45, msgSender: &addr, - sighashType: SighashEthSign, queueOrigin: QueueOriginL1ToL2, rawTransaction: []byte{42, 69, 42, 69}, }, @@ -41,7 +38,6 @@ var ( l1BlockNumber: l1BlockNumber, l1Timestamp: 0, msgSender: nil, - sighashType: SighashEthSign, queueOrigin: QueueOriginSequencer, rawTransaction: []byte{0, 0, 0, 0}, }, @@ -49,7 +45,6 @@ var ( l1BlockNumber: l1BlockNumber, l1Timestamp: 0, msgSender: &addr, - sighashType: SighashEthSign, queueOrigin: QueueOriginSequencer, rawTransaction: []byte{0, 0, 0, 0}, }, @@ -57,7 +52,6 @@ var ( l1BlockNumber: nil, l1Timestamp: 0, msgSender: nil, - sighashType: SighashEthSign, queueOrigin: QueueOriginL1ToL2, rawTransaction: []byte{0, 0, 0, 0}, }, @@ -65,30 +59,15 @@ var ( l1BlockNumber: l1BlockNumber, l1Timestamp: 0, msgSender: &addr, - sighashType: SighashEthSign, queueOrigin: QueueOriginL1ToL2, rawTransaction: []byte{0, 0, 0, 0}, }, } - - txMetaSighashEncodeTests = []struct { - input SignatureHashType - output SignatureHashType - }{ - { - input: SighashEIP155, - output: SighashEIP155, - }, - { - input: SighashEthSign, - output: SighashEthSign, - }, - } ) func TestTransactionMetaEncode(t *testing.T) { for _, test := range txMetaSerializationTests { - txmeta := NewTransactionMeta(test.l1BlockNumber, test.l1Timestamp, test.msgSender, test.sighashType, test.queueOrigin, nil, nil, test.rawTransaction) + txmeta := NewTransactionMeta(test.l1BlockNumber, test.l1Timestamp, test.msgSender, test.queueOrigin, nil, nil, test.rawTransaction) encoded := TxMetaEncode(txmeta) decoded, err := TxMetaDecode(encoded) @@ -103,22 +82,6 @@ func TestTransactionMetaEncode(t *testing.T) { } } -func TestTransactionSighashEncode(t *testing.T) { - for _, test := range txMetaSighashEncodeTests { - txmeta := NewTransactionMeta(l1BlockNumber, 0, &addr, test.input, QueueOriginSequencer, nil, nil, nil) - encoded := TxMetaEncode(txmeta) - decoded, err := TxMetaDecode(encoded) - - if err != nil { - t.Fatal(err) - } - - if decoded.SignatureHashType != test.output { - t.Fatal("SighashTypes do not match") - } - } -} - func isTxMetaEqual(meta1 *TransactionMeta, meta2 *TransactionMeta) bool { // Maybe can just return this if !reflect.DeepEqual(meta1, meta2) { @@ -149,10 +112,6 @@ func isTxMetaEqual(meta1 *TransactionMeta, meta2 *TransactionMeta) bool { } } - if meta1.SignatureHashType != meta2.SignatureHashType { - return false - } - if meta1.QueueOrigin == nil || meta2.QueueOrigin == nil { // Note: this only works because it is the final comparison if meta1.QueueOrigin == nil && meta2.QueueOrigin == nil { diff --git a/l2geth/core/types/transaction_test.go b/l2geth/core/types/transaction_test.go index f7d108379b67..6106362f4bf1 100644 --- a/l2geth/core/types/transaction_test.go +++ b/l2geth/core/types/transaction_test.go @@ -263,8 +263,4 @@ func TestOVMMetaDataHash(t *testing.T) { if emptyTx.Hash() != emptyTxEmptyL1Sender.Hash() { t.Errorf("L1MessageSender, should not affect the hash, want %x, got %x with L1MessageSender", emptyTx.Hash(), emptyTxEmptyL1Sender.Hash()) } - - if emptyTx.Hash() != emptyTxSighashEthSign.Hash() { - t.Errorf("SignatureHashType, should not affect the hash, want %x, got %x with SighashEthSign", emptyTx.Hash(), emptyTxSighashEthSign.Hash()) - } } diff --git a/l2geth/interfaces.go b/l2geth/interfaces.go index 50bde19ddf8c..ab3f44eb86fc 100644 --- a/l2geth/interfaces.go +++ b/l2geth/interfaces.go @@ -120,10 +120,9 @@ type CallMsg struct { Value *big.Int // amount of wei sent along with the call Data []byte // input data, usually an ABI-encoded contract method invocation - L1MessageSender *common.Address - L1BlockNumber *big.Int - QueueOrigin *big.Int - SignatureHashType types.SignatureHashType + L1MessageSender *common.Address + L1BlockNumber *big.Int + QueueOrigin *big.Int } // A ContractCaller provides contract calls, essentially transactions that are executed by diff --git a/l2geth/internal/ethapi/api.go b/l2geth/internal/ethapi/api.go index 2828d83707bd..c509b1c1c5cb 100644 --- a/l2geth/internal/ethapi/api.go +++ b/l2geth/internal/ethapi/api.go @@ -931,7 +931,7 @@ func DoCall(ctx context.Context, b Backend, args CallArgs, blockNrOrHash rpc.Blo // Create new call message var msg core.Message - msg = types.NewMessage(addr, args.To, 0, value, gas, gasPrice, data, false, &addr, nil, types.QueueOriginSequencer, 0) + msg = types.NewMessage(addr, args.To, 0, value, gas, gasPrice, data, false, &addr, nil, types.QueueOriginSequencer) if vm.UsingOVM { cfg := b.ChainConfig() executionManager := cfg.StateDump.Accounts["OVM_ExecutionManager"] @@ -1375,15 +1375,6 @@ func newRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber queueIndex := (hexutil.Uint64)(*meta.QueueIndex) result.QueueIndex = &queueIndex } - - switch meta.SignatureHashType { - case types.SighashEthSign: - result.TxType = "EthSign" - case types.SighashEIP155: - result.TxType = "EIP155" - case types.CreateEOA: - result.TxType = "CreateEOA" - } } return result } @@ -1616,9 +1607,8 @@ type SendTxArgs struct { Data *hexutil.Bytes `json:"data"` Input *hexutil.Bytes `json:"input"` - L1BlockNumber *big.Int `json:"l1BlockNumber"` - L1MessageSender *common.Address `json:"l1MessageSender"` - SignatureHashType types.SignatureHashType `json:"signatureHashType"` + L1BlockNumber *big.Int `json:"l1BlockNumber"` + L1MessageSender *common.Address `json:"l1MessageSender"` } // setDefaults is a helper function that fills in default values for unspecified tx fields. @@ -1691,13 +1681,13 @@ func (args *SendTxArgs) toTransaction() *types.Transaction { if args.To == nil { tx := types.NewContractCreation(uint64(*args.Nonce), (*big.Int)(args.Value), uint64(*args.Gas), (*big.Int)(args.GasPrice), input) raw, _ := rlp.EncodeToBytes(tx) - txMeta := types.NewTransactionMeta(args.L1BlockNumber, 0, nil, types.SighashEIP155, types.QueueOriginSequencer, nil, nil, raw) + txMeta := types.NewTransactionMeta(args.L1BlockNumber, 0, nil, types.QueueOriginSequencer, nil, nil, raw) tx.SetTransactionMeta(txMeta) return tx } tx := types.NewTransaction(uint64(*args.Nonce), *args.To, (*big.Int)(args.Value), uint64(*args.Gas), (*big.Int)(args.GasPrice), input) raw, _ := rlp.EncodeToBytes(tx) - txMeta := types.NewTransactionMeta(args.L1BlockNumber, 0, args.L1MessageSender, args.SignatureHashType, types.QueueOriginSequencer, nil, nil, raw) + txMeta := types.NewTransactionMeta(args.L1BlockNumber, 0, args.L1MessageSender, types.QueueOriginSequencer, nil, nil, raw) tx.SetTransactionMeta(txMeta) return tx } @@ -1794,7 +1784,7 @@ func (s *PublicTransactionPoolAPI) SendRawTransaction(ctx context.Context, encod return common.Hash{}, err } // L1Timestamp and L1BlockNumber will be set right before execution - txMeta := types.NewTransactionMeta(nil, 0, nil, types.SighashEIP155, types.QueueOriginSequencer, nil, nil, encodedTx) + txMeta := types.NewTransactionMeta(nil, 0, nil, types.QueueOriginSequencer, nil, nil, encodedTx) tx.SetTransactionMeta(txMeta) return SubmitTransaction(ctx, s.b, tx) } @@ -2151,7 +2141,6 @@ func (api *PrivateDebugAPI) IngestTransactions(txs []*RPCTransaction) error { l1Timestamp := uint64(tx.L1Timestamp) rawTransaction := tx.RawTransaction - sighashType := types.SighashEIP155 var queueOrigin types.QueueOrigin switch tx.QueueOrigin { case "sequencer": @@ -2170,14 +2159,13 @@ func (api *PrivateDebugAPI) IngestTransactions(txs []*RPCTransaction) error { } meta := types.TransactionMeta{ - L1BlockNumber: l1BlockNumber, - L1Timestamp: l1Timestamp, - L1MessageSender: tx.L1TxOrigin, - SignatureHashType: sighashType, - QueueOrigin: big.NewInt(int64(queueOrigin)), - Index: (*uint64)(tx.Index), - QueueIndex: (*uint64)(tx.QueueIndex), - RawTransaction: rawTransaction, + L1BlockNumber: l1BlockNumber, + L1Timestamp: l1Timestamp, + L1MessageSender: tx.L1TxOrigin, + QueueOrigin: big.NewInt(int64(queueOrigin)), + Index: (*uint64)(tx.Index), + QueueIndex: (*uint64)(tx.QueueIndex), + RawTransaction: rawTransaction, } transaction.SetTransactionMeta(&meta) transactions[i] = transaction diff --git a/l2geth/les/odr_test.go b/l2geth/les/odr_test.go index c1004326d093..42df067ac92e 100644 --- a/l2geth/les/odr_test.go +++ b/l2geth/les/odr_test.go @@ -128,7 +128,7 @@ func odrContractCall(ctx context.Context, db ethdb.Database, config *params.Chai from := statedb.GetOrNewStateObject(bankAddr) from.SetBalance(math.MaxBig256) - msg := callmsg{types.NewMessage(from.Address(), &testContractAddr, 0, new(big.Int), 100000, new(big.Int), data, false, nil, nil, types.QueueOriginSequencer, 0)} + msg := callmsg{types.NewMessage(from.Address(), &testContractAddr, 0, new(big.Int), 100000, new(big.Int), data, false, nil, nil, types.QueueOriginSequencer)} context := core.NewEVMContext(msg, header, bc, nil) vmenv := vm.NewEVM(context, statedb, config, vm.Config{}) @@ -142,7 +142,7 @@ func odrContractCall(ctx context.Context, db ethdb.Database, config *params.Chai header := lc.GetHeaderByHash(bhash) state := light.NewState(ctx, header, lc.Odr()) state.SetBalance(bankAddr, math.MaxBig256) - msg := callmsg{types.NewMessage(bankAddr, &testContractAddr, 0, new(big.Int), 100000, new(big.Int), data, false, nil, nil, types.QueueOriginSequencer, 0)} + msg := callmsg{types.NewMessage(bankAddr, &testContractAddr, 0, new(big.Int), 100000, new(big.Int), data, false, nil, nil, types.QueueOriginSequencer)} context := core.NewEVMContext(msg, header, lc, nil) vmenv := vm.NewEVM(context, state, config, vm.Config{}) gp := new(core.GasPool).AddGas(math.MaxUint64) diff --git a/l2geth/light/odr_test.go b/l2geth/light/odr_test.go index 387f705b0315..70873e74f9e2 100644 --- a/l2geth/light/odr_test.go +++ b/l2geth/light/odr_test.go @@ -194,7 +194,7 @@ func odrContractCall(ctx context.Context, db ethdb.Database, bc *core.BlockChain // Perform read-only call. st.SetBalance(testBankAddress, math.MaxBig256) - msg := callmsg{types.NewMessage(testBankAddress, &testContractAddr, 0, new(big.Int), 1000000, new(big.Int), data, false, nil, nil, types.QueueOriginSequencer, 0)} + msg := callmsg{types.NewMessage(testBankAddress, &testContractAddr, 0, new(big.Int), 1000000, new(big.Int), data, false, nil, nil, types.QueueOriginSequencer)} context := core.NewEVMContext(msg, header, chain, nil) vmenv := vm.NewEVM(context, st, config, vm.Config{}) gp := new(core.GasPool).AddGas(math.MaxUint64) diff --git a/l2geth/miner/worker.go b/l2geth/miner/worker.go index 2c9a0a177997..de9c2ad67ea9 100644 --- a/l2geth/miner/worker.go +++ b/l2geth/miner/worker.go @@ -1073,7 +1073,7 @@ func (w *worker) commit(uncles []*types.Header, interval func(), update bool, st bn = new(big.Int) } log.Info("New block", "index", block.Number().Uint64()-uint64(1), "l1-timestamp", tx.L1Timestamp(), "l1-blocknumber", bn.Uint64(), "tx-hash", tx.Hash().Hex(), - "queue-orign", tx.QueueOrigin(), "type", tx.SignatureHashType(), "gas", block.GasUsed(), "fees", feesEth, "elapsed", common.PrettyDuration(time.Since(start))) + "queue-orign", tx.QueueOrigin(), "gas", block.GasUsed(), "fees", feesEth, "elapsed", common.PrettyDuration(time.Since(start))) case <-w.exitCh: log.Info("Worker has exited") diff --git a/l2geth/rollup/client.go b/l2geth/rollup/client.go index b8b08222c73b..743525a4f343 100644 --- a/l2geth/rollup/client.go +++ b/l2geth/rollup/client.go @@ -74,7 +74,6 @@ type transaction struct { Origin *common.Address `json:"origin"` Data hexutil.Bytes `json:"data"` QueueOrigin string `json:"queueOrigin"` - Type string `json:"type"` QueueIndex *uint64 `json:"queueIndex"` Decoded *decoded `json:"decoded"` } @@ -241,7 +240,6 @@ func enqueueToTransaction(enqueue *Enqueue) (*types.Transaction, error) { blockNumber, timestamp, &origin, - types.SighashEIP155, types.QueueOriginL1ToL2, enqueue.Index, enqueue.QueueIndex, @@ -327,7 +325,6 @@ func batchedTransactionToTransaction(res *transaction, signer *types.EIP155Signe } else { return nil, fmt.Errorf("Unknown queue origin: %s", res.QueueOrigin) } - sighashType := types.SighashEIP155 // Transactions that have been decoded are // Queue Origin Sequencer transactions if res.Decoded != nil { @@ -352,7 +349,6 @@ func batchedTransactionToTransaction(res *transaction, signer *types.EIP155Signe new(big.Int).SetUint64(res.BlockNumber), res.Timestamp, res.Origin, - sighashType, queueOrigin, &res.Index, res.QueueIndex, @@ -393,7 +389,6 @@ func batchedTransactionToTransaction(res *transaction, signer *types.EIP155Signe new(big.Int).SetUint64(res.BlockNumber), res.Timestamp, origin, - sighashType, queueOrigin, &res.Index, res.QueueIndex, diff --git a/l2geth/rollup/sync_service_test.go b/l2geth/rollup/sync_service_test.go index d23f5ad304d4..f9e71d6b93b8 100644 --- a/l2geth/rollup/sync_service_test.go +++ b/l2geth/rollup/sync_service_test.go @@ -121,7 +121,6 @@ func TestSyncServiceTransactionEnqueued(t *testing.T) { l1BlockNumber, timestamp, &l1TxOrigin, - types.SighashEIP155, types.QueueOriginL1ToL2, &index, &queueIndex, @@ -570,7 +569,6 @@ func TestSyncServiceSync(t *testing.T) { l1BlockNumber, timestamp, &l1TxOrigin, - types.SighashEIP155, types.QueueOriginL1ToL2, &index, &queueIndex, @@ -622,7 +620,6 @@ func TestInitializeL1ContextPostGenesis(t *testing.T) { l1BlockNumber, timestamp, &l1TxOrigin, - types.SighashEIP155, types.QueueOriginL1ToL2, &index, &queueIndex, diff --git a/l2geth/signer/core/types.go b/l2geth/signer/core/types.go index 28ccea210c34..c9f2b2eb3128 100644 --- a/l2geth/signer/core/types.go +++ b/l2geth/signer/core/types.go @@ -78,10 +78,9 @@ type SendTxArgs struct { Data *hexutil.Bytes `json:"data"` Input *hexutil.Bytes `json:"input"` - L1MessageSender *common.MixedcaseAddress `json:"l1MessageSender"` - L1BlockNumber *big.Int `json:"l1BlockNumber"` - SignatureHashType types.SignatureHashType `json:"signatureHashType"` - QueueOrigin types.QueueOrigin `json:"queueOrigin"` + L1MessageSender *common.MixedcaseAddress `json:"l1MessageSender"` + L1BlockNumber *big.Int `json:"l1BlockNumber"` + QueueOrigin types.QueueOrigin `json:"queueOrigin"` } func (args SendTxArgs) String() string { @@ -111,7 +110,7 @@ func (args *SendTxArgs) toTransaction() *types.Transaction { } tx := types.NewTransaction(uint64(args.Nonce), args.To.Address(), (*big.Int)(&args.Value), (uint64)(args.Gas), (*big.Int)(&args.GasPrice), input) - txMeta := types.NewTransactionMeta(l1BlockNumber, 0, l1MessageSender, args.SignatureHashType, args.QueueOrigin, nil, nil, nil) + txMeta := types.NewTransactionMeta(l1BlockNumber, 0, l1MessageSender, args.QueueOrigin, nil, nil, nil) tx.SetTransactionMeta(txMeta) return tx } diff --git a/l2geth/tests/state_test_util.go b/l2geth/tests/state_test_util.go index fd1e679ae44d..26e6607ef241 100644 --- a/l2geth/tests/state_test_util.go +++ b/l2geth/tests/state_test_util.go @@ -279,7 +279,7 @@ func (tx *stTransaction) toMessage(ps stPostState) (core.Message, error) { return nil, fmt.Errorf("invalid tx data %q", dataHex) } - msg := types.NewMessage(from, to, tx.Nonce, value, gasLimit, tx.GasPrice, data, true, nil, nil, types.QueueOriginSequencer, 0) + msg := types.NewMessage(from, to, tx.Nonce, value, gasLimit, tx.GasPrice, data, true, nil, nil, types.QueueOriginSequencer) return msg, nil } diff --git a/packages/core-utils/src/l2context.ts b/packages/core-utils/src/l2context.ts index 0fe7f771b7eb..18e526ba2e10 100644 --- a/packages/core-utils/src/l2context.ts +++ b/packages/core-utils/src/l2context.ts @@ -31,7 +31,6 @@ export const injectL2Context = (l1Provider: providers.JsonRpcProvider) => { ) } b.transactions[i].l1TxOrigin = block.transactions[i].l1TxOrigin - b.transactions[i].txType = block.transactions[i].txType b.transactions[i].queueOrigin = block.transactions[i].queueOrigin b.transactions[i].rawTransaction = block.transactions[i].rawTransaction } From 912ab681af7d3d6478e9745361756fe8d5f5fd26 Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Thu, 20 May 2021 09:29:21 -0400 Subject: [PATCH 012/125] feat[contracts]: introduce OVM_GasPriceOracle (#912) * feat[contracts]: congestion price oracle * chore: add changeset * contracts: gas price oracle (#917) * contracts: gas price oracle * tests: update * fees: fix tests * contracts: simplify gas price oracle * lint: fix * test: execution price is at the 1st storage slot * chore: rename predeploy to GasPriceOracle * chore: rename gas price oracle test name Co-authored-by: Mark Tyneway Co-authored-by: Georgios Konstantopoulos --- .changeset/seven-carpets-tell.md | 5 ++ packages/contracts/bin/take-dump.ts | 2 + .../OVM/predeploys/OVM_GasPriceOracle.sol | 71 ++++++++++++++++ .../src/contract-deployment/config.ts | 5 ++ packages/contracts/src/predeploys.ts | 1 + .../contracts/src/state-dump/make-dump.ts | 3 + .../precompiles/OVM_GasPriceOracle.spec.ts | 84 +++++++++++++++++++ 7 files changed, 171 insertions(+) create mode 100644 .changeset/seven-carpets-tell.md create mode 100644 packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol create mode 100644 packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts diff --git a/.changeset/seven-carpets-tell.md b/.changeset/seven-carpets-tell.md new file mode 100644 index 000000000000..9be51c0a6974 --- /dev/null +++ b/.changeset/seven-carpets-tell.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/contracts': patch +--- + +Introduces the congestion price oracle contract diff --git a/packages/contracts/bin/take-dump.ts b/packages/contracts/bin/take-dump.ts index 75b9f6d425b1..b1e5376ed737 100644 --- a/packages/contracts/bin/take-dump.ts +++ b/packages/contracts/bin/take-dump.ts @@ -5,6 +5,7 @@ import * as mkdirp from 'mkdirp' const env = process.env const CHAIN_ID = env.CHAIN_ID || '420' +const GAS_PRICE_ORACLE_OWNER = env.GAS_PRICE_ORACLE_OWNER || '0x' + 'FF'.repeat(20) /* Internal Imports */ import { makeStateDump } from '../src/state-dump/make-dump' @@ -18,6 +19,7 @@ import { RollupDeployConfig } from '../src/contract-deployment' ovmGlobalContext: { ovmCHAINID: parseInt(CHAIN_ID, 10), }, + gasPriceOracleOwner: GAS_PRICE_ORACLE_OWNER } const dump = await makeStateDump(config as RollupDeployConfig) diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol new file mode 100644 index 000000000000..6f11866b0857 --- /dev/null +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol @@ -0,0 +1,71 @@ +// SPDX-License-Identifier: MIT +pragma solidity >0.5.0 <0.8.0; + +/* External Imports */ +import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; + +/** + * @title OVM_GasPriceOracle + * @dev This contract exposes the current execution price, a measure of how congested the network + * currently is. This measure is used by the Sequencer to determine what fee to charge for + * transactions. When the system is more congested, the execution price will increase and fees + * will also increase as a result. + * + * Compiler used: optimistic-solc + * Runtime target: OVM + */ +contract OVM_GasPriceOracle is Ownable { + + /************* + * Variables * + *************/ + + // Current execution price + uint256 internal executionPrice; + + /*************** + * Constructor * + ***************/ + + /** + * @param _owner Address that will initially own this contract. + */ + constructor( + address _owner + ) + Ownable() + { + transferOwnership(_owner); + } + + + /******************** + * Public Functions * + ********************/ + + /** + * @return Current execution price. + */ + function getExecutionPrice() + public + view + returns ( + uint256 + ) + { + return executionPrice; + } + + /** + * Allows the owner to modify the execution price. + * @param _executionPrice New execution price. + */ + function setExecutionPrice( + uint256 _executionPrice + ) + public + onlyOwner + { + executionPrice = _executionPrice; + } +} diff --git a/packages/contracts/src/contract-deployment/config.ts b/packages/contracts/src/contract-deployment/config.ts index a5ea59e29bd1..ead7d5b9e2f5 100644 --- a/packages/contracts/src/contract-deployment/config.ts +++ b/packages/contracts/src/contract-deployment/config.ts @@ -34,6 +34,7 @@ export interface RollupDeployConfig { owner: string | Signer allowArbitraryContractDeployment: boolean } + gasPriceOracleOwner: string addressManager?: string dependencies?: string[] deployOverrides: Overrides @@ -258,5 +259,9 @@ export const makeContractDeployConfig = async ( true ), }, + OVM_GasPriceOracle: { + factory: getContractFactory('OVM_GasPriceOracle'), + params: [config.gasPriceOracleOwner], + }, } } diff --git a/packages/contracts/src/predeploys.ts b/packages/contracts/src/predeploys.ts index 5467e66f4c12..1fbcc692d548 100644 --- a/packages/contracts/src/predeploys.ts +++ b/packages/contracts/src/predeploys.ts @@ -18,5 +18,6 @@ export const predeploys = { Lib_AddressManager: '0x4200000000000000000000000000000000000008', OVM_ProxyEOA: '0x4200000000000000000000000000000000000009', OVM_ExecutionManagerWrapper: '0x420000000000000000000000000000000000000B', + OVM_GasPriceOracle: '0x420000000000000000000000000000000000000F', ERC1820Registry: '0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24', } diff --git a/packages/contracts/src/state-dump/make-dump.ts b/packages/contracts/src/state-dump/make-dump.ts index 9b4339a4cdc6..985f22514b78 100644 --- a/packages/contracts/src/state-dump/make-dump.ts +++ b/packages/contracts/src/state-dump/make-dump.ts @@ -137,9 +137,11 @@ export const makeStateDump = async (cfg: RollupDeployConfig): Promise => { 'OVM_StateManager', 'OVM_ETH', 'OVM_ExecutionManagerWrapper', + 'OVM_GasPriceOracle', ], deployOverrides: {}, waitForReceipts: false, + gasPriceOracleOwner: cfg.gasPriceOracleOwner, } config = { ...config, ...cfg } @@ -154,6 +156,7 @@ export const makeStateDump = async (cfg: RollupDeployConfig): Promise => { 'OVM_ECDSAContractAccount', 'OVM_ProxyEOA', 'OVM_ExecutionManagerWrapper', + 'OVM_GasPriceOracle', ] const deploymentResult = await deploy(config) diff --git a/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts b/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts new file mode 100644 index 000000000000..4e86499ef9bb --- /dev/null +++ b/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts @@ -0,0 +1,84 @@ +import { expect } from '../../../setup' + +/* External Imports */ +import { ethers } from 'hardhat' +import { ContractFactory, Contract, Signer } from 'ethers' + +describe('OVM_GasPriceOracle', () => { + let signer1: Signer + let signer2: Signer + before(async () => { + ;[signer1, signer2] = await ethers.getSigners() + }) + + let Factory__OVM_GasPriceOracle: ContractFactory + before(async () => { + Factory__OVM_GasPriceOracle = await ethers.getContractFactory( + 'OVM_GasPriceOracle' + ) + }) + + let OVM_GasPriceOracle: Contract + beforeEach(async () => { + OVM_GasPriceOracle = await Factory__OVM_GasPriceOracle.deploy( + await signer1.getAddress() + ) + }) + + describe('owner', () => { + it('should have an owner', async () => { + expect(await OVM_GasPriceOracle.owner()).to.equal( + await signer1.getAddress() + ) + }) + }) + + describe('setExecutionPrice', () => { + it('should revert if called by someone other than the owner', async () => { + await expect(OVM_GasPriceOracle.connect(signer2).setExecutionPrice(1234)) + .to.be.reverted + }) + + it('should succeed if called by the owner', async () => { + await expect(OVM_GasPriceOracle.connect(signer1).setExecutionPrice(1234)) + .to.not.be.reverted + }) + }) + + describe('getExecutionPrice', () => { + it('should return zero at first', async () => { + expect(await OVM_GasPriceOracle.getExecutionPrice()).to.equal(0) + }) + + it('should change when setExecutionPrice is called', async () => { + const executionPrice = 1234 + + await OVM_GasPriceOracle.connect(signer1).setExecutionPrice( + executionPrice + ) + + expect(await OVM_GasPriceOracle.getExecutionPrice()).to.equal( + executionPrice + ) + }) + + it('is the 1st storage slot', async () => { + const executionPrice = 1234 + const slot = 1 + + // set the price + await OVM_GasPriceOracle.connect(signer1).setExecutionPrice( + executionPrice + ) + + // get the storage slot value + const priceAtSlot = await signer1.provider.getStorageAt( + OVM_GasPriceOracle.address, + slot + ) + expect(await OVM_GasPriceOracle.getExecutionPrice()).to.equal( + ethers.BigNumber.from(priceAtSlot) + ) + }) + }) +}) From 4e0461dcc2cf47a37c8e7d7507d0caba82fac41c Mon Sep 17 00:00:00 2001 From: Georgios Konstantopoulos Date: Thu, 20 May 2021 17:10:50 +0300 Subject: [PATCH 013/125] fix: configure max gas limit to 11m (#928) Uniswap V3 contracts require that, otherwise they throw call exceptions at deployment --- l2geth/scripts/start.sh | 2 +- ops/envs/geth.env | 2 +- packages/contracts/src/state-dump/make-dump.ts | 2 +- packages/contracts/tasks/deploy.ts | 4 ++-- packages/data-transport-layer/src/utils/constants.ts | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/l2geth/scripts/start.sh b/l2geth/scripts/start.sh index 43803b00efc9..cb346a627489 100755 --- a/l2geth/scripts/start.sh +++ b/l2geth/scripts/start.sh @@ -6,7 +6,7 @@ REPO=$DIR/.. IS_VERIFIER= ROLLUP_SYNC_SERVICE_ENABLE=true DATADIR=$HOME/.ethereum -TARGET_GAS_LIMIT=10000000 +TARGET_GAS_LIMIT=11000000 CHAIN_ID=10 ETH1_CTC_DEPLOYMENT_HEIGHT=12410807 ETH1_L1_GATEWAY_ADDRESS=0xe681F80966a8b1fFadECf8068bD6F99034791c95 diff --git a/ops/envs/geth.env b/ops/envs/geth.env index 1bfd720333ab..92ff4e9be312 100644 --- a/ops/envs/geth.env +++ b/ops/envs/geth.env @@ -31,5 +31,5 @@ IPC_DISABLE=true NETWORK_ID=420 NO_USB=true NO_DISCOVER=true -TARGET_GAS_LIMIT=10000000 +TARGET_GAS_LIMIT=11000000 USING_OVM=true diff --git a/packages/contracts/src/state-dump/make-dump.ts b/packages/contracts/src/state-dump/make-dump.ts index 985f22514b78..55b44f1a66a0 100644 --- a/packages/contracts/src/state-dump/make-dump.ts +++ b/packages/contracts/src/state-dump/make-dump.ts @@ -99,7 +99,7 @@ export const makeStateDump = async (cfg: RollupDeployConfig): Promise => { deploymentSigner: signer, ovmGasMeteringConfig: { minTransactionGasLimit: 0, - maxTransactionGasLimit: 10_000_000, + maxTransactionGasLimit: 11_000_000, maxGasPerQueuePerEpoch: 1_000_000_000_000, secondsPerEpoch: 0, }, diff --git a/packages/contracts/tasks/deploy.ts b/packages/contracts/tasks/deploy.ts index 4e28e199b736..cfe3ad3e80bc 100644 --- a/packages/contracts/tasks/deploy.ts +++ b/packages/contracts/tasks/deploy.ts @@ -5,9 +5,9 @@ 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_MAX_TRANSACTION_GAS_LIMIT = 10_000_000 +const DEFAULT_CTC_MAX_TRANSACTION_GAS_LIMIT = 11_000_000 const DEFAULT_EM_MIN_TRANSACTION_GAS_LIMIT = 50_000 -const DEFAULT_EM_MAX_TRANSACTION_GAS_LIMIT = 10_000_000 +const DEFAULT_EM_MAX_TRANSACTION_GAS_LIMIT = 11_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 diff --git a/packages/data-transport-layer/src/utils/constants.ts b/packages/data-transport-layer/src/utils/constants.ts index b7655cc638fa..8309786c3b56 100644 --- a/packages/data-transport-layer/src/utils/constants.ts +++ b/packages/data-transport-layer/src/utils/constants.ts @@ -1,3 +1,3 @@ -export const SEQUENCER_GAS_LIMIT = 10_000_000 // TODO: Remove and use value from event. +export const SEQUENCER_GAS_LIMIT = 11_000_000 // TODO: Remove and use value from event. export const SEQUENCER_ENTRYPOINT_ADDRESS = '0x4200000000000000000000000000000000000005' From 62a6c531c73761718572556695d3111c59ad9029 Mon Sep 17 00:00:00 2001 From: Rajiv Patel-O'Connor Date: Tue, 25 May 2021 10:07:32 -0400 Subject: [PATCH 014/125] Consolidate Predeploy Addresses (#931) * added library for predeploy addresses * refactor tests and other packages to use exported predeploys * revert library usage in OVM_ECDSAContractAccount * lint * added newline * fixed address typos Co-authored-by: rajivpo Co-authored-by: smartcontracts --- integration-tests/test/shared/utils.ts | 3 ++- .../batch-submitter/batch-submitter.spec.ts | 7 +++---- .../OVM/accounts/OVM_ProxyEOA.sol | 4 ++-- .../messaging/OVM_L1CrossDomainMessenger.sol | 3 ++- .../OVM/execution/OVM_ExecutionManager.sol | 7 ++++--- .../constants/Lib_PredeployAddresses.sol | 18 ++++++++++++++++++ .../src/contract-deployment/config.ts | 6 +++--- packages/contracts/src/state-dump/make-dump.ts | 3 +-- .../base/OVM_L1CrossDomainMessenger.spec.ts | 12 +++++++----- .../OVM_CanonicalTransactionChain.gas.spec.ts | 5 +++-- .../OVM_CanonicalTransactionChain.spec.ts | 6 +++--- .../OVM_ExecutionManager/ovmCREATE.spec.ts | 9 +++++---- packages/message-relayer/src/service.ts | 8 ++++++-- 13 files changed, 59 insertions(+), 32 deletions(-) create mode 100644 packages/contracts/contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol diff --git a/integration-tests/test/shared/utils.ts b/integration-tests/test/shared/utils.ts index 5e9214afaae0..cded6058cf00 100644 --- a/integration-tests/test/shared/utils.ts +++ b/integration-tests/test/shared/utils.ts @@ -3,6 +3,7 @@ import { Direction, waitForXDomainTransaction } from './watcher-utils' import { getContractFactory, getContractInterface, + predeploys, } from '@eth-optimism/contracts' import { remove0x, Watcher } from '@eth-optimism/core-utils' import { @@ -54,7 +55,7 @@ export const l2Wallet = l1Wallet.connect(l2Provider) // Predeploys export const PROXY_SEQUENCER_ENTRYPOINT_ADDRESS = '0x4200000000000000000000000000000000000004' -export const OVM_ETH_ADDRESS = '0x4200000000000000000000000000000000000006' +export const OVM_ETH_ADDRESS = predeploys.OVM_ETH export const getAddressManager = (provider: any) => { return getContractFactory('Lib_AddressManager') diff --git a/packages/batch-submitter/test/batch-submitter/batch-submitter.spec.ts b/packages/batch-submitter/test/batch-submitter/batch-submitter.spec.ts index f0b0e4686e8e..b217a5567b39 100644 --- a/packages/batch-submitter/test/batch-submitter/batch-submitter.spec.ts +++ b/packages/batch-submitter/test/batch-submitter/batch-submitter.spec.ts @@ -9,7 +9,7 @@ import sinon from 'sinon' import { Web3Provider } from '@ethersproject/providers' import scc from '@eth-optimism/contracts/artifacts/contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol/OVM_StateCommitmentChain.json' -import { getContractInterface } from '@eth-optimism/contracts' +import { getContractInterface, predeploys } from '@eth-optimism/contracts' import { smockit, MockContract } from '@eth-optimism/smock' /* Internal Imports */ @@ -38,7 +38,6 @@ import { } from '@eth-optimism/core-utils' import { Logger, Metrics } from '@eth-optimism/common-ts' -const DECOMPRESSION_ADDRESS = '0x4200000000000000000000000000000000000008' const DUMMY_ADDRESS = '0x' + '00'.repeat(20) const EXAMPLE_STATE_ROOT = '0x16b7f83f409c7195b1f4fde5652f1b54a4477eacb6db7927691becafba5f8801' @@ -98,7 +97,7 @@ describe('BatchSubmitter', () => { ) await AddressManager.setAddress( 'OVM_DecompressionPrecompileAddress', - DECOMPRESSION_ADDRESS + predeploys.OVM_SequencerEntrypoint ) Mock__OVM_ExecutionManager = await smockit( @@ -484,7 +483,7 @@ describe('Batch Submitter with Ganache', () => { gasPrices.push(gasPrice) const tx = signer.sendTransaction({ - to: DECOMPRESSION_ADDRESS, + to: predeploys.OVM_SequencerEntrypoint, value: 88, nonce: 0, gasPrice, diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol index 5965ab317a5f..c1e7fe3a2b47 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol @@ -3,6 +3,7 @@ pragma solidity >0.5.0 <0.8.0; /* Library Imports */ import { Lib_Bytes32Utils } from "../../libraries/utils/Lib_Bytes32Utils.sol"; +import { Lib_PredeployAddresses } from "../../libraries/constants/Lib_PredeployAddresses.sol"; import { Lib_ExecutionManagerWrapper } from "../../libraries/wrappers/Lib_ExecutionManagerWrapper.sol"; /** @@ -29,7 +30,6 @@ contract OVM_ProxyEOA { * Constants * *************/ - address constant DEFAULT_IMPLEMENTATION = 0x4200000000000000000000000000000000000003; bytes32 constant IMPLEMENTATION_KEY = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; //bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1); @@ -98,7 +98,7 @@ contract OVM_ProxyEOA { address implementation = Lib_Bytes32Utils.toAddress(addr32); if (implementation == address(0)) { - return DEFAULT_IMPLEMENTATION; + return Lib_PredeployAddresses.ovmECDSAContractAccount; } else { return implementation; } diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol index 0fa61807d07e..d71002bd540a 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol @@ -7,6 +7,7 @@ import { Lib_AddressResolver } from "../../../libraries/resolver/Lib_AddressReso import { Lib_OVMCodec } from "../../../libraries/codec/Lib_OVMCodec.sol"; import { Lib_AddressManager } from "../../../libraries/resolver/Lib_AddressManager.sol"; import { Lib_SecureMerkleTrie } from "../../../libraries/trie/Lib_SecureMerkleTrie.sol"; +import { Lib_PredeployAddresses } from "../../../libraries/constants/Lib_PredeployAddresses.sol"; import { Lib_CrossDomainUtils } from "../../../libraries/bridge/Lib_CrossDomainUtils.sol"; /* Interface Imports */ @@ -407,7 +408,7 @@ contract OVM_L1CrossDomainMessenger is bool exists, bytes memory encodedMessagePassingAccount ) = Lib_SecureMerkleTrie.get( - abi.encodePacked(0x4200000000000000000000000000000000000000), + abi.encodePacked(Lib_PredeployAddresses.ovmL2ToL1MessagePasser), _proof.stateTrieWitness, _proof.stateRoot ); diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol index 7fdfdfa1f944..8c410cb51e55 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol @@ -8,6 +8,7 @@ import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; import { Lib_EthUtils } from "../../libraries/utils/Lib_EthUtils.sol"; import { Lib_ErrorUtils } from "../../libraries/utils/Lib_ErrorUtils.sol"; +import { Lib_PredeployAddresses } from "../../libraries/constants/Lib_PredeployAddresses.sol"; /* Interface Imports */ import { iOVM_ExecutionManager } from "../../iOVM/execution/iOVM_ExecutionManager.sol"; @@ -551,9 +552,9 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { address proxyEOA = Lib_EthUtils.createContract(abi.encodePacked( hex"600D380380600D6000396000f3", ovmEXTCODECOPY( - 0x4200000000000000000000000000000000000009, + Lib_PredeployAddresses.ovmProxyEOA, 0, - ovmEXTCODESIZE(0x4200000000000000000000000000000000000009) + ovmEXTCODESIZE(Lib_PredeployAddresses.ovmProxyEOA) ) )); @@ -829,7 +830,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { // the deployer ovmCALLing the whitelist. This is fine--in a sense, we are forcing them to. (bool success, bytes memory data) = ovmCALL( gasleft(), - 0x4200000000000000000000000000000000000002, + Lib_PredeployAddresses.ovmDeployerWhitelist, abi.encodeWithSignature("isDeployerAllowed(address)", _deployerAddress) ); bool isAllowed = abi.decode(data, (bool)); diff --git a/packages/contracts/contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol b/packages/contracts/contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol new file mode 100644 index 000000000000..09fae11cb1d3 --- /dev/null +++ b/packages/contracts/contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: MIT +pragma solidity >0.5.0 <0.8.0; + +/** + * @title Lib_PredeployAddresses + */ +library Lib_PredeployAddresses { + address public constant ovmL2ToL1MessagePasser = 0x4200000000000000000000000000000000000000; + address public constant ovmL1MessageSender = 0x4200000000000000000000000000000000000001; + address public constant ovmDeployerWhitelist = 0x4200000000000000000000000000000000000002; + address public constant ovmECDSAContractAccount = 0x4200000000000000000000000000000000000003; + address public constant ovmSequencerEntrypoint = 0x4200000000000000000000000000000000000005; + address public constant ovmETH = 0x4200000000000000000000000000000000000006; + address public constant ovmL2CrossDomainMessenger = 0x4200000000000000000000000000000000000007; + address public constant libAddressManager = 0x4200000000000000000000000000000000000008; + address public constant ovmProxyEOA = 0x4200000000000000000000000000000000000009; + address public constant ERC1820Registry = 0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24; +} diff --git a/packages/contracts/src/contract-deployment/config.ts b/packages/contracts/src/contract-deployment/config.ts index ead7d5b9e2f5..5801427ef5b0 100644 --- a/packages/contracts/src/contract-deployment/config.ts +++ b/packages/contracts/src/contract-deployment/config.ts @@ -122,7 +122,7 @@ export const makeContractDeployConfig = async ( await _sendTx( l1EthGateway.initialize( AddressManager.address, - '0x4200000000000000000000000000000000000006', + predeploys.OVM_ETH, config.deployOverrides ) ) @@ -149,7 +149,7 @@ export const makeContractDeployConfig = async ( await _sendTx( AddressManager.setAddress( 'OVM_DecompressionPrecompileAddress', - '0x4200000000000000000000000000000000000005' + predeploys.OVM_SequencerEntrypoint ) ) await _sendTx( @@ -230,7 +230,7 @@ export const makeContractDeployConfig = async ( OVM_ETH: { factory: getContractFactory('OVM_ETH'), params: [ - '0x4200000000000000000000000000000000000007', + predeploys.OVM_L2CrossDomainMessenger, '0x0000000000000000000000000000000000000000', // will be overridden by geth when state dump is ingested. Storage key: 0x0000000000000000000000000000000000000000000000000000000000000008 ], }, diff --git a/packages/contracts/src/state-dump/make-dump.ts b/packages/contracts/src/state-dump/make-dump.ts index 55b44f1a66a0..b6d49f233443 100644 --- a/packages/contracts/src/state-dump/make-dump.ts +++ b/packages/contracts/src/state-dump/make-dump.ts @@ -105,8 +105,7 @@ export const makeStateDump = async (cfg: RollupDeployConfig): Promise => { }, ovmGlobalContext: { ovmCHAINID: 420, - L2CrossDomainMessengerAddress: - '0x4200000000000000000000000000000000000007', + L2CrossDomainMessengerAddress: predeploys.OVM_L2CrossDomainMessenger, }, transactionChainConfig: { sequencer: signer, diff --git a/packages/contracts/test/contracts/OVM/bridge/base/OVM_L1CrossDomainMessenger.spec.ts b/packages/contracts/test/contracts/OVM/bridge/base/OVM_L1CrossDomainMessenger.spec.ts index f1291c79f933..5b6a25eac656 100644 --- a/packages/contracts/test/contracts/OVM/bridge/base/OVM_L1CrossDomainMessenger.spec.ts +++ b/packages/contracts/test/contracts/OVM/bridge/base/OVM_L1CrossDomainMessenger.spec.ts @@ -21,6 +21,7 @@ import { encodeXDomainCalldata, } from '../../../../helpers' import { keccak256 } from 'ethers/lib/utils' +import { predeploys } from '../../../../../src' const MAX_GAS_LIMIT = 8_000_000 @@ -269,8 +270,6 @@ describe('OVM_L1CrossDomainMessenger', () => { calldata = encodeXDomainCalldata(target, sender, message, 0) - const precompile = '0x4200000000000000000000000000000000000000' - const storageKey = keccak256( keccak256( calldata + remove0x(Mock__OVM_L2CrossDomainMessenger.address) @@ -289,7 +288,7 @@ describe('OVM_L1CrossDomainMessenger', () => { const generator = await TrieTestGenerator.fromAccounts({ accounts: [ { - address: precompile, + address: predeploys.OVM_L2ToL1MessagePasser, nonce: 0, balance: 0, codeHash: keccak256('0x1234'), @@ -303,8 +302,11 @@ describe('OVM_L1CrossDomainMessenger', () => { stateRoot: toHexString(generator._trie.root), stateRootBatchHeader: DUMMY_BATCH_HEADERS[0], stateRootProof: DUMMY_BATCH_PROOFS[0], - stateTrieWitness: (await generator.makeAccountProofTest(precompile)) - .accountTrieWitness, + stateTrieWitness: ( + await generator.makeAccountProofTest( + predeploys.OVM_L2ToL1MessagePasser + ) + ).accountTrieWitness, storageTrieWitness: ( await storageGenerator.makeInclusionProofTest(storageKey) ).proof, diff --git a/packages/contracts/test/contracts/OVM/chain/OVM_CanonicalTransactionChain.gas.spec.ts b/packages/contracts/test/contracts/OVM/chain/OVM_CanonicalTransactionChain.gas.spec.ts index 87c84ff6356a..5bf32d6ff051 100644 --- a/packages/contracts/test/contracts/OVM/chain/OVM_CanonicalTransactionChain.gas.spec.ts +++ b/packages/contracts/test/contracts/OVM/chain/OVM_CanonicalTransactionChain.gas.spec.ts @@ -20,10 +20,11 @@ import { getNextBlockNumber, } from '../../../helpers' +import { predeploys } from '../../../../src' + // Still have some duplication from OVM_CanonicalTransactionChain.spec.ts, but it's so minimal that // this is probably cleaner for now. Particularly since we're planning to move all of this out into // core-utils soon anyway. -const DECOMPRESSION_ADDRESS = '0x4200000000000000000000000000000000000008' const MAX_GAS_LIMIT = 8_000_000 const appendSequencerBatch = async ( @@ -55,7 +56,7 @@ describe('[GAS BENCHMARK] OVM_CanonicalTransactionChain', () => { ) await AddressManager.setAddress( 'OVM_DecompressionPrecompileAddress', - DECOMPRESSION_ADDRESS + predeploys.OVM_SequencerEntrypoint ) Mock__OVM_ExecutionManager = await smockit( diff --git a/packages/contracts/test/contracts/OVM/chain/OVM_CanonicalTransactionChain.spec.ts b/packages/contracts/test/contracts/OVM/chain/OVM_CanonicalTransactionChain.spec.ts index 4366bf78c829..76c90c4e0c6f 100644 --- a/packages/contracts/test/contracts/OVM/chain/OVM_CanonicalTransactionChain.spec.ts +++ b/packages/contracts/test/contracts/OVM/chain/OVM_CanonicalTransactionChain.spec.ts @@ -27,9 +27,9 @@ import { getBlockTime, mineBlock, } from '../../../helpers' +import { predeploys } from '../../../../src' const ELEMENT_TEST_SIZES = [1, 2, 4, 8, 16] -const DECOMPRESSION_ADDRESS = '0x4200000000000000000000000000000000000008' const MAX_GAS_LIMIT = 8_000_000 const getQueueLeafHash = (index: number): string => { @@ -105,7 +105,7 @@ describe('OVM_CanonicalTransactionChain', () => { ) await AddressManager.setAddress( 'OVM_DecompressionPrecompileAddress', - DECOMPRESSION_ADDRESS + predeploys.OVM_SequencerEntrypoint ) Mock__OVM_ExecutionManager = await smockit( @@ -604,7 +604,7 @@ describe('OVM_CanonicalTransactionChain', () => { }) it('should successfully verify against a valid sequencer transaction', async () => { - const entrypoint = DECOMPRESSION_ADDRESS + const entrypoint = predeploys.OVM_SequencerEntrypoint const gasLimit = MAX_GAS_LIMIT const data = '0x' + '12'.repeat(1234) const timestamp = (await getEthTime(ethers.provider)) - 10 diff --git a/packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/ovmCREATE.spec.ts b/packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/ovmCREATE.spec.ts index 8281cd5516af..63b4a07bc8c8 100644 --- a/packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/ovmCREATE.spec.ts +++ b/packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/ovmCREATE.spec.ts @@ -14,6 +14,7 @@ import { getStorageXOR, encodeSolidityError, } from '../../../../helpers' +import { predeploys } from '../../../../../src' const CREATED_CONTRACT_1 = '0x2bda4a99d5be88609d23b1e4ab5d1d34fb1c2feb' const CREATED_CONTRACT_2 = '0x2bda4a99d5be88609d23b1e4ab5d1d34fb1c2feb' @@ -772,7 +773,7 @@ const test_ovmCREATE: TestDefinition = { }, }, contractStorage: { - ['0x4200000000000000000000000000000000000002']: { + [predeploys.OVM_DeployerWhitelist]: { // initialized? true, allowArbitraryDeployment? false '0x0000000000000000000000000000000000000000000000000000000000000000': getStorageXOR( '0x0000000000000000000000000000000000000000000000000000000000000001' @@ -788,7 +789,7 @@ const test_ovmCREATE: TestDefinition = { }, }, verifiedContractStorage: { - ['0x4200000000000000000000000000000000000002']: { + [predeploys.OVM_DeployerWhitelist]: { '0x0000000000000000000000000000000000000000000000000000000000000000': 1, [NON_WHITELISTED_DEPLOYER_KEY]: 1, [WHITELISTED_DEPLOYER_KEY]: 1, @@ -902,7 +903,7 @@ const test_ovmCREATE: TestDefinition = { }, }, contractStorage: { - ['0x4200000000000000000000000000000000000002']: { + [predeploys.OVM_DeployerWhitelist]: { // initialized? true, allowArbitraryDeployment? true '0x0000000000000000000000000000000000000000000000000000000000000000': getStorageXOR( '0x0000000000000000000000000000000000000000000000000000000000000101' @@ -918,7 +919,7 @@ const test_ovmCREATE: TestDefinition = { }, }, verifiedContractStorage: { - ['0x4200000000000000000000000000000000000002']: { + [predeploys.OVM_DeployerWhitelist]: { '0x0000000000000000000000000000000000000000000000000000000000000000': 1, [NON_WHITELISTED_DEPLOYER_KEY]: 1, [WHITELISTED_DEPLOYER_KEY]: 1, diff --git a/packages/message-relayer/src/service.ts b/packages/message-relayer/src/service.ts index 9568f3e1ea23..4e0f85009087 100644 --- a/packages/message-relayer/src/service.ts +++ b/packages/message-relayer/src/service.ts @@ -8,7 +8,11 @@ import { fromHexString, sleep } from '@eth-optimism/core-utils' import { BaseService } from '@eth-optimism/common-ts' import SpreadSheet from './spreadsheet' -import { loadContract, loadContractFromManager } from '@eth-optimism/contracts' +import { + loadContract, + loadContractFromManager, + predeploys, +} from '@eth-optimism/contracts' import { StateRootBatchHeader, SentMessage, SentMessageProof } from './types' interface MessageRelayerOptions { @@ -132,7 +136,7 @@ export class MessageRelayerService extends BaseService { this.logger.info('Connecting to OVM_L2ToL1MessagePasser...') this.state.OVM_L2ToL1MessagePasser = loadContract( 'OVM_L2ToL1MessagePasser', - '0x4200000000000000000000000000000000000000', + predeploys.OVM_L2ToL1MessagePasser, this.options.l2RpcProvider ) this.logger.info('Connected to OVM_L2ToL1MessagePasser', { From e8a95dff7b960d0a704cc0b698a7d5666848b513 Mon Sep 17 00:00:00 2001 From: Georgios Konstantopoulos Date: Tue, 25 May 2021 17:11:32 +0300 Subject: [PATCH 015/125] chore: remove yarn-error.log and gitignore it (#956) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 18b731ead5fc..62f52dfdd80a 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ packages/data-transport-layer/db *.swp .env +*.log From 85da4979586d23b9b8452f31d7734af826a5373c Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Tue, 25 May 2021 12:06:32 -0400 Subject: [PATCH 016/125] feat[contracts]: Replace Lib_RingBuffer with a much simpler Lib_Buffer (#821) * feat[contracts]: replace Lib_RingBuffer with a simpler Lib_Buffer * chore: changeset * test: add tests for Lib_Buffer * lint: fix * test: add extra coverage for Lib_Buffer * Update packages/contracts/contracts/optimistic-ethereum/libraries/utils/Lib_Buffer.sol Co-authored-by: ben-chain * add some extra comments Co-authored-by: ben-chain --- .changeset/fair-donuts-lick.md | 5 + .../OVM/chain/OVM_ChainStorageContainer.sol | 19 +- .../iOVM/chain/iOVM_ChainStorageContainer.sol | 9 - .../libraries/utils/Lib_Buffer.sol | 258 ++++++++++++ .../libraries/utils/Lib_RingBuffer.sol | 376 ------------------ ...tLib_RingBuffer.sol => TestLib_Buffer.sol} | 36 +- .../libraries/utils/Lib_Buffer.spec.ts | 175 ++++++++ 7 files changed, 469 insertions(+), 409 deletions(-) create mode 100644 .changeset/fair-donuts-lick.md create mode 100644 packages/contracts/contracts/optimistic-ethereum/libraries/utils/Lib_Buffer.sol delete mode 100644 packages/contracts/contracts/optimistic-ethereum/libraries/utils/Lib_RingBuffer.sol rename packages/contracts/contracts/test-libraries/utils/{TestLib_RingBuffer.sol => TestLib_Buffer.sol} (61%) create mode 100644 packages/contracts/test/contracts/libraries/utils/Lib_Buffer.spec.ts diff --git a/.changeset/fair-donuts-lick.md b/.changeset/fair-donuts-lick.md new file mode 100644 index 000000000000..62a0373f1cd7 --- /dev/null +++ b/.changeset/fair-donuts-lick.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/contracts': patch +--- + +Replaces RingBuffer with a simpler Buffer library diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol index 15936e4d2c7d..dcb85f84d485 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol @@ -2,7 +2,7 @@ pragma solidity >0.5.0 <0.8.0; /* Library Imports */ -import { Lib_RingBuffer } from "../../libraries/utils/Lib_RingBuffer.sol"; +import { Lib_Buffer } from "../../libraries/utils/Lib_Buffer.sol"; import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; /* Interface Imports */ @@ -28,7 +28,7 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes * Libraries * *************/ - using Lib_RingBuffer for Lib_RingBuffer.RingBuffer; + using Lib_Buffer for Lib_Buffer.Buffer; /************* @@ -36,7 +36,7 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes *************/ string public owner; - Lib_RingBuffer.RingBuffer internal buffer; + Lib_Buffer.Buffer internal buffer; /*************** @@ -189,17 +189,4 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes _globalMetadata ); } - - /** - * @inheritdoc iOVM_ChainStorageContainer - */ - function setNextOverwritableIndex( - uint256 _index - ) - override - public - onlyOwner - { - buffer.nextOverwritableIndex = _index; - } } diff --git a/packages/contracts/contracts/optimistic-ethereum/iOVM/chain/iOVM_ChainStorageContainer.sol b/packages/contracts/contracts/optimistic-ethereum/iOVM/chain/iOVM_ChainStorageContainer.sol index 3c0670497cef..4fa8a6c7ecd7 100644 --- a/packages/contracts/contracts/optimistic-ethereum/iOVM/chain/iOVM_ChainStorageContainer.sol +++ b/packages/contracts/contracts/optimistic-ethereum/iOVM/chain/iOVM_ChainStorageContainer.sol @@ -99,13 +99,4 @@ interface iOVM_ChainStorageContainer { bytes27 _globalMetadata ) external; - - /** - * Marks an index as overwritable, meaing the underlying buffer can start to write values over - * any objects before and including the given index. - */ - function setNextOverwritableIndex( - uint256 _index - ) - external; } diff --git a/packages/contracts/contracts/optimistic-ethereum/libraries/utils/Lib_Buffer.sol b/packages/contracts/contracts/optimistic-ethereum/libraries/utils/Lib_Buffer.sol new file mode 100644 index 000000000000..51826710bda5 --- /dev/null +++ b/packages/contracts/contracts/optimistic-ethereum/libraries/utils/Lib_Buffer.sol @@ -0,0 +1,258 @@ +// SPDX-License-Identifier: MIT +pragma solidity >0.5.0 <0.8.0; + +/** + * @title Lib_Buffer + * @dev This library implements a bytes32 storage array with some additional gas-optimized + * functionality. In particular, it encodes its length as a uint40, and tightly packs this with an + * overwritable "extra data" field so we can store more information with a single SSTORE. + */ +library Lib_Buffer { + + /************* + * Libraries * + *************/ + + using Lib_Buffer for Buffer; + + + /*********** + * Structs * + ***********/ + + struct Buffer { + bytes32 context; + mapping (uint256 => bytes32) buf; + } + + struct BufferContext { + // Stores the length of the array. Uint40 is way more elements than we'll ever reasonably + // need in an array and we get an extra 27 bytes of extra data to play with. + uint40 length; + + // Arbitrary extra data that can be modified whenever the length is updated. Useful for + // squeezing out some gas optimizations. + bytes27 extraData; + } + + + /********************** + * Internal Functions * + **********************/ + + /** + * Pushes a single element to the buffer. + * @param _self Buffer to access. + * @param _value Value to push to the buffer. + * @param _extraData Global extra data. + */ + function push( + Buffer storage _self, + bytes32 _value, + bytes27 _extraData + ) + internal + { + BufferContext memory ctx = _self.getContext(); + + _self.buf[ctx.length] = _value; + + // Bump the global index and insert our extra data, then save the context. + ctx.length++; + ctx.extraData = _extraData; + _self.setContext(ctx); + } + + /** + * Pushes a single element to the buffer. + * @param _self Buffer to access. + * @param _value Value to push to the buffer. + */ + function push( + Buffer storage _self, + bytes32 _value + ) + internal + { + BufferContext memory ctx = _self.getContext(); + + _self.push( + _value, + ctx.extraData + ); + } + + /** + * Retrieves an element from the buffer. + * @param _self Buffer to access. + * @param _index Element index to retrieve. + * @return Value of the element at the given index. + */ + function get( + Buffer storage _self, + uint256 _index + ) + internal + view + returns ( + bytes32 + ) + { + BufferContext memory ctx = _self.getContext(); + + require( + _index < ctx.length, + "Index out of bounds." + ); + + return _self.buf[_index]; + } + + /** + * Deletes all elements after (and including) a given index. + * @param _self Buffer to access. + * @param _index Index of the element to delete from (inclusive). + * @param _extraData Optional global extra data. + */ + function deleteElementsAfterInclusive( + Buffer storage _self, + uint40 _index, + bytes27 _extraData + ) + internal + { + BufferContext memory ctx = _self.getContext(); + + require( + _index < ctx.length, + "Index out of bounds." + ); + + // Set our length and extra data, save the context. + ctx.length = _index; + ctx.extraData = _extraData; + _self.setContext(ctx); + } + + /** + * Deletes all elements after (and including) a given index. + * @param _self Buffer to access. + * @param _index Index of the element to delete from (inclusive). + */ + function deleteElementsAfterInclusive( + Buffer storage _self, + uint40 _index + ) + internal + { + BufferContext memory ctx = _self.getContext(); + _self.deleteElementsAfterInclusive( + _index, + ctx.extraData + ); + } + + /** + * Retrieves the current global index. + * @param _self Buffer to access. + * @return Current global index. + */ + function getLength( + Buffer storage _self + ) + internal + view + returns ( + uint40 + ) + { + BufferContext memory ctx = _self.getContext(); + return ctx.length; + } + + /** + * Changes current global extra data. + * @param _self Buffer to access. + * @param _extraData New global extra data. + */ + function setExtraData( + Buffer storage _self, + bytes27 _extraData + ) + internal + { + BufferContext memory ctx = _self.getContext(); + ctx.extraData = _extraData; + _self.setContext(ctx); + } + + /** + * Retrieves the current global extra data. + * @param _self Buffer to access. + * @return Current global extra data. + */ + function getExtraData( + Buffer storage _self + ) + internal + view + returns ( + bytes27 + ) + { + BufferContext memory ctx = _self.getContext(); + return ctx.extraData; + } + + /** + * Sets the current buffer context. + * @param _self Buffer to access. + * @param _ctx Current buffer context. + */ + function setContext( + Buffer storage _self, + BufferContext memory _ctx + ) + internal + { + bytes32 context; + uint40 length = _ctx.length; + bytes27 extraData = _ctx.extraData; + assembly { + context := length + context := or(context, extraData) + } + + if (_self.context != context) { + _self.context = context; + } + } + + /** + * Retrieves the current buffer context. + * @param _self Buffer to access. + * @return Current buffer context. + */ + function getContext( + Buffer storage _self + ) + internal + view + returns ( + BufferContext memory + ) + { + bytes32 context = _self.context; + uint40 length; + bytes27 extraData; + assembly { + length := and(context, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF) + extraData := and(context, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000) + } + + return BufferContext({ + length: length, + extraData: extraData + }); + } +} diff --git a/packages/contracts/contracts/optimistic-ethereum/libraries/utils/Lib_RingBuffer.sol b/packages/contracts/contracts/optimistic-ethereum/libraries/utils/Lib_RingBuffer.sol deleted file mode 100644 index 65da3fb17ed5..000000000000 --- a/packages/contracts/contracts/optimistic-ethereum/libraries/utils/Lib_RingBuffer.sol +++ /dev/null @@ -1,376 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >0.5.0 <0.8.0; - -library Lib_RingBuffer { - using Lib_RingBuffer for RingBuffer; - - /*********** - * Structs * - ***********/ - - struct Buffer { - uint256 length; - mapping (uint256 => bytes32) buf; - } - - struct RingBuffer { - bytes32 contextA; - bytes32 contextB; - Buffer bufferA; - Buffer bufferB; - uint256 nextOverwritableIndex; - } - - struct RingBufferContext { - // contextA - uint40 globalIndex; - bytes27 extraData; - - // contextB - uint64 currBufferIndex; - uint40 prevResetIndex; - uint40 currResetIndex; - } - - - /************* - * Constants * - *************/ - - uint256 constant MIN_CAPACITY = 16; - - - /********************** - * Internal Functions * - **********************/ - - /** - * Pushes a single element to the buffer. - * @param _self Buffer to access. - * @param _value Value to push to the buffer. - * @param _extraData Optional global extra data. - */ - function push( - RingBuffer storage _self, - bytes32 _value, - bytes27 _extraData - ) - internal - { - RingBufferContext memory ctx = _self.getContext(); - Buffer storage currBuffer = _self.getBuffer(ctx.currBufferIndex); - - // Set a minimum capacity. - if (currBuffer.length == 0) { - currBuffer.length = MIN_CAPACITY; - } - - // Check if we need to expand the buffer. - if (ctx.globalIndex - ctx.currResetIndex >= currBuffer.length) { - if (ctx.currResetIndex < _self.nextOverwritableIndex) { - // We're going to overwrite the inactive buffer. - // Bump the buffer index, reset the delete offset, and set our reset indices. - ctx.currBufferIndex++; - ctx.prevResetIndex = ctx.currResetIndex; - ctx.currResetIndex = ctx.globalIndex; - - // Swap over to the next buffer. - currBuffer = _self.getBuffer(ctx.currBufferIndex); - } else { - // We're not overwriting yet, double the length of the current buffer. - currBuffer.length *= 2; - } - } - - // Index to write to is the difference of the global and reset indices. - uint256 writeHead = ctx.globalIndex - ctx.currResetIndex; - currBuffer.buf[writeHead] = _value; - - // Bump the global index and insert our extra data, then save the context. - ctx.globalIndex++; - ctx.extraData = _extraData; - _self.setContext(ctx); - } - - /** - * Pushes a single element to the buffer. - * @param _self Buffer to access. - * @param _value Value to push to the buffer. - */ - function push( - RingBuffer storage _self, - bytes32 _value - ) - internal - { - RingBufferContext memory ctx = _self.getContext(); - - _self.push( - _value, - ctx.extraData - ); - } - - /** - * Retrieves an element from the buffer. - * @param _self Buffer to access. - * @param _index Element index to retrieve. - * @return Value of the element at the given index. - */ - function get( - RingBuffer storage _self, - uint256 _index - ) - internal - view - returns ( - bytes32 - ) - { - RingBufferContext memory ctx = _self.getContext(); - - require( - _index < ctx.globalIndex, - "Index out of bounds." - ); - - Buffer storage currBuffer = _self.getBuffer(ctx.currBufferIndex); - Buffer storage prevBuffer = _self.getBuffer(ctx.currBufferIndex + 1); - - if (_index >= ctx.currResetIndex) { - // We're trying to load an element from the current buffer. - // Relative index is just the difference from the reset index. - uint256 relativeIndex = _index - ctx.currResetIndex; - - // Shouldn't happen but why not check. - require( - relativeIndex < currBuffer.length, - "Index out of bounds." - ); - - return currBuffer.buf[relativeIndex]; - } else { - // We're trying to load an element from the previous buffer. - // Relative index is the difference from the reset index in the other direction. - uint256 relativeIndex = ctx.currResetIndex - _index; - - // Condition only fails in the case that we deleted and flipped buffers. - require( - ctx.currResetIndex > ctx.prevResetIndex, - "Index out of bounds." - ); - - // Make sure we're not trying to read beyond the array. - require( - relativeIndex <= prevBuffer.length, - "Index out of bounds." - ); - - return prevBuffer.buf[prevBuffer.length - relativeIndex]; - } - } - - /** - * Deletes all elements after (and including) a given index. - * @param _self Buffer to access. - * @param _index Index of the element to delete from (inclusive). - * @param _extraData Optional global extra data. - */ - function deleteElementsAfterInclusive( - RingBuffer storage _self, - uint40 _index, - bytes27 _extraData - ) - internal - { - RingBufferContext memory ctx = _self.getContext(); - - require( - _index < ctx.globalIndex && _index >= ctx.prevResetIndex, - "Index out of bounds." - ); - - if (_index < ctx.currResetIndex) { - // We're switching back to the previous buffer. - // Reduce the buffer index, set the current reset index back to match the previous one. - // We use the equality of these two values to prevent reading beyond this buffer. - ctx.currBufferIndex--; - ctx.currResetIndex = ctx.prevResetIndex; - } - - // Set our global index and extra data, save the context. - ctx.globalIndex = _index; - ctx.extraData = _extraData; - _self.setContext(ctx); - } - - /** - * Deletes all elements after (and including) a given index. - * @param _self Buffer to access. - * @param _index Index of the element to delete from (inclusive). - */ - function deleteElementsAfterInclusive( - RingBuffer storage _self, - uint40 _index - ) - internal - { - RingBufferContext memory ctx = _self.getContext(); - _self.deleteElementsAfterInclusive( - _index, - ctx.extraData - ); - } - - /** - * Retrieves the current global index. - * @param _self Buffer to access. - * @return Current global index. - */ - function getLength( - RingBuffer storage _self - ) - internal - view - returns ( - uint40 - ) - { - RingBufferContext memory ctx = _self.getContext(); - return ctx.globalIndex; - } - - /** - * Changes current global extra data. - * @param _self Buffer to access. - * @param _extraData New global extra data. - */ - function setExtraData( - RingBuffer storage _self, - bytes27 _extraData - ) - internal - { - RingBufferContext memory ctx = _self.getContext(); - ctx.extraData = _extraData; - _self.setContext(ctx); - } - - /** - * Retrieves the current global extra data. - * @param _self Buffer to access. - * @return Current global extra data. - */ - function getExtraData( - RingBuffer storage _self - ) - internal - view - returns ( - bytes27 - ) - { - RingBufferContext memory ctx = _self.getContext(); - return ctx.extraData; - } - - /** - * Sets the current ring buffer context. - * @param _self Buffer to access. - * @param _ctx Current ring buffer context. - */ - function setContext( - RingBuffer storage _self, - RingBufferContext memory _ctx - ) - internal - { - bytes32 contextA; - bytes32 contextB; - - uint40 globalIndex = _ctx.globalIndex; - bytes27 extraData = _ctx.extraData; - assembly { - contextA := globalIndex - contextA := or(contextA, extraData) - } - - uint64 currBufferIndex = _ctx.currBufferIndex; - uint40 prevResetIndex = _ctx.prevResetIndex; - uint40 currResetIndex = _ctx.currResetIndex; - assembly { - contextB := currBufferIndex - contextB := or(contextB, shl(64, prevResetIndex)) - contextB := or(contextB, shl(104, currResetIndex)) - } - - if (_self.contextA != contextA) { - _self.contextA = contextA; - } - - if (_self.contextB != contextB) { - _self.contextB = contextB; - } - } - - /** - * Retrieves the current ring buffer context. - * @param _self Buffer to access. - * @return Current ring buffer context. - */ - function getContext( - RingBuffer storage _self - ) - internal - view - returns ( - RingBufferContext memory - ) - { - bytes32 contextA = _self.contextA; - bytes32 contextB = _self.contextB; - - uint40 globalIndex; - bytes27 extraData; - assembly { - globalIndex := and(contextA, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF) - extraData := and(contextA, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000) - } - - uint64 currBufferIndex; - uint40 prevResetIndex; - uint40 currResetIndex; - assembly { - currBufferIndex := and(contextB, 0x000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFF) - prevResetIndex := shr(64, and(contextB, 0x00000000000000000000000000000000000000FFFFFFFFFF0000000000000000)) - currResetIndex := shr(104, and(contextB, 0x0000000000000000000000000000FFFFFFFFFF00000000000000000000000000)) - } - - return RingBufferContext({ - globalIndex: globalIndex, - extraData: extraData, - currBufferIndex: currBufferIndex, - prevResetIndex: prevResetIndex, - currResetIndex: currResetIndex - }); - } - - /** - * Retrieves the a buffer from the ring buffer by index. - * @param _self Buffer to access. - * @param _which Index of the sub buffer to access. - * @return Sub buffer for the index. - */ - function getBuffer( - RingBuffer storage _self, - uint256 _which - ) - internal - view - returns ( - Buffer storage - ) - { - return _which % 2 == 0 ? _self.bufferA : _self.bufferB; - } -} diff --git a/packages/contracts/contracts/test-libraries/utils/TestLib_RingBuffer.sol b/packages/contracts/contracts/test-libraries/utils/TestLib_Buffer.sol similarity index 61% rename from packages/contracts/contracts/test-libraries/utils/TestLib_RingBuffer.sol rename to packages/contracts/contracts/test-libraries/utils/TestLib_Buffer.sol index bf45bb30bfaf..fbca9ae4c1f4 100644 --- a/packages/contracts/contracts/test-libraries/utils/TestLib_RingBuffer.sol +++ b/packages/contracts/contracts/test-libraries/utils/TestLib_Buffer.sol @@ -3,15 +3,15 @@ pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Library Imports */ -import { Lib_RingBuffer } from "../../optimistic-ethereum/libraries/utils/Lib_RingBuffer.sol"; +import { Lib_Buffer } from "../../optimistic-ethereum/libraries/utils/Lib_Buffer.sol"; /** - * @title TestLib_RingBuffer + * @title TestLib_Buffer */ -contract TestLib_RingBuffer { - using Lib_RingBuffer for Lib_RingBuffer.RingBuffer; +contract TestLib_Buffer { + using Lib_Buffer for Lib_Buffer.Buffer; - Lib_RingBuffer.RingBuffer internal buf; + Lib_Buffer.Buffer internal buf; function push( bytes32 _value, @@ -37,11 +37,21 @@ contract TestLib_RingBuffer { return buf.get(_index); } + function deleteElementsAfterInclusive( + uint40 _index + ) + public + { + return buf.deleteElementsAfterInclusive( + _index + ); + } + function deleteElementsAfterInclusive( uint40 _index, bytes27 _extraData ) - internal + public { return buf.deleteElementsAfterInclusive( _index, @@ -50,7 +60,7 @@ contract TestLib_RingBuffer { } function getLength() - internal + public view returns ( uint40 @@ -59,8 +69,18 @@ contract TestLib_RingBuffer { return buf.getLength(); } + function setExtraData( + bytes27 _extraData + ) + public + { + return buf.setExtraData( + _extraData + ); + } + function getExtraData() - internal + public view returns ( bytes27 diff --git a/packages/contracts/test/contracts/libraries/utils/Lib_Buffer.spec.ts b/packages/contracts/test/contracts/libraries/utils/Lib_Buffer.spec.ts new file mode 100644 index 000000000000..51934e34772f --- /dev/null +++ b/packages/contracts/test/contracts/libraries/utils/Lib_Buffer.spec.ts @@ -0,0 +1,175 @@ +import { expect } from '../../../setup' + +import hre from 'hardhat' +import { Contract, ethers } from 'ethers' + +describe('Lib_Buffer', () => { + let Lib_Buffer: Contract + beforeEach(async () => { + const Factory__Lib_Buffer = await hre.ethers.getContractFactory( + 'TestLib_Buffer' + ) + Lib_Buffer = await Factory__Lib_Buffer.deploy() + }) + + describe('push', () => { + for (const len of [1, 2, 4, 8, 32]) { + it(`it should be able to add ${len} element(s) to the array`, async () => { + for (let i = 0; i < len; i++) { + await expect( + Lib_Buffer.push( + ethers.utils.keccak256(`0x${i.toString(16).padStart(16, '0')}`), + `0x${'00'.repeat(27)}` + ) + ).to.not.be.reverted + } + }) + } + }) + + describe('get', () => { + for (const len of [1, 2, 4, 8, 32]) { + describe(`when the array has ${len} element(s)`, () => { + const values = [] + beforeEach(async () => { + for (let i = 0; i < len; i++) { + const value = ethers.utils.keccak256( + `0x${i.toString(16).padStart(16, '0')}` + ) + values.push(value) + await Lib_Buffer.push(value, `0x${'00'.repeat(27)}`) + } + }) + + for (let i = 0; i < len; i += Math.max(1, len / 4)) { + it(`should be able to get the ${i}th/st/rd/whatever value`, async () => { + expect(await Lib_Buffer.get(i)).to.equal(values[i]) + }) + } + + it('should throw if attempting to access an element that does not exist', async () => { + await expect(Lib_Buffer.get(len + 1)).to.be.reverted + }) + }) + } + }) + + describe('getLength', () => { + it('should return zero by default', async () => { + expect(await Lib_Buffer.getLength()).to.equal(0) + }) + + for (const len of [1, 2, 4, 8, 32]) { + describe(`when the array has ${len} element(s)`, () => { + const values = [] + beforeEach(async () => { + for (let i = 0; i < len; i++) { + const value = ethers.utils.keccak256( + `0x${i.toString(16).padStart(16, '0')}` + ) + values.push(value) + await Lib_Buffer.push(value, `0x${'00'.repeat(27)}`) + } + }) + + it(`should return a value of ${len}`, async () => { + expect(await Lib_Buffer.getLength()).to.equal(len) + }) + }) + } + }) + + describe('getExtraData', () => { + it('should be bytes27(0) by default', async () => { + expect(await Lib_Buffer.getExtraData()).to.equal(`0x${'00'.repeat(27)}`) + }) + + it('should change if set by a call to push()', async () => { + const extraData = `0x${'11'.repeat(27)}` + await Lib_Buffer.push(ethers.utils.keccak256('0x00'), extraData) + + expect(await Lib_Buffer.getExtraData()).to.equal(extraData) + }) + + it('should change if set multiple times', async () => { + await Lib_Buffer.push( + ethers.utils.keccak256('0x00'), + `0x${'11'.repeat(27)}` + ) + + const extraData = `0x${'22'.repeat(27)}` + + await Lib_Buffer.push(ethers.utils.keccak256('0x00'), extraData) + + expect(await Lib_Buffer.getExtraData()).to.equal(extraData) + }) + }) + + describe('setExtraData', () => { + it('should modify the extra data', async () => { + const extraData = `0x${'11'.repeat(27)}` + await Lib_Buffer.setExtraData(extraData) + + expect(await Lib_Buffer.getExtraData()).to.equal(extraData) + }) + + it('should be able to modify the extra data multiple times', async () => { + const extraData1 = `0x${'22'.repeat(27)}` + await Lib_Buffer.setExtraData(extraData1) + expect(await Lib_Buffer.getExtraData()).to.equal(extraData1) + + const extraData2 = `0x${'11'.repeat(27)}` + await Lib_Buffer.setExtraData(extraData2) + + expect(await Lib_Buffer.getExtraData()).to.equal(extraData2) + }) + }) + + describe('deleteElementsAfterInclusive', () => { + it('should revert when the array is empty', async () => { + await expect(Lib_Buffer['deleteElementsAfterInclusive(uint40)'](0)).to.be + .reverted + }) + + for (const len of [1, 2, 4, 8, 32]) { + describe(`when the array has ${len} element(s)`, () => { + const values = [] + beforeEach(async () => { + for (let i = 0; i < len; i++) { + const value = ethers.utils.keccak256( + `0x${i.toString(16).padStart(16, '0')}` + ) + values.push(value) + await Lib_Buffer.push(value, `0x${'00'.repeat(27)}`) + } + }) + + for (let i = len - 1; i > 0; i -= Math.max(1, len / 4)) { + it(`should be able to delete everything after and including the ${i}th/st/rd/whatever element`, async () => { + await expect(Lib_Buffer['deleteElementsAfterInclusive(uint40)'](i)) + .to.not.be.reverted + + expect(await Lib_Buffer.getLength()).to.equal(i) + await expect(Lib_Buffer.get(i)).to.be.reverted + }) + } + + for (let i = len - 1; i > 0; i -= Math.max(1, len / 4)) { + it(`should be able to delete after and incl. ${i}th/st/rd/whatever element while changing extra data`, async () => { + const extraData = `0x${i.toString(16).padStart(54, '0')}` + await expect( + Lib_Buffer['deleteElementsAfterInclusive(uint40,bytes27)']( + i, + extraData + ) + ).to.not.be.reverted + + expect(await Lib_Buffer.getLength()).to.equal(i) + await expect(Lib_Buffer.get(i)).to.be.reverted + expect(await Lib_Buffer.getExtraData()).to.equal(extraData) + }) + } + }) + } + }) +}) From 95ccef51c4578b3d27ed74423ca1e86df63d3114 Mon Sep 17 00:00:00 2001 From: Maurelian Date: Fri, 28 May 2021 18:49:09 -0400 Subject: [PATCH 017/125] fix(contracts): import predeploys (#982) * fix(contracts): import predeploys * fix: lint --- packages/contracts/src/contract-deployment/config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/contracts/src/contract-deployment/config.ts b/packages/contracts/src/contract-deployment/config.ts index 5801427ef5b0..99c9f8b722d4 100644 --- a/packages/contracts/src/contract-deployment/config.ts +++ b/packages/contracts/src/contract-deployment/config.ts @@ -5,6 +5,7 @@ import { Overrides } from '@ethersproject/contracts' /* Internal Imports */ import { getContractFactory } from '../contract-defs' +import { predeploys } from '../predeploys' export interface RollupDeployConfig { deploymentSigner: Signer From 4e03f8a97b3c2f17a2e758323706f2a880a834d9 Mon Sep 17 00:00:00 2001 From: Karl Floersch Date: Fri, 28 May 2021 20:05:36 -0400 Subject: [PATCH 018/125] feat: add hardhat deploy instructions to readme (#965) * feat: add deployment instructions to readme * Add changeset * fix style * Update README.md --- .changeset/late-countries-guess.md | 5 ++ packages/contracts/README.md | 76 ++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 .changeset/late-countries-guess.md diff --git a/.changeset/late-countries-guess.md b/.changeset/late-countries-guess.md new file mode 100644 index 000000000000..2edddd99dad3 --- /dev/null +++ b/.changeset/late-countries-guess.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/contracts': patch +--- + +Update contracts README to add deploy instructions. diff --git a/packages/contracts/README.md b/packages/contracts/README.md index 9c2280db7813..9c7ed7b7b1cc 100644 --- a/packages/contracts/README.md +++ b/packages/contracts/README.md @@ -84,5 +84,81 @@ You can also build specific components as follows: yarn build:contracts ``` +### Deploying the Contracts +To deploy the contracts first clone, install, and build the contracts package. + +Next set the following env vars: + +```bash +CONTRACTS_TARGET_NETWORK=... +CONTRACTS_DEPLOYER_KEY=... +CONTRACTS_RPC_URL=... +``` + +Then to perform the actual deployment run: + +```bash +npx hardhat deploy \ + --network ... \ # `network` MUST equal your env var `CONTRACTS_TARGET_NETWORK` + --ovm-address-manager-owner ... \ + --ovm-proposer-address ... \ + --ovm-relayer-address ... \ + --ovm-sequencer-address ... \ + --scc-fraud-proof-window ... \ + --scc-sequencer-publish-window ... +``` + +This will deploy the contracts to the network specified in your env and create +an artifacts directory in `./deployments`. + +To view all deployment options run: + +```bash +npx hardhat deploy --help + +Hardhat version 2.2.1 + +Usage: hardhat [GLOBAL OPTIONS] deploy [--ctc-force-inclusion-period-seconds ] [--ctc-max-transaction-gas-limit ] --deploy-scripts [--em-max-gas-per-queue-per-epoch ] [--em-max-transaction-gas-limit ] [--em-min-transaction-gas-limit ] [--em-ovm-chain-id ] [--em-seconds-per-epoch ] --export --export-all --gasprice [--l1-block-time-seconds ] [--no-compile] [--no-impersonation] --ovm-address-manager-owner --ovm-proposer-address --ovm-relayer-address --ovm-sequencer-address [--reset] [--scc-fraud-proof-window ] [--scc-sequencer-publish-window ] [--silent] --tags [--watch] --write + +OPTIONS: + + --ctc-force-inclusion-period-seconds Number of seconds that the sequencer has to include transactions before the L1 queue. (default: 2592000) + --ctc-max-transaction-gas-limit Max gas limit for L1 queue transactions. (default: 9000000) + --deploy-scripts override deploy script folder path + --em-max-gas-per-queue-per-epoch Maximum gas allowed in a given queue for each epoch. (default: 250000000) + --em-max-transaction-gas-limit Maximum allowed transaction gas limit. (default: 9000000) + --em-min-transaction-gas-limit Minimum allowed transaction gas limit. (default: 50000) + --em-ovm-chain-id Chain ID for the L2 network. (default: 420) + --em-seconds-per-epoch Number of seconds in each epoch. (default: 0) + --export export current network deployments + --export-all export all deployments into one file + --gasprice gas price to use for transactions + --l1-block-time-seconds Number of seconds on average between every L1 block. (default: 15) + --no-compile disable pre compilation + --no-impersonation do not impersonate unknown accounts + --ovm-address-manager-owner Address that will own the Lib_AddressManager. Must be provided or this deployment will fail. + --ovm-proposer-address Address of the account that will propose state roots. Must be provided or this deployment will fail. + --ovm-relayer-address Address of the message relayer. Must be provided or this deployment will fail. + --ovm-sequencer-address Address of the sequencer. Must be provided or this deployment will fail. + --reset whether to delete deployments files first + --scc-fraud-proof-window Number of seconds until a transaction is considered finalized. (default: 604800) + --scc-sequencer-publish-window Number of seconds that the sequencer is exclusively allowed to post state roots. (default: 1800) + --silent whether to remove log + --tags specify which deploy script to execute via tags, separated by commas + --watch redeploy on every change of contract or deploy script + --write whether to write deployments to file + +deploy: Deploy contracts + +For global options help run: hardhat help +``` + +### Verifying Deployments on Etherscan +If you are using a network which Etherscan supports you can verify your contracts with: + +```bash +npx hardhat etherscan-verify --api-key ... --network ... +``` + ## Security Please refer to our [Security Policy](https://github.com/ethereum-optimism/.github/security/policy) for information about how to disclose security issues with this code. From a64f8161514faee540a9ed90f0c460ff5597cb95 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Fri, 28 May 2021 19:43:41 -0700 Subject: [PATCH 019/125] feat: fees v2 (#976) * l2 geth: new fee logic * l2 geth: migrate to fees package * core-utils: new fee scheme * chore: add changeset * l2geth: delete dead code * integration-tests: fix typo * integration-tests: fixes * fees: use fee scalar * lint: fix * rollup: correct gas payment comparison * fix(integration-tests): do not hardcode gas price * core-utils: update with new scheme * l2geth: refactor rollup oracle * l2geth: clean up DoEstimateGas * l2geth: implement latest scheme * tests: fix up * lint: fix * l2geth: better sycn service test * optimism: rename to TxGasLimit * fee: fix docstring * tests: fix * variables: rename * l2geth: prevent users from sending txs with too high of a fee * integration-tests: fix import * integration-tests: fix type * integration-tests: fix gas limits * lint: fix * l2geth: log error Co-authored-by: Georgios Konstantopoulos --- .changeset/fuzzy-dogs-share.md | 6 + integration-tests/test/erc20.spec.ts | 6 +- integration-tests/test/fee-payment.spec.ts | 7 +- integration-tests/test/native-eth.spec.ts | 4 +- integration-tests/test/rpc.spec.ts | 48 +++++--- l2geth/core/rollup_fee.go | 126 ------------------- l2geth/core/rollup_fee_test.go | 121 ------------------- l2geth/eth/gasprice/rollup_gasprice.go | 53 ++++---- l2geth/internal/ethapi/api.go | 24 ++-- l2geth/rollup/client.go | 2 +- l2geth/rollup/fees/rollup_fee.go | 94 +++++++++++++++ l2geth/rollup/fees/rollup_fee_test.go | 103 ++++++++++++++++ l2geth/rollup/sync_service.go | 50 ++++---- l2geth/rollup/sync_service_test.go | 7 +- packages/core-utils/README.md | 39 +++--- packages/core-utils/src/fees.ts | 79 ++---------- packages/core-utils/test/fees/fees.spec.ts | 133 ++++++++++----------- 17 files changed, 402 insertions(+), 500 deletions(-) create mode 100644 .changeset/fuzzy-dogs-share.md delete mode 100644 l2geth/core/rollup_fee.go delete mode 100644 l2geth/core/rollup_fee_test.go create mode 100644 l2geth/rollup/fees/rollup_fee.go create mode 100644 l2geth/rollup/fees/rollup_fee_test.go diff --git a/.changeset/fuzzy-dogs-share.md b/.changeset/fuzzy-dogs-share.md new file mode 100644 index 000000000000..3b890e4e9e8d --- /dev/null +++ b/.changeset/fuzzy-dogs-share.md @@ -0,0 +1,6 @@ +--- +'@eth-optimism/l2geth': patch +'@eth-optimism/core-utils': patch +--- + +Implement the next fee spec in both geth and in core-utils diff --git a/integration-tests/test/erc20.spec.ts b/integration-tests/test/erc20.spec.ts index 925ec01e6f21..1c03476592a2 100644 --- a/integration-tests/test/erc20.spec.ts +++ b/integration-tests/test/erc20.spec.ts @@ -1,5 +1,6 @@ import { Contract, ContractFactory, Wallet } from 'ethers' import { ethers } from 'hardhat' +import { TxGasLimit, TxGasPrice } from '@eth-optimism/core-utils' import chai, { expect } from 'chai' import { GWEI } from './shared/utils' import { OptimismEnv } from './shared/env' @@ -64,7 +65,10 @@ describe('Basic ERC20 interactions', async () => { const receipt = await transfer.wait() // The expected fee paid is the value returned by eth_estimateGas - const expectedFeePaid = await ERC20.estimateGas.transfer(other.address, 100) + const gasLimit = await ERC20.estimateGas.transfer(other.address, 100) + const gasPrice = await wallet.getGasPrice() + expect(gasPrice).to.deep.equal(TxGasPrice) + const expectedFeePaid = gasLimit.mul(gasPrice) // There are two events from the transfer with the first being // the ETH fee paid and the second of the value transfered (100) diff --git a/integration-tests/test/fee-payment.spec.ts b/integration-tests/test/fee-payment.spec.ts index d57718539819..3583df4493c8 100644 --- a/integration-tests/test/fee-payment.spec.ts +++ b/integration-tests/test/fee-payment.spec.ts @@ -3,7 +3,7 @@ import chaiAsPromised from 'chai-as-promised' chai.use(chaiAsPromised) import { BigNumber, utils } from 'ethers' import { OptimismEnv } from './shared/env' -import { L2GasLimit } from '@eth-optimism/core-utils' +import { TxGasLimit } from '@eth-optimism/core-utils' describe('Fee Payment Integration Tests', async () => { let env: OptimismEnv @@ -29,7 +29,7 @@ describe('Fee Payment Integration Tests', async () => { ) const executionGas = await (env.ovmEth .provider as any).send('eth_estimateExecutionGas', [tx]) - const decoded = L2GasLimit.decode(gas) + const decoded = TxGasLimit.decode(gas) expect(BigNumber.from(executionGas)).deep.eq(decoded) }) @@ -38,8 +38,7 @@ describe('Fee Payment Integration Tests', async () => { const balanceBefore = await env.l2Wallet.getBalance() expect(balanceBefore.gt(amount)) - const gas = await env.ovmEth.estimateGas.transfer(other, amount) - const tx = await env.ovmEth.transfer(other, amount, { gasPrice: 1 }) + const tx = await env.ovmEth.transfer(other, amount) const receipt = await tx.wait() expect(receipt.status).to.eq(1) diff --git a/integration-tests/test/native-eth.spec.ts b/integration-tests/test/native-eth.spec.ts index 017199d28cf6..fc11c82c8be6 100644 --- a/integration-tests/test/native-eth.spec.ts +++ b/integration-tests/test/native-eth.spec.ts @@ -45,13 +45,13 @@ describe('Native ETH Integration Tests', async () => { const amount = utils.parseEther('0.5') const addr = '0x' + '1234'.repeat(10) const gas = await env.ovmEth.estimateGas.transfer(addr, amount) - expect(gas).to.be.deep.eq(BigNumber.from(0x23284d28fe6d)) + expect(gas).to.be.deep.eq(BigNumber.from(0x0ef897216d)) }) it('Should estimate gas for ETH withdraw', async () => { const amount = utils.parseEther('0.5') const gas = await env.ovmEth.estimateGas.withdraw(amount) - expect(gas).to.be.deep.eq(BigNumber.from(0x207ad91a77b4)) + expect(gas).to.be.deep.eq(BigNumber.from(61400489396)) }) }) diff --git a/integration-tests/test/rpc.spec.ts b/integration-tests/test/rpc.spec.ts index a65dcab5dfdf..4c88cc4952a7 100644 --- a/integration-tests/test/rpc.spec.ts +++ b/integration-tests/test/rpc.spec.ts @@ -1,12 +1,13 @@ import { injectL2Context, - L2GasLimit, - roundL1GasPrice, + TxGasLimit, + TxGasPrice, + toRpcHexString, } from '@eth-optimism/core-utils' import { Wallet, BigNumber, Contract } from 'ethers' import { ethers } from 'hardhat' import chai, { expect } from 'chai' -import { sleep, l2Provider, GWEI } from './shared/utils' +import { sleep, l2Provider, l1Provider } from './shared/utils' import chaiAsPromised from 'chai-as-promised' import { OptimismEnv } from './shared/env' import { @@ -130,11 +131,25 @@ describe('Basic RPC tests', () => { const tx = { ...DEFAULT_TRANSACTION, gasLimit: 1, - gasPrice: 1, + gasPrice: TxGasPrice, } + const fee = tx.gasPrice.mul(tx.gasLimit) + const gasLimit = 59300000001 await expect(env.l2Wallet.sendTransaction(tx)).to.be.rejectedWith( - 'fee too low: 1, use at least tx.gasLimit = 33600000000001 and tx.gasPrice = 1' + `fee too low: ${fee}, use at least tx.gasLimit = ${gasLimit} and tx.gasPrice = ${TxGasPrice.toString()}` + ) + }) + + it('should reject a transaction with an incorrect gas price', async () => { + const tx = { + ...DEFAULT_TRANSACTION, + gasLimit: 1, + gasPrice: TxGasPrice.sub(1), + } + + await expect(env.l2Wallet.sendTransaction(tx)).to.be.rejectedWith( + `tx.gasPrice must be ${TxGasPrice.toString()}` ) }) @@ -198,7 +213,7 @@ describe('Basic RPC tests', () => { it('correctly exposes revert data for contract calls', async () => { const req: TransactionRequest = { ...revertingTx, - gasLimit: 934111908999999, // override gas estimation + gasLimit: 59808999999, // override gas estimation } const tx = await wallet.sendTransaction(req) @@ -221,7 +236,7 @@ describe('Basic RPC tests', () => { it('correctly exposes revert data for contract creations', async () => { const req: TransactionRequest = { ...revertingDeployTx, - gasLimit: 1051391908999999, // override gas estimation + gasLimit: 177008999999, // override gas estimation } const tx = await wallet.sendTransaction(req) @@ -311,12 +326,14 @@ describe('Basic RPC tests', () => { }) describe('eth_gasPrice', () => { - it('gas price should be 1 gwei', async () => { - expect(await provider.getGasPrice()).to.be.deep.equal(1) + it('gas price should be the fee scalar', async () => { + expect(await provider.getGasPrice()).to.be.deep.equal( + TxGasPrice.toNumber() + ) }) }) - describe('eth_estimateGas (returns the fee)', () => { + describe('eth_estimateGas (returns the scaled fee)', () => { it('gas estimation is deterministic', async () => { let lastEstimate: BigNumber for (let i = 0; i < 10; i++) { @@ -338,7 +355,7 @@ describe('Basic RPC tests', () => { to: DEFAULT_TRANSACTION.to, value: 0, }) - expect(estimate).to.be.eq(33600000119751) + expect(estimate).to.be.eq(0x0dce9004c7) }) it('should return a gas estimate that grows with the size of data', async () => { @@ -349,7 +366,6 @@ describe('Basic RPC tests', () => { for (const data of dataLen) { const tx = { to: '0x' + '1234'.repeat(10), - gasPrice: '0x1', value: '0x0', data: '0x' + '00'.repeat(data), from: '0x' + '1234'.repeat(10), @@ -359,16 +375,16 @@ describe('Basic RPC tests', () => { tx, ]) - const decoded = L2GasLimit.decode(estimate) + const decoded = TxGasLimit.decode(estimate) expect(decoded).to.deep.eq(BigNumber.from(l2Gaslimit)) expect(estimate.toString().endsWith(l2Gaslimit.toString())) + const l2GasPrice = BigNumber.from(0) // The L2GasPrice should be fetched from the L2GasPrice oracle contract, // but it does not yet exist. Use the default value for now - const l2GasPrice = BigNumber.from(1) - const expected = L2GasLimit.encode({ + const expected = TxGasLimit.encode({ data: tx.data, - l1GasPrice: roundL1GasPrice(l1GasPrice), + l1GasPrice, l2GasLimit: BigNumber.from(l2Gaslimit), l2GasPrice, }) diff --git a/l2geth/core/rollup_fee.go b/l2geth/core/rollup_fee.go deleted file mode 100644 index 17662547df22..000000000000 --- a/l2geth/core/rollup_fee.go +++ /dev/null @@ -1,126 +0,0 @@ -package core - -import ( - "errors" - "fmt" - "math/big" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/params" -) - -// overhead represents the fixed cost of batch submission of a single -// transaction in gas -const overhead uint64 = 4200 - -// hundredMillion is a constant used in the gas encoding formula -const hundredMillion uint64 = 100_000_000 - -var bigHundredMillion = new(big.Int).SetUint64(hundredMillion) - -// errInvalidGasPrice is the error returned when a user submits an incorrect gas -// price. The gas price must satisfy a particular equation depending on if it -// is a L1 gas price or a L2 gas price -var errInvalidGasPrice = errors.New("rollup fee: invalid gas price") - -// CalculateFee calculates the fee that must be paid to the Rollup sequencer, taking into -// account the cost of publishing data to L1. -// l2_gas_price * l2_gas_limit + l1_gas_price * l1_gas_used -// where the l2 gas price must satisfy the equation `x % (10**8) = 1` -// and the l1 gas price must satisfy the equation `x % (10**8) = 0` -func CalculateRollupFee(data []byte, l1GasPrice, l2GasLimit, l2GasPrice *big.Int) (*big.Int, error) { - if err := VerifyL1GasPrice(l1GasPrice); err != nil { - return nil, fmt.Errorf("invalid L1 gas price %d: %w", l1GasPrice, err) - } - if err := VerifyL2GasPrice(l2GasPrice); err != nil { - return nil, fmt.Errorf("invalid L2 gas price %d: %w", l2GasPrice, err) - } - l1GasLimit := calculateL1GasLimit(data, overhead) - l1Fee := new(big.Int).Mul(l1GasPrice, l1GasLimit) - l2Fee := new(big.Int).Mul(l2GasLimit, l2GasPrice) - fee := new(big.Int).Add(l1Fee, l2Fee) - return fee, nil -} - -// calculateL1GasLimit computes the L1 gasLimit based on the calldata and -// constant sized overhead. The overhead can be decreased as the cost of the -// batch submission goes down via contract optimizations. This will not overflow -// under standard network conditions. -func calculateL1GasLimit(data []byte, overhead uint64) *big.Int { - zeroes, ones := zeroesAndOnes(data) - zeroesCost := zeroes * params.TxDataZeroGas - onesCost := ones * params.TxDataNonZeroGasEIP2028 - gasLimit := zeroesCost + onesCost + overhead - return new(big.Int).SetUint64(gasLimit) -} - -// ceilModOneHundredMillion rounds the input integer up to the nearest modulus -// of one hundred million -func ceilModOneHundredMillion(num *big.Int) *big.Int { - if new(big.Int).Mod(num, bigHundredMillion).Cmp(common.Big0) == 0 { - return num - } - sum := new(big.Int).Add(num, bigHundredMillion) - mod := new(big.Int).Mod(num, bigHundredMillion) - return new(big.Int).Sub(sum, mod) -} - -// VerifyL1GasPrice returns an error if the number is an invalid possible L1 gas -// price -func VerifyL1GasPrice(l1GasPrice *big.Int) error { - if new(big.Int).Mod(l1GasPrice, bigHundredMillion).Cmp(common.Big0) != 0 { - return errInvalidGasPrice - } - return nil -} - -// VerifyL2GasPrice returns an error if the number is an invalid possible L2 gas -// price -func VerifyL2GasPrice(l2GasPrice *big.Int) error { - isNonZero := l2GasPrice.Cmp(common.Big0) != 0 - isNotModHundredMillion := new(big.Int).Mod(l2GasPrice, bigHundredMillion).Cmp(common.Big1) != 0 - if isNonZero && isNotModHundredMillion { - return errInvalidGasPrice - } - if l2GasPrice.Cmp(common.Big0) == 0 { - return errInvalidGasPrice - } - return nil -} - -// RoundL1GasPrice returns a ceilModOneHundredMillion where 0 -// is the identity function -func RoundL1GasPrice(gasPrice *big.Int) *big.Int { - return ceilModOneHundredMillion(gasPrice) -} - -// RoundL2GasPriceBig implements the algorithm: -// if gasPrice is 0; return 1 -// if gasPrice is 1; return 10**8 + 1 -// return ceilModOneHundredMillion(gasPrice-1)+1 -func RoundL2GasPrice(gasPrice *big.Int) *big.Int { - if gasPrice.Cmp(common.Big0) == 0 { - return big.NewInt(1) - } - if gasPrice.Cmp(common.Big1) == 0 { - return new(big.Int).Add(bigHundredMillion, common.Big1) - } - gp := new(big.Int).Sub(gasPrice, common.Big1) - mod := ceilModOneHundredMillion(gp) - return new(big.Int).Add(mod, common.Big1) -} - -func DecodeL2GasLimit(gasLimit *big.Int) *big.Int { - return new(big.Int).Mod(gasLimit, bigHundredMillion) -} - -func zeroesAndOnes(data []byte) (uint64, uint64) { - var zeroes uint64 - for _, byt := range data { - if byt == 0 { - zeroes++ - } - } - ones := uint64(len(data)) - zeroes - return zeroes, ones -} diff --git a/l2geth/core/rollup_fee_test.go b/l2geth/core/rollup_fee_test.go deleted file mode 100644 index dfe68107ad3f..000000000000 --- a/l2geth/core/rollup_fee_test.go +++ /dev/null @@ -1,121 +0,0 @@ -package core - -import ( - "errors" - "math" - "math/big" - "testing" -) - -var roundingL1GasPriceTests = map[string]struct { - input uint64 - expect uint64 -}{ - "simple": {10, pow10(8)}, - "one-over": {pow10(8) + 1, 2 * pow10(8)}, - "exact": {pow10(8), pow10(8)}, - "one-under": {pow10(8) - 1, pow10(8)}, - "small": {3, pow10(8)}, - "two": {2, pow10(8)}, - "one": {1, pow10(8)}, - "zero": {0, 0}, -} - -func TestRoundL1GasPrice(t *testing.T) { - for name, tt := range roundingL1GasPriceTests { - t.Run(name, func(t *testing.T) { - got := RoundL1GasPrice(new(big.Int).SetUint64(tt.input)) - if got.Uint64() != tt.expect { - t.Fatalf("Mismatched rounding to nearest, got %d expected %d", got, tt.expect) - } - }) - } -} - -var roundingL2GasPriceTests = map[string]struct { - input uint64 - expect uint64 -}{ - "simple": {10, pow10(8) + 1}, - "one-over": {pow10(8) + 2, 2*pow10(8) + 1}, - "exact": {pow10(8) + 1, pow10(8) + 1}, - "one-under": {pow10(8), pow10(8) + 1}, - "small": {3, pow10(8) + 1}, - "two": {2, pow10(8) + 1}, - "one": {1, pow10(8) + 1}, - "zero": {0, 1}, -} - -func TestRoundL2GasPrice(t *testing.T) { - for name, tt := range roundingL2GasPriceTests { - t.Run(name, func(t *testing.T) { - got := RoundL2GasPrice(new(big.Int).SetUint64(tt.input)) - if got.Uint64() != tt.expect { - t.Fatalf("Mismatched rounding to nearest, got %d expected %d", got, tt.expect) - } - }) - } -} - -var l1GasLimitTests = map[string]struct { - data []byte - overhead uint64 - expect *big.Int -}{ - "simple": {[]byte{}, 0, big.NewInt(0)}, - "simple-overhead": {[]byte{}, 10, big.NewInt(10)}, - "zeros": {[]byte{0x00, 0x00, 0x00, 0x00}, 10, big.NewInt(26)}, - "ones": {[]byte{0x01, 0x02, 0x03, 0x04}, 200, big.NewInt(16*4 + 200)}, -} - -func TestL1GasLimit(t *testing.T) { - for name, tt := range l1GasLimitTests { - t.Run(name, func(t *testing.T) { - got := calculateL1GasLimit(tt.data, tt.overhead) - if got.Cmp(tt.expect) != 0 { - t.Fatal("Calculated gas limit does not match") - } - }) - } -} - -var feeTests = map[string]struct { - dataLen int - l1GasPrice uint64 - l2GasLimit uint64 - l2GasPrice uint64 - err error -}{ - "simple": {100, 100_000_000, 437118, 100_000_001, nil}, - "zero-l2-gasprice": {10, 100_000_000, 196205, 0, errInvalidGasPrice}, - "one-l2-gasprice": {10, 100_000_000, 196205, 1, nil}, - "zero-l1-gasprice": {10, 0, 196205, 100_000_001, nil}, - "one-l1-gasprice": {10, 1, 23255, 23254, errInvalidGasPrice}, -} - -func TestCalculateRollupFee(t *testing.T) { - for name, tt := range feeTests { - t.Run(name, func(t *testing.T) { - data := make([]byte, 0, tt.dataLen) - l1GasPrice := new(big.Int).SetUint64(tt.l1GasPrice) - l2GasLimit := new(big.Int).SetUint64(tt.l2GasLimit) - l2GasPrice := new(big.Int).SetUint64(tt.l2GasPrice) - - fee, err := CalculateRollupFee(data, l1GasPrice, l2GasLimit, l2GasPrice) - if !errors.Is(err, tt.err) { - t.Fatalf("Cannot calculate fee: %s", err) - } - - if err == nil { - decodedGasLimit := DecodeL2GasLimit(fee) - if l2GasLimit.Cmp(decodedGasLimit) != 0 { - t.Errorf("rollup fee check failed: expected %d, got %d", l2GasLimit.Uint64(), decodedGasLimit) - } - } - }) - } -} - -func pow10(x int) uint64 { - return uint64(math.Pow10(x)) -} diff --git a/l2geth/eth/gasprice/rollup_gasprice.go b/l2geth/eth/gasprice/rollup_gasprice.go index 388161febecc..7b0a062e6c41 100644 --- a/l2geth/eth/gasprice/rollup_gasprice.go +++ b/l2geth/eth/gasprice/rollup_gasprice.go @@ -5,62 +5,55 @@ import ( "math/big" "sync" - "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/log" ) // RollupOracle holds the L1 and L2 gas prices for fee calculation type RollupOracle struct { - dataPrice *big.Int - executionPrice *big.Int - dataPriceLock sync.RWMutex - executionPriceLock sync.RWMutex + l1GasPrice *big.Int + l2GasPrice *big.Int + l1GasPriceLock sync.RWMutex + l2GasPriceLock sync.RWMutex } // NewRollupOracle returns an initialized RollupOracle -func NewRollupOracle(dataPrice *big.Int, executionPrice *big.Int) *RollupOracle { +func NewRollupOracle(l1GasPrice *big.Int, l2GasPrice *big.Int) *RollupOracle { return &RollupOracle{ - dataPrice: dataPrice, - executionPrice: executionPrice, + l1GasPrice: l1GasPrice, + l2GasPrice: l2GasPrice, } } // SuggestL1GasPrice returns the gas price which should be charged per byte of published // data by the sequencer. func (gpo *RollupOracle) SuggestL1GasPrice(ctx context.Context) (*big.Int, error) { - gpo.dataPriceLock.RLock() - defer gpo.dataPriceLock.RUnlock() - return gpo.dataPrice, nil + gpo.l1GasPriceLock.RLock() + defer gpo.l1GasPriceLock.RUnlock() + return gpo.l1GasPrice, nil } // SetL1GasPrice returns the current L1 gas price -func (gpo *RollupOracle) SetL1GasPrice(dataPrice *big.Int) error { - gpo.dataPriceLock.Lock() - defer gpo.dataPriceLock.Unlock() - if err := core.VerifyL1GasPrice(dataPrice); err != nil { - return err - } - gpo.dataPrice = dataPrice - log.Info("Set L1 Gas Price", "gasprice", gpo.dataPrice) +func (gpo *RollupOracle) SetL1GasPrice(gasPrice *big.Int) error { + gpo.l1GasPriceLock.Lock() + defer gpo.l1GasPriceLock.Unlock() + gpo.l1GasPrice = gasPrice + log.Info("Set L1 Gas Price", "gasprice", gpo.l1GasPrice) return nil } // SuggestL2GasPrice returns the gas price which should be charged per unit of gas // set manually by the sequencer depending on congestion func (gpo *RollupOracle) SuggestL2GasPrice(ctx context.Context) (*big.Int, error) { - gpo.executionPriceLock.RLock() - defer gpo.executionPriceLock.RUnlock() - return gpo.executionPrice, nil + gpo.l2GasPriceLock.RLock() + defer gpo.l2GasPriceLock.RUnlock() + return gpo.l2GasPrice, nil } // SetL2GasPrice returns the current L2 gas price -func (gpo *RollupOracle) SetL2GasPrice(executionPrice *big.Int) error { - gpo.executionPriceLock.Lock() - defer gpo.executionPriceLock.Unlock() - if err := core.VerifyL2GasPrice(executionPrice); err != nil { - return err - } - gpo.executionPrice = executionPrice - log.Info("Set L2 Gas Price", "gasprice", gpo.executionPrice) +func (gpo *RollupOracle) SetL2GasPrice(gasPrice *big.Int) error { + gpo.l2GasPriceLock.Lock() + defer gpo.l2GasPriceLock.Unlock() + gpo.l2GasPrice = gasPrice + log.Info("Set L2 Gas Price", "gasprice", gpo.l2GasPrice) return nil } diff --git a/l2geth/internal/ethapi/api.go b/l2geth/internal/ethapi/api.go index 2828d83707bd..648ddea679cd 100644 --- a/l2geth/internal/ethapi/api.go +++ b/l2geth/internal/ethapi/api.go @@ -45,15 +45,17 @@ import ( "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rlp" + "github.com/ethereum/go-ethereum/rollup/fees" "github.com/ethereum/go-ethereum/rpc" "github.com/tyler-smith/go-bip39" ) const ( - defaultGasPrice = params.Wei + defaultGasPrice = params.Wei * fees.TxGasPrice ) var errOVMUnsupported = errors.New("OVM: Unsupported RPC Method") +var bigDefaultGasPrice = new(big.Int).SetUint64(defaultGasPrice) // PublicEthereumAPI provides an API to access Ethereum related information. // It offers only methods that operate on public data that is freely available to anyone. @@ -68,7 +70,7 @@ func NewPublicEthereumAPI(b Backend) *PublicEthereumAPI { // GasPrice always returns 1 gwei. See `DoEstimateGas` below for context. func (s *PublicEthereumAPI) GasPrice(ctx context.Context) (*hexutil.Big, error) { - return (*hexutil.Big)(big.NewInt(defaultGasPrice)), nil + return (*hexutil.Big)(bigDefaultGasPrice), nil } // ProtocolVersion returns the current Ethereum protocol version this node supports @@ -1037,31 +1039,27 @@ func DoEstimateGas(ctx context.Context, b Backend, args CallArgs, blockNrOrHash if err != nil { return 0, err } - // 2a. fetch the data price, depends on how the sequencer has chosen to update their values based on the // l1 gas prices l1GasPrice, err := b.SuggestL1GasPrice(ctx) if err != nil { return 0, err } - // 2b. fetch the execution gas price, by the typical mempool dynamics l2GasPrice, err := b.SuggestL2GasPrice(ctx) if err != nil { return 0, err } - - var data []byte - if args.Data == nil { - data = []byte{} - } else { + data := []byte{} + if args.Data != nil { data = *args.Data } - // 3. calculate the fee + // 3. calculate the fee using just the calldata. The additional overhead of + // RLP encoding is covered inside of EncodeL2GasLimit l2GasLimit := new(big.Int).SetUint64(uint64(gasUsed)) - fee, err := core.CalculateRollupFee(data, l1GasPrice, l2GasLimit, l2GasPrice) - if err != nil { - return 0, err + fee := fees.EncodeTxGasLimit(data, l1GasPrice, l2GasLimit, l2GasPrice) + if !fee.IsUint64() { + return 0, fmt.Errorf("estimate gas overflow: %s", fee) } return (hexutil.Uint64)(fee.Uint64()), nil } diff --git a/l2geth/rollup/client.go b/l2geth/rollup/client.go index b8b08222c73b..2e6402bfd4e6 100644 --- a/l2geth/rollup/client.go +++ b/l2geth/rollup/client.go @@ -570,7 +570,7 @@ func (c *Client) GetTransactionBatch(index uint64) (*Batch, []*types.Transaction Get("/batch/transaction/index/{index}") if err != nil { - return nil, nil, fmt.Errorf("Cannot get transaction batch %d", index) + return nil, nil, fmt.Errorf("Cannot get transaction batch %d: %w", index, err) } txBatch, ok := response.Result().(*TransactionBatchResponse) if !ok { diff --git a/l2geth/rollup/fees/rollup_fee.go b/l2geth/rollup/fees/rollup_fee.go new file mode 100644 index 000000000000..2f5455057e7d --- /dev/null +++ b/l2geth/rollup/fees/rollup_fee.go @@ -0,0 +1,94 @@ +package fees + +import ( + "math/big" + + "github.com/ethereum/go-ethereum/params" +) + +// overhead represents the fixed cost of batch submission of a single +// transaction in gas. +const overhead uint64 = 4200 + 200*params.TxDataNonZeroGasEIP2028 + +// hundredMillion is a constant used in the gas encoding formula +const hundredMillion uint64 = 100_000_000 + +// feeScalar is used to scale the calculations in EncodeL2GasLimit +// to prevent them from being too large +const feeScalar uint64 = 1000 + +// TxGasPrice is a constant that determines the result of `eth_gasPrice` +// It is scaled upwards by 50% +// tx.gasPrice is hard coded to 1500 * wei and all transactions must set that +// gas price. +const TxGasPrice uint64 = feeScalar + (feeScalar / 2) + +// BigTxGasPrice is the L2GasPrice as type big.Int +var BigTxGasPrice = new(big.Int).SetUint64(TxGasPrice) +var bigFeeScalar = new(big.Int).SetUint64(feeScalar) +var bigHundredMillion = new(big.Int).SetUint64(hundredMillion) + +// EncodeTxGasLimit computes the `tx.gasLimit` based on the L1/L2 gas prices and +// the L2 gas limit. The L2 gas limit is encoded inside of the lower order bits +// of the number like so: [ | l2GasLimit ] +// [ tx.gaslimit ] +// The lower order bits must be large enough to fit the L2 gas limit, so 10**8 +// is chosen. If higher order bits collide with any bits from the L2 gas limit, +// the L2 gas limit will not be able to be decoded. +// An explicit design goal of this scheme was to make the L2 gas limit be human +// readable. The entire number is interpreted as the gas limit when computing +// the fee, so increasing the L2 Gas limit will increase the fee paid. +// The calculation is: +// l1GasLimit = zero_count(data) * 4 + non_zero_count(data) * 16 + overhead +// l1Fee = l1GasPrice * l1GasLimit +// l2Fee = l2GasPrice * l2GasLimit +// sum = l1Fee + l2Fee +// scaled = sum / scalar +// rounded = ceilmod(scaled, hundredMillion) +// result = rounded + l2GasLimit +// Note that for simplicity purposes, only the calldata is passed into this +// function when in reality the RLP encoded transaction should be. The +// additional cost is added to the overhead constant to prevent the need to RLP +// encode transactions during calls to `eth_estimateGas` +func EncodeTxGasLimit(data []byte, l1GasPrice, l2GasLimit, l2GasPrice *big.Int) *big.Int { + l1GasLimit := calculateL1GasLimit(data, overhead) + l1Fee := new(big.Int).Mul(l1GasPrice, l1GasLimit) + l2Fee := new(big.Int).Mul(l2GasPrice, l2GasLimit) + sum := new(big.Int).Add(l1Fee, l2Fee) + scaled := new(big.Int).Div(sum, bigFeeScalar) + remainder := new(big.Int).Mod(scaled, bigHundredMillion) + scaledSum := new(big.Int).Add(scaled, bigHundredMillion) + rounded := new(big.Int).Sub(scaledSum, remainder) + result := new(big.Int).Add(rounded, l2GasLimit) + return result +} + +// DecodeL2GasLimit decodes the L2 gas limit from an encoded L2 gas limit +func DecodeL2GasLimit(gasLimit *big.Int) *big.Int { + return new(big.Int).Mod(gasLimit, bigHundredMillion) +} + +// calculateL1GasLimit computes the L1 gasLimit based on the calldata and +// constant sized overhead. The overhead can be decreased as the cost of the +// batch submission goes down via contract optimizations. This will not overflow +// under standard network conditions. +func calculateL1GasLimit(data []byte, overhead uint64) *big.Int { + zeroes, ones := zeroesAndOnes(data) + zeroesCost := zeroes * params.TxDataZeroGas + onesCost := ones * params.TxDataNonZeroGasEIP2028 + gasLimit := zeroesCost + onesCost + overhead + return new(big.Int).SetUint64(gasLimit) +} + +func zeroesAndOnes(data []byte) (uint64, uint64) { + var zeroes uint64 + var ones uint64 + for _, byt := range data { + if byt == 0 { + zeroes++ + } else { + ones++ + } + } + return zeroes, ones +} diff --git a/l2geth/rollup/fees/rollup_fee_test.go b/l2geth/rollup/fees/rollup_fee_test.go new file mode 100644 index 000000000000..138a0d0bb16a --- /dev/null +++ b/l2geth/rollup/fees/rollup_fee_test.go @@ -0,0 +1,103 @@ +package fees + +import ( + "math/big" + "testing" + + "github.com/ethereum/go-ethereum/params" +) + +var l1GasLimitTests = map[string]struct { + data []byte + overhead uint64 + expect *big.Int +}{ + "simple": {[]byte{}, 0, big.NewInt(0)}, + "simple-overhead": {[]byte{}, 10, big.NewInt(10)}, + "zeros": {[]byte{0x00, 0x00, 0x00, 0x00}, 10, big.NewInt(26)}, + "ones": {[]byte{0x01, 0x02, 0x03, 0x04}, 200, big.NewInt(16*4 + 200)}, +} + +func TestL1GasLimit(t *testing.T) { + for name, tt := range l1GasLimitTests { + t.Run(name, func(t *testing.T) { + got := calculateL1GasLimit(tt.data, tt.overhead) + if got.Cmp(tt.expect) != 0 { + t.Fatal("Calculated gas limit does not match") + } + }) + } +} + +var feeTests = map[string]struct { + dataLen int + l1GasPrice uint64 + l2GasLimit uint64 + l2GasPrice uint64 +}{ + "simple": { + dataLen: 10, + l1GasPrice: params.GWei, + l2GasLimit: 437118, + l2GasPrice: params.GWei, + }, + "zero-l2-gasprice": { + dataLen: 10, + l1GasPrice: params.GWei, + l2GasLimit: 196205, + l2GasPrice: 0, + }, + "one-l2-gasprice": { + dataLen: 10, + l1GasPrice: params.GWei, + l2GasLimit: 196205, + l2GasPrice: 1, + }, + "zero-l1-gasprice": { + dataLen: 10, + l1GasPrice: 0, + l2GasLimit: 196205, + l2GasPrice: params.GWei, + }, + "one-l1-gasprice": { + dataLen: 10, + l1GasPrice: 1, + l2GasLimit: 23255, + l2GasPrice: params.GWei, + }, + "zero-gasprices": { + dataLen: 10, + l1GasPrice: 0, + l2GasLimit: 23255, + l2GasPrice: 0, + }, + "max-gaslimit": { + dataLen: 10, + l1GasPrice: params.GWei, + l2GasLimit: 99999999, + l2GasPrice: params.GWei, + }, + "larger-divisor": { + dataLen: 10, + l1GasPrice: 0, + l2GasLimit: 10, + l2GasPrice: 0, + }, +} + +func TestCalculateRollupFee(t *testing.T) { + for name, tt := range feeTests { + t.Run(name, func(t *testing.T) { + data := make([]byte, tt.dataLen) + l1GasPrice := new(big.Int).SetUint64(tt.l1GasPrice) + l2GasLimit := new(big.Int).SetUint64(tt.l2GasLimit) + l2GasPrice := new(big.Int).SetUint64(tt.l2GasPrice) + + fee := EncodeTxGasLimit(data, l1GasPrice, l2GasLimit, l2GasPrice) + decodedGasLimit := DecodeL2GasLimit(fee) + if l2GasLimit.Cmp(decodedGasLimit) != 0 { + t.Errorf("rollup fee check failed: expected %d, got %d", l2GasLimit.Uint64(), decodedGasLimit) + } + }) + } +} diff --git a/l2geth/rollup/sync_service.go b/l2geth/rollup/sync_service.go index b3f831559a79..98460aa7387a 100644 --- a/l2geth/rollup/sync_service.go +++ b/l2geth/rollup/sync_service.go @@ -21,6 +21,7 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/eth/gasprice" + "github.com/ethereum/go-ethereum/rollup/fees" ) // errShortRemoteTip is an error for when the remote tip is shorter than the @@ -445,13 +446,7 @@ func (s *SyncService) updateL2GasPrice(hash *common.Hash) error { return err } result := state.GetState(s.gpoAddress, l2GasPriceSlot) - gasPrice := result.Big() - if err := core.VerifyL2GasPrice(gasPrice); err != nil { - gp := core.RoundL2GasPrice(gasPrice) - log.Warn("Invalid gas price detected in state", "state", gasPrice, "using", gp) - gasPrice = gp - } - s.RollupGpo.SetL2GasPrice(gasPrice) + s.RollupGpo.SetL2GasPrice(result.Big()) return nil } @@ -728,11 +723,18 @@ func (s *SyncService) applyBatchedTransaction(tx *types.Transaction) error { // verifyFee will verify that a valid fee is being paid. func (s *SyncService) verifyFee(tx *types.Transaction) error { - // Exit early if fees are enforced and the gasPrice is set to 0 - if s.enforceFees && tx.GasPrice().Cmp(common.Big0) == 0 { - return errors.New("cannot accept 0 gas price transaction") + if tx.GasPrice().Cmp(common.Big0) == 0 { + // Exit early if fees are enforced and the gasPrice is set to 0 + if s.enforceFees { + return errors.New("cannot accept 0 gas price transaction") + } + // If fees are not enforced and the gas price is 0, return early + return nil + } + // When the gas price is non zero, it must be equal to the constant + if tx.GasPrice().Cmp(fees.BigTxGasPrice) != 0 { + return fmt.Errorf("tx.gasPrice must be %d", fees.TxGasPrice) } - l1GasPrice, err := s.RollupGpo.SuggestL1GasPrice(context.Background()) if err != nil { return err @@ -743,22 +745,29 @@ func (s *SyncService) verifyFee(tx *types.Transaction) error { } // Calculate the fee based on decoded L2 gas limit gas := new(big.Int).SetUint64(tx.Gas()) - l2GasLimit := core.DecodeL2GasLimit(gas) - fee, err := core.CalculateRollupFee(tx.Data(), l1GasPrice, l2GasLimit, l2GasPrice) + l2GasLimit := fees.DecodeL2GasLimit(gas) + // Only count the calldata here as the overhead of the fully encoded + // RLP transaction is handled inside of EncodeL2GasLimit + fee := fees.EncodeTxGasLimit(tx.Data(), l1GasPrice, l2GasLimit, l2GasPrice) if err != nil { return err } - // If fees are not enforced and the gas price is 0, return early - if !s.enforceFees && tx.GasPrice().Cmp(common.Big0) == 0 { - return nil - } // This should only happen if the transaction fee is greater than 18.44 ETH if !fee.IsUint64() { return fmt.Errorf("fee overflow: %s", fee.String()) } - // Make sure that the fee is paid - if tx.Gas() < fee.Uint64() { - return fmt.Errorf("fee too low: %d, use at least tx.gasLimit = %d and tx.gasPrice = 1", tx.Gas(), fee.Uint64()) + // Compute the user's fee + paying := new(big.Int).Mul(new(big.Int).SetUint64(tx.Gas()), tx.GasPrice()) + // Compute the minimum expected fee + expecting := new(big.Int).Mul(fee, fees.BigTxGasPrice) + if paying.Cmp(expecting) == -1 { + return fmt.Errorf("fee too low: %d, use at least tx.gasLimit = %d and tx.gasPrice = %d", paying, fee.Uint64(), fees.BigTxGasPrice) + } + // Protect users from overpaying by too much + overpaying := new(big.Int).Sub(paying, expecting) + threshold := new(big.Int).Mul(expecting, common.Big3) + if overpaying.Cmp(threshold) == 1 { + return fmt.Errorf("fee too large: %d", paying) } return nil } @@ -776,7 +785,6 @@ func (s *SyncService) ValidateAndApplySequencerTransaction(tx *types.Transaction if err := s.verifyFee(tx); err != nil { return err } - s.txLock.Lock() defer s.txLock.Unlock() log.Trace("Sequencer transaction validation", "hash", tx.Hash().Hex()) diff --git a/l2geth/rollup/sync_service_test.go b/l2geth/rollup/sync_service_test.go index d23f5ad304d4..705539be7fe4 100644 --- a/l2geth/rollup/sync_service_test.go +++ b/l2geth/rollup/sync_service_test.go @@ -507,7 +507,8 @@ func TestSyncServiceL1GasPrice(t *testing.T) { t.Fatal(err) } - if gasAfter.Cmp(core.RoundL1GasPrice(big.NewInt(1))) != 0 { + expect, _ := service.client.GetL1GasPrice() + if gasAfter.Cmp(expect) != 0 { t.Fatal("expected 100 gas price, got", gasAfter) } } @@ -533,7 +534,7 @@ func TestSyncServiceL2GasPrice(t *testing.T) { if err != nil { t.Fatal("Cannot get state db") } - l2GasPrice := big.NewInt(100000001) + l2GasPrice := big.NewInt(100000000000) state.SetState(service.gpoAddress, l2GasPriceSlot, common.BigToHash(l2GasPrice)) root, _ := state.Commit(false) @@ -824,7 +825,7 @@ func (m *mockClient) SyncStatus(backend Backend) (*SyncStatus, error) { } func (m *mockClient) GetL1GasPrice() (*big.Int, error) { - price := core.RoundL1GasPrice(big.NewInt(2)) + price := big.NewInt(1) return price, nil } diff --git a/packages/core-utils/README.md b/packages/core-utils/README.md index 20a6539f5293..fc01bdfdfe78 100644 --- a/packages/core-utils/README.md +++ b/packages/core-utils/README.md @@ -25,36 +25,29 @@ $ yarn lint ### L2 Fees -The Layer 2 fee is encoded in `tx.gasLimit`. The Layer 2 `gasLimit` is encoded -in the lower order bits of the `tx.gasLimit`. For this scheme to work, both the -L1 gas price and the L2 gas price must satisfy specific equations. There are -functions that help ensure that the correct gas prices are used. - -- `roundL1GasPrice` -- `roundL2GasPrice` - -The Layer 2 fee is based on both the cost of submitting the data to L1 as well -as the cost of execution on L2. To make libraries like `ethers` just work, the -return value of `eth_estimateGas` has been modified to return the fee. A new RPC -endpoint `eth_estimateExecutionGas` has been added that returns the L2 gas used. - -To locally encode the `tx.gasLimit`, the `L2GasLimit` methods `encode` and -`decode` should be used. +`TxGasLimit` can be used to `encode` and `decode` the L2 Gas Limit +locally. ```typescript -import { L2GasLimit, roundL1GasPrice, roundL2GasPrice } from '@eth-optimism/core-utils' +import { TxGasLimit } from '@eth-optimism/core-utils' import { JsonRpcProvider } from 'ethers' -const provider = new JsonRpcProvider('https://mainnet.optimism.io') -const gasLimit = await provider.send('eth_estimateExecutionGas', [tx]) +const L2Provider = new JsonRpcProvider('https://mainnet.optimism.io') +const L1Provider = new JsonRpcProvider('http://127.0.0.1:8545') -const encoded = L2GasLimit.encode({ +const l2GasLimit = await L2Provider.send('eth_estimateExecutionGas', [tx]) +const l1GasPrice = await L1Provider.getGasPrice() + +const encoded = TxGasLimit.encode({ data: '0x', - l1GasPrice: roundL1GasPrice(1), - l2GasLimit: gasLimit, - l2GasPrice: roundL2GasPrice(1), + l1GasPrice, + l2GasLimit, + l2GasPrice: 10000000, }) -const decoded = L2GasLimit.decode(encoded) +const decoded = TxGasLimit.decode(encoded) assert(decoded.eq(gasLimit)) + +const estimate = await L2Provider.estimateGas() +assert(estimate.eq(encoded)) ``` diff --git a/packages/core-utils/src/fees.ts b/packages/core-utils/src/fees.ts index cc754e5fcb81..3910d19196df 100644 --- a/packages/core-utils/src/fees.ts +++ b/packages/core-utils/src/fees.ts @@ -6,9 +6,11 @@ import { BigNumber } from 'ethers' import { remove0x } from './common' const hundredMillion = BigNumber.from(100_000_000) +const feeScalar = 1000 +export const TxGasPrice = BigNumber.from(feeScalar + feeScalar / 2) const txDataZeroGas = 4 const txDataNonZeroGasEIP2028 = 16 -const overhead = 4200 +const overhead = 4200 + 200 * txDataNonZeroGasEIP2028 export interface EncodableL2GasLimit { data: Buffer | string @@ -29,17 +31,15 @@ function encode(input: EncodableL2GasLimit): BigNumber { if (typeof l2GasPrice === 'number') { l2GasPrice = BigNumber.from(l2GasPrice) } - - if (!verifyL2GasPrice(l2GasPrice)) { - throw new Error(`Invalid L2 Gas Price: ${l2GasPrice.toString()}`) - } - if (!verifyL1GasPrice(l1GasPrice)) { - throw new Error(`Invalid L1 Gas Price: ${l1GasPrice.toString()}`) - } const l1GasLimit = calculateL1GasLimit(data) - const l1Fee = l1GasPrice.mul(l1GasLimit) + const l1Fee = l1GasLimit.mul(l1GasPrice) const l2Fee = l2GasLimit.mul(l2GasPrice) - return l1Fee.add(l2Fee) + const sum = l1Fee.add(l2Fee) + const scaled = sum.div(feeScalar) + const remainder = scaled.mod(hundredMillion) + const scaledSum = scaled.add(hundredMillion) + const rounded = scaledSum.sub(remainder) + return rounded.add(l2GasLimit) } function decode(fee: BigNumber | number): BigNumber { @@ -49,39 +49,17 @@ function decode(fee: BigNumber | number): BigNumber { return fee.mod(hundredMillion) } -export const L2GasLimit = { +export const TxGasLimit = { encode, decode, } -export function verifyL2GasPrice(gasPrice: BigNumber | number): boolean { - if (typeof gasPrice === 'number') { - gasPrice = BigNumber.from(gasPrice) - } - // If the gas price is not equal to 0 and the gas price mod - // one hundred million is not one - if (!gasPrice.eq(0) && !gasPrice.mod(hundredMillion).eq(1)) { - return false - } - if (gasPrice.eq(0)) { - return false - } - return true -} - -export function verifyL1GasPrice(gasPrice: BigNumber | number): boolean { - if (typeof gasPrice === 'number') { - gasPrice = BigNumber.from(gasPrice) - } - return gasPrice.mod(hundredMillion).eq(0) -} - -export function calculateL1GasLimit(data: string | Buffer): number { +export function calculateL1GasLimit(data: string | Buffer): BigNumber { const [zeroes, ones] = zeroesAndOnes(data) const zeroesCost = zeroes * txDataZeroGas const onesCost = ones * txDataNonZeroGasEIP2028 const gasLimit = zeroesCost + onesCost + overhead - return gasLimit + return BigNumber.from(gasLimit) } export function zeroesAndOnes(data: Buffer | string): Array { @@ -99,34 +77,3 @@ export function zeroesAndOnes(data: Buffer | string): Array { } return [zeros, ones] } - -export function roundL1GasPrice(gasPrice: BigNumber | number): BigNumber { - if (typeof gasPrice === 'number') { - gasPrice = BigNumber.from(gasPrice) - } - return ceilModOneHundredMillion(gasPrice) -} - -function ceilModOneHundredMillion(num: BigNumber): BigNumber { - if (num.mod(hundredMillion).eq(0)) { - return num - } - const sum = num.add(hundredMillion) - const mod = num.mod(hundredMillion) - return sum.sub(mod) -} - -export function roundL2GasPrice(gasPrice: BigNumber | number): BigNumber { - if (typeof gasPrice === 'number') { - gasPrice = BigNumber.from(gasPrice) - } - if (gasPrice.eq(0)) { - return BigNumber.from(1) - } - if (gasPrice.eq(1)) { - return hundredMillion.add(1) - } - const gp = gasPrice.sub(1) - const mod = ceilModOneHundredMillion(gp) - return mod.add(1) -} diff --git a/packages/core-utils/test/fees/fees.spec.ts b/packages/core-utils/test/fees/fees.spec.ts index bc548c5baa67..c624c0b3128b 100644 --- a/packages/core-utils/test/fees/fees.spec.ts +++ b/packages/core-utils/test/fees/fees.spec.ts @@ -1,6 +1,9 @@ import { expect } from '../setup' import * as fees from '../../src/fees' -import { BigNumber } from 'ethers' +import { BigNumber, utils } from 'ethers' + +const hundredBillion = 10 ** 11 +const million = 10 ** 6 describe('Fees', () => { it('should count zeros and ones', () => { @@ -18,115 +21,99 @@ describe('Fees', () => { } }) - describe('Round L1 Gas Price', () => { - const roundL1GasPriceTests = [ - { input: 10, expect: 10 ** 8, name: 'simple' }, - { input: 10 ** 8 + 1, expect: 2 * 10 ** 8, name: 'one-over' }, - { input: 10 ** 8, expect: 10 ** 8, name: 'exact' }, - { input: 10 ** 8 - 1, expect: 10 ** 8, name: 'one-under' }, - { input: 3, expect: 10 ** 8, name: 'small' }, - { input: 2, expect: 10 ** 8, name: 'two' }, - { input: 1, expect: 10 ** 8, name: 'one' }, - { input: 0, expect: 0, name: 'zero' }, - ] - - for (const test of roundL1GasPriceTests) { - it(`should pass for ${test.name} case`, () => { - const got = fees.roundL1GasPrice(test.input) - const expected = BigNumber.from(test.expect) - expect(got).to.deep.equal(expected) - }) - } - }) - - describe('Round L2 Gas Price', () => { - const roundL2GasPriceTests = [ - { input: 10, expect: 10 ** 8 + 1, name: 'simple' }, - { input: 10 ** 8 + 2, expect: 2 * 10 ** 8 + 1, name: 'one-over' }, - { input: 10 ** 8 + 1, expect: 10 ** 8 + 1, name: 'exact' }, - { input: 10 ** 8, expect: 10 ** 8 + 1, name: 'one-under' }, - { input: 3, expect: 10 ** 8 + 1, name: 'small' }, - { input: 2, expect: 10 ** 8 + 1, name: 'two' }, - { input: 1, expect: 10 ** 8 + 1, name: 'one' }, - { input: 0, expect: 1, name: 'zero' }, - ] - - for (const test of roundL2GasPriceTests) { - it(`should pass for ${test.name} case`, () => { - const got = fees.roundL2GasPrice(test.input) - const expected = BigNumber.from(test.expect) - expect(got).to.deep.equal(expected) - }) - } - }) - describe('Rollup Fees', () => { const rollupFeesTests = [ { name: 'simple', dataLen: 10, - l1GasPrice: 100_000_000, - l2GasPrice: 100_000_001, + l1GasPrice: utils.parseUnits('1', 'gwei'), + l2GasPrice: utils.parseUnits('1', 'gwei'), l2GasLimit: 437118, - error: false, + }, + { + name: 'small-gasprices-max-gaslimit', + dataLen: 10, + l1GasPrice: utils.parseUnits('1', 'wei'), + l2GasPrice: utils.parseUnits('1', 'wei'), + l2GasLimit: 0x4ffffff, + }, + { + name: 'large-gasprices-max-gaslimit', + dataLen: 10, + l1GasPrice: utils.parseUnits('1', 'ether'), + l2GasPrice: utils.parseUnits('1', 'ether'), + l2GasLimit: 0x4ffffff, + }, + { + name: 'small-gasprices-max-gaslimit', + dataLen: 10, + l1GasPrice: utils.parseUnits('1', 'ether'), + l2GasPrice: utils.parseUnits('1', 'ether'), + l2GasLimit: 1, + }, + { + name: 'max-gas-limit', + dataLen: 10, + l1GasPrice: utils.parseUnits('5', 'ether'), + l2GasPrice: utils.parseUnits('5', 'ether'), + l2GasLimit: 10 ** 8 - 1, }, { name: 'zero-l2-gasprice', dataLen: 10, - l1GasPrice: 100_000_000, + l1GasPrice: hundredBillion, l2GasPrice: 0, l2GasLimit: 196205, - error: true, }, { name: 'one-l2-gasprice', dataLen: 10, - l1GasPrice: 100_000_000, + l1GasPrice: hundredBillion, l2GasPrice: 1, l2GasLimit: 196205, - error: false, }, { name: 'zero-l1-gasprice', dataLen: 10, l1GasPrice: 0, - l2GasPrice: 100_000_001, + l2GasPrice: hundredBillion, l2GasLimit: 196205, - error: false, }, { name: 'one-l1-gasprice', dataLen: 10, l1GasPrice: 1, - l2GasPrice: 23254, + l2GasPrice: hundredBillion, + l2GasLimit: 23255, + }, + { + name: 'zero-gasprices', + dataLen: 10, + l1GasPrice: 0, + l2GasPrice: 0, l2GasLimit: 23255, - error: true, + }, + { + name: 'larger-divisor', + dataLen: 10, + l1GasPrice: 0, + l2GasLimit: 10, + l2GasPrice: 0, }, ] for (const test of rollupFeesTests) { it(`should pass for ${test.name} case`, () => { const data = Buffer.alloc(test.dataLen) + const got = fees.TxGasLimit.encode({ + data, + l1GasPrice: test.l1GasPrice, + l2GasPrice: test.l2GasPrice, + l2GasLimit: test.l2GasLimit, + }) - let got - let err = false - try { - got = fees.L2GasLimit.encode({ - data, - l1GasPrice: test.l1GasPrice, - l2GasPrice: test.l2GasPrice, - l2GasLimit: test.l2GasLimit, - }) - } catch (e) { - err = true - } - - expect(err).to.equal(test.error) - - if (!err) { - const decoded = fees.L2GasLimit.decode(got) - expect(decoded).to.deep.eq(BigNumber.from(test.l2GasLimit)) - } + const decoded = fees.TxGasLimit.decode(got) + expect(decoded).to.deep.eq(BigNumber.from(test.l2GasLimit)) }) } }) From 11a9296fabe1a54c28ccd2043bd362dc7c42720a Mon Sep 17 00:00:00 2001 From: Elena Gesheva Date: Mon, 31 May 2021 16:12:21 +0300 Subject: [PATCH 020/125] Add static analysis action (#848) * Add static analysis github action setup python and install slither * Add nvmrc file for setting node to v14.17 * Update slither command run to link missing contract packages from monorepo root * Add steps for installing dependencies * Add yarn build step to github action * Enable colour in github action for static analysis * Disable certain detectors * Ensure slither does not fail build * Add instructions on running static analysis to monorepo readme --- .github/workflows/static-analysis.yml | 61 ++++++++++++++++++++++++++ .gitignore | 3 ++ .nvmrc | 1 + README.md | 14 ++++-- packages/contracts/package.json | 3 ++ packages/contracts/slither.config.json | 12 +++++ 6 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/static-analysis.yml create mode 100644 .nvmrc create mode 100644 packages/contracts/slither.config.json diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml new file mode 100644 index 000000000000..9eab9a0b3de9 --- /dev/null +++ b/.github/workflows/static-analysis.yml @@ -0,0 +1,61 @@ +name: Static analysis + +on: + push: + branches: + - master + - develop + pull_request: + workflow_dispatch: + +env: + PYTEST_ADDOPTS: "--color=yes" + +jobs: + slither: + name: Slither run + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Fetch history + run: git fetch + + - name: Setup node + uses: actions/setup-node@v1 + with: + node-version: '12.x' + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + + - uses: actions/cache@v2 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Install Dependencies + # only install dependencies if there was a change in the deps + # if: steps.yarn-cache.outputs.cache-hit != 'true' + run: yarn install + + - name: Build + run: yarn build + + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: '3.8' + + - name: Install Slither + run: pip3 install slither-analyzer + + - name: Run analysis + working-directory: ./packages/contracts + shell: bash + run: yarn test:slither + continue-on-error: true diff --git a/.gitignore b/.gitignore index 18b731ead5fc..45c8671678a8 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,9 @@ cache-ovm l2geth/build/bin packages/contracts/deployments/custom packages/contracts/coverage* +packages/contracts/@ens* +packages/contracts/@openzeppelin* +packages/contracts/hardhat* packages/data-transport-layer/db diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 000000000000..62df50f1eefe --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +14.17.0 diff --git a/README.md b/README.md index d7b11ea584f2..8ed492095de5 100644 --- a/README.md +++ b/README.md @@ -23,14 +23,14 @@ Extensive documentation is available [here](http://community.optimism.io/docs/) * [`message-relayer`](./packages/message-relayer): Service for relaying L2 messages to L1 * [`l2geth`](./l2geth): Fork of [go-ethereum v1.9.10](https://github.com/ethereum/go-ethereum/tree/v1.9.10) implementing the [OVM](https://research.paradigm.xyz/optimism#optimistic-geth). * [`integration-tests`](./integration-tests): Integration tests between a L1 testnet, `l2geth`, -* [`ops`](./ops): Contains Dockerfiles for containerizing each service involved in the protocol, +* [`ops`](./ops): Contains Dockerfiles for containerizing each service involved in the protocol, as well as a docker-compose file for bringing up local testnets easily ## Quickstart ### Installation -Dependency management is done using `yarn`. +Dependency management is done using `yarn`. ```bash git clone git@github.com:ethereum-optimism/optimism.git @@ -67,7 +67,7 @@ you can run `yarn lerna run test --parallel --since master` #### Running the integration tests The integration tests first require bringing up the Optimism stack. This is done via -a Docker Compose network. For better performance, we also recommend enabling Docker +a Docker Compose network. For better performance, we also recommend enabling Docker BuildKit ```bash @@ -110,3 +110,11 @@ can be hard to filter through. In order to view the logs from a specific service ``` docker-compose logs --follow ``` +### Static analysis + +To run `slither` locally in `./packages/contracts` do + +``` +pip3 install slither-analyzer +yarn test:slither +``` diff --git a/packages/contracts/package.json b/packages/contracts/package.json index e8f750f6d7a3..ec5771a978c3 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -32,6 +32,9 @@ "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", "test:coverage": "NODE_OPTIONS=--max_old_space_size=8192 hardhat coverage", + "test:slither": "slither .", + "pretest:slither": "rm -f @openzeppelin && rm -f @ens && rm -f hardhat && ln -s ../../node_modules/@openzeppelin @openzeppelin && ln -s ../../node_modules/@ens @ens && ln -s ../../node_modules/hardhat hardhat", + "posttest:slither": "rm -f @openzeppelin && rm -f @ens && rm -f hardhat", "lint": "yarn lint:fix && yarn lint:check", "lint:fix": "yarn run lint:fix:typescript", "lint:fix:typescript": "prettier --config .prettierrc.json --write \"hardhat.config.ts\" \"{src,test}/**/*.ts\"", diff --git a/packages/contracts/slither.config.json b/packages/contracts/slither.config.json new file mode 100644 index 000000000000..8827f71e57ec --- /dev/null +++ b/packages/contracts/slither.config.json @@ -0,0 +1,12 @@ +{ + "detectors_to_exclude": "conformance-to-solidity-naming-conventions,assembly-usage,low-level-calls,block-timestamp", + "exclude_informational": false, + "exclude_low": false, + "exclude_medium": false, + "exclude_high": false, + "solc_disable_warnings": false, + "hardhat_ignore_compile": true, + "disable_color": false, + "exclude_dependencies": true, + "filter_paths": "@openzeppelin|hardhat|contracts/test-helpers|contracts/test-libraries" +} From 5a7984973622d1d6e610ac98cfc206ab9a3bfe1a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 May 2021 19:21:45 +0300 Subject: [PATCH 021/125] build(deps): bump ws from 7.4.4 to 7.4.6 in /ops/docker/hardhat (#987) Bumps [ws](https://github.com/websockets/ws) from 7.4.4 to 7.4.6. - [Release notes](https://github.com/websockets/ws/releases) - [Commits](https://github.com/websockets/ws/compare/7.4.4...7.4.6) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- ops/docker/hardhat/yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ops/docker/hardhat/yarn.lock b/ops/docker/hardhat/yarn.lock index bad1ef0d6d31..5d7149c252ea 100644 --- a/ops/docker/hardhat/yarn.lock +++ b/ops/docker/hardhat/yarn.lock @@ -2252,9 +2252,9 @@ wrappy@1: integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= ws@^7.2.1: - version "7.4.4" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.4.tgz#383bc9742cb202292c9077ceab6f6047b17f2d59" - integrity sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw== + version "7.4.6" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" + integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.0: version "4.0.2" From c4c7beaa964269d8114767bf08cadcc288560e1f Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Tue, 1 Jun 2021 16:13:09 -0400 Subject: [PATCH 022/125] fix[l2geth]: fix accidental merge conflict (#994) --- l2geth/rollup/sync_service_test.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/l2geth/rollup/sync_service_test.go b/l2geth/rollup/sync_service_test.go index d7ebb9be848e..8ba60a3facb5 100644 --- a/l2geth/rollup/sync_service_test.go +++ b/l2geth/rollup/sync_service_test.go @@ -177,7 +177,6 @@ func TestTransactionToTipNoIndex(t *testing.T) { l1BlockNumber, timestamp, &l1TxOrigin, - types.SighashEIP155, types.QueueOriginL1ToL2, nil, // The index is `nil`, expect it to be set afterwards nil, @@ -868,7 +867,6 @@ func mockTx() *types.Transaction { l1BlockNumber, timestamp, &l1TxOrigin, - types.SighashEIP155, types.QueueOriginSequencer, nil, nil, From 86708bb5758cd2b647b3ca2be698beb5aa3af81f Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Tue, 1 Jun 2021 16:44:53 -0400 Subject: [PATCH 023/125] feat[message-relayer]: relay tx generator (#952) * feat[message-relayer]: relay tx generator * whoops, I burned our infura key * fix minor bug * add comments * add more comments and clean stuff up * add empty test descriptions * add tests * move smock to dev deps * chore: add changeset * minor cleanup to merkle tree proof function * use bignumber math to avoid nested await * use a better interface * minor fixes and simplifications --- .changeset/sharp-files-knock.md | 5 + packages/message-relayer/hardhat.config.ts | 15 + packages/message-relayer/package.json | 17 +- packages/message-relayer/src/index.ts | 1 + packages/message-relayer/src/relay-tx.ts | 418 ++++++++++++++++++ packages/message-relayer/test/setup.ts | 12 + .../MockL2CrossDomainMessenger.sol | 44 ++ .../test/unit-tests/relay-tx.spec.ts | 377 ++++++++++++++++ yarn.lock | 58 +++ 9 files changed, 945 insertions(+), 2 deletions(-) create mode 100644 .changeset/sharp-files-knock.md create mode 100644 packages/message-relayer/hardhat.config.ts create mode 100644 packages/message-relayer/src/index.ts create mode 100644 packages/message-relayer/src/relay-tx.ts create mode 100644 packages/message-relayer/test/setup.ts create mode 100644 packages/message-relayer/test/test-contracts/MockL2CrossDomainMessenger.sol create mode 100644 packages/message-relayer/test/unit-tests/relay-tx.spec.ts diff --git a/.changeset/sharp-files-knock.md b/.changeset/sharp-files-knock.md new file mode 100644 index 000000000000..c74d2c14e4c3 --- /dev/null +++ b/.changeset/sharp-files-knock.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/message-relayer': patch +--- + +Adds a new set of tools for generating messages to be relayed and their proofs diff --git a/packages/message-relayer/hardhat.config.ts b/packages/message-relayer/hardhat.config.ts new file mode 100644 index 000000000000..fac7c21376f0 --- /dev/null +++ b/packages/message-relayer/hardhat.config.ts @@ -0,0 +1,15 @@ +import { HardhatUserConfig } from 'hardhat/config' + +import '@nomiclabs/hardhat-ethers' +import '@nomiclabs/hardhat-waffle' + +const config: HardhatUserConfig = { + paths: { + sources: './test/test-contracts', + }, + solidity: { + version: '0.7.6', + }, +} + +export default config diff --git a/packages/message-relayer/package.json b/packages/message-relayer/package.json index 20ce2406e96b..6dae8b1eb7d6 100644 --- a/packages/message-relayer/package.json +++ b/packages/message-relayer/package.json @@ -14,7 +14,8 @@ "clean": "rimraf dist/ ./tsconfig.build.tsbuildinfo", "lint": "yarn lint:fix && yarn lint:check", "lint:fix": "prettier --config .prettierrc.json --write \"{src,exec,test}/**/*.ts\"", - "lint:check": "tslint --format stylish --project ." + "lint:check": "tslint --format stylish --project .", + "test": "hardhat test --show-stack-traces" }, "keywords": [ "optimism", @@ -30,9 +31,9 @@ }, "dependencies": { "@eth-optimism/common-ts": "^0.1.2", - "bcfg": "^0.1.6", "@eth-optimism/contracts": "^0.3.3", "@eth-optimism/core-utils": "^0.4.3", + "bcfg": "^0.1.6", "dotenv": "^8.2.0", "ethers": "^5.1.0", "google-spreadsheet": "^3.1.15", @@ -40,6 +41,18 @@ "rlp": "^2.2.6" }, "devDependencies": { + "@eth-optimism/smock": "^1.1.4", + "@nomiclabs/hardhat-ethers": "^2.0.2", + "@nomiclabs/hardhat-waffle": "^2.0.1", + "@types/chai": "^4.2.18", + "@types/chai-as-promised": "^7.1.4", + "@types/mocha": "^8.2.2", + "chai": "^4.3.4", + "chai-as-promised": "^7.1.1", + "ethereum-waffle": "^3.3.0", + "hardhat": "^2.3.0", + "lodash": "^4.17.21", + "mocha": "^8.4.0", "prettier": "^2.2.1", "tslint": "^6.1.3", "tslint-config-prettier": "^1.18.0", diff --git a/packages/message-relayer/src/index.ts b/packages/message-relayer/src/index.ts new file mode 100644 index 000000000000..419b5715f12d --- /dev/null +++ b/packages/message-relayer/src/index.ts @@ -0,0 +1 @@ +export * from './relay-tx' diff --git a/packages/message-relayer/src/relay-tx.ts b/packages/message-relayer/src/relay-tx.ts new file mode 100644 index 000000000000..547006ed7735 --- /dev/null +++ b/packages/message-relayer/src/relay-tx.ts @@ -0,0 +1,418 @@ +/* Imports: External */ +import { ethers } from 'ethers' +import { + fromHexString, + remove0x, + toHexString, + toRpcHexString, +} from '@eth-optimism/core-utils' +import { getContractInterface, predeploys } from '@eth-optimism/contracts' +import * as rlp from 'rlp' +import { MerkleTree } from 'merkletreejs' + +// Number of blocks added to the L2 chain before the first L2 transaction. Genesis are added to the +// chain to initialize the system. However, they create a discrepancy between the L2 block number +// the index of the transaction that corresponds to that block number. For example, if there's 1 +// genesis block, then the transaction with an index of 0 corresponds to the block with index 1. +const NUM_L2_GENESIS_BLOCKS = 1 + +interface StateRootBatchHeader { + batchIndex: ethers.BigNumber + batchRoot: string + batchSize: ethers.BigNumber + prevTotalElements: ethers.BigNumber + extraData: string +} + +interface StateRootBatch { + header: StateRootBatchHeader + stateRoots: string[] +} + +interface CrossDomainMessage { + target: string + sender: string + message: string + messageNonce: number +} + +interface CrossDomainMessageProof { + stateRoot: string + stateRootBatchHeader: StateRootBatchHeader + stateRootProof: { + index: number + siblings: string[] + } + stateTrieWitness: string + storageTrieWitness: string +} + +interface CrossDomainMessagePair { + message: CrossDomainMessage + proof: CrossDomainMessageProof +} + +interface StateTrieProof { + accountProof: string + storageProof: string +} + +/** + * Finds all L2 => L1 messages triggered by a given L2 transaction, if the message exists. + * @param l2RpcProvider L2 RPC provider. + * @param l2CrossDomainMessengerAddress Address of the L2CrossDomainMessenger. + * @param l2TransactionHash Hash of the L2 transaction to find a message for. + * @returns Messages associated with the transaction. + */ +export const getMessagesByTransactionHash = async ( + l2RpcProvider: ethers.providers.JsonRpcProvider, + l2CrossDomainMessengerAddress: string, + l2TransactionHash: string +): Promise => { + // Complain if we can't find the given transaction. + const transaction = await l2RpcProvider.getTransaction(l2TransactionHash) + if (transaction === null) { + throw new Error(`unable to find tx with hash: ${l2TransactionHash}`) + } + + const l2CrossDomainMessenger = new ethers.Contract( + l2CrossDomainMessengerAddress, + getContractInterface('OVM_L2CrossDomainMessenger'), + l2RpcProvider + ) + + // Find all SentMessage events created in the same block as the given transaction. This is + // reliable because we should only have one transaction per block. + const sentMessageEvents = await l2CrossDomainMessenger.queryFilter( + l2CrossDomainMessenger.filters.SentMessage(), + transaction.blockNumber, + transaction.blockNumber + ) + + // Decode the messages and turn them into a nicer struct. + const sentMessages = sentMessageEvents.map((sentMessageEvent) => { + const encodedMessage = sentMessageEvent.args.message + const decodedMessage = l2CrossDomainMessenger.interface.decodeFunctionData( + 'relayMessage', + encodedMessage + ) + + return { + target: decodedMessage._target, + sender: decodedMessage._sender, + message: decodedMessage._message, + messageNonce: decodedMessage._messageNonce.toNumber(), + } + }) + + return sentMessages +} + +/** + * Encodes a cross domain message. + * @param message Message to encode. + * @returns Encoded message. + */ +const encodeCrossDomainMessage = (message: CrossDomainMessage): string => { + return getContractInterface( + 'OVM_L2CrossDomainMessenger' + ).encodeFunctionData('relayMessage', [ + message.target, + message.sender, + message.message, + message.messageNonce, + ]) +} + +/** + * Finds the StateBatchAppended event associated with a given L2 transaction. + * @param l1RpcProvider L1 RPC provider. + * @param l1StateCommitmentChainAddress Address of the L1StateCommitmentChain. + * @param l2TransactionIndex Index of the L2 transaction to find a StateBatchAppended event for. + * @returns StateBatchAppended event for the given transaction or null if no such event exists. + */ +export const getStateBatchAppendedEventByTransactionIndex = async ( + l1RpcProvider: ethers.providers.JsonRpcProvider, + l1StateCommitmentChainAddress: string, + l2TransactionIndex: number +): Promise => { + const l1StateCommitmentChain = new ethers.Contract( + l1StateCommitmentChainAddress, + getContractInterface('OVM_StateCommitmentChain'), + l1RpcProvider + ) + + const getStateBatchAppendedEventByBatchIndex = async ( + index: number + ): Promise => { + const eventQueryResult = await l1StateCommitmentChain.queryFilter( + l1StateCommitmentChain.filters.StateBatchAppended(index) + ) + if (eventQueryResult.length === 0) { + return null + } else { + return eventQueryResult[0] + } + } + + const isEventHi = (event: ethers.Event, index: number) => { + const prevTotalElements = event.args._prevTotalElements.toNumber() + return index < prevTotalElements + } + + const isEventLo = (event: ethers.Event, index: number) => { + const prevTotalElements = event.args._prevTotalElements.toNumber() + const batchSize = event.args._batchSize.toNumber() + return index >= prevTotalElements + batchSize + } + + const totalBatches: ethers.BigNumber = await l1StateCommitmentChain.getTotalBatches() + if (totalBatches.eq(0)) { + return null + } + + let lowerBound = 0 + let upperBound = totalBatches.toNumber() - 1 + let batchEvent: ethers.Event | null = await getStateBatchAppendedEventByBatchIndex( + upperBound + ) + + if (isEventLo(batchEvent, l2TransactionIndex)) { + // Upper bound is too low, means this transaction doesn't have a corresponding state batch yet. + return null + } else if (!isEventHi(batchEvent, l2TransactionIndex)) { + // Upper bound is not too low and also not too high. This means the upper bound event is the + // one we're looking for! Return it. + return batchEvent + } + + // Binary search to find the right event. The above checks will guarantee that the event does + // exist and that we'll find it during this search. + while (lowerBound < upperBound) { + const middleOfBounds = Math.floor((lowerBound + upperBound) / 2) + batchEvent = await getStateBatchAppendedEventByBatchIndex(middleOfBounds) + + if (isEventHi(batchEvent, l2TransactionIndex)) { + upperBound = middleOfBounds + } else if (isEventLo(batchEvent, l2TransactionIndex)) { + lowerBound = middleOfBounds + } else { + break + } + } + + return batchEvent +} + +/** + * Finds the full state root batch associated with a given transaction index. + * @param l1RpcProvider L1 RPC provider. + * @param l1StateCommitmentChainAddress Address of the L1StateCommitmentChain. + * @param l2TransactionIndex Index of the L2 transaction to find a state root batch for. + * @returns State root batch associated with the given transaction index or null if no state root + * batch exists. + */ +export const getStateRootBatchByTransactionIndex = async ( + l1RpcProvider: ethers.providers.JsonRpcProvider, + l1StateCommitmentChainAddress: string, + l2TransactionIndex: number +): Promise => { + const l1StateCommitmentChain = new ethers.Contract( + l1StateCommitmentChainAddress, + getContractInterface('OVM_StateCommitmentChain'), + l1RpcProvider + ) + + const stateBatchAppendedEvent = await getStateBatchAppendedEventByTransactionIndex( + l1RpcProvider, + l1StateCommitmentChainAddress, + l2TransactionIndex + ) + if (stateBatchAppendedEvent === null) { + return null + } + + const stateBatchTransaction = await stateBatchAppendedEvent.getTransaction() + const [stateRoots] = l1StateCommitmentChain.interface.decodeFunctionData( + 'appendStateBatch', + stateBatchTransaction.data + ) + + return { + header: { + batchIndex: stateBatchAppendedEvent.args._batchIndex, + batchRoot: stateBatchAppendedEvent.args._batchRoot, + batchSize: stateBatchAppendedEvent.args._batchSize, + prevTotalElements: stateBatchAppendedEvent.args._prevTotalElements, + extraData: stateBatchAppendedEvent.args._extraData, + }, + stateRoots, + } +} + +/** + * Generates a Merkle proof (using the particular scheme we use within Lib_MerkleTree). + * @param leaves Leaves of the merkle tree. + * @param index Index to generate a proof for. + * @returns Merkle proof sibling leaves, as hex strings. + */ +const getMerkleTreeProof = (leaves: string[], index: number): string[] => { + // Our specific Merkle tree implementation requires that the number of leaves is a power of 2. + // If the number of given leaves is less than a power of 2, we need to round up to the next + // available power of 2. We fill the remaining space with the hash of bytes32(0). + const correctedTreeSize = Math.pow(2, Math.ceil(Math.log2(leaves.length))) + const parsedLeaves = [] + for (let i = 0; i < correctedTreeSize; i++) { + if (i < leaves.length) { + parsedLeaves.push(leaves[i]) + } else { + parsedLeaves.push(ethers.utils.keccak256('0x' + '00'.repeat(32))) + } + } + + // merkletreejs prefers things to be Buffers. + const bufLeaves = parsedLeaves.map(fromHexString) + const tree = new MerkleTree( + bufLeaves, + (el: Buffer | string): Buffer => { + return fromHexString(ethers.utils.keccak256(el)) + } + ) + + const proof = tree.getProof(bufLeaves[index], index).map((element: any) => { + return toHexString(element.data) + }) + + return proof +} + +/** + * Generates a Merkle-Patricia trie proof for a given account and storage slot. + * @param l2RpcProvider L2 RPC provider. + * @param blockNumber Block number to generate the proof at. + * @param address Address to generate the proof for. + * @param slot Storage slot to generate the proof for. + * @returns Account proof and storage proof. + */ +const getStateTrieProof = async ( + l2RpcProvider: ethers.providers.JsonRpcProvider, + blockNumber: number, + address: string, + slot: string +): Promise => { + const proof = await l2RpcProvider.send('eth_getProof', [ + address, + [slot], + toRpcHexString(blockNumber), + ]) + + return { + accountProof: toHexString(rlp.encode(proof.accountProof)), + storageProof: toHexString(rlp.encode(proof.storageProof[0].proof)), + } +} + +/** + * Finds all L2 => L1 messages sent in a given L2 transaction and generates proofs for each of + * those messages. + * @param l1RpcProvider L1 RPC provider. + * @param l2RpcProvider L2 RPC provider. + * @param l1StateCommitmentChainAddress Address of the StateCommitmentChain. + * @param l2CrossDomainMessengerAddress Address of the L2CrossDomainMessenger. + * @param l2TransactionHash L2 transaction hash to generate a relay transaction for. + * @returns An array of messages sent in the transaction and a proof of inclusion for each. + */ +export const getMessagesAndProofsForL2Transaction = async ( + l1RpcProvider: ethers.providers.JsonRpcProvider, + l2RpcProvider: ethers.providers.JsonRpcProvider, + l1StateCommitmentChainAddress: string, + l2CrossDomainMessengerAddress: string, + l2TransactionHash: string +): Promise => { + const l2Transaction = await l2RpcProvider.getTransaction(l2TransactionHash) + if (l2Transaction === null) { + throw new Error(`unable to find tx with hash: ${l2TransactionHash}`) + } + + // Need to find the state batch for the given transaction. If no state batch has been published + // yet then we will not be able to generate a proof. + const batch = await getStateRootBatchByTransactionIndex( + l1RpcProvider, + l1StateCommitmentChainAddress, + l2Transaction.blockNumber - NUM_L2_GENESIS_BLOCKS + ) + if (batch === null) { + throw new Error( + `unable to find state root batch for tx with hash: ${l2TransactionHash}` + ) + } + + // Adjust the transaction index based on the number of L2 genesis block we have. "Index" here + // refers to the position of the transaction within the *Canonical Transaction Chain*. + const l2TransactionIndex = l2Transaction.blockNumber - NUM_L2_GENESIS_BLOCKS + + // Here the index refers to the position of the state root that corresponds to this transaction + // within the batch of state roots in which that state root was published. + const txIndexInBatch = + l2TransactionIndex - batch.header.prevTotalElements.toNumber() + + // Find every message that was sent during this transaction. We'll then attach a proof for each. + const messages = await getMessagesByTransactionHash( + l2RpcProvider, + l2CrossDomainMessengerAddress, + l2TransactionHash + ) + + const messagePairs: CrossDomainMessagePair[] = [] + for (const message of messages) { + // We need to calculate the specific storage slot that demonstrates that this message was + // actually included in the L2 chain. The following calculation is based on the fact that + // messages are stored in the following mapping on L2: + // https://github.com/ethereum-optimism/optimism/blob/c84d3450225306abbb39b4e7d6d82424341df2be/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_L2ToL1MessagePasser.sol#L23 + // You can read more about how Solidity storage slots are computed for mappings here: + // https://docs.soliditylang.org/en/v0.8.4/internals/layout_in_storage.html#mappings-and-dynamic-arrays + const messageSlot = ethers.utils.keccak256( + ethers.utils.keccak256( + encodeCrossDomainMessage(message) + + remove0x(l2CrossDomainMessengerAddress) + ) + '00'.repeat(32) + ) + + // We need a Merkle trie proof for the given storage slot. This allows us to prove to L1 that + // the message was actually sent on L2. + const stateTrieProof = await getStateTrieProof( + l2RpcProvider, + l2Transaction.blockNumber, + predeploys.OVM_L2ToL1MessagePasser, + messageSlot + ) + + // State roots are published in batches to L1 and correspond 1:1 to transactions. We compute a + // Merkle root for these state roots so that we only need to store the minimum amount of + // information on-chain. So we need to create a Merkle proof for the specific state root that + // corresponds to this transaction. + const stateRootMerkleProof = getMerkleTreeProof( + batch.stateRoots, + txIndexInBatch + ) + + // We now have enough information to create the message proof. + const proof: CrossDomainMessageProof = { + stateRoot: batch.stateRoots[txIndexInBatch], + stateRootBatchHeader: batch.header, + stateRootProof: { + index: txIndexInBatch, + siblings: stateRootMerkleProof, + }, + stateTrieWitness: stateTrieProof.accountProof, + storageTrieWitness: stateTrieProof.storageProof, + } + + messagePairs.push({ + message, + proof, + }) + } + + return messagePairs +} diff --git a/packages/message-relayer/test/setup.ts b/packages/message-relayer/test/setup.ts new file mode 100644 index 000000000000..f5952afdbe6b --- /dev/null +++ b/packages/message-relayer/test/setup.ts @@ -0,0 +1,12 @@ +/* External Imports */ +import chai = require('chai') +import Mocha from 'mocha' +import { solidity } from 'ethereum-waffle' +import chaiAsPromised from 'chai-as-promised' + +chai.use(solidity) +chai.use(chaiAsPromised) +const should = chai.should() +const expect = chai.expect + +export { should, expect, Mocha } diff --git a/packages/message-relayer/test/test-contracts/MockL2CrossDomainMessenger.sol b/packages/message-relayer/test/test-contracts/MockL2CrossDomainMessenger.sol new file mode 100644 index 000000000000..7545691229b8 --- /dev/null +++ b/packages/message-relayer/test/test-contracts/MockL2CrossDomainMessenger.sol @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: MIT +pragma solidity >0.7.0 <0.9.0; +pragma experimental ABIEncoderV2; + +contract MockL2CrossDomainMessenger { + struct MessageData { + address target; + address sender; + bytes message; + uint256 messageNonce; + } + + event SentMessage(bytes message); + + function emitSentMessageEvent( + MessageData memory _message + ) + public + { + emit SentMessage( + abi.encodeWithSignature( + "relayMessage(address,address,bytes,uint256)", + _message.target, + _message.sender, + _message.message, + _message.messageNonce + ) + ); + } + + function emitMultipleSentMessageEvents( + MessageData[] memory _messages + ) + public + { + for (uint256 i = 0; i < _messages.length; i++) { + emitSentMessageEvent( + _messages[i] + ); + } + } + + function doNothing() public {} +} diff --git a/packages/message-relayer/test/unit-tests/relay-tx.spec.ts b/packages/message-relayer/test/unit-tests/relay-tx.spec.ts new file mode 100644 index 000000000000..1745a620f5f2 --- /dev/null +++ b/packages/message-relayer/test/unit-tests/relay-tx.spec.ts @@ -0,0 +1,377 @@ +import { expect } from '../setup' + +/* Imports: External */ +import hre from 'hardhat' +import { Contract, Signer } from 'ethers' +import { getContractFactory } from '@eth-optimism/contracts' +import { smockit } from '@eth-optimism/smock' +import { toPlainObject } from 'lodash' + +/* Imports: Internal */ +import { + getMessagesAndProofsForL2Transaction, + getStateRootBatchByTransactionIndex, + getStateBatchAppendedEventByTransactionIndex, + getMessagesByTransactionHash, +} from '../../src/relay-tx' + +describe('relay transaction generation functions', () => { + const ethers = (hre as any).ethers + const l1RpcProvider = ethers.provider + const l2RpcProvider = ethers.provider + + let signer1: Signer + before(async () => { + ;[signer1] = await ethers.getSigners() + }) + + let MockL2CrossDomainMessenger: Contract + beforeEach(async () => { + const factory = await ethers.getContractFactory( + 'MockL2CrossDomainMessenger' + ) + MockL2CrossDomainMessenger = await factory.deploy() + }) + + let StateCommitmentChain: Contract + beforeEach(async () => { + const factory1 = getContractFactory('Lib_AddressManager') + const factory2 = getContractFactory('OVM_ChainStorageContainer') + const factory3 = getContractFactory('OVM_StateCommitmentChain') + + const mockBondManager = await smockit(getContractFactory('OVM_BondManager')) + const mockCanonicalTransactionChain = await smockit( + getContractFactory('OVM_CanonicalTransactionChain') + ) + + mockBondManager.smocked.isCollateralized.will.return.with(true) + mockCanonicalTransactionChain.smocked.getTotalElements.will.return.with( + 999999 + ) + + const AddressManager = await factory1.connect(signer1).deploy() + const ChainStorageContainer = await factory2 + .connect(signer1) + .deploy(AddressManager.address, 'OVM_StateCommitmentChain') + StateCommitmentChain = await factory3 + .connect(signer1) + .deploy(AddressManager.address, 0, 0) + + await AddressManager.setAddress( + 'OVM_ChainStorageContainer:SCC:batches', + ChainStorageContainer.address + ) + + await AddressManager.setAddress( + 'OVM_StateCommitmentChain', + StateCommitmentChain.address + ) + + await AddressManager.setAddress('OVM_BondManager', mockBondManager.address) + + await AddressManager.setAddress( + 'OVM_CanonicalTransactionChain', + mockCanonicalTransactionChain.address + ) + }) + + describe('getMessageByTransactionHash', () => { + it('should throw an error if a transaction with the given hash does not exist', async () => { + await expect( + getMessagesByTransactionHash( + l2RpcProvider, + MockL2CrossDomainMessenger.address, + ethers.constants.HashZero + ) + ).to.be.rejected + }) + + it('should return null if the transaction did not emit a SentMessage event', async () => { + const tx = await MockL2CrossDomainMessenger.doNothing() + + expect( + await getMessagesByTransactionHash( + l2RpcProvider, + MockL2CrossDomainMessenger.address, + tx.hash + ) + ).to.deep.equal([]) + }) + + it('should return the parsed event if the transaction emitted exactly one SentMessage event', async () => { + const message = { + target: ethers.constants.AddressZero, + sender: ethers.constants.AddressZero, + message: '0x', + messageNonce: 0, + } + const tx = await MockL2CrossDomainMessenger.emitSentMessageEvent(message) + + expect( + await getMessagesByTransactionHash( + l2RpcProvider, + MockL2CrossDomainMessenger.address, + tx.hash + ) + ).to.deep.equal([message]) + }) + + it('should return the parsed events if the transaction emitted more than one SentMessage event', async () => { + const messages = [ + { + target: ethers.constants.AddressZero, + sender: ethers.constants.AddressZero, + message: '0x', + messageNonce: 0, + }, + { + target: ethers.constants.AddressZero, + sender: ethers.constants.AddressZero, + message: '0x', + messageNonce: 1, + }, + ] + + const tx = await MockL2CrossDomainMessenger.emitMultipleSentMessageEvents( + messages + ) + + expect( + await getMessagesByTransactionHash( + l2RpcProvider, + MockL2CrossDomainMessenger.address, + tx.hash + ) + ).to.deep.equal(messages) + }) + }) + + describe('getStateBatchAppendedEventByTransactionIndex', () => { + it('should return null when there are no batches yet', async () => { + expect( + await getStateBatchAppendedEventByTransactionIndex( + l1RpcProvider, + StateCommitmentChain.address, + 0 + ) + ).to.equal(null) + }) + + it('should return null if a batch for the index does not exist', async () => { + // Should have a total of 1 element now. + await StateCommitmentChain.appendStateBatch( + [ethers.constants.HashZero], + 0 + ) + + expect( + await getStateBatchAppendedEventByTransactionIndex( + l1RpcProvider, + StateCommitmentChain.address, + 1 // Index 0 is ok but 1 should return null + ) + ).to.equal(null) + }) + + it('should return the batch if the index is part of the first batch', async () => { + // 5 elements + await StateCommitmentChain.appendStateBatch( + [ + ethers.constants.HashZero, + ethers.constants.HashZero, + ethers.constants.HashZero, + ethers.constants.HashZero, + ethers.constants.HashZero, + ], + 0 + ) + + // Add another 5 so we have two batches and can isolate tests against the first. + await StateCommitmentChain.appendStateBatch( + [ + ethers.constants.HashZero, + ethers.constants.HashZero, + ethers.constants.HashZero, + ethers.constants.HashZero, + ethers.constants.HashZero, + ], + 5 + ) + + const event = await getStateBatchAppendedEventByTransactionIndex( + l1RpcProvider, + StateCommitmentChain.address, + 1 + ) + + expect(toPlainObject(event.args)).to.deep.include({ + _batchIndex: ethers.BigNumber.from(0), + _batchSize: ethers.BigNumber.from(5), + _prevTotalElements: ethers.BigNumber.from(0), + }) + }) + + it('should return the batch if the index is part of the last batch', async () => { + // 5 elements + await StateCommitmentChain.appendStateBatch( + [ + ethers.constants.HashZero, + ethers.constants.HashZero, + ethers.constants.HashZero, + ethers.constants.HashZero, + ethers.constants.HashZero, + ], + 0 + ) + + // Add another 5 so we have two batches and can isolate tests against the second. + await StateCommitmentChain.appendStateBatch( + [ + ethers.constants.HashZero, + ethers.constants.HashZero, + ethers.constants.HashZero, + ethers.constants.HashZero, + ethers.constants.HashZero, + ], + 5 + ) + + const event = await getStateBatchAppendedEventByTransactionIndex( + l1RpcProvider, + StateCommitmentChain.address, + 7 + ) + + expect(toPlainObject(event.args)).to.deep.include({ + _batchIndex: ethers.BigNumber.from(1), + _batchSize: ethers.BigNumber.from(5), + _prevTotalElements: ethers.BigNumber.from(5), + }) + }) + + for (const numBatches of [1, 2, 8]) { + const elementsPerBatch = 8 + describe(`when there are ${numBatches} batch(es) of ${elementsPerBatch} elements each`, () => { + const totalElements = numBatches * elementsPerBatch + beforeEach(async () => { + for (let i = 0; i < numBatches; i++) { + await StateCommitmentChain.appendStateBatch( + new Array(elementsPerBatch).fill(ethers.constants.HashZero), + i * elementsPerBatch + ) + } + }) + + for (let i = 0; i < totalElements; i += elementsPerBatch) { + it(`should be able to get the correct event for the ${i}th/st/rd/whatever element`, async () => { + const event = await getStateBatchAppendedEventByTransactionIndex( + l1RpcProvider, + StateCommitmentChain.address, + i + ) + + expect(toPlainObject(event.args)).to.deep.include({ + _batchIndex: ethers.BigNumber.from(i / elementsPerBatch), + _batchSize: ethers.BigNumber.from(elementsPerBatch), + _prevTotalElements: ethers.BigNumber.from(i), + }) + }) + } + }) + } + }) + + describe('getStateRootBatchByTransactionIndex', () => { + it('should return null if a batch for the index does not exist', async () => { + // Should have a total of 1 element now. + await StateCommitmentChain.appendStateBatch( + [ethers.constants.HashZero], + 0 + ) + + expect( + await getStateRootBatchByTransactionIndex( + l1RpcProvider, + StateCommitmentChain.address, + 1 // Index 0 is ok but 1 should return null + ) + ).to.equal(null) + }) + + it('should return the full batch for a given index when it exists', async () => { + // Should have a total of 1 element now. + await StateCommitmentChain.appendStateBatch( + [ethers.constants.HashZero], + 0 + ) + + const batch = await getStateRootBatchByTransactionIndex( + l1RpcProvider, + StateCommitmentChain.address, + 0 // Index 0 is ok but 1 should return null + ) + + expect(batch.header).to.deep.include({ + batchIndex: ethers.BigNumber.from(0), + batchSize: ethers.BigNumber.from(1), + prevTotalElements: ethers.BigNumber.from(0), + }) + + expect(batch.stateRoots).to.deep.equal([ethers.constants.HashZero]) + }) + }) + + describe('makeRelayTransactionData', () => { + it('should throw an error if the transaction does not exist', async () => { + await expect( + getMessagesAndProofsForL2Transaction( + l1RpcProvider, + l2RpcProvider, + StateCommitmentChain.address, + MockL2CrossDomainMessenger.address, + ethers.constants.HashZero + ) + ).to.be.rejected + }) + + it('should throw an error if the transaction did not send a message', async () => { + const tx = await MockL2CrossDomainMessenger.doNothing() + + await expect( + getMessagesAndProofsForL2Transaction( + l1RpcProvider, + l2RpcProvider, + StateCommitmentChain.address, + MockL2CrossDomainMessenger.address, + tx.hash + ) + ).to.be.rejected + }) + + it('should throw an error if the corresponding state batch has not been submitted', async () => { + const tx = await MockL2CrossDomainMessenger.emitSentMessageEvent({ + target: ethers.constants.AddressZero, + sender: ethers.constants.AddressZero, + message: '0x', + messageNonce: 0, + }) + + await expect( + getMessagesAndProofsForL2Transaction( + l1RpcProvider, + l2RpcProvider, + StateCommitmentChain.address, + MockL2CrossDomainMessenger.address, + tx.hash + ) + ).to.be.rejected + }) + + // Unfortunately this is hard to test here because hardhat doesn't support eth_getProof. + // Because this function is embedded into the message relayer, we should be able to use + // integration tests to sufficiently test this. + it.skip('should otherwise return the encoded transaction data', () => { + // TODO? + }) + }) +}) diff --git a/yarn.lock b/yarn.lock index eaf60064a1bc..9c0b57790d9f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2248,6 +2248,13 @@ dependencies: "@types/chai" "*" +"@types/chai-as-promised@^7.1.4": + version "7.1.4" + resolved "https://registry.yarnpkg.com/@types/chai-as-promised/-/chai-as-promised-7.1.4.tgz#caf64e76fb056b8c8ced4b761ed499272b737601" + integrity sha512-1y3L1cHePcIm5vXkh1DSGf/zQq5n5xDKG1fpCvf18+uOkpce0Z1ozNFPkyWsVswK7ntN1sZBw3oU6gmN+pDUcA== + dependencies: + "@types/chai" "*" + "@types/chai@*", "@types/chai@^4.1.7": version "4.2.16" resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.2.16.tgz#f09cc36e18d28274f942e7201147cce34d97e8c8" @@ -7178,6 +7185,57 @@ hardhat@^2.2.1: uuid "^3.3.2" ws "^7.2.1" +hardhat@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.3.0.tgz#5c29f8b4d08155c3dc8c908af9713fd5079522d5" + integrity sha512-nc4ro2bM4wPaA6/0Y22o5F5QrifQk2KCyPUUKLPUeFFZoGNGYB8vmeW/k9gV9DdMukdWTzfYlKc2Jn4bfb6tDQ== + dependencies: + "@ethereumjs/block" "^3.2.1" + "@ethereumjs/blockchain" "^5.2.1" + "@ethereumjs/common" "^2.2.0" + "@ethereumjs/tx" "^3.1.3" + "@ethereumjs/vm" "^5.3.2" + "@sentry/node" "^5.18.1" + "@solidity-parser/parser" "^0.11.0" + "@types/bn.js" "^5.1.0" + "@types/lru-cache" "^5.1.0" + abort-controller "^3.0.0" + adm-zip "^0.4.16" + ansi-escapes "^4.3.0" + chalk "^2.4.2" + chokidar "^3.4.0" + ci-info "^2.0.0" + debug "^4.1.1" + enquirer "^2.3.0" + env-paths "^2.2.0" + eth-sig-util "^2.5.2" + ethereum-cryptography "^0.1.2" + ethereumjs-abi "^0.6.8" + ethereumjs-util "^7.0.10" + find-up "^2.1.0" + fp-ts "1.19.3" + fs-extra "^7.0.1" + glob "^7.1.3" + immutable "^4.0.0-rc.12" + io-ts "1.10.4" + lodash "^4.17.11" + merkle-patricia-tree "^4.1.0" + mnemonist "^0.38.0" + mocha "^7.1.2" + node-fetch "^2.6.0" + qs "^6.7.0" + raw-body "^2.4.1" + resolve "1.17.0" + semver "^6.3.0" + slash "^3.0.0" + solc "0.7.3" + source-map-support "^0.5.13" + stacktrace-parser "^0.1.10" + "true-case-path" "^2.2.1" + tsort "0.0.1" + uuid "^3.3.2" + ws "^7.2.1" + has-ansi@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" From 1293825cee3bd79ec3cd66a985b77febcbf66824 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Tue, 1 Jun 2021 16:12:33 -0700 Subject: [PATCH 024/125] backwards compatible dtl syncing (#986) * kovan: fix attempt * kovan: db fix * kovan: types are strings from db * l2geth: parse things as strings * chore: add changeset * dtl: also stringify the range query * geth: dereference * geth: assign err * dtl: handle null * dtl: fix unit tests --- .changeset/nasty-dots-grow.md | 6 ++++ l2geth/rollup/client.go | 4 +-- .../src/db/transport-db.ts | 29 +++++++++++++++++-- .../handlers/sequencer-batch-appended.ts | 6 ++-- .../handlers/transaction-enqueued.ts | 2 +- .../l2-ingestion/handlers/transaction.ts | 4 +-- .../src/types/database-types.ts | 4 +-- .../src/types/event-handler-types.ts | 2 +- .../handlers/sequencer-batch-appended.spec.ts | 2 +- .../handlers/transaction-enqueued.spec.ts | 4 +-- 10 files changed, 46 insertions(+), 17 deletions(-) create mode 100644 .changeset/nasty-dots-grow.md diff --git a/.changeset/nasty-dots-grow.md b/.changeset/nasty-dots-grow.md new file mode 100644 index 000000000000..417ca35c1d1f --- /dev/null +++ b/.changeset/nasty-dots-grow.md @@ -0,0 +1,6 @@ +--- +'@eth-optimism/l2geth': patch +'@eth-optimism/data-transport-layer': patch +--- + +Fix gasLimit overflow diff --git a/l2geth/rollup/client.go b/l2geth/rollup/client.go index 2e6402bfd4e6..4a1a0f5b14e5 100644 --- a/l2geth/rollup/client.go +++ b/l2geth/rollup/client.go @@ -69,7 +69,7 @@ type transaction struct { BlockNumber uint64 `json:"blockNumber"` Timestamp uint64 `json:"timestamp"` Value hexutil.Uint64 `json:"value"` - GasLimit uint64 `json:"gasLimit"` + GasLimit uint64 `json:"gasLimit,string"` Target common.Address `json:"target"` Origin *common.Address `json:"origin"` Data hexutil.Bytes `json:"data"` @@ -84,7 +84,7 @@ type Enqueue struct { Index *uint64 `json:"ctcIndex"` Target *common.Address `json:"target"` Data *hexutil.Bytes `json:"data"` - GasLimit *uint64 `json:"gasLimit"` + GasLimit *uint64 `json:"gasLimit,string"` Origin *common.Address `json:"origin"` BlockNumber *uint64 `json:"blockNumber"` Timestamp *uint64 `json:"timestamp"` diff --git a/packages/data-transport-layer/src/db/transport-db.ts b/packages/data-transport-layer/src/db/transport-db.ts index be80e6314b55..777ba4423dde 100644 --- a/packages/data-transport-layer/src/db/transport-db.ts +++ b/packages/data-transport-layer/src/db/transport-db.ts @@ -379,8 +379,9 @@ export class TransportDB { if (index === null) { return null } - - return this.db.get(`${key}:index`, index) + let entry = await this.db.get(`${key}:index`, index) + entry = stringify(entry) + return entry } private async _getEntries( @@ -388,6 +389,28 @@ export class TransportDB { startIndex: number, endIndex: number ): Promise { - return this.db.range(`${key}:index`, startIndex, endIndex) + const entries = await this.db.range( + `${key}:index`, + startIndex, + endIndex + ) + const results = [] + for (const entry of entries) { + results.push(stringify(entry)) + } + return results + } +} + +function stringify(entry) { + if (entry === null || entry === undefined) { + return entry + } + if (entry.gasLimit) { + entry.gasLimit = BigNumber.from(entry.gasLimit).toString() + } + if (entry.decoded) { + entry.decoded.gasLimit = BigNumber.from(entry.decoded.gasLimit).toString() } + return entry } diff --git a/packages/data-transport-layer/src/services/l1-ingestion/handlers/sequencer-batch-appended.ts b/packages/data-transport-layer/src/services/l1-ingestion/handlers/sequencer-batch-appended.ts index 71b483f4dcde..23230efd02fe 100644 --- a/packages/data-transport-layer/src/services/l1-ingestion/handlers/sequencer-batch-appended.ts +++ b/packages/data-transport-layer/src/services/l1-ingestion/handlers/sequencer-batch-appended.ts @@ -69,7 +69,7 @@ export const handleEventsSequencerBatchAppended: EventHandlerSet< submitter: l1Transaction.from, l1TransactionHash: l1Transaction.hash, l1TransactionData: l1Transaction.data, - gasLimit: SEQUENCER_GAS_LIMIT, + gasLimit: `${SEQUENCER_GAS_LIMIT}`, prevTotalElements: batchSubmissionEvent.args._prevTotalElements, batchIndex: batchSubmissionEvent.args._batchIndex, @@ -115,7 +115,7 @@ export const handleEventsSequencerBatchAppended: EventHandlerSet< batchIndex: extraData.batchIndex.toNumber(), blockNumber: BigNumber.from(context.blockNumber).toNumber(), timestamp: BigNumber.from(context.timestamp).toNumber(), - gasLimit: BigNumber.from(extraData.gasLimit).toNumber(), + gasLimit: BigNumber.from(extraData.gasLimit).toString(), target: SEQUENCER_ENTRYPOINT_ADDRESS, origin: null, data: toHexString(sequencerTransaction), @@ -147,7 +147,7 @@ export const handleEventsSequencerBatchAppended: EventHandlerSet< batchIndex: extraData.batchIndex.toNumber(), blockNumber: BigNumber.from(0).toNumber(), timestamp: BigNumber.from(0).toNumber(), - gasLimit: BigNumber.from(0).toNumber(), + gasLimit: BigNumber.from(0).toString(), target: constants.AddressZero, origin: constants.AddressZero, data: '0x', diff --git a/packages/data-transport-layer/src/services/l1-ingestion/handlers/transaction-enqueued.ts b/packages/data-transport-layer/src/services/l1-ingestion/handlers/transaction-enqueued.ts index e343a7e78fbf..7e6bcb9b2b66 100644 --- a/packages/data-transport-layer/src/services/l1-ingestion/handlers/transaction-enqueued.ts +++ b/packages/data-transport-layer/src/services/l1-ingestion/handlers/transaction-enqueued.ts @@ -17,7 +17,7 @@ export const handleEventsTransactionEnqueued: EventHandlerSet< index: event.args._queueIndex.toNumber(), target: event.args._target, data: event.args._data, - gasLimit: event.args._gasLimit.toNumber(), + gasLimit: event.args._gasLimit.toString(), origin: event.args._l1TxOrigin, blockNumber: BigNumber.from(event.blockNumber).toNumber(), timestamp: event.args._timestamp.toNumber(), diff --git a/packages/data-transport-layer/src/services/l2-ingestion/handlers/transaction.ts b/packages/data-transport-layer/src/services/l2-ingestion/handlers/transaction.ts index 0022afc285d7..be127cc2d0dd 100644 --- a/packages/data-transport-layer/src/services/l2-ingestion/handlers/transaction.ts +++ b/packages/data-transport-layer/src/services/l2-ingestion/handlers/transaction.ts @@ -57,7 +57,7 @@ export const handleSequencerBlock = { transactionEntry = { ...transactionEntry, - gasLimit: SEQUENCER_GAS_LIMIT, // ? + gasLimit: `${SEQUENCER_GAS_LIMIT}`, // ? target: SEQUENCER_ENTRYPOINT_ADDRESS, origin: null, data: serialize( @@ -82,7 +82,7 @@ export const handleSequencerBlock = { } else { transactionEntry = { ...transactionEntry, - gasLimit: BigNumber.from(transaction.gas).toNumber(), + gasLimit: BigNumber.from(transaction.gas).toString(), target: ethers.utils.getAddress(transaction.to), origin: ethers.utils.getAddress(transaction.l1TxOrigin), data: transaction.input, diff --git a/packages/data-transport-layer/src/types/database-types.ts b/packages/data-transport-layer/src/types/database-types.ts index 32e52288ee4f..470b402c3590 100644 --- a/packages/data-transport-layer/src/types/database-types.ts +++ b/packages/data-transport-layer/src/types/database-types.ts @@ -16,7 +16,7 @@ export interface EnqueueEntry { index: number target: string data: string - gasLimit: number + gasLimit: string origin: string blockNumber: number timestamp: number @@ -28,7 +28,7 @@ export interface TransactionEntry { data: string blockNumber: number timestamp: number - gasLimit: number + gasLimit: string target: string origin: string value: string diff --git a/packages/data-transport-layer/src/types/event-handler-types.ts b/packages/data-transport-layer/src/types/event-handler-types.ts index 8b2e190b6efd..82bf5bf7f198 100644 --- a/packages/data-transport-layer/src/types/event-handler-types.ts +++ b/packages/data-transport-layer/src/types/event-handler-types.ts @@ -40,7 +40,7 @@ export interface SequencerBatchAppendedExtraData { submitter: string l1TransactionData: string l1TransactionHash: string - gasLimit: number + gasLimit: string // Stuff from TransactionBatchAppended. prevTotalElements: BigNumber diff --git a/packages/data-transport-layer/test/unit-tests/services/l1-ingestion/handlers/sequencer-batch-appended.spec.ts b/packages/data-transport-layer/test/unit-tests/services/l1-ingestion/handlers/sequencer-batch-appended.spec.ts index 0a6690bf832e..813f3c65c63a 100644 --- a/packages/data-transport-layer/test/unit-tests/services/l1-ingestion/handlers/sequencer-batch-appended.spec.ts +++ b/packages/data-transport-layer/test/unit-tests/services/l1-ingestion/handlers/sequencer-batch-appended.spec.ts @@ -18,7 +18,7 @@ describe('Event Handlers: OVM_CanonicalTransactionChain.SequencerBatchAppended', submitter: '0xfd7d4de366850c08ee2cba32d851385a3071ec8d', l1TransactionHash: '0x6effe006836b841205ace4d99d7ae1b74ee96aac499a3f358b97fccd32ee9af2', - gasLimit: 548976, + gasLimit: '548976', prevTotalElements: BigNumber.from(73677), batchIndex: BigNumber.from(743), batchSize: BigNumber.from(101), diff --git a/packages/data-transport-layer/test/unit-tests/services/l1-ingestion/handlers/transaction-enqueued.spec.ts b/packages/data-transport-layer/test/unit-tests/services/l1-ingestion/handlers/transaction-enqueued.spec.ts index 52e5da27739e..b14d6ba505b9 100644 --- a/packages/data-transport-layer/test/unit-tests/services/l1-ingestion/handlers/transaction-enqueued.spec.ts +++ b/packages/data-transport-layer/test/unit-tests/services/l1-ingestion/handlers/transaction-enqueued.spec.ts @@ -93,7 +93,7 @@ describe('Event Handlers: OVM_CanonicalTransactionChain.TransactionEnqueued', () } }) - it('should have a gasLimit equal to the integer value of the _gasLimit argument', () => { + it('should have a gasLimit equal to the string value of the _gasLimit argument', () => { for ( let i = 0; i < Number.MAX_SAFE_INTEGER; @@ -113,7 +113,7 @@ describe('Event Handlers: OVM_CanonicalTransactionChain.TransactionEnqueued', () const output1 = handleEventsTransactionEnqueued.parseEvent(...input1) - const expected1 = BigNumber.from(i).toNumber() + const expected1 = BigNumber.from(i).toString() expect(output1).to.have.property('gasLimit', expected1) } From 5e3c5d1c65ef3352947989ba9f51a1047bf7ba0c Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Tue, 1 Jun 2021 21:01:58 -0400 Subject: [PATCH 025/125] fix[smock]: fix broken call assertions for overloaded functions (#996) * fix[smock]: fix broken call assertions for overloaded functions * chore: add changeset * minor correction and add a test * add a test for non-overloaded functions --- .changeset/cool-baboons-guess.md | 5 ++ packages/smock/src/smockit/smockit.ts | 11 ++- .../test/contracts/TestHelpers_MockCaller.sol | 8 +++ .../test/smockit/call-assertions.spec.ts | 72 +++++++++++++++++++ 4 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 .changeset/cool-baboons-guess.md create mode 100644 packages/smock/test/contracts/TestHelpers_MockCaller.sol create mode 100644 packages/smock/test/smockit/call-assertions.spec.ts diff --git a/.changeset/cool-baboons-guess.md b/.changeset/cool-baboons-guess.md new file mode 100644 index 000000000000..aa0ea6cea3e9 --- /dev/null +++ b/.changeset/cool-baboons-guess.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/smock': patch +--- + +Fixes a bug that would break call assertions for overloaded smocked functions diff --git a/packages/smock/src/smockit/smockit.ts b/packages/smock/src/smockit/smockit.ts index 9ca98ba8c087..1673064518aa 100644 --- a/packages/smock/src/smockit/smockit.ts +++ b/packages/smock/src/smockit/smockit.ts @@ -79,18 +79,25 @@ const smockifyFunction = ( let data: any = toHexString(calldataBuf) try { - data = contract.interface.decodeFunctionData(fragment.name, data) + data = contract.interface.decodeFunctionData( + fragment.format(), + data + ) } catch (e) { console.error(e) } return { functionName: fragment.name, + functionSignature: fragment.format(), data, } }) .filter((functionResult: any) => { - return functionResult.functionName === functionName + return ( + functionResult.functionName === functionName || + functionResult.functionSignature === functionName + ) }) .map((functionResult: any) => { return functionResult.data diff --git a/packages/smock/test/contracts/TestHelpers_MockCaller.sol b/packages/smock/test/contracts/TestHelpers_MockCaller.sol new file mode 100644 index 000000000000..818f3d77087a --- /dev/null +++ b/packages/smock/test/contracts/TestHelpers_MockCaller.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.7.0; + +contract TestHelpers_MockCaller { + function callMock(address _target, bytes memory _data) public { + _target.call(_data); + } +} diff --git a/packages/smock/test/smockit/call-assertions.spec.ts b/packages/smock/test/smockit/call-assertions.spec.ts new file mode 100644 index 000000000000..f4c920410669 --- /dev/null +++ b/packages/smock/test/smockit/call-assertions.spec.ts @@ -0,0 +1,72 @@ +/* Imports: External */ +import hre from 'hardhat' +import { expect } from 'chai' +import { Contract } from 'ethers' + +/* Imports: Internal */ +import { MockContract, smockit } from '../../src' + +describe('[smock]: call assertion tests', () => { + const ethers = (hre as any).ethers + + let mock: MockContract + beforeEach(async () => { + mock = await smockit('TestHelpers_BasicReturnContract') + }) + + let mockCaller: Contract + before(async () => { + const mockCallerFactory = await ethers.getContractFactory( + 'TestHelpers_MockCaller' + ) + mockCaller = await mockCallerFactory.deploy() + }) + + describe('call assertions for functions', () => { + it('should be able to make assertions about a non-overloaded function', async () => { + mock.smocked.getInputtedUint256.will.return.with(0) + + const expected1 = ethers.BigNumber.from(1234) + await mockCaller.callMock( + mock.address, + mock.interface.encodeFunctionData('getInputtedUint256(uint256)', [ + expected1, + ]) + ) + + expect(mock.smocked.getInputtedUint256.calls[0]).to.deep.equal([ + expected1, + ]) + }) + + it('should be able to make assertions about both versions of an overloaded function', async () => { + mock.smocked['overloadedFunction(uint256)'].will.return.with(0) + mock.smocked['overloadedFunction(uint256,uint256)'].will.return.with(0) + + const expected1 = ethers.BigNumber.from(1234) + await mockCaller.callMock( + mock.address, + mock.interface.encodeFunctionData('overloadedFunction(uint256)', [ + expected1, + ]) + ) + + expect( + mock.smocked['overloadedFunction(uint256)'].calls[0] + ).to.deep.equal([expected1]) + + const expected2 = ethers.BigNumber.from(5678) + await mockCaller.callMock( + mock.address, + mock.interface.encodeFunctionData( + 'overloadedFunction(uint256,uint256)', + [expected2, expected2] + ) + ) + + expect( + mock.smocked['overloadedFunction(uint256,uint256)'].calls[0] + ).to.deep.equal([expected2, expected2]) + }) + }) +}) From a41311c9c91543e84f611360184668ee1d994a38 Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Tue, 1 Jun 2021 21:55:54 -0400 Subject: [PATCH 026/125] fix[message-relayer]: fix failing test because of merge with develop (#1000) --- packages/message-relayer/test/unit-tests/relay-tx.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/message-relayer/test/unit-tests/relay-tx.spec.ts b/packages/message-relayer/test/unit-tests/relay-tx.spec.ts index 1745a620f5f2..de668f24898d 100644 --- a/packages/message-relayer/test/unit-tests/relay-tx.spec.ts +++ b/packages/message-relayer/test/unit-tests/relay-tx.spec.ts @@ -58,7 +58,7 @@ describe('relay transaction generation functions', () => { .deploy(AddressManager.address, 0, 0) await AddressManager.setAddress( - 'OVM_ChainStorageContainer:SCC:batches', + 'OVM_ChainStorageContainer-SCC-batches', ChainStorageContainer.address ) From 064c03afb0afef9a7151ef71d441c918266633ac Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Tue, 1 Jun 2021 22:19:16 -0400 Subject: [PATCH 027/125] fix[message-relayer]: remove spreadsheet mode (#998) * fix[message-relayer]: remove spreadsheet mode * chore: add changeset --- .changeset/ten-spiders-boil.md | 5 + packages/message-relayer/package.json | 2 - packages/message-relayer/src/exec/run.ts | 31 ----- packages/message-relayer/src/service.ts | 139 +++++++------------- packages/message-relayer/src/spreadsheet.ts | 25 ---- yarn.lock | 113 +--------------- 6 files changed, 55 insertions(+), 260 deletions(-) create mode 100644 .changeset/ten-spiders-boil.md delete mode 100644 packages/message-relayer/src/spreadsheet.ts diff --git a/.changeset/ten-spiders-boil.md b/.changeset/ten-spiders-boil.md new file mode 100644 index 000000000000..757827799789 --- /dev/null +++ b/.changeset/ten-spiders-boil.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/message-relayer': patch +--- + +Removes spreadsheet mode from the message relayer diff --git a/packages/message-relayer/package.json b/packages/message-relayer/package.json index 6dae8b1eb7d6..7cd1a0444edf 100644 --- a/packages/message-relayer/package.json +++ b/packages/message-relayer/package.json @@ -1,7 +1,6 @@ { "name": "@eth-optimism/message-relayer", "version": "0.1.3", - "private": true, "description": "[Optimism] Cross Domain Message Relayer service", "main": "dist/index", "types": "dist/index", @@ -36,7 +35,6 @@ "bcfg": "^0.1.6", "dotenv": "^8.2.0", "ethers": "^5.1.0", - "google-spreadsheet": "^3.1.15", "merkletreejs": "^0.2.18", "rlp": "^2.2.6" }, diff --git a/packages/message-relayer/src/exec/run.ts b/packages/message-relayer/src/exec/run.ts index c12c67d09215..0ee3a0abeefc 100644 --- a/packages/message-relayer/src/exec/run.ts +++ b/packages/message-relayer/src/exec/run.ts @@ -1,7 +1,6 @@ import { Wallet, providers } from 'ethers' import { MessageRelayerService } from '../service' import { Bcfg } from '@eth-optimism/core-utils' -import SpreadSheet from '../spreadsheet' import * as dotenv from 'dotenv' import Config from 'bcfg' @@ -49,18 +48,6 @@ const main = async () => { parseInt(env.FROM_L2_TRANSACTION_INDEX, 10) || 0 ) - // Spreadsheet configuration - const SPREADSHEET_MODE = config.bool( - 'spreadsheet-mode', - !!env.SPREADSHEET_MODE || false - ) - const SHEET_ID = config.str('sheet-id', env.SHEET_ID) - const CLIENT_EMAIL = config.str('client-email', env.CLIENT_EMAIL) - const CLIENT_PRIVATE_KEY = config.str( - 'client-private-key', - env.CLIENT_PRIVATE_KEY - ) - if (!ADDRESS_MANAGER_ADDRESS) { throw new Error('Must pass ADDRESS_MANAGER_ADDRESS') } @@ -84,22 +71,6 @@ const main = async () => { throw new Error('Must pass one of L1_WALLET_KEY or MNEMONIC') } - let spreadsheet = null - if (SPREADSHEET_MODE) { - if (!SHEET_ID) { - throw new Error('Must pass SHEET_ID') - } - if (!CLIENT_EMAIL) { - throw new Error('Must pass CLIENT_EMAIL') - } - if (!CLIENT_PRIVATE_KEY) { - throw new Error('Must pass CLIENT_PRIVATE_KEY') - } - const privateKey = CLIENT_PRIVATE_KEY.replace(/\\n/g, '\n') - spreadsheet = new SpreadSheet(SHEET_ID) - await spreadsheet.init(CLIENT_EMAIL, privateKey) - } - const service = new MessageRelayerService({ l1RpcProvider: l1Provider, l2RpcProvider: l2Provider, @@ -111,8 +82,6 @@ const main = async () => { l2BlockOffset: L2_BLOCK_OFFSET, l1StartOffset: L1_START_OFFSET, getLogsInterval: GET_LOGS_INTERVAL, - spreadsheetMode: !!SPREADSHEET_MODE, - spreadsheet, }) await service.start() diff --git a/packages/message-relayer/src/service.ts b/packages/message-relayer/src/service.ts index 9568f3e1ea23..1851dc7f0005 100644 --- a/packages/message-relayer/src/service.ts +++ b/packages/message-relayer/src/service.ts @@ -6,7 +6,6 @@ import { MerkleTree } from 'merkletreejs' /* Imports: Internal */ import { fromHexString, sleep } from '@eth-optimism/core-utils' import { BaseService } from '@eth-optimism/common-ts' -import SpreadSheet from './spreadsheet' import { loadContract, loadContractFromManager } from '@eth-optimism/contracts' import { StateRootBatchHeader, SentMessage, SentMessageProof } from './types' @@ -41,10 +40,6 @@ interface MessageRelayerOptions { // Number of blocks within each getLogs query - max is 2000 getLogsInterval?: number - - // Append txs to a spreadsheet instead of submitting transactions - spreadsheetMode?: boolean - spreadsheet?: SpreadSheet } const optionSettings = { @@ -54,7 +49,6 @@ const optionSettings = { l2BlockOffset: { default: 1 }, l1StartOffset: { default: 0 }, getLogsInterval: { default: 2000 }, - spreadsheetMode: { default: false }, } export class MessageRelayerService extends BaseService { @@ -62,9 +56,6 @@ export class MessageRelayerService extends BaseService { super('Message_Relayer', options, optionSettings) } - protected spreadsheetMode: boolean - protected spreadsheet: SpreadSheet - private state: { lastFinalizedTxHeight: number nextUnfinalizedTxHeight: number @@ -84,7 +75,6 @@ export class MessageRelayerService extends BaseService { pollingInterval: this.options.pollingInterval, l2BlockOffset: this.options.l2BlockOffset, getLogsInterval: this.options.getLogsInterval, - spreadSheetMode: this.options.spreadsheetMode, }) // Need to improve this, sorry. this.state = {} as any @@ -141,10 +131,6 @@ export class MessageRelayerService extends BaseService { this.logger.info('Connected to all contracts.') - if (this.options.spreadsheetMode) { - this.logger.info('Running in spreadsheet mode') - } - this.state.lastQueriedL1Block = this.options.l1StartOffset this.state.eventCache = [] @@ -494,67 +480,12 @@ export class MessageRelayerService extends BaseService { message: SentMessage, proof: SentMessageProof ): Promise { - if (this.options.spreadsheetMode) { - try { - await this.options.spreadsheet.addRow({ - target: message.target, - sender: message.sender, - message: message.message, - messageNonce: message.messageNonce.toString(), - encodedMessage: message.encodedMessage, - encodedMessageHash: message.encodedMessageHash, - parentTransactionIndex: message.parentTransactionIndex, - parentTransactionHash: message.parentTransactionIndex, - stateRoot: proof.stateRoot, - batchIndex: proof.stateRootBatchHeader.batchIndex.toString(), - batchRoot: proof.stateRootBatchHeader.batchRoot, - batchSize: proof.stateRootBatchHeader.batchSize.toString(), - prevTotalElements: proof.stateRootBatchHeader.prevTotalElements.toString(), - extraData: proof.stateRootBatchHeader.extraData, - index: proof.stateRootProof.index, - siblings: proof.stateRootProof.siblings.join(','), - stateTrieWitness: proof.stateTrieWitness.toString('hex'), - storageTrieWitness: proof.storageTrieWitness.toString('hex'), - }) - this.logger.info('Submitted relay message to spreadsheet') - } catch (e) { - this.logger.error('Cannot submit message to spreadsheet') - this.logger.error(e.message) - } - } else { - try { - this.logger.info( - 'Dry-run, checking to make sure proof would succeed...' - ) - - await this.state.OVM_L1CrossDomainMessenger.connect( - this.options.l1Wallet - ).callStatic.relayMessage( - message.target, - message.sender, - message.message, - message.messageNonce, - proof, - { - gasLimit: this.options.relayGasLimit, - } - ) + try { + this.logger.info('Dry-run, checking to make sure proof would succeed...') - this.logger.info( - 'Proof should succeed. Submitting for real this time...' - ) - } catch (err) { - this.logger.error('Proof would fail, skipping', { - message: err.toString(), - stack: err.stack, - code: err.code, - }) - return - } - - const result = await this.state.OVM_L1CrossDomainMessenger.connect( + await this.state.OVM_L1CrossDomainMessenger.connect( this.options.l1Wallet - ).relayMessage( + ).callStatic.relayMessage( message.target, message.sender, message.message, @@ -565,29 +496,51 @@ export class MessageRelayerService extends BaseService { } ) - this.logger.info('Relay message transaction sent', { - transactionHash: result, + this.logger.info('Proof should succeed. Submitting for real this time...') + } catch (err) { + this.logger.error('Proof would fail, skipping', { + message: err.toString(), + stack: err.stack, + code: err.code, }) + return + } - try { - const receipt = await result.wait() - - this.logger.info('Relay message included in block', { - transactionHash: receipt.transactionHash, - blockNumber: receipt.blockNumber, - gasUsed: receipt.gasUsed.toString(), - confirmations: receipt.confirmations, - status: receipt.status, - }) - } catch (err) { - this.logger.error('Real relay attempt failed, skipping.', { - message: err.toString(), - stack: err.stack, - code: err.code, - }) - return + const result = await this.state.OVM_L1CrossDomainMessenger.connect( + this.options.l1Wallet + ).relayMessage( + message.target, + message.sender, + message.message, + message.messageNonce, + proof, + { + gasLimit: this.options.relayGasLimit, } - this.logger.info('Message successfully relayed to Layer 1!') + ) + + this.logger.info('Relay message transaction sent', { + transactionHash: result, + }) + + try { + const receipt = await result.wait() + + this.logger.info('Relay message included in block', { + transactionHash: receipt.transactionHash, + blockNumber: receipt.blockNumber, + gasUsed: receipt.gasUsed.toString(), + confirmations: receipt.confirmations, + status: receipt.status, + }) + } catch (err) { + this.logger.error('Real relay attempt failed, skipping.', { + message: err.toString(), + stack: err.stack, + code: err.code, + }) + return } + this.logger.info('Message successfully relayed to Layer 1!') } } diff --git a/packages/message-relayer/src/spreadsheet.ts b/packages/message-relayer/src/spreadsheet.ts deleted file mode 100644 index bf1260c88746..000000000000 --- a/packages/message-relayer/src/spreadsheet.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { GoogleSpreadsheet } from 'google-spreadsheet' - -export default class SpreadSheet { - public doc - public sheet - - constructor(id) { - this.doc = new GoogleSpreadsheet(id) - this.sheet = null - } - - async init(email, privateKey) { - await this.doc.useServiceAccountAuth({ - client_email: email, - private_key: privateKey, - }) - - await this.doc.loadInfo() - this.sheet = this.doc.sheetsByIndex[0] - } - - async addRow(row) { - return this.sheet.addRow(row) - } -} diff --git a/yarn.lock b/yarn.lock index 9c0b57790d9f..678b6dfabc8f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2960,7 +2960,7 @@ arrify@^1.0.0, arrify@^1.0.1: resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" integrity sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0= -arrify@^2.0.0, arrify@^2.0.1: +arrify@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-2.0.1.tgz#c9655e9331e0abcd588d2a7cad7e9956f66701fa" integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug== @@ -3608,7 +3608,7 @@ base-x@^3.0.2, base-x@^3.0.8: dependencies: safe-buffer "^5.0.1" -base64-js@^1.3.0, base64-js@^1.3.1: +base64-js@^1.3.1: version "1.5.1" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== @@ -3901,11 +3901,6 @@ bsert@~0.0.10: resolved "https://registry.yarnpkg.com/bsert/-/bsert-0.0.10.tgz#231ac82873a1418c6ade301ab5cd9ae385895597" integrity sha512-NHNwlac+WPy4t2LoNh8pXk8uaIGH3NSaIUbTTRXGpE2WEbq0te/tDykYHkFK57YKLPjv/aGHmbqvnGeVWDz57Q== -buffer-equal-constant-time@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819" - integrity sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk= - buffer-from@^1.0.0, buffer-from@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" @@ -5241,13 +5236,6 @@ ecc-jsbn@~0.1.1: jsbn "~0.1.0" safer-buffer "^2.1.0" -ecdsa-sig-formatter@1.0.11, ecdsa-sig-formatter@^1.0.11: - version "1.0.11" - resolved "https://registry.yarnpkg.com/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz#ae0f0fa2d85045ef14a817daa3ce9acd0489e5bf" - integrity sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ== - dependencies: - safe-buffer "^5.0.1" - ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" @@ -6213,7 +6201,7 @@ extend-shallow@^3.0.0, extend-shallow@^3.0.2: assign-symbols "^1.0.0" is-extendable "^1.0.1" -extend@^3.0.2, extend@~3.0.2: +extend@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== @@ -6305,11 +6293,6 @@ fast-safe-stringify@^2.0.7: resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz#124aa885899261f68aedb42a7c080de9da608743" integrity sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA== -fast-text-encoding@^1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/fast-text-encoding/-/fast-text-encoding-1.0.3.tgz#ec02ac8e01ab8a319af182dae2681213cfe9ce53" - integrity sha512-dtm4QZH9nZtcDt8qJiOH9fcQd1NAgi+K1O2DbE6GG1PPCK/BWfOH3idCTRQ4ImXRUOyopDEgDEnVEE7Y/2Wrig== - fastq@^1.6.0: version "1.11.0" resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.11.0.tgz#bb9fb955a07130a918eb63c1f5161cc32a5d0858" @@ -6707,25 +6690,6 @@ gauge@~2.7.3: strip-ansi "^3.0.1" wide-align "^1.1.0" -gaxios@^4.0.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/gaxios/-/gaxios-4.2.0.tgz#33bdc4fc241fc33b8915a4b8c07cfb368b932e46" - integrity sha512-Ms7fNifGv0XVU+6eIyL9LB7RVESeML9+cMvkwGS70xyD6w2Z80wl6RiqiJ9k1KFlJCUTQqFFc8tXmPQfSKUe8g== - dependencies: - abort-controller "^3.0.0" - extend "^3.0.2" - https-proxy-agent "^5.0.0" - is-stream "^2.0.0" - node-fetch "^2.3.0" - -gcp-metadata@^4.2.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/gcp-metadata/-/gcp-metadata-4.2.1.tgz#31849fbcf9025ef34c2297c32a89a1e7e9f2cd62" - integrity sha512-tSk+REe5iq/N+K+SK1XjZJUrFPuDqGZVzCy2vocIHIGmPlTGsa8owXMJwGkrXr73NO0AzhPW4MF2DEHz7P2AVw== - dependencies: - gaxios "^4.0.0" - json-bigint "^1.0.0" - get-caller-file@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" @@ -6978,37 +6942,6 @@ globby@^11.0.0, globby@^11.0.2: merge2 "^1.3.0" slash "^3.0.0" -google-auth-library@^6.1.3: - version "6.1.6" - resolved "https://registry.yarnpkg.com/google-auth-library/-/google-auth-library-6.1.6.tgz#deacdcdb883d9ed6bac78bb5d79a078877fdf572" - integrity sha512-Q+ZjUEvLQj/lrVHF/IQwRo6p3s8Nc44Zk/DALsN+ac3T4HY/g/3rrufkgtl+nZ1TW7DNAw5cTChdVp4apUXVgQ== - dependencies: - arrify "^2.0.0" - base64-js "^1.3.0" - ecdsa-sig-formatter "^1.0.11" - fast-text-encoding "^1.0.0" - gaxios "^4.0.0" - gcp-metadata "^4.2.0" - gtoken "^5.0.4" - jws "^4.0.0" - lru-cache "^6.0.0" - -google-p12-pem@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/google-p12-pem/-/google-p12-pem-3.0.3.tgz#673ac3a75d3903a87f05878f3c75e06fc151669e" - integrity sha512-wS0ek4ZtFx/ACKYF3JhyGe5kzH7pgiQ7J5otlumqR9psmWMYc+U9cErKlCYVYHoUaidXHdZ2xbo34kB+S+24hA== - dependencies: - node-forge "^0.10.0" - -google-spreadsheet@^3.1.15: - version "3.1.15" - resolved "https://registry.yarnpkg.com/google-spreadsheet/-/google-spreadsheet-3.1.15.tgz#e7a86f750d8166faaa3e16929561baceb807bf5a" - integrity sha512-S5477f3Gf3Mz6AXgCw7dbaYnzu5aHou1AX4sDqrGboQWnAytkxqJGKQiXN+zzRTTcYzSTJCe0g7KqCPZO9xiOw== - dependencies: - axios "^0.21.1" - google-auth-library "^6.1.3" - lodash "^4.17.20" - got@9.6.0: version "9.6.0" resolved "https://registry.yarnpkg.com/got/-/got-9.6.0.tgz#edf45e7d67f99545705de1f7bbeeeb121765ed85" @@ -7061,15 +6994,6 @@ growl@1.10.5: resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e" integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA== -gtoken@^5.0.4: - version "5.2.1" - resolved "https://registry.yarnpkg.com/gtoken/-/gtoken-5.2.1.tgz#4dae1fea17270f457954b4a45234bba5fc796d16" - integrity sha512-OY0BfPKe3QnMsY9MzTHTSKn+Vl2l1CcLe6BwDEQj00mbbkl5nyQ/7EUREstg4fQNZ8iYE7br4JJ7TdKeDOPWmw== - dependencies: - gaxios "^4.0.0" - google-p12-pem "^3.0.3" - jws "^4.0.0" - handlebars@^4.0.1, handlebars@^4.7.6: version "4.7.7" resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.7.tgz#9ce33416aad02dbd6c8fafa8240d5d98004945a1" @@ -8114,13 +8038,6 @@ jsesc@~0.5.0: resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" integrity sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0= -json-bigint@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/json-bigint/-/json-bigint-1.0.0.tgz#ae547823ac0cad8398667f8cd9ef4730f5b01ff1" - integrity sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ== - dependencies: - bignumber.js "^9.0.0" - json-buffer@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.0.tgz#5b1f397afc75d677bde8bcfc0e47e1f9a3d9a898" @@ -8254,23 +8171,6 @@ just-extend@^4.0.2: resolved "https://registry.yarnpkg.com/just-extend/-/just-extend-4.2.1.tgz#ef5e589afb61e5d66b24eca749409a8939a8c744" integrity sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg== -jwa@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/jwa/-/jwa-2.0.0.tgz#a7e9c3f29dae94027ebcaf49975c9345593410fc" - integrity sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA== - dependencies: - buffer-equal-constant-time "1.0.1" - ecdsa-sig-formatter "1.0.11" - safe-buffer "^5.0.1" - -jws@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/jws/-/jws-4.0.0.tgz#2d4e8cf6a318ffaa12615e9dec7e86e6c97310f4" - integrity sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg== - dependencies: - jwa "^2.0.0" - safe-buffer "^5.0.1" - keccak@3.0.1, keccak@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.1.tgz#ae30a0e94dbe43414f741375cff6d64c8bea0bff" @@ -9745,7 +9645,7 @@ node-fetch@2.1.2: resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.1.2.tgz#ab884e8e7e57e38a944753cec706f788d1768bb5" integrity sha1-q4hOjn5X44qUR1POxwb3iNF2i7U= -node-fetch@^2.3.0, node-fetch@^2.6.0, node-fetch@^2.6.1: +node-fetch@^2.6.0, node-fetch@^2.6.1: version "2.6.1" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== @@ -9758,11 +9658,6 @@ node-fetch@~1.7.1: encoding "^0.1.11" is-stream "^1.0.1" -node-forge@^0.10.0: - version "0.10.0" - resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.10.0.tgz#32dea2afb3e9926f02ee5ce8794902691a676bf3" - integrity sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA== - node-gyp-build@^4.2.0: version "4.2.3" resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.2.3.tgz#ce6277f853835f718829efb47db20f3e4d9c4739" From 8082d16c306aab1e53a019ecbce7038d2f1415ca Mon Sep 17 00:00:00 2001 From: Kevin Ho Date: Tue, 1 Jun 2021 19:21:01 -0700 Subject: [PATCH 028/125] Lower local rollup timestamp refresh (#985) * update rollup timestamp refresh * increase refresh time to 5s --- ops/docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/ops/docker-compose.yml b/ops/docker-compose.yml index 2470c5e9dc8a..4acad64c523d 100644 --- a/ops/docker-compose.yml +++ b/ops/docker-compose.yml @@ -80,6 +80,7 @@ services: - ./envs/geth.env environment: ETH1_HTTP: http://l1_chain:8545 + ROLLUP_TIMESTAMP_REFRESH: 5s ROLLUP_STATE_DUMP_PATH: http://deployer:8081/state-dump.latest.json # used for getting the addresses URL: http://deployer:8081/addresses.json From c2b6e14bc470d71957928d51937293404d5e1a25 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Tue, 1 Jun 2021 22:22:23 -0700 Subject: [PATCH 029/125] feat: fees v3 (#999) * core-utils: fee impl v3 * l2geth: fees v3 impl * integration-tests: update for fees v3 * chore: add changeset * fix: typo * integration-tests: fix and generalize * fees: update fee scalar * l2geth: check gas in the mempool behind usingovm * tests: fix up * l2geth: remove dead var * truffle: fix config --- .changeset/smooth-ears-pay.md | 7 ++++ examples/truffle/truffle-config-ovm.js | 3 +- integration-tests/test/fee-payment.spec.ts | 8 ++-- integration-tests/test/native-eth.spec.ts | 4 +- integration-tests/test/rpc.spec.ts | 9 +++-- l2geth/core/tx_pool.go | 17 ++++---- l2geth/core/types/transaction.go | 3 +- l2geth/internal/ethapi/api.go | 12 +++++- l2geth/rollup/fees/rollup_fee.go | 47 +++++++++++++++------- l2geth/rollup/fees/rollup_fee_test.go | 5 ++- packages/core-utils/src/fees.ts | 32 +++++++++++---- packages/core-utils/test/fees/fees.spec.ts | 5 ++- 12 files changed, 106 insertions(+), 46 deletions(-) create mode 100644 .changeset/smooth-ears-pay.md diff --git a/.changeset/smooth-ears-pay.md b/.changeset/smooth-ears-pay.md new file mode 100644 index 000000000000..9df7b7cc9289 --- /dev/null +++ b/.changeset/smooth-ears-pay.md @@ -0,0 +1,7 @@ +--- +'@eth-optimism/integration-tests': patch +'@eth-optimism/l2geth': patch +'@eth-optimism/core-utils': patch +--- + +Implement the latest fee spec such that the L2 gas limit is scaled and the tx.gasPrice/tx.gasLimit show correctly in metamask diff --git a/examples/truffle/truffle-config-ovm.js b/examples/truffle/truffle-config-ovm.js index b5dc2736725c..b7b849d43ee4 100644 --- a/examples/truffle/truffle-config-ovm.js +++ b/examples/truffle/truffle-config-ovm.js @@ -17,6 +17,7 @@ module.exports = { host: '127.0.0.1', port: 8545, gasPrice: 0, + gas: 54180127, } }, compilers: { @@ -31,4 +32,4 @@ module.exports = { } } } -} \ No newline at end of file +} diff --git a/integration-tests/test/fee-payment.spec.ts b/integration-tests/test/fee-payment.spec.ts index 3583df4493c8..f7de4d3611a2 100644 --- a/integration-tests/test/fee-payment.spec.ts +++ b/integration-tests/test/fee-payment.spec.ts @@ -3,7 +3,7 @@ import chaiAsPromised from 'chai-as-promised' chai.use(chaiAsPromised) import { BigNumber, utils } from 'ethers' import { OptimismEnv } from './shared/env' -import { TxGasLimit } from '@eth-optimism/core-utils' +import { TxGasLimit, TxGasPrice } from '@eth-optimism/core-utils' describe('Fee Payment Integration Tests', async () => { let env: OptimismEnv @@ -13,9 +13,9 @@ describe('Fee Payment Integration Tests', async () => { env = await OptimismEnv.new() }) - it('Should return a gasPrice of 1 wei', async () => { + it(`Should return a gasPrice of ${TxGasPrice.toString()} wei`, async () => { const gasPrice = await env.l2Wallet.getGasPrice() - expect(gasPrice.eq(1)) + expect(gasPrice).to.deep.eq(TxGasPrice) }) it('Should estimateGas with recoverable L2 gasLimit', async () => { @@ -28,7 +28,7 @@ describe('Fee Payment Integration Tests', async () => { utils.parseEther('0.5') ) const executionGas = await (env.ovmEth - .provider as any).send('eth_estimateExecutionGas', [tx]) + .provider as any).send('eth_estimateExecutionGas', [tx, true]) const decoded = TxGasLimit.decode(gas) expect(BigNumber.from(executionGas)).deep.eq(decoded) }) diff --git a/integration-tests/test/native-eth.spec.ts b/integration-tests/test/native-eth.spec.ts index fc11c82c8be6..68c27f52a639 100644 --- a/integration-tests/test/native-eth.spec.ts +++ b/integration-tests/test/native-eth.spec.ts @@ -45,13 +45,13 @@ describe('Native ETH Integration Tests', async () => { const amount = utils.parseEther('0.5') const addr = '0x' + '1234'.repeat(10) const gas = await env.ovmEth.estimateGas.transfer(addr, amount) - expect(gas).to.be.deep.eq(BigNumber.from(0x0ef897216d)) + expect(gas).to.be.deep.eq(BigNumber.from(6430020)) }) it('Should estimate gas for ETH withdraw', async () => { const amount = utils.parseEther('0.5') const gas = await env.ovmEth.estimateGas.withdraw(amount) - expect(gas).to.be.deep.eq(BigNumber.from(61400489396)) + expect(gas).to.be.deep.eq(BigNumber.from(6140049)) }) }) diff --git a/integration-tests/test/rpc.spec.ts b/integration-tests/test/rpc.spec.ts index 4c88cc4952a7..9866ba906f5d 100644 --- a/integration-tests/test/rpc.spec.ts +++ b/integration-tests/test/rpc.spec.ts @@ -134,7 +134,7 @@ describe('Basic RPC tests', () => { gasPrice: TxGasPrice, } const fee = tx.gasPrice.mul(tx.gasLimit) - const gasLimit = 59300000001 + const gasLimit = 5920001 await expect(env.l2Wallet.sendTransaction(tx)).to.be.rejectedWith( `fee too low: ${fee}, use at least tx.gasLimit = ${gasLimit} and tx.gasPrice = ${TxGasPrice.toString()}` @@ -213,7 +213,7 @@ describe('Basic RPC tests', () => { it('correctly exposes revert data for contract calls', async () => { const req: TransactionRequest = { ...revertingTx, - gasLimit: 59808999999, // override gas estimation + gasLimit: 5980899, // override gas estimation } const tx = await wallet.sendTransaction(req) @@ -236,7 +236,7 @@ describe('Basic RPC tests', () => { it('correctly exposes revert data for contract creations', async () => { const req: TransactionRequest = { ...revertingDeployTx, - gasLimit: 177008999999, // override gas estimation + gasLimit: 17700899, // override gas estimation } const tx = await wallet.sendTransaction(req) @@ -355,7 +355,7 @@ describe('Basic RPC tests', () => { to: DEFAULT_TRANSACTION.to, value: 0, }) - expect(estimate).to.be.eq(0x0dce9004c7) + expect(estimate).to.be.eq(5920012) }) it('should return a gas estimate that grows with the size of data', async () => { @@ -373,6 +373,7 @@ describe('Basic RPC tests', () => { const estimate = await l2Provider.estimateGas(tx) const l2Gaslimit = await l2Provider.send('eth_estimateExecutionGas', [ tx, + true, ]) const decoded = TxGasLimit.decode(estimate) diff --git a/l2geth/core/tx_pool.go b/l2geth/core/tx_pool.go index c92e3fde1c5c..1244e27835ca 100644 --- a/l2geth/core/tx_pool.go +++ b/l2geth/core/tx_pool.go @@ -92,9 +92,8 @@ var ( ) var ( - evictionInterval = time.Minute // Time interval to check for evictable transactions - statsReportInterval = 8 * time.Second // Time interval to report transaction pool stats - gwei = big.NewInt(params.GWei) // 1 gwei, used as a flag for "rollup" transactions + evictionInterval = time.Minute // Time interval to check for evictable transactions + statsReportInterval = 8 * time.Second // Time interval to report transaction pool stats ) var ( @@ -540,10 +539,14 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error { } // Ensure the transaction doesn't exceed the current block limit gas. - // We skip this condition check if the transaction's gasPrice is set to 1gwei, - // which indicates a "rollup" transaction that's paying for its data. - if pool.currentMaxGas < tx.L2Gas() && tx.GasPrice().Cmp(gwei) != 0 { - return ErrGasLimit + if vm.UsingOVM { + if pool.currentMaxGas < tx.L2Gas() { + return ErrGasLimit + } + } else { + if pool.currentMaxGas < tx.Gas() { + return ErrGasLimit + } } // Make sure the transaction is signed properly diff --git a/l2geth/core/types/transaction.go b/l2geth/core/types/transaction.go index a3fc9874acf6..6f30076f9bf5 100644 --- a/l2geth/core/types/transaction.go +++ b/l2geth/core/types/transaction.go @@ -27,6 +27,7 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/rlp" + "github.com/ethereum/go-ethereum/rollup/fees" ) //go:generate gencodec -type txdata -field-override txdataMarshaling -out gen_tx_json.go @@ -225,7 +226,7 @@ func (tx *Transaction) UnmarshalJSON(input []byte) error { func (tx *Transaction) Data() []byte { return common.CopyBytes(tx.data.Payload) } func (tx *Transaction) Gas() uint64 { return tx.data.GasLimit } -func (tx *Transaction) L2Gas() uint64 { return tx.data.GasLimit % 100_000_000 } +func (tx *Transaction) L2Gas() uint64 { return fees.DecodeL2GasLimitU64(tx.data.GasLimit) } func (tx *Transaction) GasPrice() *big.Int { return new(big.Int).Set(tx.data.Price) } func (tx *Transaction) Value() *big.Int { return new(big.Int).Set(tx.data.Amount) } func (tx *Transaction) Nonce() uint64 { return tx.data.AccountNonce } diff --git a/l2geth/internal/ethapi/api.go b/l2geth/internal/ethapi/api.go index 648ddea679cd..abec7e0b1c06 100644 --- a/l2geth/internal/ethapi/api.go +++ b/l2geth/internal/ethapi/api.go @@ -1148,9 +1148,17 @@ func (s *PublicBlockChainAPI) EstimateGas(ctx context.Context, args CallArgs) (h // EstimateExecutionGas returns an estimate of the amount of gas needed to execute the // given transaction against the current pending block. -func (s *PublicBlockChainAPI) EstimateExecutionGas(ctx context.Context, args CallArgs) (hexutil.Uint64, error) { +func (s *PublicBlockChainAPI) EstimateExecutionGas(ctx context.Context, args CallArgs, round *bool) (hexutil.Uint64, error) { blockNrOrHash := rpc.BlockNumberOrHashWithNumber(rpc.PendingBlockNumber) - return legacyDoEstimateGas(ctx, s.b, args, blockNrOrHash, s.b.RPCGasCap()) + estimate, err := legacyDoEstimateGas(ctx, s.b, args, blockNrOrHash, s.b.RPCGasCap()) + if err != nil { + return estimate, err + } + if round != nil && *round { + rounded := fees.Ceilmod(new(big.Int).SetUint64(uint64(estimate)), fees.BigTenThousand) + estimate = (hexutil.Uint64)(rounded.Uint64()) + } + return estimate, nil } // ExecutionResult groups all structured logs emitted by the EVM diff --git a/l2geth/rollup/fees/rollup_fee.go b/l2geth/rollup/fees/rollup_fee.go index 2f5455057e7d..13feafbbdef7 100644 --- a/l2geth/rollup/fees/rollup_fee.go +++ b/l2geth/rollup/fees/rollup_fee.go @@ -3,6 +3,7 @@ package fees import ( "math/big" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/params" ) @@ -10,12 +11,9 @@ import ( // transaction in gas. const overhead uint64 = 4200 + 200*params.TxDataNonZeroGasEIP2028 -// hundredMillion is a constant used in the gas encoding formula -const hundredMillion uint64 = 100_000_000 - // feeScalar is used to scale the calculations in EncodeL2GasLimit // to prevent them from being too large -const feeScalar uint64 = 1000 +const feeScalar uint64 = 10_000_000 // TxGasPrice is a constant that determines the result of `eth_gasPrice` // It is scaled upwards by 50% @@ -26,7 +24,10 @@ const TxGasPrice uint64 = feeScalar + (feeScalar / 2) // BigTxGasPrice is the L2GasPrice as type big.Int var BigTxGasPrice = new(big.Int).SetUint64(TxGasPrice) var bigFeeScalar = new(big.Int).SetUint64(feeScalar) -var bigHundredMillion = new(big.Int).SetUint64(hundredMillion) + +const tenThousand = 10000 + +var BigTenThousand = new(big.Int).SetUint64(tenThousand) // EncodeTxGasLimit computes the `tx.gasLimit` based on the L1/L2 gas prices and // the L2 gas limit. The L2 gas limit is encoded inside of the lower order bits @@ -40,32 +41,50 @@ var bigHundredMillion = new(big.Int).SetUint64(hundredMillion) // the fee, so increasing the L2 Gas limit will increase the fee paid. // The calculation is: // l1GasLimit = zero_count(data) * 4 + non_zero_count(data) * 16 + overhead +// roundedL2GasLimit = ceilmod(l2GasLimit, 10_000) // l1Fee = l1GasPrice * l1GasLimit -// l2Fee = l2GasPrice * l2GasLimit +// l2Fee = l2GasPrice * roundedL2GasLimit // sum = l1Fee + l2Fee // scaled = sum / scalar -// rounded = ceilmod(scaled, hundredMillion) -// result = rounded + l2GasLimit +// rounded = ceilmod(scaled, tenThousand) +// roundedScaledL2GasLimit = roundedL2GasLimit / tenThousand +// result = rounded + roundedScaledL2GasLimit // Note that for simplicity purposes, only the calldata is passed into this // function when in reality the RLP encoded transaction should be. The // additional cost is added to the overhead constant to prevent the need to RLP // encode transactions during calls to `eth_estimateGas` func EncodeTxGasLimit(data []byte, l1GasPrice, l2GasLimit, l2GasPrice *big.Int) *big.Int { l1GasLimit := calculateL1GasLimit(data, overhead) + roundedL2GasLimit := Ceilmod(l2GasLimit, BigTenThousand) l1Fee := new(big.Int).Mul(l1GasPrice, l1GasLimit) - l2Fee := new(big.Int).Mul(l2GasPrice, l2GasLimit) + l2Fee := new(big.Int).Mul(l2GasPrice, roundedL2GasLimit) sum := new(big.Int).Add(l1Fee, l2Fee) scaled := new(big.Int).Div(sum, bigFeeScalar) - remainder := new(big.Int).Mod(scaled, bigHundredMillion) - scaledSum := new(big.Int).Add(scaled, bigHundredMillion) - rounded := new(big.Int).Sub(scaledSum, remainder) - result := new(big.Int).Add(rounded, l2GasLimit) + rounded := Ceilmod(scaled, BigTenThousand) + roundedScaledL2GasLimit := new(big.Int).Div(roundedL2GasLimit, BigTenThousand) + result := new(big.Int).Add(rounded, roundedScaledL2GasLimit) return result } +func Ceilmod(a, b *big.Int) *big.Int { + remainder := new(big.Int).Mod(a, b) + if remainder.Cmp(common.Big0) == 0 { + return a + } + sum := new(big.Int).Add(a, b) + rounded := new(big.Int).Sub(sum, remainder) + return rounded +} + // DecodeL2GasLimit decodes the L2 gas limit from an encoded L2 gas limit func DecodeL2GasLimit(gasLimit *big.Int) *big.Int { - return new(big.Int).Mod(gasLimit, bigHundredMillion) + scaled := new(big.Int).Mod(gasLimit, BigTenThousand) + return new(big.Int).Mul(scaled, BigTenThousand) +} + +func DecodeL2GasLimitU64(gasLimit uint64) uint64 { + scaled := gasLimit % tenThousand + return scaled * tenThousand } // calculateL1GasLimit computes the L1 gasLimit based on the calldata and diff --git a/l2geth/rollup/fees/rollup_fee_test.go b/l2geth/rollup/fees/rollup_fee_test.go index 138a0d0bb16a..254d418ad8fa 100644 --- a/l2geth/rollup/fees/rollup_fee_test.go +++ b/l2geth/rollup/fees/rollup_fee_test.go @@ -74,7 +74,7 @@ var feeTests = map[string]struct { "max-gaslimit": { dataLen: 10, l1GasPrice: params.GWei, - l2GasLimit: 99999999, + l2GasLimit: 99_970_000, l2GasPrice: params.GWei, }, "larger-divisor": { @@ -95,7 +95,8 @@ func TestCalculateRollupFee(t *testing.T) { fee := EncodeTxGasLimit(data, l1GasPrice, l2GasLimit, l2GasPrice) decodedGasLimit := DecodeL2GasLimit(fee) - if l2GasLimit.Cmp(decodedGasLimit) != 0 { + roundedL2GasLimit := Ceilmod(l2GasLimit, BigTenThousand) + if roundedL2GasLimit.Cmp(decodedGasLimit) != 0 { t.Errorf("rollup fee check failed: expected %d, got %d", l2GasLimit.Uint64(), decodedGasLimit) } }) diff --git a/packages/core-utils/src/fees.ts b/packages/core-utils/src/fees.ts index 3910d19196df..5a1008b1aa5a 100644 --- a/packages/core-utils/src/fees.ts +++ b/packages/core-utils/src/fees.ts @@ -6,11 +6,12 @@ import { BigNumber } from 'ethers' import { remove0x } from './common' const hundredMillion = BigNumber.from(100_000_000) -const feeScalar = 1000 +const feeScalar = 10_000_000 export const TxGasPrice = BigNumber.from(feeScalar + feeScalar / 2) const txDataZeroGas = 4 const txDataNonZeroGasEIP2028 = 16 const overhead = 4200 + 200 * txDataNonZeroGasEIP2028 +const tenThousand = BigNumber.from(10_000) export interface EncodableL2GasLimit { data: Buffer | string @@ -32,21 +33,22 @@ function encode(input: EncodableL2GasLimit): BigNumber { l2GasPrice = BigNumber.from(l2GasPrice) } const l1GasLimit = calculateL1GasLimit(data) + const roundedL2GasLimit = ceilmod(l2GasLimit, tenThousand) const l1Fee = l1GasLimit.mul(l1GasPrice) - const l2Fee = l2GasLimit.mul(l2GasPrice) + const l2Fee = roundedL2GasLimit.mul(l2GasPrice) const sum = l1Fee.add(l2Fee) const scaled = sum.div(feeScalar) - const remainder = scaled.mod(hundredMillion) - const scaledSum = scaled.add(hundredMillion) - const rounded = scaledSum.sub(remainder) - return rounded.add(l2GasLimit) + const rounded = ceilmod(scaled, tenThousand) + const roundedScaledL2GasLimit = roundedL2GasLimit.div(tenThousand) + return rounded.add(roundedScaledL2GasLimit) } function decode(fee: BigNumber | number): BigNumber { if (typeof fee === 'number') { fee = BigNumber.from(fee) } - return fee.mod(hundredMillion) + const scaled = fee.mod(tenThousand) + return scaled.mul(tenThousand) } export const TxGasLimit = { @@ -54,6 +56,22 @@ export const TxGasLimit = { decode, } +export function ceilmod(a: BigNumber | number, b: BigNumber | number) { + if (typeof a === 'number') { + a = BigNumber.from(a) + } + if (typeof b === 'number') { + b = BigNumber.from(b) + } + const remainder = a.mod(b) + if (remainder.eq(0)) { + return a + } + const sum = a.add(b) + const rounded = sum.sub(remainder) + return rounded +} + export function calculateL1GasLimit(data: string | Buffer): BigNumber { const [zeroes, ones] = zeroesAndOnes(data) const zeroesCost = zeroes * txDataZeroGas diff --git a/packages/core-utils/test/fees/fees.spec.ts b/packages/core-utils/test/fees/fees.spec.ts index c624c0b3128b..3870092dfc57 100644 --- a/packages/core-utils/test/fees/fees.spec.ts +++ b/packages/core-utils/test/fees/fees.spec.ts @@ -56,7 +56,7 @@ describe('Fees', () => { dataLen: 10, l1GasPrice: utils.parseUnits('5', 'ether'), l2GasPrice: utils.parseUnits('5', 'ether'), - l2GasLimit: 10 ** 8 - 1, + l2GasLimit: 99_970_000, }, { name: 'zero-l2-gasprice', @@ -113,7 +113,8 @@ describe('Fees', () => { }) const decoded = fees.TxGasLimit.decode(got) - expect(decoded).to.deep.eq(BigNumber.from(test.l2GasLimit)) + const roundedL2GasLimit = fees.ceilmod(test.l2GasLimit, 10_000) + expect(decoded).to.deep.eq(roundedL2GasLimit) }) } }) From 750a5021214f3db5eed3faac9e6608b617abd2e0 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Tue, 1 Jun 2021 22:36:03 -0700 Subject: [PATCH 030/125] fix: remove dead coders (#1001) * chore: delete dead coders * chore: add changeset * dtl: remove dead imports * core-utils: delete dead tests * batch-submitter: remove txtype * chore: add changeset --- .changeset/fair-maps-pretend.md | 6 + .changeset/silent-masks-hunt.md | 5 + .../batch-submitter/batch-submitter.spec.ts | 7 +- packages/core-utils/src/coders/ecdsa-coder.ts | 243 ------------------ packages/core-utils/src/coders/index.ts | 1 - packages/core-utils/src/coders/types.ts | 5 - .../test/coders/batch-encoder.spec.ts | 89 ------- .../handlers/sequencer-batch-appended.ts | 2 - 8 files changed, 14 insertions(+), 344 deletions(-) create mode 100644 .changeset/fair-maps-pretend.md create mode 100644 .changeset/silent-masks-hunt.md delete mode 100644 packages/core-utils/src/coders/ecdsa-coder.ts diff --git a/.changeset/fair-maps-pretend.md b/.changeset/fair-maps-pretend.md new file mode 100644 index 000000000000..2feeebb11b22 --- /dev/null +++ b/.changeset/fair-maps-pretend.md @@ -0,0 +1,6 @@ +--- +'@eth-optimism/batch-submitter': patch +'@eth-optimism/data-transport-layer': patch +--- + +Remove dead imports from core-utils diff --git a/.changeset/silent-masks-hunt.md b/.changeset/silent-masks-hunt.md new file mode 100644 index 000000000000..46f0382c5a79 --- /dev/null +++ b/.changeset/silent-masks-hunt.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/core-utils': patch +--- + +Delete dead transaction coders. These are no longer used now that RLP encoded transactions are used diff --git a/packages/batch-submitter/test/batch-submitter/batch-submitter.spec.ts b/packages/batch-submitter/test/batch-submitter/batch-submitter.spec.ts index f0b0e4686e8e..dffbdc33867c 100644 --- a/packages/batch-submitter/test/batch-submitter/batch-submitter.spec.ts +++ b/packages/batch-submitter/test/batch-submitter/batch-submitter.spec.ts @@ -33,7 +33,6 @@ import { QueueOrigin, Batch, Signature, - TxType, remove0x, } from '@eth-optimism/core-utils' import { Logger, Metrics } from '@eth-optimism/common-ts' @@ -253,7 +252,7 @@ describe('BatchSubmitter', () => { { rawTransaction: '0x1234', l1BlockNumber: nextQueueElement.blockNumber - 1, - txType: TxType.EIP155, + txType: 0, queueOrigin: QueueOrigin.Sequencer, l1TxOrigin: null, } as any, @@ -302,7 +301,7 @@ describe('BatchSubmitter', () => { { rawTransaction: '0x1234', l1BlockNumber: nextQueueElement.blockNumber - 1, - txType: TxType.EthSign, + txType: 1, queueOrigin: QueueOrigin.Sequencer, l1TxOrigin: null, } as any, @@ -406,7 +405,7 @@ describe('BatchSubmitter', () => { { rawTransaction: '0x1234', l1BlockNumber: nextQueueElement.blockNumber - 1, - txType: TxType.EIP155, + txType: 0, queueOrigin: QueueOrigin.Sequencer, l1TxOrigin: null, } as any, diff --git a/packages/core-utils/src/coders/ecdsa-coder.ts b/packages/core-utils/src/coders/ecdsa-coder.ts deleted file mode 100644 index be381a107723..000000000000 --- a/packages/core-utils/src/coders/ecdsa-coder.ts +++ /dev/null @@ -1,243 +0,0 @@ -/* Internal Imports */ -import { add0x, remove0x, toVerifiedBytes, encodeHex, getLen } from '../common' -import { Coder, Signature, Uint16, Uint8, Uint24, Address } from './types' - -/*********************** - * TxTypes and TxData * - **********************/ - -export enum TxType { - EIP155 = 0, - EthSign = 1, - EthSign2 = 2, -} - -export const txTypePlainText = { - 0: TxType.EIP155, - 1: TxType.EthSign, - 2: TxType.EthSign2, - EIP155: TxType.EIP155, - EthSign: TxType.EthSign, -} - -export interface DefaultEcdsaTxData { - sig: Signature - gasLimit: Uint16 - gasPrice: Uint8 - nonce: Uint24 - target: Address - data: string - type: TxType -} - -export interface EIP155TxData extends DefaultEcdsaTxData {} -export interface EthSignTxData extends DefaultEcdsaTxData {} - -/*********************** - * Encoding Positions * - **********************/ - -/* - * The positions in the tx data for the different transaction types - */ - -export const TX_TYPE_POSITION = { start: 0, end: 1 } - -/* - * The positions in the tx data for the EIP155TxData and EthSignTxData - */ - -export const SIGNATURE_FIELD_POSITIONS = { - r: { start: 1, end: 33 }, // 32 bytes - s: { start: 33, end: 65 }, // 32 bytes - v: { start: 65, end: 66 }, // 1 byte -} - -export const DEFAULT_ECDSA_TX_FIELD_POSITIONS = { - txType: TX_TYPE_POSITION, // 1 byte - sig: SIGNATURE_FIELD_POSITIONS, // 65 bytes - gasLimit: { start: 66, end: 69 }, // 3 bytes - gasPrice: { start: 69, end: 72 }, // 3 byte - nonce: { start: 72, end: 75 }, // 3 bytes - target: { start: 75, end: 95 }, // 20 bytes - data: { start: 95 }, // byte 95 onward -} - -export const EIP155_TX_FIELD_POSITIONS = DEFAULT_ECDSA_TX_FIELD_POSITIONS -export const ETH_SIGN_TX_FIELD_POSITIONS = DEFAULT_ECDSA_TX_FIELD_POSITIONS -export const CTC_TX_GAS_PRICE_MULT_FACTOR = 1_000_000 - -/*************** - * EcdsaCoders * - **************/ - -class DefaultEcdsaTxCoder implements Coder { - constructor(readonly txType: TxType) {} - - public encode(txData: DefaultEcdsaTxData): string { - const txType = encodeHex( - this.txType, - getLen(DEFAULT_ECDSA_TX_FIELD_POSITIONS.txType) - ) - - const r = toVerifiedBytes( - txData.sig.r, - getLen(DEFAULT_ECDSA_TX_FIELD_POSITIONS.sig.r) - ) - const s = toVerifiedBytes( - txData.sig.s, - getLen(DEFAULT_ECDSA_TX_FIELD_POSITIONS.sig.s) - ) - const v = encodeHex( - txData.sig.v, - getLen(DEFAULT_ECDSA_TX_FIELD_POSITIONS.sig.v) - ) - - const gasLimit = encodeHex( - txData.gasLimit, - getLen(DEFAULT_ECDSA_TX_FIELD_POSITIONS.gasLimit) - ) - if (txData.gasPrice % CTC_TX_GAS_PRICE_MULT_FACTOR !== 0) { - throw new Error(`Gas Price ${txData.gasPrice} cannot be encoded`) - } - const gasPrice = encodeHex( - txData.gasPrice / CTC_TX_GAS_PRICE_MULT_FACTOR, - getLen(DEFAULT_ECDSA_TX_FIELD_POSITIONS.gasPrice) - ) - const nonce = encodeHex( - txData.nonce, - getLen(DEFAULT_ECDSA_TX_FIELD_POSITIONS.nonce) - ) - const target = toVerifiedBytes( - txData.target, - getLen(DEFAULT_ECDSA_TX_FIELD_POSITIONS.target) - ) - // Make sure that the data is even - if (txData.data.length % 2 !== 0) { - throw new Error('Non-even hex string for tx data!') - } - const encoding = - '0x' + - txType + - r + - s + - v + - gasLimit + - gasPrice + - nonce + - target + - remove0x(txData.data) - return encoding - } - - public decode(txData: string): DefaultEcdsaTxData { - txData = remove0x(txData) - const sliceBytes = (position: { start; end? }): string => - txData.slice(position.start * 2, position.end * 2) - - const pos = DEFAULT_ECDSA_TX_FIELD_POSITIONS - if (parseInt(sliceBytes(pos.txType), 16) !== this.txType) { - throw new Error('Invalid tx type') - } - - return { - sig: { - r: add0x(sliceBytes(pos.sig.r)), - s: add0x(sliceBytes(pos.sig.s)), - v: parseInt(sliceBytes(pos.sig.v), 16), - }, - gasLimit: parseInt(sliceBytes(pos.gasLimit), 16), - gasPrice: - parseInt(sliceBytes(pos.gasPrice), 16) * CTC_TX_GAS_PRICE_MULT_FACTOR, - nonce: parseInt(sliceBytes(pos.nonce), 16), - target: add0x(sliceBytes(pos.target)), - data: add0x(txData.slice(pos.data.start * 2)), - type: this.txType, - } - } -} - -class EthSignTxCoder extends DefaultEcdsaTxCoder { - constructor() { - super(TxType.EthSign) - } - - public encode(txData: EthSignTxData): string { - return super.encode(txData) - } - - public decode(txData: string): EthSignTxData { - return super.decode(txData) - } -} - -class EthSign2TxCoder extends DefaultEcdsaTxCoder { - constructor() { - super(TxType.EthSign2) - } - - public encode(txData: EthSignTxData): string { - return super.encode(txData) - } - - public decode(txData: string): EthSignTxData { - return super.decode(txData) - } -} - -class Eip155TxCoder extends DefaultEcdsaTxCoder { - constructor() { - super(TxType.EIP155) - } - - public encode(txData: EIP155TxData): string { - return super.encode(txData) - } - - public decode(txData: string): EIP155TxData { - return super.decode(txData) - } -} - -/************* - * ctcCoder * - ************/ - -function encode(data: EIP155TxData): string { - if (data.type === TxType.EIP155) { - return new Eip155TxCoder().encode(data) - } - if (data.type === TxType.EthSign) { - return new EthSignTxCoder().encode(data) - } - return null -} - -function decode(data: string | Buffer): EIP155TxData { - if (Buffer.isBuffer(data)) { - data = data.toString() - } - data = remove0x(data) - const type = parseInt(data.slice(0, 2), 16) - if (type === TxType.EIP155) { - return new Eip155TxCoder().decode(data) - } - if (type === TxType.EthSign) { - return new EthSignTxCoder().decode(data) - } - if (type === TxType.EthSign2) { - return new EthSign2TxCoder().decode(data) - } - return null -} - -/* - * Encoding and decoding functions for all txData types. - */ -export const ctcCoder = { - eip155TxData: new Eip155TxCoder(), - ethSignTxData: new EthSignTxCoder(), - ethSign2TxData: new EthSign2TxCoder(), - encode, - decode, -} diff --git a/packages/core-utils/src/coders/index.ts b/packages/core-utils/src/coders/index.ts index 4d9613d932e7..dfa4404fbe81 100644 --- a/packages/core-utils/src/coders/index.ts +++ b/packages/core-utils/src/coders/index.ts @@ -1,3 +1,2 @@ -export * from './ecdsa-coder' export * from './types' export * from './sequencer-batch' diff --git a/packages/core-utils/src/coders/types.ts b/packages/core-utils/src/coders/types.ts index 928c2cc58266..1280fe3d7099 100644 --- a/packages/core-utils/src/coders/types.ts +++ b/packages/core-utils/src/coders/types.ts @@ -8,8 +8,3 @@ export type Uint16 = number export type Uint8 = number export type Uint24 = number export type Address = string - -export interface Coder { - encode: Function - decode: Function -} diff --git a/packages/core-utils/test/coders/batch-encoder.spec.ts b/packages/core-utils/test/coders/batch-encoder.spec.ts index 2ad7c2eeeeb9..ce277a72d051 100644 --- a/packages/core-utils/test/coders/batch-encoder.spec.ts +++ b/packages/core-utils/test/coders/batch-encoder.spec.ts @@ -2,63 +2,13 @@ import '../setup' /* Internal Imports */ import { - ctcCoder, encodeAppendSequencerBatch, decodeAppendSequencerBatch, - TxType, sequencerBatch, } from '../../src' import { expect } from 'chai' describe('BatchEncoder', () => { - describe('eip155TxData', () => { - it('should encode & then decode to the correct value', () => { - const eip155TxData = { - sig: { - v: 1, - r: '0x' + '11'.repeat(32), - s: '0x' + '22'.repeat(32), - }, - gasLimit: 500, - gasPrice: 1000000, - nonce: 100, - target: '0x' + '12'.repeat(20), - data: '0x' + '99'.repeat(10), - type: TxType.EIP155, - } - const encoded = ctcCoder.eip155TxData.encode(eip155TxData) - const decoded = ctcCoder.eip155TxData.decode(encoded) - expect(eip155TxData).to.deep.equal(decoded) - }) - - it('should fail encoding a bad gas price', () => { - const badGasPrice = 1000001 - const eip155TxData = { - sig: { - v: 1, - r: '0x' + '11'.repeat(32), - s: '0x' + '22'.repeat(32), - }, - gasLimit: 500, - gasPrice: badGasPrice, - nonce: 100, - target: '0x' + '12'.repeat(20), - data: '0x' + '99'.repeat(10), - type: TxType.EIP155, - } - - let error - try { - ctcCoder.eip155TxData.encode(eip155TxData) - } catch (e) { - error = e - } - expect(error.message).to.equal( - `Gas Price ${badGasPrice} cannot be encoded` - ) - }) - }) - describe('appendSequencerBatch', () => { it('should work with the simple case', () => { const batch = { @@ -100,43 +50,4 @@ describe('BatchEncoder', () => { } }) }) - - describe('generic ctcCoder', () => { - it('should decode EIP155 txs to the correct value', () => { - const eip155TxData = { - sig: { - v: 1, - r: '0x' + '11'.repeat(32), - s: '0x' + '22'.repeat(32), - }, - gasLimit: 500, - gasPrice: 1000000, - nonce: 100, - target: '0x' + '12'.repeat(20), - data: '0x' + '99'.repeat(10), - type: TxType.EIP155, - } - const encoded = ctcCoder.encode(eip155TxData) - const decoded = ctcCoder.decode(encoded) - expect(eip155TxData).to.deep.equal(decoded) - }) - - it('should return null when encoding an unknown type', () => { - const weirdTypeTxData = { - sig: { - v: 1, - r: '0x' + '11'.repeat(32), - s: '0x' + '22'.repeat(32), - }, - gasLimit: 500, - gasPrice: 100, - nonce: 100, - target: '0x' + '12'.repeat(20), - data: '0x' + '99'.repeat(10), - type: 420, - } - const encoded = ctcCoder.encode(weirdTypeTxData) - expect(encoded).to.be.null - }) - }) }) diff --git a/packages/data-transport-layer/src/services/l1-ingestion/handlers/sequencer-batch-appended.ts b/packages/data-transport-layer/src/services/l1-ingestion/handlers/sequencer-batch-appended.ts index 23230efd02fe..0c90fa286277 100644 --- a/packages/data-transport-layer/src/services/l1-ingestion/handlers/sequencer-batch-appended.ts +++ b/packages/data-transport-layer/src/services/l1-ingestion/handlers/sequencer-batch-appended.ts @@ -2,11 +2,9 @@ import { BigNumber, ethers, constants } from 'ethers' import { getContractFactory } from '@eth-optimism/contracts' import { - ctcCoder, fromHexString, toHexString, toRpcHexString, - TxType, EventArgsSequencerBatchAppended, } from '@eth-optimism/core-utils' From 9d39121b80a84691cf59681e6b98215db1e6d7d7 Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Wed, 2 Jun 2021 03:56:39 -0400 Subject: [PATCH 031/125] docs[message-relayer]: add a README and improve the interface for generating proofs (#1002) * docs[message-relayer]: add basic docs and clean up an interface * chore: add changeset --- .changeset/great-shrimps-rule.md | 5 ++ packages/message-relayer/README.md | 69 ++++++++++++++++++++++++ packages/message-relayer/src/relay-tx.ts | 11 +++- 3 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 .changeset/great-shrimps-rule.md create mode 100644 packages/message-relayer/README.md diff --git a/.changeset/great-shrimps-rule.md b/.changeset/great-shrimps-rule.md new file mode 100644 index 000000000000..388ad60eeaa7 --- /dev/null +++ b/.changeset/great-shrimps-rule.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/message-relayer': patch +--- + +Adds a README and cleans up the interface for generating messages and proofs diff --git a/packages/message-relayer/README.md b/packages/message-relayer/README.md new file mode 100644 index 000000000000..964f1a67e5e9 --- /dev/null +++ b/packages/message-relayer/README.md @@ -0,0 +1,69 @@ +# @eth-optimism/message-relayer + +This package contains: + +1. A service for relaying messages from L2 to L1. +2. Utilities for finding these messages and relaying them. + +## Installation + +``` +yarn add @eth-optimism/message-relayer +``` + +## Relay Utilities + +### getMessagesAndProofsForL2Transaction + +Finds all L2 => L1 messages sent in a given L2 transaction and generates proof for each. + +#### Usage + +```typescript +import { getMessagesAndProofsForL2Transaction } from '@eth-optimism/message-relayer' + +const main = async () => { + const l1RpcProviderUrl = 'https://layer1.endpoint' + const l2RpcProviderUrl = 'https://layer2.endpoint' + const l1StateCommitmentChainAddress = 'address of OVM_StateCommitmentChain from deployments page' + const l2CrossDomainMessengerAddress = 'address of OVM_L2CrossDomainMessenger from deployments page' + const l2TransactionHash = 'hash of the transaction with messages to relay' + + const messagePairs = await getMessagesAndProofsForL2Transaction( + l1RpcProviderUrl, + l2RpcProviderUrl, + l1StateCommitmentChainAddress, + l2CrossDomainMessengerAddress, + l2TransactionHash + ) + + console.log(messagePairs) + // Will log something along the lines of: + // [ + // { + // message: { + // target: '0x...', + // sender: '0x...', + // message: '0x...', + // messageNonce: 1234... + // }, + // proof: { + // // complicated + // } + // } + // ] + + // You can then do something along the lines of: + // for (const { message, proof } of messagePairs) { + // await l1CrossDomainMessenger.relayMessage( + // message.target, + // message.sender, + // message.message, + // message.messageNonce, + // proof + // ) + // } +} + +main() +``` diff --git a/packages/message-relayer/src/relay-tx.ts b/packages/message-relayer/src/relay-tx.ts index 547006ed7735..92c83e189add 100644 --- a/packages/message-relayer/src/relay-tx.ts +++ b/packages/message-relayer/src/relay-tx.ts @@ -323,12 +323,19 @@ const getStateTrieProof = async ( * @returns An array of messages sent in the transaction and a proof of inclusion for each. */ export const getMessagesAndProofsForL2Transaction = async ( - l1RpcProvider: ethers.providers.JsonRpcProvider, - l2RpcProvider: ethers.providers.JsonRpcProvider, + l1RpcProvider: ethers.providers.JsonRpcProvider | string, + l2RpcProvider: ethers.providers.JsonRpcProvider | string, l1StateCommitmentChainAddress: string, l2CrossDomainMessengerAddress: string, l2TransactionHash: string ): Promise => { + if (typeof l1RpcProvider === 'string') { + l1RpcProvider = new ethers.providers.JsonRpcProvider(l1RpcProvider) + } + if (typeof l2RpcProvider === 'string') { + l2RpcProvider = new ethers.providers.JsonRpcProvider(l2RpcProvider) + } + const l2Transaction = await l2RpcProvider.getTransaction(l2TransactionHash) if (l2Transaction === null) { throw new Error(`unable to find tx with hash: ${l2TransactionHash}`) From e52ccd98c997789b17ce6d38beb1d49fa8c52fc4 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Wed, 2 Jun 2021 02:02:26 -0700 Subject: [PATCH 032/125] dtl: log error stack for failed http request (#995) * dtl: log error stack for failed http request * chore: add changeset --- .changeset/slimy-rivers-promise.md | 5 +++++ packages/data-transport-layer/src/services/server/service.ts | 1 + 2 files changed, 6 insertions(+) create mode 100644 .changeset/slimy-rivers-promise.md diff --git a/.changeset/slimy-rivers-promise.md b/.changeset/slimy-rivers-promise.md new file mode 100644 index 000000000000..38b393bac00e --- /dev/null +++ b/.changeset/slimy-rivers-promise.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/data-transport-layer': patch +--- + +Logs the error stacktrace for a failed HTTP request diff --git a/packages/data-transport-layer/src/services/server/service.ts b/packages/data-transport-layer/src/services/server/service.ts index 8774181ade3e..4e781114d92d 100644 --- a/packages/data-transport-layer/src/services/server/service.ts +++ b/packages/data-transport-layer/src/services/server/service.ts @@ -198,6 +198,7 @@ export class L1TransportServer extends BaseService { url: req.url, elapsed, msg: e.toString(), + stack: e.stack, }) return res.status(400).json({ error: e.toString(), From a02392b070382112003c4fdd246cf3ad5ec261b5 Mon Sep 17 00:00:00 2001 From: Ben Wilson <82120899+optimisticben@users.noreply.github.com> Date: Wed, 2 Jun 2021 05:19:53 -0400 Subject: [PATCH 033/125] Add rpc-proxy service for whitelisting JSON RPC methods to the sequencer. (#945) * Add healthcheck endpoint for rpc-proxy Added ethereum-nginx-proxy source updated README and docker image build * Check ETH_CALLS_ALLOWED is set, clean up comments, remove old Dockerfile --- .github/workflows/release.yml | 8 ++ ops/README.md | 2 + ops/docker-compose-rpc-proxy.yml | 17 ++++ ops/docker-compose.yml | 1 + ops/docker/Dockerfile.rpc-proxy | 21 +++++ ops/docker/rpc-proxy/docker-entrypoint.sh | 19 +++++ ops/docker/rpc-proxy/eth-jsonrpc-access.lua | 91 +++++++++++++++++++++ ops/docker/rpc-proxy/nginx.template.conf | 80 ++++++++++++++++++ 8 files changed, 239 insertions(+) create mode 100644 ops/docker-compose-rpc-proxy.yml create mode 100644 ops/docker/Dockerfile.rpc-proxy create mode 100755 ops/docker/rpc-proxy/docker-entrypoint.sh create mode 100644 ops/docker/rpc-proxy/eth-jsonrpc-access.lua create mode 100644 ops/docker/rpc-proxy/nginx.template.conf diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2bdc59c027b4..65bfc5216d1f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -92,6 +92,14 @@ jobs: push: true tags: ethereumoptimism/l2geth:${{ needs.release.outputs.l2geth }} + - name: Publish rpc-proxy + uses: docker/build-push-action@v2 + with: + context: . + file: ./ops/docker/Dockerfile.rpc-proxy + push: true + tags: ethereumoptimism/rpc-proxy:${{ needs.release.outputs.l2geth }} + # pushes the base builder image to dockerhub builder: name: Prepare the base builder image for the services diff --git a/ops/README.md b/ops/README.md index 488e3a6f2a62..1dc7858efb0e 100644 --- a/ops/README.md +++ b/ops/README.md @@ -14,6 +14,8 @@ The base `docker-compose.yml` file will start the required components for a full Supplementing the base configuration is an additional metric enabling file, `docker-compose-metrics.yml`. Adding this configuration to the stack will enable metric emission for l2geth and start grafana (for metrics visualisation) and influxdb (for metric collection) instances. +Also available for testing is the `rpc-proxy` service in the `docker-compose-rpc-proxy.yml` file. It can be used to restrict what RPC methods are allowed to the Sequencer. + The base stack can be started and stopped with a command like this (there is no need to specify the default docker-compose.yml) ``` docker-compose \ diff --git a/ops/docker-compose-rpc-proxy.yml b/ops/docker-compose-rpc-proxy.yml new file mode 100644 index 000000000000..dccd31c1cb07 --- /dev/null +++ b/ops/docker-compose-rpc-proxy.yml @@ -0,0 +1,17 @@ +version: "3" +services: + rpc-proxy: + depends_on: + - l1_chain + - deployer + - l2geth + image: rpc-proxy + build: + context: .. + dockerfile: ./ops/docker/Dockerfile.rpc-proxy + environment: + SEQUENCER: l2geth:8545 + ETH_CALLS_ALLOWED: eth_blockNumber,eth_sendRawTransaction + ports: + - 9546:8080 + - 9145:9145 diff --git a/ops/docker-compose.yml b/ops/docker-compose.yml index 4acad64c523d..496f3738705f 100644 --- a/ops/docker-compose.yml +++ b/ops/docker-compose.yml @@ -173,3 +173,4 @@ services: URL: http://deployer:8081/addresses.json ENABLE_GAS_REPORT: 1 NO_NETWORK: 1 + diff --git a/ops/docker/Dockerfile.rpc-proxy b/ops/docker/Dockerfile.rpc-proxy new file mode 100644 index 000000000000..c0e03b93bd14 --- /dev/null +++ b/ops/docker/Dockerfile.rpc-proxy @@ -0,0 +1,21 @@ +FROM openresty/openresty:buster +LABEL maintainer="Optimistic Systems " +ARG GOTEMPLATE_VERSION=v3.9.0 + +RUN DEBIAN_FRONTEND=noninteractive apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + openresty-opm \ + && opm get knyar/nginx-lua-prometheus + +RUN curl -o /usr/local/bin/gomplate \ + -sSL https://github.com/hairyhenderson/gomplate/releases/download/$GOTEMPLATE_VERSION/gomplate_linux-amd64-slim \ + && chmod +x /usr/local/bin/gomplate + +RUN mkdir -p /var/log/nginx/ \ + && ln -sf /dev/stdout /var/log/nginx/access.log \ + && ln -sf /dev/stderr /var/log/nginx/error.log + +COPY ./ops/docker/rpc-proxy/eth-jsonrpc-access.lua /usr/local/openresty/nginx/eth-jsonrpc-access.lua +COPY ./ops/docker/rpc-proxy/nginx.template.conf /docker-entrypoint.d/nginx.template.conf +COPY ./ops/docker/rpc-proxy/docker-entrypoint.sh /docker-entrypoint.sh +ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/ops/docker/rpc-proxy/docker-entrypoint.sh b/ops/docker/rpc-proxy/docker-entrypoint.sh new file mode 100755 index 000000000000..477f1dd8f934 --- /dev/null +++ b/ops/docker/rpc-proxy/docker-entrypoint.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -eo pipefail + +if [ -z "$SEQUENCER" ];then + echo "SEQUENCER env must be set, exiting" + exit 1 +fi + +if [ -z "$ETH_CALLS_ALLOWED" ];then + echo "ETH_CALLS_ALLOWED env must be set, exiting" + exit 1 +fi + +gomplate -f /docker-entrypoint.d/nginx.template.conf > /usr/local/openresty/nginx/conf/nginx.conf + +cat /usr/local/openresty/nginx/conf/nginx.conf + +exec openresty "$@" diff --git a/ops/docker/rpc-proxy/eth-jsonrpc-access.lua b/ops/docker/rpc-proxy/eth-jsonrpc-access.lua new file mode 100644 index 000000000000..3f2280ec815f --- /dev/null +++ b/ops/docker/rpc-proxy/eth-jsonrpc-access.lua @@ -0,0 +1,91 @@ +-- Source: https://github.com/adetante/ethereum-nginx-proxy +local cjson = require('cjson') + +local function empty(s) + return s == nil or s == '' +end + +local function split(s) + local res = {} + local i = 1 + for v in string.gmatch(s, "([^,]+)") do + res[i] = v + i = i + 1 + end + return res +end + +local function contains(arr, val) + for i, v in ipairs (arr) do + if v == val then + return true + end + end + return false +end + +-- parse conf +local blacklist, whitelist = nil +if not empty(ngx.var.jsonrpc_blacklist) then + blacklist = split(ngx.var.jsonrpc_blacklist) +end +if not empty(ngx.var.jsonrpc_whitelist) then + whitelist = split(ngx.var.jsonrpc_whitelist) +end + +-- check conf +if blacklist ~= nil and whitelist ~= nil then + ngx.log(ngx.ERR, 'invalid conf: jsonrpc_blacklist and jsonrpc_whitelist are both set') + ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR) + return +end + +-- get request content +ngx.req.read_body() + +-- try to parse the body as JSON +local success, body = pcall(cjson.decode, ngx.var.request_body); +if not success then + ngx.log(ngx.ERR, 'invalid JSON request') + ngx.exit(ngx.HTTP_BAD_REQUEST) + return +end + +local method = body['method'] +local version = body['jsonrpc'] + +-- check we have a method and a version +if empty(method) or empty(version) then + ngx.log(ngx.ERR, 'no method and/or jsonrpc attribute') + ngx.exit(ngx.HTTP_BAD_REQUEST) + return +end + +metric_sequencer_requests:inc(1, {method, ngx.var.server_name, ngx.var.status}) + +-- check the version is supported +if version ~= "2.0" then + ngx.log(ngx.ERR, 'jsonrpc version not supported: ' .. version) + ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR) + return +end + +-- if whitelist is configured, check that the method is whitelisted +if whitelist ~= nil then + if not contains(whitelist, method) then + ngx.log(ngx.ERR, 'jsonrpc method is not whitelisted: ' .. method) + ngx.exit(ngx.HTTP_FORBIDDEN) + return + end +end + +-- if blacklist is configured, check that the method is not blacklisted +if blacklist ~= nil then + if contains(blacklist, method) then + ngx.log(ngx.ERR, 'jsonrpc method is blacklisted: ' .. method) + ngx.exit(ngx.HTTP_FORBIDDEN) + return + end +end + +return diff --git a/ops/docker/rpc-proxy/nginx.template.conf b/ops/docker/rpc-proxy/nginx.template.conf new file mode 100644 index 000000000000..4530b5ddb849 --- /dev/null +++ b/ops/docker/rpc-proxy/nginx.template.conf @@ -0,0 +1,80 @@ +worker_processes 5; +daemon off; +error_log /var/log/nginx/error.log; +worker_rlimit_nofile 8192; +pcre_jit on; + +events { + worker_connections 4096; +} + +http { + include mime.types; + index index.html; + + # See Move default writable paths to a dedicated directory (#119) + # https://github.com/openresty/docker-openresty/issues/119 + client_body_temp_path /var/run/openresty/nginx-client-body; + proxy_temp_path /var/run/openresty/nginx-proxy; + fastcgi_temp_path /var/run/openresty/nginx-fastcgi; + uwsgi_temp_path /var/run/openresty/nginx-uwsgi; + scgi_temp_path /var/run/openresty/nginx-scgi; + + keepalive_timeout 0; + + default_type application/octet-stream; + log_format main '$remote_addr - $remote_user [$time_local] $status ' + '"$request" $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + access_log /var/log/nginx/access.log main; + sendfile on; + tcp_nopush on; + + lua_shared_dict prometheus_metrics 10M; + init_worker_by_lua_block { + prometheus = require("prometheus").init("prometheus_metrics") + metric_requests = prometheus:counter( + "nginx_http_requests_total", "Number of HTTP requests", {"host", "status"}) + metric_sequencer_requests = prometheus:counter( + "nginx_eth_sequencer_requests", "Number of requests going to the sequencer", {"method", "host", "status"}) + metric_replica_requests = prometheus:counter( + "nginx_eth_replica_requests", "Number of requests going to the replicas", {"host", "status"}) + metric_latency = prometheus:histogram( + "nginx_http_request_duration_seconds", "HTTP request latency", {"host"}) + metric_connections = prometheus:gauge( + "nginx_http_connections", "Number of HTTP connections", {"state"}) + } + log_by_lua_block { + metric_requests:inc(1, {ngx.var.server_name, ngx.var.status}) + metric_latency:observe(tonumber(ngx.var.request_time), {ngx.var.server_name}) + } + + upstream sequencer { + server {{env.Getenv "SEQUENCER"}}; + } + + server { # RPC proxy server + listen 8080; + location = /healthz { + return 200 'healthz'; + } + location / { + set $jsonrpc_whitelist {{env.Getenv "ETH_CALLS_ALLOWED"}}; + access_by_lua_file 'eth-jsonrpc-access.lua'; + proxy_pass http://sequencer; + } + } + + server { # Metrics server + listen 9145; + location /metrics { + content_by_lua_block { + metric_connections:set(ngx.var.connections_reading, {"reading"}) + metric_connections:set(ngx.var.connections_waiting, {"waiting"}) + metric_connections:set(ngx.var.connections_writing, {"writing"}) + prometheus:collect() + } + } + } + +} \ No newline at end of file From e29fab1084cac189b034e7607ce5b8fe6e2bc5e8 Mon Sep 17 00:00:00 2001 From: Maurelian Date: Wed, 2 Jun 2021 10:42:38 -0400 Subject: [PATCH 034/125] Pass additional information across domains via token gateways (#824) * feat(contracts): add from and data args to L1ERC20Gateway fix(integration): add gasLimit to fundUser refactor(contracts): add data to gateway events add changeset fix(integration): provide data in outboundTransfer refactor(contracts): reset Abs_L2TokenGateway to Abs_L2DepositedToken refactor(contracts): fix mismatched names * feat[contracts]: add custom gas arg to gateway fix(contracts): take max of user vs. default gas * fix(integrations): update ovm-eth function call * fix(integration): remove unecessary explicit gasLimit * test(contracts): 32kb transfer, 9MM gas * fix(contracts): fixup comment, bytes arg last * fix(integration): args order in integrations * fix(contracts): remove unused L2 gas arg * fix(contracts): limit data that can be passed to L2 * fix(integration): better tests for data length * test: check for error on too large data * Experimental: specify gaslimit in before hook * fix(integration): add l2 gas argument * fix: increase gas on fundUser * fix(contracts): remove duplicate max size limit * fix(integration): fine tune gas amounts * lint * fix: large data test * fix(integration): set gas closer to real cost * fix(contracts): remove unused bridge variables These variables were the default gas amounts for cross domain messages * fix(contracts): Reorder args Place dynamic length args last * fix(integration): update estimateGas values * fix(integration): reset eth withdraw estimate to 21000 * fix(integration): update expected gas amount * fix(integration): reduce gas amount for ETH withdraw --- .changeset/wild-months-matter.md | 5 + integration-tests/test/native-eth.spec.ts | 77 +++++++++-- integration-tests/test/shared/utils.ts | 5 +- .../OVM/bridge/tokens/Abs_L1TokenGateway.sol | 85 +++++++------ .../bridge/tokens/Abs_L2DepositedToken.sol | 120 ++++++++++-------- .../OVM/bridge/tokens/OVM_L1ERC20Gateway.sol | 20 +-- .../OVM/bridge/tokens/OVM_L1ETHGateway.sol | 102 ++++++++++----- .../bridge/tokens/OVM_L2DepositedERC20.sol | 8 +- .../iOVM/bridge/tokens/iOVM_L1ETHGateway.sol | 28 ++-- .../bridge/tokens/iOVM_L1TokenGateway.sol | 22 +++- .../bridge/tokens/iOVM_L2DepositedToken.sol | 22 +++- .../bridge/OVM_CrossDomainEnabled.sol | 12 +- .../bridge/assets/OVM_L1ERC20Gateway.spec.ts | 50 +++++--- .../bridge/assets/OVM_L1ETHGateway.spec.ts | 75 +++++++---- .../assets/OVM_L2DepositedERC20.spec.ts | 89 ++++++++++--- 15 files changed, 479 insertions(+), 241 deletions(-) create mode 100644 .changeset/wild-months-matter.md diff --git a/.changeset/wild-months-matter.md b/.changeset/wild-months-matter.md new file mode 100644 index 000000000000..aa4c01a6e5c8 --- /dev/null +++ b/.changeset/wild-months-matter.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/contracts': patch +--- + +Token gateways pass additional information: sender and arbitrary data. diff --git a/integration-tests/test/native-eth.spec.ts b/integration-tests/test/native-eth.spec.ts index fc11c82c8be6..f152d0a85c13 100644 --- a/integration-tests/test/native-eth.spec.ts +++ b/integration-tests/test/native-eth.spec.ts @@ -5,6 +5,11 @@ import { Direction } from './shared/watcher-utils' import { PROXY_SEQUENCER_ENTRYPOINT_ADDRESS } from './shared/utils' import { OptimismEnv } from './shared/env' +const DEFAULT_TEST_GAS_L1 = 230_000 +const DEFAULT_TEST_GAS_L2 = 825_000 +// TX size enforced by CTC: +const MAX_ROLLUP_TX_SIZE = 50_000 + describe('Native ETH Integration Tests', async () => { let env: OptimismEnv let l1Bob: Wallet @@ -50,8 +55,8 @@ describe('Native ETH Integration Tests', async () => { it('Should estimate gas for ETH withdraw', async () => { const amount = utils.parseEther('0.5') - const gas = await env.ovmEth.estimateGas.withdraw(amount) - expect(gas).to.be.deep.eq(BigNumber.from(61400489396)) + const gas = await env.ovmEth.estimateGas.withdraw(amount, 0, '0xFFFF') + expect(gas).to.be.deep.eq(BigNumber.from(0x0f5203e9bf)) }) }) @@ -59,7 +64,10 @@ describe('Native ETH Integration Tests', async () => { const depositAmount = 10 const preBalances = await getBalances(env) const { tx, receipt } = await env.waitForXDomainTransaction( - env.gateway.deposit({ value: depositAmount }), + env.gateway.deposit(DEFAULT_TEST_GAS_L2, '0xFFFF', { + value: depositAmount, + gasLimit: DEFAULT_TEST_GAS_L1, + }), Direction.L1ToL2 ) @@ -81,8 +89,9 @@ describe('Native ETH Integration Tests', async () => { const depositAmount = 10 const preBalances = await getBalances(env) const depositReceipts = await env.waitForXDomainTransaction( - env.gateway.depositTo(l2Bob.address, { + env.gateway.depositTo(l2Bob.address, DEFAULT_TEST_GAS_L2, '0xFFFF', { value: depositAmount, + gasLimit: DEFAULT_TEST_GAS_L1, }), Direction.L1ToL2 ) @@ -102,6 +111,50 @@ describe('Native ETH Integration Tests', async () => { ) }) + it('deposit passes with a large data argument', async () => { + const ASSUMED_L2_GAS_LIMIT = 8_000_000 + const depositAmount = 10 + const preBalances = await getBalances(env) + + // Set data length slightly less than MAX_ROLLUP_TX_SIZE + // to allow for encoding and other arguments + const data = `0x` + 'ab'.repeat(MAX_ROLLUP_TX_SIZE - 500) + const { tx, receipt } = await env.waitForXDomainTransaction( + env.gateway.deposit(ASSUMED_L2_GAS_LIMIT, data, { + value: depositAmount, + gasLimit: 4_000_000, + }), + Direction.L1ToL2 + ) + + const l1FeePaid = receipt.gasUsed.mul(tx.gasPrice) + const postBalances = await getBalances(env) + + expect(postBalances.l1GatewayBalance).to.deep.eq( + preBalances.l1GatewayBalance.add(depositAmount) + ) + expect(postBalances.l2UserBalance).to.deep.eq( + preBalances.l2UserBalance.add(depositAmount) + ) + expect(postBalances.l1UserBalance).to.deep.eq( + preBalances.l1UserBalance.sub(l1FeePaid.add(depositAmount)) + ) + }) + + it('deposit fails with a TOO large data argument', async () => { + const depositAmount = 10 + + const data = `0x` + 'ab'.repeat(MAX_ROLLUP_TX_SIZE + 1) + await expect( + env.gateway.deposit(DEFAULT_TEST_GAS_L2, data, { + value: depositAmount, + gasLimit: 4_000_000, + }) + ).to.be.revertedWith( + 'Transaction data size exceeds maximum for rollup transaction.' + ) + }) + it('withdraw', async () => { const withdrawAmount = BigNumber.from(3) const preBalances = await getBalances(env) @@ -111,7 +164,7 @@ describe('Native ETH Integration Tests', async () => { ) const receipts = await env.waitForXDomainTransaction( - env.ovmEth.withdraw(withdrawAmount), + env.ovmEth.withdraw(withdrawAmount, DEFAULT_TEST_GAS_L1, '0xFFFF'), Direction.L2ToL1 ) const fee = receipts.tx.gasLimit.mul(receipts.tx.gasPrice) @@ -140,7 +193,12 @@ describe('Native ETH Integration Tests', async () => { ) const receipts = await env.waitForXDomainTransaction( - env.ovmEth.withdrawTo(l1Bob.address, withdrawAmount), + env.ovmEth.withdrawTo( + l1Bob.address, + withdrawAmount, + DEFAULT_TEST_GAS_L1, + '0xFFFF' + ), Direction.L2ToL1 ) const fee = receipts.tx.gasLimit.mul(receipts.tx.gasPrice) @@ -162,8 +220,9 @@ describe('Native ETH Integration Tests', async () => { // 1. deposit const amount = utils.parseEther('1') await env.waitForXDomainTransaction( - env.gateway.deposit({ + env.gateway.deposit(DEFAULT_TEST_GAS_L2, '0xFFFF', { value: amount, + gasLimit: DEFAULT_TEST_GAS_L1, }), Direction.L1ToL2 ) @@ -180,7 +239,9 @@ describe('Native ETH Integration Tests', async () => { // 3. do withdrawal const withdrawnAmount = utils.parseEther('0.95') const receipts = await env.waitForXDomainTransaction( - env.ovmEth.connect(other).withdraw(withdrawnAmount), + env.ovmEth + .connect(other) + .withdraw(withdrawnAmount, DEFAULT_TEST_GAS_L1, '0xFFFF'), Direction.L2ToL1 ) diff --git a/integration-tests/test/shared/utils.ts b/integration-tests/test/shared/utils.ts index cded6058cf00..33f69c6b6323 100644 --- a/integration-tests/test/shared/utils.ts +++ b/integration-tests/test/shared/utils.ts @@ -101,8 +101,9 @@ export const fundUser = async ( ) => { const value = BigNumber.from(amount) const tx = recipient - ? gateway.depositTo(recipient, { value }) - : gateway.deposit({ value }) + ? gateway.depositTo(recipient, 1_000_000, '0xFFFF', { value }) + : gateway.deposit(1_000_000, '0xFFFF', { value }) + await waitForXDomainTransaction(watcher, tx, Direction.L1ToL2) } diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/Abs_L1TokenGateway.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/Abs_L1TokenGateway.sol index db4ba0bd9aa8..a5e147bf833a 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/Abs_L1TokenGateway.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/Abs_L1TokenGateway.sol @@ -52,13 +52,9 @@ abstract contract Abs_L1TokenGateway is iOVM_L1TokenGateway, OVM_CrossDomainEnab * Overridable Accounting logic * ********************************/ - // Default gas value which can be overridden if more complex logic runs on L2. - uint32 internal constant DEFAULT_FINALIZE_DEPOSIT_L2_GAS = 1200000; - /** * @dev Core logic to be performed when a withdrawal is finalized on L1. * In most cases, this will simply send locked funds to the withdrawer. - * * param _to Address being withdrawn to. * param _amount Amount being withdrawn. */ @@ -75,7 +71,6 @@ abstract contract Abs_L1TokenGateway is iOVM_L1TokenGateway, OVM_CrossDomainEnab /** * @dev Core logic to be performed when a deposit is initiated on L1. * In most cases, this will simply send locked funds to the withdrawer. - * * param _from Address being deposited from on L1. * param _to Address being deposited into on L2. * param _amount Amount being deposited. @@ -91,54 +86,50 @@ abstract contract Abs_L1TokenGateway is iOVM_L1TokenGateway, OVM_CrossDomainEnab revert("Implement me in child contracts"); } - /** - * @dev Overridable getter for the L2 gas limit, in the case it may be - * dynamic, and the above public constant does not suffice. - * - */ - function getFinalizeDepositL2Gas() - public - view - virtual - returns( - uint32 - ) - { - return DEFAULT_FINALIZE_DEPOSIT_L2_GAS; - } - /************** * Depositing * **************/ /** - * @dev deposit an amount of the ERC20 to the caller's balance on L2 + * @dev deposit an amount of the ERC20 to the caller's balance on L2. * @param _amount Amount of the ERC20 to deposit + * @param _l2Gas Gas limit required to complete the deposit on L2. + * @param _data Optional data to forward to L2. This data is provided + * solely as a convenience for external contracts. Aside from enforcing a maximum + * length, these contracts provide no guarantees about its content. */ function deposit( - uint _amount + uint256 _amount, + uint32 _l2Gas, + bytes calldata _data ) external override virtual { - _initiateDeposit(msg.sender, msg.sender, _amount); + _initiateDeposit(msg.sender, msg.sender, _amount, _l2Gas, _data); } /** - * @dev deposit an amount of ERC20 to a recipients's balance on L2 - * @param _to L2 address to credit the withdrawal to - * @param _amount Amount of the ERC20 to deposit + * @dev deposit an amount of ERC20 to a recipient's balance on L2. + * @param _to L2 address to credit the withdrawal to. + * @param _amount Amount of the ERC20 to deposit. + * @param _l2Gas Gas limit required to complete the deposit on L2. + * @param _data Optional data to forward to L2. This data is provided + * solely as a convenience for external contracts. Aside from enforcing a maximum + * length, these contracts provide no guarantees about its content. */ function depositTo( address _to, - uint _amount + uint256 _amount, + uint32 _l2Gas, + bytes calldata _data ) external override virtual { - _initiateDeposit(msg.sender, _to, _amount); + _initiateDeposit(msg.sender, _to, _amount, _l2Gas, _data); } /** @@ -148,11 +139,17 @@ abstract contract Abs_L1TokenGateway is iOVM_L1TokenGateway, OVM_CrossDomainEnab * @param _from Account to pull the deposit from on L1 * @param _to Account to give the deposit to on L2 * @param _amount Amount of the ERC20 to deposit. + * @param _l2Gas Gas limit required to complete the deposit on L2. + * @param _data Optional data to forward to L2. This data is provided + * solely as a convenience for external contracts. Aside from enforcing a maximum + * length, these contracts provide no guarantees about its content. */ function _initiateDeposit( address _from, address _to, - uint _amount + uint256 _amount, + uint32 _l2Gas, + bytes calldata _data ) internal { @@ -164,20 +161,23 @@ abstract contract Abs_L1TokenGateway is iOVM_L1TokenGateway, OVM_CrossDomainEnab ); // Construct calldata for l2DepositedToken.finalizeDeposit(_to, _amount) - bytes memory data = abi.encodeWithSelector( + bytes memory message = abi.encodeWithSelector( iOVM_L2DepositedToken.finalizeDeposit.selector, + _from, _to, - _amount + _amount, + _data ); // Send calldata into L2 sendCrossDomainMessage( l2DepositedToken, - data, - getFinalizeDepositL2Gas() + _l2Gas, + message ); - emit DepositInitiated(_from, _to, _amount); + // We omit _data here because events only support bytes32 types. + emit DepositInitiated(_from, _to, _amount, _data); } /************************* @@ -189,12 +189,18 @@ abstract contract Abs_L1TokenGateway is iOVM_L1TokenGateway, OVM_CrossDomainEnab * L1 ERC20 token. * This call will fail if the initialized withdrawal from L2 has not been finalized. * - * @param _to L1 address to credit the withdrawal to - * @param _amount Amount of the ERC20 to withdraw + * @param _from L2 address initiating the transfer. + * @param _to L1 address to credit the withdrawal to. + * @param _amount Amount of the ERC20 to deposit. + * @param _data Data provided by the sender on L2. This data is provided + * solely as a convenience for external contracts. Aside from enforcing a maximum + * length, these contracts provide no guarantees about its content. */ function finalizeWithdrawal( + address _from, address _to, - uint _amount + uint256 _amount, + bytes calldata _data ) external override @@ -206,7 +212,6 @@ abstract contract Abs_L1TokenGateway is iOVM_L1TokenGateway, OVM_CrossDomainEnab _to, _amount ); - - emit WithdrawalFinalized(_to, _amount); + emit WithdrawalFinalized(_from, _to, _amount, _data); } } diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/Abs_L2DepositedToken.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/Abs_L2DepositedToken.sol index 338220be2dbf..f71dc6667a29 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/Abs_L2DepositedToken.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/Abs_L2DepositedToken.sol @@ -40,7 +40,7 @@ abstract contract Abs_L2DepositedToken is iOVM_L2DepositedToken, OVM_CrossDomain ********************************/ /** - * @param _l2CrossDomainMessenger L1 Messenger address being used for cross-chain communications. + * @param _l2CrossDomainMessenger L2 Messenger address being used for cross-chain communications. */ constructor( address _l2CrossDomainMessenger @@ -50,9 +50,10 @@ abstract contract Abs_L2DepositedToken is iOVM_L2DepositedToken, OVM_CrossDomain /** * @dev Initialize this contract with the L1 token gateway address. - * The flow: 1) this contract gets deployed on L2, 2) the L1 - * gateway is deployed with addr from (1), 3) L1 gateway address passed here. - * + * The flow: + * 1) this contract is deployed on L2, + * 2) the L1 gateway is deployed with addr from (1), + * 3) L1 gateway address passed here. * @param _l1TokenGateway Address of the corresponding L1 gateway deployed to the main chain */ function init( @@ -80,19 +81,15 @@ abstract contract Abs_L2DepositedToken is iOVM_L2DepositedToken, OVM_CrossDomain * Overridable Accounting logic * ********************************/ - // Default gas value which can be overridden if more complex logic runs on L1. - uint32 internal constant DEFAULT_FINALIZE_WITHDRAWAL_L1_GAS = 100000; - /** * @dev Core logic to be performed when a withdrawal from L2 is initialized. * In most cases, this will simply burn the withdrawn L2 funds. - * - * param _to Address being withdrawn to - * param _amount Amount being withdrawn + * param _to Address being withdrawn to. + * param _amount Amount being withdrawn. */ function _handleInitiateWithdrawal( address, // _to, - uint // _amount + uint256 // _amount ) internal virtual @@ -103,13 +100,12 @@ abstract contract Abs_L2DepositedToken is iOVM_L2DepositedToken, OVM_CrossDomain /** * @dev Core logic to be performed when a deposit from L2 is finalized on L2. * In most cases, this will simply _mint() to credit L2 funds to the recipient. - * - * param _to Address being deposited to on L2 - * param _amount Amount which was deposited on L1 + * param _to Address being deposited to on L2. + * param _amount Amount which was deposited on L1. */ function _handleFinalizeDeposit( address, // _to - uint // _amount + uint256 // _amount ) internal virtual @@ -117,67 +113,82 @@ abstract contract Abs_L2DepositedToken is iOVM_L2DepositedToken, OVM_CrossDomain revert("Accounting must be implemented by child contract."); } - /** - * @dev Overridable getter for the *L1* gas limit of settling the withdrawal, in the case it may be - * dynamic, and the above public constant does not suffice. - */ - function getFinalizeWithdrawalL1Gas() - public - view - virtual - returns( - uint32 - ) - { - return DEFAULT_FINALIZE_WITHDRAWAL_L1_GAS; - } - - /*************** * Withdrawing * ***************/ /** * @dev initiate a withdraw of some tokens to the caller's account on L1 - * @param _amount Amount of the token to withdraw + * @param _amount Amount of the token to withdraw. + * param _l1Gas Unused, but included for potential forward compatibility considerations. + * @param _data Optional data to forward to L1. This data is provided + * solely as a convenience for external contracts. Aside from enforcing a maximum + * length, these contracts provide no guarantees about its content. */ function withdraw( - uint _amount + uint256 _amount, + uint32, // _l1Gas, + bytes calldata _data ) external override virtual onlyInitialized() { - _initiateWithdrawal(msg.sender, _amount); + _initiateWithdrawal( + msg.sender, + msg.sender, + _amount, + 0, + _data + ); } /** - * @dev initiate a withdraw of some token to a recipient's account on L1 - * @param _to L1 adress to credit the withdrawal to - * @param _amount Amount of the token to withdraw + * @dev initiate a withdraw of some token to a recipient's account on L1. + * @param _to L1 adress to credit the withdrawal to. + * @param _amount Amount of the token to withdraw. + * param _l1Gas Unused, but included for potential forward compatibility considerations. + * @param _data Optional data to forward to L1. This data is provided + * solely as a convenience for external contracts. Aside from enforcing a maximum + * length, these contracts provide no guarantees about its content. */ function withdrawTo( address _to, - uint _amount + uint256 _amount, + uint32, // _l1Gas, + bytes calldata _data ) external override virtual onlyInitialized() { - _initiateWithdrawal(_to, _amount); + _initiateWithdrawal( + msg.sender, + _to, + _amount, + 0, + _data + ); } /** * @dev Performs the logic for deposits by storing the token and informing the L2 token Gateway of the deposit. - * - * @param _to Account to give the withdrawal to on L1 - * @param _amount Amount of the token to withdraw + * @param _from Account to pull the deposit from on L2. + * @param _to Account to give the withdrawal to on L1. + * @param _amount Amount of the token to withdraw. + * param _l1Gas Unused, but included for potential forward compatibility considerations. + * @param _data Optional data to forward to L1. This data is provided + * solely as a convenience for external contracts. Aside from enforcing a maximum + * length, these contracts provide no guarantees about its content. */ function _initiateWithdrawal( + address _from, address _to, - uint _amount + uint256 _amount, + uint32, // _l1Gas, + bytes calldata _data ) internal { @@ -185,20 +196,22 @@ abstract contract Abs_L2DepositedToken is iOVM_L2DepositedToken, OVM_CrossDomain _handleInitiateWithdrawal(_to, _amount); // Construct calldata for l1TokenGateway.finalizeWithdrawal(_to, _amount) - bytes memory data = abi.encodeWithSelector( + bytes memory message = abi.encodeWithSelector( iOVM_L1TokenGateway.finalizeWithdrawal.selector, + _from, _to, - _amount + _amount, + _data ); // Send message up to L1 gateway sendCrossDomainMessage( address(l1TokenGateway), - data, - getFinalizeWithdrawalL1Gas() + 0, + message ); - emit WithdrawalInitiated(msg.sender, _to, _amount); + emit WithdrawalInitiated(msg.sender, _to, _amount, _data); } /************************************ @@ -209,13 +222,18 @@ abstract contract Abs_L2DepositedToken is iOVM_L2DepositedToken, OVM_CrossDomain * @dev Complete a deposit from L1 to L2, and credits funds to the recipient's balance of this * L2 token. * This call will fail if it did not originate from a corresponding deposit in OVM_l1TokenGateway. - * + * @param _from Account to pull the deposit from on L2. * @param _to Address to receive the withdrawal at * @param _amount Amount of the token to withdraw + * @param _data Data provider by the sender on L1. This data is provided + * solely as a convenience for external contracts. Aside from enforcing a maximum + * length, these contracts provide no guarantees about its content. */ function finalizeDeposit( + address _from, address _to, - uint _amount + uint256 _amount, + bytes calldata _data ) external override @@ -224,6 +242,6 @@ abstract contract Abs_L2DepositedToken is iOVM_L2DepositedToken, OVM_CrossDomain onlyFromCrossDomainAccount(address(l1TokenGateway)) { _handleFinalizeDeposit(_to, _amount); - emit DepositFinalized(_to, _amount); + emit DepositFinalized(_from, _to, _amount, _data); } } diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ERC20Gateway.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ERC20Gateway.sol index 0d97a7a24c3f..23834445b8b3 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ERC20Gateway.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ERC20Gateway.sol @@ -35,8 +35,8 @@ contract OVM_L1ERC20Gateway is Abs_L1TokenGateway { ***************/ /** - * @param _l1ERC20 L1 ERC20 address this contract stores deposits for - * @param _l2DepositedERC20 L2 Gateway address on the chain being deposited into + * @param _l1ERC20 L1 ERC20 address this contract stores deposits for. + * @param _l2DepositedERC20 L2 Gateway address on the chain being deposited into. */ constructor( iOVM_ERC20 _l1ERC20, @@ -58,11 +58,11 @@ contract OVM_L1ERC20Gateway is Abs_L1TokenGateway { /** * @dev When a deposit is initiated on L1, the L1 Gateway - * transfers the funds to itself for future withdrawals + * transfers the funds to itself for future withdrawals. * - * @param _from L1 address ETH is being deposited from - * param _to L2 address that the ETH is being deposited to - * @param _amount Amount of ERC20 to send + * @param _from L1 address ETH is being deposited from. + * param _to L2 address that the ETH is being deposited to. + * @param _amount Amount of ERC20 to send. */ function _handleInitiateDeposit( address _from, @@ -82,14 +82,14 @@ contract OVM_L1ERC20Gateway is Abs_L1TokenGateway { /** * @dev When a withdrawal is finalized on L1, the L1 Gateway - * transfers the funds to the withdrawer + * transfers the funds to the withdrawer. * - * @param _to L1 address that the ERC20 is being withdrawn to - * @param _amount Amount of ERC20 to send + * @param _to L1 address that the ERC20 is being withdrawn to. + * @param _amount Amount of ERC20 to send. */ function _handleFinalizeWithdrawal( address _to, - uint _amount + uint256 _amount ) internal override diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ETHGateway.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ETHGateway.sol index 1080e5691895..d3e475e43ceb 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ETHGateway.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ETHGateway.sol @@ -21,12 +21,6 @@ import { Lib_AddressManager } from "../../../libraries/resolver/Lib_AddressManag */ contract OVM_L1ETHGateway is iOVM_L1ETHGateway, OVM_CrossDomainEnabled, Lib_AddressResolver { - /******************** - * Public Constants * - ********************/ - - uint32 public constant override getFinalizeDepositL2Gas = 1200000; - /******************************** * External Contract References * ********************************/ @@ -41,7 +35,6 @@ contract OVM_L1ETHGateway is iOVM_L1ETHGateway, OVM_CrossDomainEnabled, Lib_Addr constructor() OVM_CrossDomainEnabled(address(0)) Lib_AddressResolver(address(0)) - public {} /****************** @@ -68,66 +61,102 @@ contract OVM_L1ETHGateway is iOVM_L1ETHGateway, OVM_CrossDomainEnabled, Lib_Addr * Depositing * **************/ + /** + * @dev This function can be called with no data + * to deposit an amount of ETH to the caller's balance on L2. + * Since the receive function doesn't take data, a conservative + * default of 1.2 Million gas is forwarded to L2. + */ receive() external payable { - _initiateDeposit(msg.sender, msg.sender); + _initiateDeposit(msg.sender, msg.sender, 1_200_000, bytes("")); } /** - * @dev deposit an amount of the ETH to the caller's balance on L2 + * @dev Deposit an amount of the ETH to the caller's balance on L2. + * @param _l2Gas Gas limit required to complete the deposit on L2. + * @param _data Optional data to forward to L2. This data is provided + * solely as a convenience for external contracts. Aside from enforcing a maximum + * length, these contracts provide no guarantees about its content. */ - function deposit() + function deposit( + uint32 _l2Gas, + bytes calldata _data + ) external override payable { - _initiateDeposit(msg.sender, msg.sender); + _initiateDeposit( + msg.sender, + msg.sender, + _l2Gas, + _data + ); } /** - * @dev deposit an amount of ETH to a recipients's balance on L2 - * @param _to L2 address to credit the withdrawal to + * @dev Deposit an amount of ETH to a recipient's balance on L2. + * @param _to L2 address to credit the withdrawal to. + * @param _l2Gas Gas limit required to complete the deposit on L2. + * @param _data Optional data to forward to L2. This data is provided + * solely as a convenience for external contracts. Aside from enforcing a maximum + * length, these contracts provide no guarantees about its content. */ function depositTo( - address _to + address _to, + uint32 _l2Gas, + bytes calldata _data ) external override payable { - _initiateDeposit(msg.sender, _to); + _initiateDeposit( + msg.sender, + _to, + _l2Gas, + _data + ); } /** * @dev Performs the logic for deposits by storing the ETH and informing the L2 ETH Gateway of the deposit. - * - * @param _from Account to pull the deposit from on L1 - * @param _to Account to give the deposit to on L2 + * @param _from Account to pull the deposit from on L1. + * @param _to Account to give the deposit to on L2. + * @param _l2Gas Gas limit required to complete the deposit on L2. + * @param _data Optional data to forward to L2. This data is provided + * solely as a convenience for external contracts. Aside from enforcing a maximum + * length, these contracts provide no guarantees about its content. */ function _initiateDeposit( address _from, - address _to + address _to, + uint32 _l2Gas, + bytes memory _data ) internal { // Construct calldata for l2ETHGateway.finalizeDeposit(_to, _amount) - bytes memory data = + bytes memory message = abi.encodeWithSelector( iOVM_L2DepositedToken.finalizeDeposit.selector, + _from, _to, - msg.value + msg.value, + _data ); // Send calldata into L2 sendCrossDomainMessage( ovmEth, - data, - getFinalizeDepositL2Gas + _l2Gas, + message ); - emit DepositInitiated(_from, _to, msg.value); + emit DepositInitiated(_from, _to, msg.value, _data); } /************************* @@ -138,13 +167,18 @@ contract OVM_L1ETHGateway is iOVM_L1ETHGateway, OVM_CrossDomainEnabled, Lib_Addr * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the * L1 ETH token. * Since only the xDomainMessenger can call this function, it will never be called before the withdrawal is finalized. - * - * @param _to L1 address to credit the withdrawal to - * @param _amount Amount of the ETH to withdraw + * @param _from L2 address initiating the transfer. + * @param _to L1 address to credit the withdrawal to. + * @param _amount Amount of the ERC20 to deposit. + * @param _data Optional data to forward to L2. This data is provided + * solely as a convenience for external contracts. Aside from enforcing a maximum + * length, these contracts provide no guarantees about its content. */ function finalizeWithdrawal( + address _from, address _to, - uint256 _amount + uint256 _amount, + bytes calldata _data ) external override @@ -152,7 +186,7 @@ contract OVM_L1ETHGateway is iOVM_L1ETHGateway, OVM_CrossDomainEnabled, Lib_Addr { _safeTransferETH(_to, _amount); - emit WithdrawalFinalized(_to, _amount); + emit WithdrawalFinalized(_from, _to, _amount, _data); } /********************************** @@ -162,8 +196,8 @@ contract OVM_L1ETHGateway is iOVM_L1ETHGateway, OVM_CrossDomainEnabled, Lib_Addr /** * @dev Internal accounting function for moving around L1 ETH. * - * @param _to L1 address to transfer ETH to - * @param _value Amount of ETH to send to + * @param _to L1 address to transfer ETH to. + * @param _value Amount of ETH to transfer. */ function _safeTransferETH( address _to, @@ -180,8 +214,8 @@ contract OVM_L1ETHGateway is iOVM_L1ETHGateway, OVM_CrossDomainEnabled, Lib_Addr *****************************/ /** - * @dev Migrates entire ETH balance to another gateway - * @param _to Gateway Proxy address to migrate ETH to + * @dev Migrates entire ETH balance to another gateway. + * @param _to Gateway Proxy address to migrate ETH to. */ function migrateEth(address payable _to) external { address owner = Lib_AddressManager(libAddressManager).owner(); @@ -192,7 +226,7 @@ contract OVM_L1ETHGateway is iOVM_L1ETHGateway, OVM_CrossDomainEnabled, Lib_Addr /** * @dev Adds ETH balance to the account. This is meant to allow for ETH - * to be migrated from an old gateway to a new gateway + * to be migrated from an old gateway to a new gateway. */ function donateETH() external payable {} } diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L2DepositedERC20.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L2DepositedERC20.sol index e1fd3112493b..b7e741636caf 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L2DepositedERC20.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L2DepositedERC20.sol @@ -31,8 +31,8 @@ contract OVM_L2DepositedERC20 is Abs_L2DepositedToken, UniswapV2ERC20 { /** * @param _l2CrossDomainMessenger Cross-domain messenger used by this contract. - * @param _name ERC20 name - * @param _symbol ERC20 symbol + * @param _name ERC20 name. + * @param _symbol ERC20 symbol. */ constructor( address _l2CrossDomainMessenger, @@ -46,7 +46,7 @@ contract OVM_L2DepositedERC20 is Abs_L2DepositedToken, UniswapV2ERC20 { // When a withdrawal is initiated, we burn the withdrawer's funds to prevent subsequent L2 usage. function _handleInitiateWithdrawal( address, // _to, - uint _amount + uint256 _amount ) internal override @@ -57,7 +57,7 @@ contract OVM_L2DepositedERC20 is Abs_L2DepositedToken, UniswapV2ERC20 { // When a deposit is finalized, we credit the account on L2 with the same amount of tokens. function _handleFinalizeDeposit( address _to, - uint _amount + uint256 _amount ) internal override diff --git a/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1ETHGateway.sol b/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1ETHGateway.sol index 32a9918d9cca..44c834b89da5 100644 --- a/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1ETHGateway.sol +++ b/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1ETHGateway.sol @@ -13,25 +13,33 @@ interface iOVM_L1ETHGateway { event DepositInitiated( address indexed _from, - address _to, - uint256 _amount + address indexed _to, + uint256 _amount, + bytes _data ); event WithdrawalFinalized( + address indexed _from, address indexed _to, - uint256 _amount + uint256 _amount, + bytes _data ); /******************** * Public Functions * ********************/ - function deposit() + function deposit( + uint32 _l2Gas, + bytes calldata _data + ) external payable; function depositTo( - address _to + address _to, + uint32 _l2Gas, + bytes calldata _data ) external payable; @@ -41,15 +49,11 @@ interface iOVM_L1ETHGateway { *************************/ function finalizeWithdrawal( + address _from, address _to, - uint _amount + uint _amount, + bytes calldata _data ) external; - function getFinalizeDepositL2Gas() - external - view - returns( - uint32 - ); } diff --git a/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1TokenGateway.sol b/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1TokenGateway.sol index 087684e34026..402aefbcc669 100644 --- a/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1TokenGateway.sol +++ b/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1TokenGateway.sol @@ -13,13 +13,16 @@ interface iOVM_L1TokenGateway { event DepositInitiated( address indexed _from, - address _to, - uint256 _amount + address indexed _to, + uint256 _amount, + bytes _data ); event WithdrawalFinalized( + address indexed _from, address indexed _to, - uint256 _amount + uint256 _amount, + bytes _data ); @@ -28,13 +31,17 @@ interface iOVM_L1TokenGateway { ********************/ function deposit( - uint _amount + uint _amount, + uint32 _l2Gas, + bytes calldata _data ) external; function depositTo( address _to, - uint _amount + uint _amount, + uint32 _l2Gas, + bytes calldata _data ) external; @@ -44,8 +51,11 @@ interface iOVM_L1TokenGateway { *************************/ function finalizeWithdrawal( + address _from, address _to, - uint _amount + uint _amount, + bytes calldata _data ) external; + } diff --git a/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L2DepositedToken.sol b/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L2DepositedToken.sol index 40088bfc2d48..14d12db81a9a 100644 --- a/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L2DepositedToken.sol +++ b/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L2DepositedToken.sol @@ -13,13 +13,16 @@ interface iOVM_L2DepositedToken { event WithdrawalInitiated( address indexed _from, - address _to, - uint256 _amount + address indexed _to, + uint256 _amount, + bytes _data ); event DepositFinalized( + address indexed _from, address indexed _to, - uint256 _amount + uint256 _amount, + bytes _data ); @@ -28,13 +31,17 @@ interface iOVM_L2DepositedToken { ********************/ function withdraw( - uint _amount + uint _amount, + uint32 _l1Gas, + bytes calldata _data ) external; function withdrawTo( address _to, - uint _amount + uint _amount, + uint32 _l1Gas, + bytes calldata _data ) external; @@ -44,8 +51,11 @@ interface iOVM_L2DepositedToken { *************************/ function finalizeDeposit( + address _from, address _to, - uint _amount + uint _amount, + bytes calldata _data ) external; + } diff --git a/packages/contracts/contracts/optimistic-ethereum/libraries/bridge/OVM_CrossDomainEnabled.sol b/packages/contracts/contracts/optimistic-ethereum/libraries/bridge/OVM_CrossDomainEnabled.sol index 56f55799f102..784ecfb71094 100644 --- a/packages/contracts/contracts/optimistic-ethereum/libraries/bridge/OVM_CrossDomainEnabled.sol +++ b/packages/contracts/contracts/optimistic-ethereum/libraries/bridge/OVM_CrossDomainEnabled.sol @@ -23,7 +23,7 @@ contract OVM_CrossDomainEnabled { /*************** * Constructor * - ***************/ + ***************/ /** * @param _messenger Address of the CrossDomainMessenger on the current layer. @@ -68,7 +68,7 @@ contract OVM_CrossDomainEnabled { /** * Gets the messenger, usually from storage. This function is exposed in case a child contract * needs to override. - * @return The address of the cross-domain messenger contract which should be used. + * @return The address of the cross-domain messenger contract which should be used. */ function getCrossDomainMessenger() internal @@ -83,17 +83,17 @@ contract OVM_CrossDomainEnabled { /** * Sends a message to an account on another domain * @param _crossDomainTarget The intended recipient on the destination domain - * @param _data The data to send to the target (usually calldata to a function with + * @param _message The data to send to the target (usually calldata to a function with * `onlyFromCrossDomainAccount()`) * @param _gasLimit The gasLimit for the receipt of the message on the target domain. */ function sendCrossDomainMessage( address _crossDomainTarget, - bytes memory _data, - uint32 _gasLimit + uint32 _gasLimit, + bytes memory _message ) internal { - getCrossDomainMessenger().sendMessage(_crossDomainTarget, _data, _gasLimit); + getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit); } } diff --git a/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L1ERC20Gateway.spec.ts b/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L1ERC20Gateway.spec.ts index a3a305862774..a7fb4394a311 100644 --- a/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L1ERC20Gateway.spec.ts +++ b/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L1ERC20Gateway.spec.ts @@ -6,9 +6,10 @@ import { Signer, ContractFactory, Contract, constants } from 'ethers' import { smockit, MockContract, smoddit } from '@eth-optimism/smock' /* Internal Imports */ -import { NON_ZERO_ADDRESS } from '../../../../helpers' +import { NON_NULL_BYTES32, NON_ZERO_ADDRESS } from '../../../../helpers' const INITIAL_TOTAL_L1_SUPPLY = 3000 +const FINALIZATION_GAS = 1_200_000 const ERR_INVALID_MESSENGER = 'OVM_XCHAIN: messenger contract unauthenticated' const ERR_INVALID_X_DOMAIN_MSG_SENDER = @@ -46,7 +47,6 @@ describe('OVM_L1ERC20Gateway', () => { let OVM_L1ERC20Gateway: Contract let Mock__OVM_L1CrossDomainMessenger: MockContract - let finalizeDepositGasLimit: number beforeEach(async () => { // Create a special signer which will enable us to send messages from the L1Messenger contract let l1MessengerImpersonator: Signer @@ -65,8 +65,6 @@ describe('OVM_L1ERC20Gateway', () => { Mock__OVM_L2DepositedERC20.address, Mock__OVM_L1CrossDomainMessenger.address ) - - finalizeDepositGasLimit = await OVM_L1ERC20Gateway.getFinalizeDepositL2Gas() }) describe('finalizeWithdrawal', () => { @@ -81,7 +79,12 @@ describe('OVM_L1ERC20Gateway', () => { ) await expect( - OVM_L1ERC20Gateway.finalizeWithdrawal(constants.AddressZero, 1) + OVM_L1ERC20Gateway.finalizeWithdrawal( + constants.AddressZero, + constants.AddressZero, + 1, + NON_NULL_BYTES32 + ) ).to.be.revertedWith(ERR_INVALID_MESSENGER) }) @@ -91,9 +94,15 @@ describe('OVM_L1ERC20Gateway', () => { ) await expect( - OVM_L1ERC20Gateway.finalizeWithdrawal(constants.AddressZero, 1, { - from: Mock__OVM_L1CrossDomainMessenger.address, - }) + OVM_L1ERC20Gateway.finalizeWithdrawal( + constants.AddressZero, + constants.AddressZero, + 1, + NON_NULL_BYTES32, + { + from: Mock__OVM_L1CrossDomainMessenger.address, + } + ) ).to.be.revertedWith(ERR_INVALID_X_DOMAIN_MSG_SENDER) }) @@ -109,8 +118,10 @@ describe('OVM_L1ERC20Gateway', () => { await L1ERC20.transfer(OVM_L1ERC20Gateway.address, withdrawalAmount) const res = await OVM_L1ERC20Gateway.finalizeWithdrawal( + NON_ZERO_ADDRESS, NON_ZERO_ADDRESS, withdrawalAmount, + NON_NULL_BYTES32, { from: Mock__OVM_L1CrossDomainMessenger.address } ) @@ -125,8 +136,6 @@ describe('OVM_L1ERC20Gateway', () => { const OVM_L2DepositedERC20 = await ( await ethers.getContractFactory('OVM_L2DepositedERC20') ).deploy(constants.AddressZero, '', '') - const defaultFinalizeWithdrawalGas = await OVM_L2DepositedERC20.getFinalizeWithdrawalL1Gas() - await expect(gasUsed.gt((defaultFinalizeWithdrawalGas * 11) / 10)) }) it.skip('finalizeWithdrawalAndCall(): should should credit funds to the withdrawer, and forward from and data', async () => { @@ -171,7 +180,11 @@ describe('OVM_L1ERC20Gateway', () => { it('deposit() escrows the deposit amount and sends the correct deposit message', async () => { // alice calls deposit on the gateway and the L1 gateway calls transferFrom on the token - await OVM_L1ERC20Gateway.deposit(depositAmount) + await OVM_L1ERC20Gateway.deposit( + depositAmount, + FINALIZATION_GAS, + NON_NULL_BYTES32 + ) const depositCallToMessenger = Mock__OVM_L1CrossDomainMessenger.smocked.sendMessage.calls[0] @@ -195,16 +208,21 @@ describe('OVM_L1ERC20Gateway', () => { expect(depositCallToMessenger._message).to.equal( await Mock__OVM_L2DepositedERC20.interface.encodeFunctionData( 'finalizeDeposit', - [depositer, depositAmount] + [depositer, depositer, depositAmount, NON_NULL_BYTES32] ) ) - expect(depositCallToMessenger._gasLimit).to.equal(finalizeDepositGasLimit) + expect(depositCallToMessenger._gasLimit).to.equal(FINALIZATION_GAS) }) it('depositTo() escrows the deposit amount and sends the correct deposit message', async () => { // depositor calls deposit on the gateway and the L1 gateway calls transferFrom on the token const bobsAddress = await bob.getAddress() - await OVM_L1ERC20Gateway.depositTo(bobsAddress, depositAmount) + await OVM_L1ERC20Gateway.depositTo( + bobsAddress, + depositAmount, + FINALIZATION_GAS, + NON_NULL_BYTES32 + ) const depositCallToMessenger = Mock__OVM_L1CrossDomainMessenger.smocked.sendMessage.calls[0] @@ -228,10 +246,10 @@ describe('OVM_L1ERC20Gateway', () => { expect(depositCallToMessenger._message).to.equal( await Mock__OVM_L2DepositedERC20.interface.encodeFunctionData( 'finalizeDeposit', - [bobsAddress, depositAmount] + [depositer, bobsAddress, depositAmount, NON_NULL_BYTES32] ) ) - expect(depositCallToMessenger._gasLimit).to.equal(finalizeDepositGasLimit) + expect(depositCallToMessenger._gasLimit).to.equal(FINALIZATION_GAS) }) }) }) diff --git a/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L1ETHGateway.spec.ts b/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L1ETHGateway.spec.ts index 98d64620cfad..731cf073f432 100644 --- a/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L1ETHGateway.spec.ts +++ b/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L1ETHGateway.spec.ts @@ -6,7 +6,11 @@ import { Signer, Contract, constants } from 'ethers' import { smockit, MockContract } from '@eth-optimism/smock' /* Internal Imports */ -import { NON_ZERO_ADDRESS, makeAddressManager } from '../../../../helpers' +import { + NON_ZERO_ADDRESS, + makeAddressManager, + NON_NULL_BYTES32, +} from '../../../../helpers' const L1_MESSENGER_NAME = 'Proxy__OVM_L1CrossDomainMessenger' @@ -14,6 +18,7 @@ const ERR_INVALID_MESSENGER = 'OVM_XCHAIN: messenger contract unauthenticated' const ERR_INVALID_X_DOMAIN_MSG_SENDER = 'OVM_XCHAIN: wrong sender of cross-domain message' const ERR_ALREADY_INITIALIZED = 'Contract has already been initialized.' +const FINALIZATION_GAS = 1_200_000 describe('OVM_L1ETHGateway', () => { // init signers @@ -38,7 +43,6 @@ describe('OVM_L1ETHGateway', () => { let OVM_L1ETHGateway: Contract let Mock__OVM_L1CrossDomainMessenger: MockContract - let finalizeDepositGasLimit: number beforeEach(async () => { // Get a new mock L1 messenger Mock__OVM_L1CrossDomainMessenger = await smockit( @@ -54,8 +58,6 @@ describe('OVM_L1ETHGateway', () => { AddressManager.address, Mock__OVM_L2DepositedERC20.address ) - - finalizeDepositGasLimit = await OVM_L1ETHGateway.getFinalizeDepositL2Gas() }) describe('initialize', () => { @@ -75,7 +77,9 @@ describe('OVM_L1ETHGateway', () => { await expect( OVM_L1ETHGateway.connect(alice).finalizeWithdrawal( constants.AddressZero, - 1 + constants.AddressZero, + 1, + NON_NULL_BYTES32 ) ).to.be.revertedWith(ERR_INVALID_MESSENGER) }) @@ -99,7 +103,12 @@ describe('OVM_L1ETHGateway', () => { ) await expect( - OVM_L1ETHGateway.finalizeWithdrawal(constants.AddressZero, 1) + OVM_L1ETHGateway.finalizeWithdrawal( + constants.AddressZero, + constants.AddressZero, + 1, + NON_NULL_BYTES32 + ) ).to.be.revertedWith(ERR_INVALID_X_DOMAIN_MSG_SENDER) }) @@ -115,14 +124,20 @@ describe('OVM_L1ETHGateway', () => { ) // thanks Alice - await OVM_L1ETHGateway.connect(alice).deposit({ - value: ethers.utils.parseEther('1.0'), - gasPrice: 0, - }) + await OVM_L1ETHGateway.connect(alice).deposit( + FINALIZATION_GAS, + NON_NULL_BYTES32, + { + value: ethers.utils.parseEther('1.0'), + gasPrice: 0, + } + ) const res = await OVM_L1ETHGateway.finalizeWithdrawal( + NON_ZERO_ADDRESS, NON_ZERO_ADDRESS, withdrawalAmount, + NON_NULL_BYTES32, { from: Mock__OVM_L1CrossDomainMessenger.address } ) @@ -138,12 +153,6 @@ describe('OVM_L1ETHGateway', () => { const OVM_L2DepositedERC20 = await ( await ethers.getContractFactory('OVM_L2DepositedERC20') ).deploy(constants.AddressZero, '', '') - - await expect( - gasUsed.gt( - ((await OVM_L2DepositedERC20.getFinalizeWithdrawalL1Gas()) * 11) / 10 - ) - ) }) it.skip('finalizeWithdrawalAndCall(): should should credit funds to the withdrawer, and forward from and data', async () => { @@ -182,10 +191,14 @@ describe('OVM_L1ETHGateway', () => { const initialBalance = await ethers.provider.getBalance(depositer) // alice calls deposit on the gateway and the L1 gateway calls transferFrom on the token - await OVM_L1ETHGateway.connect(alice).deposit({ - value: depositAmount, - gasPrice: 0, - }) + await OVM_L1ETHGateway.connect(alice).deposit( + FINALIZATION_GAS, + NON_NULL_BYTES32, + { + value: depositAmount, + gasPrice: 0, + } + ) const depositCallToMessenger = Mock__OVM_L1CrossDomainMessenger.smocked.sendMessage.calls[0] @@ -211,10 +224,10 @@ describe('OVM_L1ETHGateway', () => { expect(depositCallToMessenger._message).to.equal( await Mock__OVM_L2DepositedERC20.interface.encodeFunctionData( 'finalizeDeposit', - [depositer, depositAmount] + [depositer, depositer, depositAmount, NON_NULL_BYTES32] ) ) - expect(depositCallToMessenger._gasLimit).to.equal(finalizeDepositGasLimit) + expect(depositCallToMessenger._gasLimit).to.equal(FINALIZATION_GAS) }) it('depositTo() escrows the deposit amount and sends the correct deposit message', async () => { @@ -223,10 +236,15 @@ describe('OVM_L1ETHGateway', () => { const aliceAddress = await alice.getAddress() const initialBalance = await ethers.provider.getBalance(aliceAddress) - await OVM_L1ETHGateway.connect(alice).depositTo(bobsAddress, { - value: depositAmount, - gasPrice: 0, - }) + await OVM_L1ETHGateway.connect(alice).depositTo( + bobsAddress, + FINALIZATION_GAS, + NON_NULL_BYTES32, + { + value: depositAmount, + gasPrice: 0, + } + ) const depositCallToMessenger = Mock__OVM_L1CrossDomainMessenger.smocked.sendMessage.calls[0] @@ -250,12 +268,13 @@ describe('OVM_L1ETHGateway', () => { expect(depositCallToMessenger._message).to.equal( await Mock__OVM_L2DepositedERC20.interface.encodeFunctionData( 'finalizeDeposit', - [bobsAddress, depositAmount] + [aliceAddress, bobsAddress, depositAmount, NON_NULL_BYTES32] ) ) - expect(depositCallToMessenger._gasLimit).to.equal(finalizeDepositGasLimit) + expect(depositCallToMessenger._gasLimit).to.equal(FINALIZATION_GAS) }) }) + describe('migrating ETH', () => { const migrateAmount = 1_000 diff --git a/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L2DepositedERC20.spec.ts b/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L2DepositedERC20.spec.ts index 94e22562931e..e404a951a2bb 100644 --- a/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L2DepositedERC20.spec.ts +++ b/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L2DepositedERC20.spec.ts @@ -11,7 +11,9 @@ import { } from '@eth-optimism/smock' /* Internal Imports */ -import { NON_ZERO_ADDRESS } from '../../../../helpers' +import { NON_NULL_BYTES32, NON_ZERO_ADDRESS } from '../../../../helpers' + +const FINALIZATION_GAS = 1_200_000 const ERR_INVALID_MESSENGER = 'OVM_XCHAIN: messenger contract unauthenticated' const ERR_INVALID_X_DOMAIN_MSG_SENDER = @@ -32,7 +34,6 @@ describe('OVM_L2DepositedERC20', () => { let OVM_L2DepositedERC20: Contract let Mock__OVM_L2CrossDomainMessenger: MockContract - let finalizeWithdrawalGasLimit: number beforeEach(async () => { // Create a special signer which will enable us to send messages from the L2Messenger contract let l2MessengerImpersonator: Signer @@ -52,8 +53,6 @@ describe('OVM_L2DepositedERC20', () => { // initialize the L2 Gateway with the L1G ateway addrss await OVM_L2DepositedERC20.init(MOCK_L1GATEWAY_ADDRESS) - - finalizeWithdrawalGasLimit = await OVM_L2DepositedERC20.getFinalizeWithdrawalL1Gas() }) // test the transfer flow of moving a token from L2 to L1 @@ -66,7 +65,12 @@ describe('OVM_L2DepositedERC20', () => { await OVM_L2DepositedERC20.init(NON_ZERO_ADDRESS) await expect( - OVM_L2DepositedERC20.finalizeDeposit(constants.AddressZero, 0) + OVM_L2DepositedERC20.finalizeDeposit( + constants.AddressZero, + constants.AddressZero, + 0, + NON_NULL_BYTES32 + ) ).to.be.revertedWith(ERR_INVALID_MESSENGER) }) @@ -76,9 +80,15 @@ describe('OVM_L2DepositedERC20', () => { ) await expect( - OVM_L2DepositedERC20.finalizeDeposit(constants.AddressZero, 0, { - from: Mock__OVM_L2CrossDomainMessenger.address, - }) + OVM_L2DepositedERC20.finalizeDeposit( + constants.AddressZero, + constants.AddressZero, + 0, + NON_NULL_BYTES32, + { + from: Mock__OVM_L2CrossDomainMessenger.address, + } + ) ).to.be.revertedWith(ERR_INVALID_X_DOMAIN_MSG_SENDER) }) @@ -89,8 +99,10 @@ describe('OVM_L2DepositedERC20', () => { ) await OVM_L2DepositedERC20.finalizeDeposit( + NON_ZERO_ADDRESS, await alice.getAddress(), depositAmount, + NON_NULL_BYTES32, { from: Mock__OVM_L2CrossDomainMessenger.address } ) @@ -124,7 +136,11 @@ describe('OVM_L2DepositedERC20', () => { }) it('withdraw() burns and sends the correct withdrawal message', async () => { - await SmoddedL2Gateway.withdraw(withdrawAmount) + await SmoddedL2Gateway.withdraw( + withdrawAmount, + FINALIZATION_GAS, + NON_NULL_BYTES32 + ) const withdrawalCallToMessenger = Mock__OVM_L2CrossDomainMessenger.smocked.sendMessage.calls[0] @@ -149,17 +165,37 @@ describe('OVM_L2DepositedERC20', () => { expect(withdrawalCallToMessenger._message).to.equal( await Factory__OVM_L1ERC20Gateway.interface.encodeFunctionData( 'finalizeWithdrawal', - [await alice.getAddress(), withdrawAmount] + [ + await alice.getAddress(), + await alice.getAddress(), + withdrawAmount, + NON_NULL_BYTES32, + ] ) ) - // Hardcoded gaslimit should be correct - expect(withdrawalCallToMessenger._gasLimit).to.equal( - finalizeWithdrawalGasLimit + // gaslimit should be correct + expect(withdrawalCallToMessenger._gasLimit).to.equal(0) + }) + + it('withdraw() uses the user provided gas limit if it is larger than the default value ', async () => { + await SmoddedL2Gateway.withdraw( + withdrawAmount, + FINALIZATION_GAS, + NON_NULL_BYTES32 ) + const withdrawalCallToMessenger = + Mock__OVM_L2CrossDomainMessenger.smocked.sendMessage.calls[0] + // gas value is ignored and set to 0. + expect(withdrawalCallToMessenger._gasLimit).to.equal(0) }) it('withdrawTo() burns and sends the correct withdrawal message', async () => { - await SmoddedL2Gateway.withdrawTo(await bob.getAddress(), withdrawAmount) + await SmoddedL2Gateway.withdrawTo( + await bob.getAddress(), + withdrawAmount, + FINALIZATION_GAS, + NON_NULL_BYTES32 + ) const withdrawalCallToMessenger = Mock__OVM_L2CrossDomainMessenger.smocked.sendMessage.calls[0] @@ -184,13 +220,30 @@ describe('OVM_L2DepositedERC20', () => { expect(withdrawalCallToMessenger._message).to.equal( await Factory__OVM_L1ERC20Gateway.interface.encodeFunctionData( 'finalizeWithdrawal', - [await bob.getAddress(), withdrawAmount] + [ + await alice.getAddress(), + await bob.getAddress(), + withdrawAmount, + NON_NULL_BYTES32, + ] ) ) - // Hardcoded gaslimit should be correct - expect(withdrawalCallToMessenger._gasLimit).to.equal( - finalizeWithdrawalGasLimit + // gas value is ignored and set to 0. + expect(withdrawalCallToMessenger._gasLimit).to.equal(0) + }) + + it('withdrawTo() uses the user provided gas limit if it is larger than the default value ', async () => { + await SmoddedL2Gateway.withdrawTo( + await bob.getAddress(), + withdrawAmount, + FINALIZATION_GAS, + NON_NULL_BYTES32 ) + const withdrawalCallToMessenger = + Mock__OVM_L2CrossDomainMessenger.smocked.sendMessage.calls[0] + + // gas value is ignored and set to 0. + expect(withdrawalCallToMessenger._gasLimit).to.equal(0) }) }) From 7f5936a835279ef57bd213a704a7651b021d9d60 Mon Sep 17 00:00:00 2001 From: Maurelian Date: Wed, 2 Jun 2021 11:46:17 -0400 Subject: [PATCH 035/125] More consistent style for Constant values (#991) * chore(contracts): make container addresses be constants chore(contracts): consistent style for constant vars * chore(contracts): add internal on predeploy constants --- .changeset/clever-dancers-warn.md | 5 +++++ .../OVM/accounts/OVM_ProxyEOA.sol | 2 +- .../messaging/OVM_L1CrossDomainMessenger.sol | 2 +- .../OVM/execution/OVM_ExecutionManager.sol | 19 ++++++++++++++---- .../constants/Lib_PredeployAddresses.sol | 20 +++++++++---------- 5 files changed, 32 insertions(+), 16 deletions(-) create mode 100644 .changeset/clever-dancers-warn.md diff --git a/.changeset/clever-dancers-warn.md b/.changeset/clever-dancers-warn.md new file mode 100644 index 000000000000..5af303ee00d7 --- /dev/null +++ b/.changeset/clever-dancers-warn.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/contracts': patch +--- + +Apply consistent styling to constants diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol index c1e7fe3a2b47..abcb63f65363 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol @@ -98,7 +98,7 @@ contract OVM_ProxyEOA { address implementation = Lib_Bytes32Utils.toAddress(addr32); if (implementation == address(0)) { - return Lib_PredeployAddresses.ovmECDSAContractAccount; + return Lib_PredeployAddresses.ECDSA_CONTRACT_ACCOUNT; } else { return implementation; } diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol index d71002bd540a..f76b04c7542c 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol @@ -408,7 +408,7 @@ contract OVM_L1CrossDomainMessenger is bool exists, bytes memory encodedMessagePassingAccount ) = Lib_SecureMerkleTrie.get( - abi.encodePacked(Lib_PredeployAddresses.ovmL2ToL1MessagePasser), + abi.encodePacked(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER), _proof.stateTrieWitness, _proof.stateRoot ); diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol index 8c410cb51e55..f75a4659ff31 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol @@ -73,6 +73,17 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { uint256 constant DEFAULT_UINT256 = 0xdefa017defa017defa017defa017defa017defa017defa017defa017defa017d; address constant DEFAULT_ADDRESS = 0xdEfa017defA017DeFA017DEfa017DeFA017DeFa0; + + /************************************* + * Container Contract Address Prefix * + *************************************/ + + /** + * @dev The Execution Manager and State Manager each have this 30 byte prefix, and are uncallable. + */ + address constant CONTAINER_CONTRACT_PREFIX = 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000; + + /*************** * Constructor * ***************/ @@ -552,9 +563,9 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { address proxyEOA = Lib_EthUtils.createContract(abi.encodePacked( hex"600D380380600D6000396000f3", ovmEXTCODECOPY( - Lib_PredeployAddresses.ovmProxyEOA, + Lib_PredeployAddresses.PROXY_EOA, 0, - ovmEXTCODESIZE(Lib_PredeployAddresses.ovmProxyEOA) + ovmEXTCODESIZE(Lib_PredeployAddresses.PROXY_EOA) ) )); @@ -830,7 +841,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { // the deployer ovmCALLing the whitelist. This is fine--in a sense, we are forcing them to. (bool success, bytes memory data) = ovmCALL( gasleft(), - Lib_PredeployAddresses.ovmDeployerWhitelist, + Lib_PredeployAddresses.DEPLOYER_WHITELIST, abi.encodeWithSignature("isDeployerAllowed(address)", _deployerAddress) ); bool isAllowed = abi.decode(data, (bool)); @@ -912,7 +923,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { // So, we block calls to these addresses since they are not safe to run as an OVM contract itself. if ( (uint256(_contract) & uint256(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000)) - == uint256(0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000) + == uint256(CONTAINER_CONTRACT_PREFIX) ) { // EVM does not return data in the success case, see: https://github.com/ethereum/go-ethereum/blob/aae7660410f0ef90279e14afaaf2f429fdc2a186/core/vm/instructions.go#L600-L604 return (true, hex''); diff --git a/packages/contracts/contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol b/packages/contracts/contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol index 09fae11cb1d3..db667bc95bc0 100644 --- a/packages/contracts/contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol +++ b/packages/contracts/contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol @@ -5,14 +5,14 @@ pragma solidity >0.5.0 <0.8.0; * @title Lib_PredeployAddresses */ library Lib_PredeployAddresses { - address public constant ovmL2ToL1MessagePasser = 0x4200000000000000000000000000000000000000; - address public constant ovmL1MessageSender = 0x4200000000000000000000000000000000000001; - address public constant ovmDeployerWhitelist = 0x4200000000000000000000000000000000000002; - address public constant ovmECDSAContractAccount = 0x4200000000000000000000000000000000000003; - address public constant ovmSequencerEntrypoint = 0x4200000000000000000000000000000000000005; - address public constant ovmETH = 0x4200000000000000000000000000000000000006; - address public constant ovmL2CrossDomainMessenger = 0x4200000000000000000000000000000000000007; - address public constant libAddressManager = 0x4200000000000000000000000000000000000008; - address public constant ovmProxyEOA = 0x4200000000000000000000000000000000000009; - address public constant ERC1820Registry = 0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24; + address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000; + address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001; + address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002; + address internal constant ECDSA_CONTRACT_ACCOUNT = 0x4200000000000000000000000000000000000003; + address internal constant SEQUENCER_ENTRYPOINT = 0x4200000000000000000000000000000000000005; + address internal constant OVM_ETH = 0x4200000000000000000000000000000000000006; + address internal constant L2_CROSS_DOMAIN_MESSENGER = 0x4200000000000000000000000000000000000007; + address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008; + address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009; + address internal constant ERC1820_REGISTRY = 0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24; } From 8e2bfd07ee99a37d9f4e79856dc822ce773cc6de Mon Sep 17 00:00:00 2001 From: Karl Floersch Date: Wed, 2 Jun 2021 14:48:15 -0400 Subject: [PATCH 036/125] feat: deployment config for fee oracle contract (#936) * feat[contracts]: add GasPriceOracle w/o predeploy Based on #912 * feat[contracts]: congestion price oracle * chore: add changeset * contracts: gas price oracle (#917) * contracts: gas price oracle * tests: update * fees: fix tests * contracts: simplify gas price oracle * lint: fix * test: execution price is at the 1st storage slot * chore: rename predeploy to GasPriceOracle * chore: rename gas price oracle test name Co-authored-by: Mark Tyneway Co-authored-by: Georgios Konstantopoulos * Add an L2 deploy script for gas oracle contract * Add a kovan deployment artifact * Add deployment to readme * Add extra validation & initial execution price * Update README.md * Fix execution price logic * Perform new deployment with final contract * contracts: better require in ovm gas price oracle * Deploy L2GasPriceOracle * Update contract to use new fee logic & rename to gas * Deploy updated contract * Fix lint * gas price oracle: do not restrict gas price * gas price oracle: new deployment * tests: delete dead test Co-authored-by: smartcontracts Co-authored-by: Mark Tyneway Co-authored-by: Georgios Konstantopoulos --- .changeset/seven-carpets-tell.md | 5 + .../OVM/predeploys/OVM_GasPriceOracle.sol | 60 +++++++ .../000-OVM_GasPriceOracle.deploy.ts | 31 ++++ packages/contracts/deployments/README.md | 9 + .../deployments/optimistic-kovan/.chainId | 1 + .../optimistic-kovan/OVM_GasPriceOracle.json | 164 ++++++++++++++++++ packages/contracts/tasks/deploy.ts | 6 + .../precompiles/OVM_GasPriceOracle.spec.ts | 80 +++++++++ 8 files changed, 356 insertions(+) create mode 100644 .changeset/seven-carpets-tell.md create mode 100644 packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol create mode 100644 packages/contracts/deploy-l2/000-OVM_GasPriceOracle.deploy.ts create mode 100644 packages/contracts/deployments/optimistic-kovan/.chainId create mode 100644 packages/contracts/deployments/optimistic-kovan/OVM_GasPriceOracle.json create mode 100644 packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts diff --git a/.changeset/seven-carpets-tell.md b/.changeset/seven-carpets-tell.md new file mode 100644 index 000000000000..9be51c0a6974 --- /dev/null +++ b/.changeset/seven-carpets-tell.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/contracts': patch +--- + +Introduces the congestion price oracle contract diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol new file mode 100644 index 000000000000..03cc96a860b0 --- /dev/null +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol @@ -0,0 +1,60 @@ +// SPDX-License-Identifier: MIT +pragma solidity >0.5.0 <0.8.0; + +/* External Imports */ +import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; + +/** + * @title OVM_GasPriceOracle + * @dev This contract exposes the current l2 gas price, a measure of how congested the network + * currently is. This measure is used by the Sequencer to determine what fee to charge for + * transactions. When the system is more congested, the l2 gas price will increase and fees + * will also increase as a result. + * + * Compiler used: optimistic-solc + * Runtime target: OVM + */ +contract OVM_GasPriceOracle is Ownable { + + /************* + * Variables * + *************/ + + // Current l2 gas price + uint256 public gasPrice; + + /*************** + * Constructor * + ***************/ + + /** + * @param _owner Address that will initially own this contract. + */ + constructor( + address _owner, + uint256 _initialGasPrice + ) + Ownable() + { + setGasPrice(_initialGasPrice); + transferOwnership(_owner); + } + + + /******************** + * Public Functions * + ********************/ + + /** + * Allows the owner to modify the l2 gas price. + * @param _gasPrice New l2 gas price. + */ + function setGasPrice( + uint256 _gasPrice + ) + public + onlyOwner + { + gasPrice = _gasPrice; + } +} diff --git a/packages/contracts/deploy-l2/000-OVM_GasPriceOracle.deploy.ts b/packages/contracts/deploy-l2/000-OVM_GasPriceOracle.deploy.ts new file mode 100644 index 000000000000..96eb8fd1b175 --- /dev/null +++ b/packages/contracts/deploy-l2/000-OVM_GasPriceOracle.deploy.ts @@ -0,0 +1,31 @@ +/* Imports: External */ +import { DeployFunction } from 'hardhat-deploy/dist/types' + +/* Imports: Internal */ +import { getContractDefinition } from '../src' + +const deployFn: DeployFunction = async (hre: any) => { + const { deployments, getNamedAccounts } = hre + const { deploy } = deployments + const { deployer } = await getNamedAccounts() + + const gasPriceOracle = getContractDefinition('OVM_GasPriceOracle', true) + + const gasOracleOwner = (hre as any).deployConfig.ovmSequencerAddress + const initialGasPrice = (hre as any).deployConfig.initialGasPriceOracleGasPrice + + if (!gasOracleOwner || !initialGasPrice) { + throw new Error('initialGasPrice & ovmSequencerAddress required to deploy gas price oracle') + } + + await deploy('OVM_GasPriceOracle', { + contract: gasPriceOracle, + from: deployer, + args: [gasOracleOwner, initialGasPrice], + log: true, + }); +} + +deployFn.tags = ['OVM_GasPriceOracle'] + +export default deployFn diff --git a/packages/contracts/deployments/README.md b/packages/contracts/deployments/README.md index 133f6ba27b34..a6d5b7156e9b 100644 --- a/packages/contracts/deployments/README.md +++ b/packages/contracts/deployments/README.md @@ -1,6 +1,15 @@ # Optimism Regenesis Deployments ## LAYER 2 +## OPTIMISTIC-KOVAN + +Network : __optimistic-kovan (chain id: 69)__ + +|Contract|Address| +|--|--| +|OVM_GasPriceOracle|[0x038a8825A3C3B0c08d52Cc76E5E361953Cf6Dc76](https://kovan-optimistic.etherscan.io/address/0x038a8825A3C3B0c08d52Cc76E5E361953Cf6Dc76)| +--- + ### Chain IDs: - Mainnet: 10 - Kovan: 69 diff --git a/packages/contracts/deployments/optimistic-kovan/.chainId b/packages/contracts/deployments/optimistic-kovan/.chainId new file mode 100644 index 000000000000..8c0474e3239f --- /dev/null +++ b/packages/contracts/deployments/optimistic-kovan/.chainId @@ -0,0 +1 @@ +69 \ No newline at end of file diff --git a/packages/contracts/deployments/optimistic-kovan/OVM_GasPriceOracle.json b/packages/contracts/deployments/optimistic-kovan/OVM_GasPriceOracle.json new file mode 100644 index 000000000000..3ad5351c0abc --- /dev/null +++ b/packages/contracts/deployments/optimistic-kovan/OVM_GasPriceOracle.json @@ -0,0 +1,164 @@ +{ + "address": "0x038a8825A3C3B0c08d52Cc76E5E361953Cf6Dc76", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_initialGasPrice", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "gasPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "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": "uint256", + "name": "_gasPrice", + "type": "uint256" + } + ], + "name": "setGasPrice", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xed5fd0757566bc0bc1f3f7d701e31199835d6fe7b1e74353ad502983f2f5e744", + "receipt": { + "to": null, + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0x038a8825A3C3B0c08d52Cc76E5E361953Cf6Dc76", + "transactionIndex": 0, + "gasUsed": "1732518", + "logsBloom": "0x00000000000000000000000000000000000000000000000000840000000000000000000000000000000000100000000000000000000000140000000000000000000000000100000000000008000000000001000010000000000000000000000400000000020000000000000000008800000000000000000000400010000000400000000000000000000000000000000000000000002000000000000000000000000000000000000000010000000000000000000000000000000000000000000000008002000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x310208064b53df696581d48cee7439d3e94acac8c31a519e5d07e7cc542c920c", + "transactionHash": "0xed5fd0757566bc0bc1f3f7d701e31199835d6fe7b1e74353ad502983f2f5e744", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 336546, + "transactionHash": "0xed5fd0757566bc0bc1f3f7d701e31199835d6fe7b1e74353ad502983f2f5e744", + "address": "0x4200000000000000000000000000000000000006", + "topics": [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x00000000000000000000000018394b52d3cb931dfa76f63251919d051953413d", + "0x0000000000000000000000004200000000000000000000000000000000000005" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000", + "logIndex": 0, + "blockHash": "0x310208064b53df696581d48cee7439d3e94acac8c31a519e5d07e7cc542c920c" + }, + { + "transactionIndex": 0, + "blockNumber": 336546, + "transactionHash": "0xed5fd0757566bc0bc1f3f7d701e31199835d6fe7b1e74353ad502983f2f5e744", + "address": "0x038a8825A3C3B0c08d52Cc76E5E361953Cf6Dc76", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000018394b52d3cb931dfa76f63251919d051953413d" + ], + "data": "0x", + "logIndex": 1, + "blockHash": "0x310208064b53df696581d48cee7439d3e94acac8c31a519e5d07e7cc542c920c" + }, + { + "transactionIndex": 0, + "blockNumber": 336546, + "transactionHash": "0xed5fd0757566bc0bc1f3f7d701e31199835d6fe7b1e74353ad502983f2f5e744", + "address": "0x038a8825A3C3B0c08d52Cc76E5E361953Cf6Dc76", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x00000000000000000000000018394b52d3cb931dfa76f63251919d051953413d", + "0x00000000000000000000000018394b52d3cb931dfa76f63251919d051953413d" + ], + "data": "0x", + "logIndex": 2, + "blockHash": "0x310208064b53df696581d48cee7439d3e94acac8c31a519e5d07e7cc542c920c" + } + ], + "blockNumber": 336546, + "cumulativeGasUsed": "1732518", + "status": 1, + "byzantium": true + }, + "args": [ + "0x18394B52d3Cb931dfA76F63251919D051953413d", + 1000000 + ], + "bytecode": "0x60806040523480156200001c5760008062000019620002ea565b50505b5060405162000a7338038062000a73833981810160405260408110156200004d576000806200004a620002ea565b50505b81019080805192919060200180519250600091506200006d9050620000ec565b90508060006001816200007f62000357565b816001600160a01b0302191690836001600160a01b0316021790620000a3620003b9565b5050506001600160a01b038116600060008051602062000a5383398151915260405160405180910390a350620000d981620000fe565b620000e48262000184565b50506200044f565b60005a620000f962000408565b905090565b62000108620000ec565b6001600160a01b03166200011b620002c7565b6001600160a01b031614620001705760405162461bcd60e51b8152602060048201819052602482015260008051602062000a338339815191526044820152606401604051809103906200016d620002ea565b50505b808060016200017e620003b9565b50505050565b6200018e620000ec565b6001600160a01b0316620001a1620002c7565b6001600160a01b031614620001f65760405162461bcd60e51b8152602060048201819052602482015260008051602062000a33833981519152604482015260640160405180910390620001f3620002ea565b50505b6001600160a01b038116620002485760405162461bcd60e51b815260040180806020018281038252602681526020018062000a0d602691396040019150506040518091039062000245620002ea565b50505b806001600160a01b03166000806200025f62000357565b906101000a90046001600160a01b03166001600160a01b031660008051602062000a5383398151915260405160405180910390a3806000600181620002a362000357565b816001600160a01b0302191690836001600160a01b03160217906200017e620003b9565b60008080620002d562000357565b906101000a90046001600160a01b0316905090565b632a2a7adb598160e01b8152600481016020815285602082015260005b868110156200032457808601518282016040015260200162000307565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b6040811015620003b4576000828201526020016200039b565b505050565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b6000815260206200039b565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b805160008252935060206200039b565b6105ae806200045f6000396000f3fe60806040523480156100195760008061001661042d565b50505b50600436106100605760003560e01c8063715018a61461006e5780638da5cb5b14610078578063bf1fe4201461009c578063f2fde38b146100c2578063fe173b97146100f1575b60008061006b61042d565b50505b61007661010b565b005b61008061020d565b6040516001600160a01b03909116815260200160405180910390f35b610076600480360360208110156100bb576000806100b861042d565b50505b503561022e565b610076600480360360208110156100e1576000806100de61042d565b50505b50356001600160a01b03166102bc565b6100f9610410565b60405190815260200160405180910390f35b61011361041d565b6001600160a01b031661012461020d565b6001600160a01b0316146101875760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016040518091039061018461042d565b50505b60008080610193610498565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000806001816101e6610498565b816001600160a01b0302191690836001600160a01b03160217906102086104f3565b505050565b60008080610219610498565b906101000a90046001600160a01b0316905090565b61023661041d565b6001600160a01b031661024761020d565b6001600160a01b0316146102aa5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906102a761042d565b50505b808060016102b66104f3565b50505050565b6102c461041d565b6001600160a01b03166102d561020d565b6001600160a01b0316146103385760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016040518091039061033561042d565b50505b6001600160a01b0381166103865760405162461bcd60e51b8152600401808060200182810382526026815260200180610588602691396040019150506040518091039061038361042d565b50505b806001600160a01b031660008061039b610498565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a38060006001816103ee610498565b816001600160a01b0302191690836001600160a01b03160217906102b66104f3565b600161041a610498565b81565b60005a610428610541565b905090565b632a2a7adb598160e01b8152600481016020815285602082015260005b8681101561046557808601518282016040015260200161044a565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b6040811015610208576000828201526020016104dc565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b6000815260206104dc565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b805160008252935060206104dc56fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65728be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "deployedBytecode": "0x60806040523480156100195760008061001661042d565b50505b50600436106100605760003560e01c8063715018a61461006e5780638da5cb5b14610078578063bf1fe4201461009c578063f2fde38b146100c2578063fe173b97146100f1575b60008061006b61042d565b50505b61007661010b565b005b61008061020d565b6040516001600160a01b03909116815260200160405180910390f35b610076600480360360208110156100bb576000806100b861042d565b50505b503561022e565b610076600480360360208110156100e1576000806100de61042d565b50505b50356001600160a01b03166102bc565b6100f9610410565b60405190815260200160405180910390f35b61011361041d565b6001600160a01b031661012461020d565b6001600160a01b0316146101875760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016040518091039061018461042d565b50505b60008080610193610498565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000806001816101e6610498565b816001600160a01b0302191690836001600160a01b03160217906102086104f3565b505050565b60008080610219610498565b906101000a90046001600160a01b0316905090565b61023661041d565b6001600160a01b031661024761020d565b6001600160a01b0316146102aa5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906102a761042d565b50505b808060016102b66104f3565b50505050565b6102c461041d565b6001600160a01b03166102d561020d565b6001600160a01b0316146103385760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016040518091039061033561042d565b50505b6001600160a01b0381166103865760405162461bcd60e51b8152600401808060200182810382526026815260200180610588602691396040019150506040518091039061038361042d565b50505b806001600160a01b031660008061039b610498565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a38060006001816103ee610498565b816001600160a01b0302191690836001600160a01b03160217906102b66104f3565b600161041a610498565b81565b60005a610428610541565b905090565b632a2a7adb598160e01b8152600481016020815285602082015260005b8681101561046557808601518282016040015260200161044a565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b6040811015610208576000828201526020016104dc565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b6000815260206104dc565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b805160008252935060206104dc56fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373" +} \ No newline at end of file diff --git a/packages/contracts/tasks/deploy.ts b/packages/contracts/tasks/deploy.ts index 35d2e041b692..8c3a793b062b 100644 --- a/packages/contracts/tasks/deploy.ts +++ b/packages/contracts/tasks/deploy.ts @@ -99,6 +99,12 @@ task('deploy') undefined, types.string ) + .addOptionalParam( + 'initialGasPriceOracleGasPrice', + 'The initial execution price for the gas price oracle.', + undefined, + types.int + ) .setAction(async (args, hre: any, runSuper) => { // Necessary because hardhat doesn't let us attach non-optional parameters to existing tasks. const validateAddressArg = (argName: string) => { diff --git a/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts b/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts new file mode 100644 index 000000000000..ead0baebf899 --- /dev/null +++ b/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts @@ -0,0 +1,80 @@ +import { expect } from '../../../setup' + +/* External Imports */ +import { ethers } from 'hardhat' +import { ContractFactory, Contract, Signer } from 'ethers' + +describe('OVM_GasPriceOracle', () => { + const initialGasPrice = 0 + let signer1: Signer + let signer2: Signer + before(async () => { + ;[signer1, signer2] = await ethers.getSigners() + }) + + let Factory__OVM_GasPriceOracle: ContractFactory + before(async () => { + Factory__OVM_GasPriceOracle = await ethers.getContractFactory( + 'OVM_GasPriceOracle' + ) + }) + + let OVM_GasPriceOracle: Contract + beforeEach(async () => { + OVM_GasPriceOracle = await Factory__OVM_GasPriceOracle.deploy( + await signer1.getAddress(), + initialGasPrice + ) + }) + + describe('owner', () => { + it('should have an owner', async () => { + expect(await OVM_GasPriceOracle.owner()).to.equal( + await signer1.getAddress() + ) + }) + }) + + describe('setGasPrice', () => { + it('should revert if called by someone other than the owner', async () => { + await expect(OVM_GasPriceOracle.connect(signer2).setGasPrice(1234)).to.be + .reverted + }) + + it('should succeed if called by the owner and is equal to `0`', async () => { + await expect(OVM_GasPriceOracle.connect(signer1).setGasPrice(0)).to.not.be + .reverted + }) + }) + + describe('get gasPrice', () => { + it('should return zero at first', async () => { + expect(await OVM_GasPriceOracle.gasPrice()).to.equal(initialGasPrice) + }) + + it('should change when setGasPrice is called', async () => { + const gasPrice = 1234 + + await OVM_GasPriceOracle.connect(signer1).setGasPrice(gasPrice) + + expect(await OVM_GasPriceOracle.gasPrice()).to.equal(gasPrice) + }) + + it('is the 1st storage slot', async () => { + const gasPrice = 1234 + const slot = 1 + + // set the price + await OVM_GasPriceOracle.connect(signer1).setGasPrice(gasPrice) + + // get the storage slot value + const priceAtSlot = await signer1.provider.getStorageAt( + OVM_GasPriceOracle.address, + slot + ) + expect(await OVM_GasPriceOracle.gasPrice()).to.equal( + ethers.BigNumber.from(priceAtSlot) + ) + }) + }) +}) From b355be0b23ab80d9cdcb0b1f481eaeec02412b20 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Wed, 2 Jun 2021 14:30:56 -0700 Subject: [PATCH 037/125] ops: expose debug namespace (#1007) --- ops/envs/geth.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ops/envs/geth.env b/ops/envs/geth.env index bf73226cf815..59519125b17b 100644 --- a/ops/envs/geth.env +++ b/ops/envs/geth.env @@ -12,7 +12,7 @@ ROLLUP_ENABLE_L2_GAS_POLLING=true RPC_ENABLE=true RPC_ADDR=0.0.0.0 RPC_PORT=8545 -RPC_API=eth,net,rollup,web3 +RPC_API=eth,net,rollup,web3,debug RPC_CORS_DOMAIN=* RPC_VHOSTS=* From c54de6003526584a447eb38ade3c58efd153356c Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Wed, 2 Jun 2021 16:43:01 -0700 Subject: [PATCH 038/125] develop merge fixes --- integration-tests/test/native-eth.spec.ts | 2 +- packages/contracts/bin/take-dump.ts | 5 ++++- .../contracts/src/contract-deployment/config.ts | 15 +++++++++++++-- packages/contracts/src/state-dump/make-dump.ts | 5 ++++- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/integration-tests/test/native-eth.spec.ts b/integration-tests/test/native-eth.spec.ts index 411054acdfec..eb8eecacb37c 100644 --- a/integration-tests/test/native-eth.spec.ts +++ b/integration-tests/test/native-eth.spec.ts @@ -56,7 +56,7 @@ describe('Native ETH Integration Tests', async () => { it('Should estimate gas for ETH withdraw', async () => { const amount = utils.parseEther('0.5') const gas = await env.ovmEth.estimateGas.withdraw(amount, 0, '0xFFFF') - expect(gas).to.be.deep.eq(BigNumber.from(6140049)) + expect(gas).to.be.deep.eq(BigNumber.from(6580050)) }) }) diff --git a/packages/contracts/bin/take-dump.ts b/packages/contracts/bin/take-dump.ts index b1e5376ed737..8dfea3bf04f7 100644 --- a/packages/contracts/bin/take-dump.ts +++ b/packages/contracts/bin/take-dump.ts @@ -19,7 +19,10 @@ import { RollupDeployConfig } from '../src/contract-deployment' ovmGlobalContext: { ovmCHAINID: parseInt(CHAIN_ID, 10), }, - gasPriceOracleOwner: GAS_PRICE_ORACLE_OWNER + gasPriceOracleConfig: { + owner: GAS_PRICE_ORACLE_OWNER, + initialGasPrice: 0, + } } const dump = await makeStateDump(config as RollupDeployConfig) diff --git a/packages/contracts/src/contract-deployment/config.ts b/packages/contracts/src/contract-deployment/config.ts index 99c9f8b722d4..ba04437c0708 100644 --- a/packages/contracts/src/contract-deployment/config.ts +++ b/packages/contracts/src/contract-deployment/config.ts @@ -35,7 +35,10 @@ export interface RollupDeployConfig { owner: string | Signer allowArbitraryContractDeployment: boolean } - gasPriceOracleOwner: string + gasPriceOracleConfig: { + owner: string | Signer + initialGasPrice: number + } addressManager?: string dependencies?: string[] deployOverrides: Overrides @@ -262,7 +265,15 @@ export const makeContractDeployConfig = async ( }, OVM_GasPriceOracle: { factory: getContractFactory('OVM_GasPriceOracle'), - params: [config.gasPriceOracleOwner], + params: [ + (() => { + if (typeof config.gasPriceOracleConfig.owner !== 'string') { + return config.gasPriceOracleConfig.owner.getAddress() + } + return config.gasPriceOracleConfig.owner + })(), + config.gasPriceOracleConfig.initialGasPrice, + ], }, } } diff --git a/packages/contracts/src/state-dump/make-dump.ts b/packages/contracts/src/state-dump/make-dump.ts index b6d49f233443..19c1ce682e46 100644 --- a/packages/contracts/src/state-dump/make-dump.ts +++ b/packages/contracts/src/state-dump/make-dump.ts @@ -140,7 +140,10 @@ export const makeStateDump = async (cfg: RollupDeployConfig): Promise => { ], deployOverrides: {}, waitForReceipts: false, - gasPriceOracleOwner: cfg.gasPriceOracleOwner, + gasPriceOracleConfig: { + owner: signer, + initialGasPrice: 0, + }, } config = { ...config, ...cfg } From 0887367461786c9bbad863dbcff3f4d74acb9cf7 Mon Sep 17 00:00:00 2001 From: Karl Floersch Date: Wed, 2 Jun 2021 19:54:16 -0400 Subject: [PATCH 039/125] refactor[l2geth]: queue origin type (#975) * refactor: queueOrigin type * Convert queueOrigin to uint8 in encode * Add changeset * Regenerate json marshall * style: combine lines * Add Stringer for QueueOrigin * Turn QueueOrigin into uint8 * l2geth: gen tx meta fix * l2geth: gen tx meta fix * lint Co-authored-by: Mark Tyneway --- .changeset/heavy-planets-return.md | 5 ++++ .../accounts/abi/bind/backends/simulated.go | 2 +- l2geth/core/state_transition.go | 6 ++-- l2geth/core/state_transition_ovm.go | 28 +++--------------- l2geth/core/types/gen_tx_json.go | 8 ++--- l2geth/core/types/gen_tx_meta_json.go | 26 +++++++++++++++-- l2geth/core/types/transaction.go | 20 +++++-------- l2geth/core/types/transaction_meta.go | 29 ++++++++++++------- l2geth/core/types/transaction_meta_test.go | 9 +----- l2geth/interfaces.go | 2 +- l2geth/internal/ethapi/api.go | 12 ++------ l2geth/miner/worker.go | 2 +- l2geth/rollup/sync_service.go | 11 +++---- 13 files changed, 75 insertions(+), 85 deletions(-) create mode 100644 .changeset/heavy-planets-return.md diff --git a/.changeset/heavy-planets-return.md b/.changeset/heavy-planets-return.md new file mode 100644 index 000000000000..c69ceaf05bc6 --- /dev/null +++ b/.changeset/heavy-planets-return.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/l2geth': patch +--- + +Update queueOrigin type diff --git a/l2geth/accounts/abi/bind/backends/simulated.go b/l2geth/accounts/abi/bind/backends/simulated.go index f00cad5055e6..83701e91f4d5 100644 --- a/l2geth/accounts/abi/bind/backends/simulated.go +++ b/l2geth/accounts/abi/bind/backends/simulated.go @@ -603,7 +603,7 @@ func (m callmsg) Data() []byte { return m.CallMsg.Data } func (m callmsg) L1MessageSender() *common.Address { return m.CallMsg.L1MessageSender } func (m callmsg) L1BlockNumber() *big.Int { return m.CallMsg.L1BlockNumber } -func (m callmsg) QueueOrigin() *big.Int { return m.CallMsg.QueueOrigin } +func (m callmsg) QueueOrigin() types.QueueOrigin { return m.CallMsg.QueueOrigin } // filterBackend implements filters.Backend to support filtering for logs without // taking bloom-bits acceleration structures into account. diff --git a/l2geth/core/state_transition.go b/l2geth/core/state_transition.go index 933b0f8aa7a8..d66e5769934e 100644 --- a/l2geth/core/state_transition.go +++ b/l2geth/core/state_transition.go @@ -77,7 +77,7 @@ type Message interface { Data() []byte L1MessageSender() *common.Address L1BlockNumber() *big.Int - QueueOrigin() *big.Int + QueueOrigin() types.QueueOrigin } // IntrinsicGas computes the 'intrinsic gas' for a message with the given data. @@ -184,9 +184,7 @@ func (st *StateTransition) preCheck() error { if nonce < st.msg.Nonce() { if vm.UsingOVM { // The nonce never increments for L1ToL2 txs - qo := st.msg.QueueOrigin() - l1ToL2 := uint64(types.QueueOriginL1ToL2) - if qo != nil && qo.Uint64() == l1ToL2 { + if st.msg.QueueOrigin() == types.QueueOriginL1ToL2 { return st.buyGas() } } diff --git a/l2geth/core/state_transition_ovm.go b/l2geth/core/state_transition_ovm.go index 5da13437adba..b9e625d1b7fe 100644 --- a/l2geth/core/state_transition_ovm.go +++ b/l2geth/core/state_transition_ovm.go @@ -26,7 +26,7 @@ func toExecutionManagerRun(evm *vm.EVM, msg Message) (Message, error) { tx := ovmTransaction{ evm.Context.Time, msg.L1BlockNumber(), - uint8(msg.QueueOrigin().Uint64()), + uint8(msg.QueueOrigin()), *msg.L1MessageSender(), *msg.To(), big.NewInt(int64(msg.Gas())), @@ -73,8 +73,7 @@ func AsOvmMessage(tx *types.Transaction, signer types.Signer, decompressor commo // sequencer entrypoint. The calldata is expected to be in the // correct format when deserialized from the EVM events, see // rollup/sync_service.go. - qo := msg.QueueOrigin() - if qo != nil && qo.Uint64() == uint64(types.QueueOriginL1ToL2) { + if msg.QueueOrigin() == types.QueueOriginL1ToL2 { return msg, nil } @@ -104,7 +103,7 @@ func EncodeSimulatedMessage(msg Message, timestamp, blockNumber *big.Int, execut tx := ovmTransaction{ timestamp, blockNumber, - uint8(msg.QueueOrigin().Uint64()), + uint8(msg.QueueOrigin()), *msg.L1MessageSender(), *to, big.NewInt(int64(msg.Gas())), @@ -139,11 +138,6 @@ func modMessage( data []byte, gasLimit uint64, ) (Message, error) { - queueOrigin, err := getQueueOrigin(msg.QueueOrigin()) - if err != nil { - return nil, err - } - outmsg := types.NewMessage( from, to, @@ -155,22 +149,8 @@ func modMessage( false, msg.L1MessageSender(), msg.L1BlockNumber(), - queueOrigin, + msg.QueueOrigin(), ) return outmsg, nil } - -func getQueueOrigin( - queueOrigin *big.Int, -) (types.QueueOrigin, error) { - if queueOrigin.Cmp(big.NewInt(0)) == 0 { - return types.QueueOriginSequencer, nil - } else if queueOrigin.Cmp(big.NewInt(1)) == 0 { - return types.QueueOriginL1ToL2, nil - } else if queueOrigin.Cmp(big.NewInt(2)) == 0 { - return types.QueueOriginL1ToL2, nil - } else { - return types.QueueOriginSequencer, fmt.Errorf("invalid queue origin: %d", queueOrigin) - } -} diff --git a/l2geth/core/types/gen_tx_json.go b/l2geth/core/types/gen_tx_json.go index f8638522b070..e676058ecc4b 100644 --- a/l2geth/core/types/gen_tx_json.go +++ b/l2geth/core/types/gen_tx_json.go @@ -13,8 +13,8 @@ import ( var _ = (*txdataMarshaling)(nil) -// TransactionMarshalJSON marshals as JSON. -func (t txdata) TransactionMarshalJSON() ([]byte, error) { +// MarshalJSON marshals as JSON. +func (t txdata) MarshalJSON() ([]byte, error) { type txdata struct { AccountNonce hexutil.Uint64 `json:"nonce" gencodec:"required"` Price *hexutil.Big `json:"gasPrice" gencodec:"required"` @@ -41,8 +41,8 @@ func (t txdata) TransactionMarshalJSON() ([]byte, error) { return json.Marshal(&enc) } -// TransactionUnmarshalJSON unmarshals from JSON. -func (t *txdata) TransactionUnmarshalJSON(input []byte) error { +// UnmarshalJSON unmarshals from JSON. +func (t *txdata) UnmarshalJSON(input []byte) error { type txdata struct { AccountNonce *hexutil.Uint64 `json:"nonce" gencodec:"required"` Price *hexutil.Big `json:"gasPrice" gencodec:"required"` diff --git a/l2geth/core/types/gen_tx_meta_json.go b/l2geth/core/types/gen_tx_meta_json.go index 13a57551050f..0f99ba918546 100644 --- a/l2geth/core/types/gen_tx_meta_json.go +++ b/l2geth/core/types/gen_tx_meta_json.go @@ -14,15 +14,21 @@ import ( func (t TransactionMeta) MarshalJSON() ([]byte, error) { type TransactionMeta struct { L1BlockNumber *big.Int `json:"l1BlockNumber"` + L1Timestamp uint64 `json:"l1Timestamp"` L1MessageSender *common.Address `json:"l1MessageSender" gencodec:"required"` - QueueOrigin *big.Int `json:"queueOrigin" gencodec:"required"` + QueueOrigin QueueOrigin `json:"queueOrigin" gencodec:"required"` Index *uint64 `json:"index" gencodec:"required"` + QueueIndex *uint64 `json:"queueIndex" gencodec:"required"` + RawTransaction []byte `json:"rawTransaction" gencodec:"required"` } var enc TransactionMeta enc.L1BlockNumber = t.L1BlockNumber + enc.L1Timestamp = t.L1Timestamp enc.L1MessageSender = t.L1MessageSender enc.QueueOrigin = t.QueueOrigin enc.Index = t.Index + enc.QueueIndex = t.QueueIndex + enc.RawTransaction = t.RawTransaction return json.Marshal(&enc) } @@ -30,9 +36,12 @@ func (t TransactionMeta) MarshalJSON() ([]byte, error) { func (t *TransactionMeta) UnmarshalJSON(input []byte) error { type TransactionMeta struct { L1BlockNumber *big.Int `json:"l1BlockNumber"` + L1Timestamp *uint64 `json:"l1Timestamp"` L1MessageSender *common.Address `json:"l1MessageSender" gencodec:"required"` - QueueOrigin *big.Int `json:"queueOrigin" gencodec:"required"` + QueueOrigin *QueueOrigin `json:"queueOrigin" gencodec:"required"` Index *uint64 `json:"index" gencodec:"required"` + QueueIndex *uint64 `json:"queueIndex" gencodec:"required"` + RawTransaction []byte `json:"rawTransaction" gencodec:"required"` } var dec TransactionMeta if err := json.Unmarshal(input, &dec); err != nil { @@ -41,6 +50,9 @@ func (t *TransactionMeta) UnmarshalJSON(input []byte) error { if dec.L1BlockNumber != nil { t.L1BlockNumber = dec.L1BlockNumber } + if dec.L1Timestamp != nil { + t.L1Timestamp = *dec.L1Timestamp + } if dec.L1MessageSender == nil { return errors.New("missing required field 'l1MessageSender' for TransactionMeta") } @@ -48,10 +60,18 @@ func (t *TransactionMeta) UnmarshalJSON(input []byte) error { if dec.QueueOrigin == nil { return errors.New("missing required field 'queueOrigin' for TransactionMeta") } - t.QueueOrigin = dec.QueueOrigin + t.QueueOrigin = *dec.QueueOrigin if dec.Index == nil { return errors.New("missing required field 'index' for TransactionMeta") } t.Index = dec.Index + if dec.QueueIndex == nil { + return errors.New("missing required field 'queueIndex' for TransactionMeta") + } + t.QueueIndex = dec.QueueIndex + if dec.RawTransaction == nil { + return errors.New("missing required field 'rawTransaction' for TransactionMeta") + } + t.RawTransaction = dec.RawTransaction return nil } diff --git a/l2geth/core/types/transaction.go b/l2geth/core/types/transaction.go index 1fccae83f679..9f41bd11aaae 100644 --- a/l2geth/core/types/transaction.go +++ b/l2geth/core/types/transaction.go @@ -187,12 +187,12 @@ func (tx *Transaction) DecodeRLP(s *rlp.Stream) error { // MarshalJSON encodes the web3 RPC transaction format. func (tx *Transaction) MarshalJSON() ([]byte, error) { - return tx.data.TransactionMarshalJSON() + return tx.data.MarshalJSON() } // UnmarshalJSON decodes the web3 RPC transaction format. func (tx *Transaction) UnmarshalJSON(input []byte) error { - err := tx.data.TransactionUnmarshalJSON(input) + err := tx.data.UnmarshalJSON(input) if err != nil { return err } @@ -254,13 +254,9 @@ func (tx *Transaction) L1BlockNumber() *big.Int { return &l1BlockNumber } -// QueueOrigin returns the Queue Origin of the transaction if it exists. -func (tx *Transaction) QueueOrigin() *big.Int { - if tx.meta.QueueOrigin == nil { - return nil - } - queueOrigin := *tx.meta.QueueOrigin - return &queueOrigin +// QueueOrigin returns the Queue Origin of the transaction +func (tx *Transaction) QueueOrigin() QueueOrigin { + return tx.meta.QueueOrigin } // Hash hashes the RLP encoding of tx. @@ -519,7 +515,7 @@ type Message struct { l1MessageSender *common.Address l1BlockNumber *big.Int - queueOrigin *big.Int + queueOrigin QueueOrigin } func NewMessage(from common.Address, to *common.Address, nonce uint64, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte, checkNonce bool, l1MessageSender *common.Address, l1BlockNumber *big.Int, queueOrigin QueueOrigin) Message { @@ -535,7 +531,7 @@ func NewMessage(from common.Address, to *common.Address, nonce uint64, amount *b l1BlockNumber: l1BlockNumber, l1MessageSender: l1MessageSender, - queueOrigin: big.NewInt(int64(queueOrigin)), + queueOrigin: queueOrigin, } } @@ -550,4 +546,4 @@ func (m Message) CheckNonce() bool { return m.checkNonce } func (m Message) L1MessageSender() *common.Address { return m.l1MessageSender } func (m Message) L1BlockNumber() *big.Int { return m.l1BlockNumber } -func (m Message) QueueOrigin() *big.Int { return m.queueOrigin } +func (m Message) QueueOrigin() QueueOrigin { return m.queueOrigin } diff --git a/l2geth/core/types/transaction_meta.go b/l2geth/core/types/transaction_meta.go index 3d09cbd69bff..7f68e6530129 100644 --- a/l2geth/core/types/transaction_meta.go +++ b/l2geth/core/types/transaction_meta.go @@ -12,7 +12,7 @@ import ( "github.com/ethereum/go-ethereum/common" ) -type QueueOrigin int64 +type QueueOrigin uint8 const ( // Possible `queue_origin` values @@ -20,13 +20,24 @@ const ( QueueOriginL1ToL2 QueueOrigin = 1 ) +func (q QueueOrigin) String() string { + switch q { + case QueueOriginSequencer: + return "sequencer" + case QueueOriginL1ToL2: + return "l1" + default: + return "" + } +} + //go:generate gencodec -type TransactionMeta -out gen_tx_meta_json.go type TransactionMeta struct { L1BlockNumber *big.Int `json:"l1BlockNumber"` L1Timestamp uint64 `json:"l1Timestamp"` L1MessageSender *common.Address `json:"l1MessageSender" gencodec:"required"` - QueueOrigin *big.Int `json:"queueOrigin" gencodec:"required"` + QueueOrigin QueueOrigin `json:"queueOrigin" gencodec:"required"` // The canonical transaction chain index Index *uint64 `json:"index" gencodec:"required"` // The queue index, nil for queue origin sequencer transactions @@ -40,7 +51,7 @@ func NewTransactionMeta(l1BlockNumber *big.Int, l1timestamp uint64, l1MessageSen L1BlockNumber: l1BlockNumber, L1Timestamp: l1timestamp, L1MessageSender: l1MessageSender, - QueueOrigin: big.NewInt(int64(queueOrigin)), + QueueOrigin: queueOrigin, Index: index, QueueIndex: queueIndex, RawTransaction: rawTransaction, @@ -83,7 +94,7 @@ func TxMetaDecode(input []byte) (*TransactionMeta, error) { } if !isNullValue(qo) { queueOrigin := new(big.Int).SetBytes(qo) - meta.QueueOrigin = queueOrigin + meta.QueueOrigin = QueueOrigin(queueOrigin.Uint64()) } l, err := common.ReadVarBytes(b, 0, 1024, "L1Timestamp") @@ -146,13 +157,9 @@ func TxMetaEncode(meta *TransactionMeta) []byte { } queueOrigin := meta.QueueOrigin - if queueOrigin == nil { - common.WriteVarBytes(b, 0, getNullValue()) - } else { - q := new(bytes.Buffer) - binary.Write(q, binary.LittleEndian, queueOrigin.Bytes()) - common.WriteVarBytes(b, 0, q.Bytes()) - } + q := new(bytes.Buffer) + binary.Write(q, binary.LittleEndian, queueOrigin) + common.WriteVarBytes(b, 0, q.Bytes()) l := new(bytes.Buffer) binary.Write(l, binary.LittleEndian, &meta.L1Timestamp) diff --git a/l2geth/core/types/transaction_meta_test.go b/l2geth/core/types/transaction_meta_test.go index 546d3cb99369..ec630d7bdcd3 100644 --- a/l2geth/core/types/transaction_meta_test.go +++ b/l2geth/core/types/transaction_meta_test.go @@ -112,14 +112,7 @@ func isTxMetaEqual(meta1 *TransactionMeta, meta2 *TransactionMeta) bool { } } - if meta1.QueueOrigin == nil || meta2.QueueOrigin == nil { - // Note: this only works because it is the final comparison - if meta1.QueueOrigin == nil && meta2.QueueOrigin == nil { - return true - } - } - - if !bytes.Equal(meta1.QueueOrigin.Bytes(), meta2.QueueOrigin.Bytes()) { + if meta1.QueueOrigin != meta2.QueueOrigin { return false } diff --git a/l2geth/interfaces.go b/l2geth/interfaces.go index ab3f44eb86fc..aaf10f31c5d7 100644 --- a/l2geth/interfaces.go +++ b/l2geth/interfaces.go @@ -122,7 +122,7 @@ type CallMsg struct { L1MessageSender *common.Address L1BlockNumber *big.Int - QueueOrigin *big.Int + QueueOrigin types.QueueOrigin } // A ContractCaller provides contract calls, essentially transactions that are executed by diff --git a/l2geth/internal/ethapi/api.go b/l2geth/internal/ethapi/api.go index b1b2fe327aa1..a8b3852c6e14 100644 --- a/l2geth/internal/ethapi/api.go +++ b/l2geth/internal/ethapi/api.go @@ -1364,14 +1364,8 @@ func newRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber if meta.L1BlockNumber != nil { result.L1BlockNumber = (*hexutil.Big)(meta.L1BlockNumber) } - if meta.QueueOrigin != nil { - switch meta.QueueOrigin.Uint64() { - case uint64(types.QueueOriginSequencer): - result.QueueOrigin = "sequencer" - case uint64(types.QueueOriginL1ToL2): - result.QueueOrigin = "l1" - } - } + + result.QueueOrigin = fmt.Sprint(meta.QueueOrigin) if meta.Index != nil { index := (hexutil.Uint64)(*meta.Index) @@ -2168,7 +2162,7 @@ func (api *PrivateDebugAPI) IngestTransactions(txs []*RPCTransaction) error { L1BlockNumber: l1BlockNumber, L1Timestamp: l1Timestamp, L1MessageSender: tx.L1TxOrigin, - QueueOrigin: big.NewInt(int64(queueOrigin)), + QueueOrigin: queueOrigin, Index: (*uint64)(tx.Index), QueueIndex: (*uint64)(tx.QueueIndex), RawTransaction: rawTransaction, diff --git a/l2geth/miner/worker.go b/l2geth/miner/worker.go index de9c2ad67ea9..2713bccd1318 100644 --- a/l2geth/miner/worker.go +++ b/l2geth/miner/worker.go @@ -869,7 +869,7 @@ func (w *worker) commitNewTx(tx *types.Transaction) error { // transactions as the timestamp cannot be malleated if parent.Time() > tx.L1Timestamp() { log.Error("Monotonicity violation", "index", num) - if tx.QueueOrigin().Uint64() == uint64(types.QueueOriginSequencer) { + if tx.QueueOrigin() == types.QueueOriginSequencer { tx.SetL1Timestamp(parent.Time()) prev := parent.Transactions() if len(prev) == 1 { diff --git a/l2geth/rollup/sync_service.go b/l2geth/rollup/sync_service.go index 98460aa7387a..ad674a799e8d 100644 --- a/l2geth/rollup/sync_service.go +++ b/l2geth/rollup/sync_service.go @@ -644,7 +644,7 @@ func (s *SyncService) applyTransactionToTip(tx *types.Transaction) error { // Queue Origin L1 to L2 transactions must have a timestamp that is set by // the L1 block that holds the transaction. This should never happen but is // a sanity check to prevent fraudulent execution. - if tx.QueueOrigin().Uint64() == uint64(types.QueueOriginL1ToL2) { + if tx.QueueOrigin() == types.QueueOriginL1ToL2 { if tx.L1Timestamp() == 0 { return fmt.Errorf("Queue origin L1 to L2 transaction without a timestamp: %s", tx.Hash().Hex()) } @@ -671,7 +671,7 @@ func (s *SyncService) applyTransactionToTip(tx *types.Transaction) error { bn := tx.L1BlockNumber() s.SetLatestL1Timestamp(ts) s.SetLatestL1BlockNumber(bn.Uint64()) - log.Debug("Updating OVM context based on new transaction", "timestamp", ts, "blocknumber", bn.Uint64(), "queue-origin", tx.QueueOrigin().Uint64()) + log.Debug("Updating OVM context based on new transaction", "timestamp", ts, "blocknumber", bn.Uint64(), "queue-origin", tx.QueueOrigin()) } else if tx.L1Timestamp() < s.GetLatestL1Timestamp() { log.Error("Timestamp monotonicity violation", "hash", tx.Hash().Hex()) } @@ -790,11 +790,8 @@ func (s *SyncService) ValidateAndApplySequencerTransaction(tx *types.Transaction log.Trace("Sequencer transaction validation", "hash", tx.Hash().Hex()) qo := tx.QueueOrigin() - if qo == nil { - return errors.New("invalid transaction with no queue origin") - } - if qo.Uint64() != uint64(types.QueueOriginSequencer) { - return fmt.Errorf("invalid transaction with queue origin %d", qo.Uint64()) + if qo != types.QueueOriginSequencer { + return fmt.Errorf("invalid transaction with queue origin %d", qo) } err := s.txpool.ValidateTx(tx) if err != nil { From 5e4eaea1cc748d803a89b13160b92d61a5201c0d Mon Sep 17 00:00:00 2001 From: Georgios Konstantopoulos Date: Thu, 3 Jun 2021 18:21:10 +0300 Subject: [PATCH 040/125] fix(sync-service): prevent underflows (#1015) * fix(sync-service): prevent underflows * chore: add changeset * chore: remove dead confirmation depth * chore: remove eth1conf depth from rollup config --- .changeset/kind-houses-rush.md | 5 +++++ l2geth/rollup/config.go | 2 -- l2geth/rollup/sync_service.go | 13 ++++++++----- 3 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 .changeset/kind-houses-rush.md diff --git a/.changeset/kind-houses-rush.md b/.changeset/kind-houses-rush.md new file mode 100644 index 000000000000..1819a8f8c93e --- /dev/null +++ b/.changeset/kind-houses-rush.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/l2geth': patch +--- + +fix potential underflow when launching the chain when the last verified index is 0 diff --git a/l2geth/rollup/config.go b/l2geth/rollup/config.go index 22d9b3f35ce5..2ce695201645 100644 --- a/l2geth/rollup/config.go +++ b/l2geth/rollup/config.go @@ -10,8 +10,6 @@ import ( type Config struct { // Maximum calldata size for a Queue Origin Sequencer Tx MaxCallDataSize int - // Number of confs before applying a L1 to L2 tx - Eth1ConfirmationDepth uint64 // Verifier mode IsVerifier bool // Enable the sync service diff --git a/l2geth/rollup/sync_service.go b/l2geth/rollup/sync_service.go index 98460aa7387a..473acff61afe 100644 --- a/l2geth/rollup/sync_service.go +++ b/l2geth/rollup/sync_service.go @@ -53,7 +53,6 @@ type SyncService struct { syncing atomic.Value chainHeadSub event.Subscription OVMContext OVMContext - confirmationDepth uint64 pollInterval time.Duration timestampRefreshThreshold time.Duration chainHeadCh chan core.ChainHeadEvent @@ -103,7 +102,6 @@ func NewSyncService(ctx context.Context, cfg Config, txpool *core.TxPool, bc *co cancel: cancel, verifier: cfg.IsVerifier, enable: cfg.Eth1SyncServiceEnable, - confirmationDepth: cfg.Eth1ConfirmationDepth, syncing: atomic.Value{}, bc: bc, txpool: txpool, @@ -244,8 +242,12 @@ func (s *SyncService) initializeLatestL1(ctcDeployHeight *big.Int) error { s.SetLatestL1Timestamp(context.Timestamp) s.SetLatestL1BlockNumber(context.BlockNumber) } else { + // Prevent underflows + if *index != 0 { + *index = *index - 1 + } log.Info("Found latest index", "index", *index) - block := s.bc.GetBlockByNumber(*index - 1) + block := s.bc.GetBlockByNumber(*index) if block == nil { block = s.bc.CurrentBlock() idx := block.Number().Uint64() @@ -254,11 +256,12 @@ func (s *SyncService) initializeLatestL1(ctcDeployHeight *big.Int) error { return fmt.Errorf("Current block height greater than index") } s.SetLatestIndex(&idx) - log.Info("Block not found, resetting index", "new", idx, "old", *index-1) + log.Info("Block not found, resetting index", "new", idx, "old", *index) } txs := block.Transactions() if len(txs) != 1 { - log.Error("Unexpected number of transactions in block: %d", len(txs)) + log.Error("Unexpected number of transactions in block", "count", len(txs)) + panic("Cannot recover OVM Context") } tx := txs[0] s.SetLatestL1Timestamp(tx.L1Timestamp()) From d2ad599755f0cc6b166d86ac21af81b91dd3c773 Mon Sep 17 00:00:00 2001 From: Liam Horne Date: Thu, 3 Jun 2021 11:21:37 -0400 Subject: [PATCH 041/125] test: remove duplicate value in array (#1014) --- packages/contracts/test/helpers/test-runner/test.types.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/contracts/test/helpers/test-runner/test.types.ts b/packages/contracts/test/helpers/test-runner/test.types.ts index fa799dd6b4e1..b31b03d17318 100644 --- a/packages/contracts/test/helpers/test-runner/test.types.ts +++ b/packages/contracts/test/helpers/test-runner/test.types.ts @@ -213,7 +213,6 @@ export const isTestStep_Context = ( 'ovmCALLER', 'ovmNUMBER', 'ovmADDRESS', - 'ovmNUMBER', 'ovmL1TXORIGIN', 'ovmTIMESTAMP', 'ovmGASLIMIT', From 1c1e405cc53c0ef5c0f3e6db471a69a6f1f076fa Mon Sep 17 00:00:00 2001 From: Liam Horne Date: Thu, 3 Jun 2021 13:52:11 -0400 Subject: [PATCH 042/125] ci: tag docker image for canary with abbreviated GITHUB_SHA (#1006) * ci: tag docker image for canary with abbreviated GITHUB_SHA * ci: update from 6 bytes to 8 bytes of abbreviation --- .github/workflows/publish-canary.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-canary.yml b/.github/workflows/publish-canary.yml index 67e53a6b54c9..5669f25dabd7 100644 --- a/.github/workflows/publish-canary.yml +++ b/.github/workflows/publish-canary.yml @@ -155,7 +155,7 @@ jobs: context: . file: ./ops/docker/Dockerfile.message-relayer push: true - tags: ethereumoptimism/message-relayer:${{ needs.builder.outputs.message-relayer }} + tags: ethereumoptimism/message-relayer:${{ GITHUB_SHA::8 }} batch-submitter: name: Publish Batch Submitter Version ${{ needs.builder.outputs.batch-submitter }} @@ -181,7 +181,7 @@ jobs: context: . file: ./ops/docker/Dockerfile.batch-submitter push: true - tags: ethereumoptimism/batch-submitter:${{ needs.builder.outputs.batch-submitter }} + tags: ethereumoptimism/batch-submitter:${{ GITHUB_SHA::8 }} data-transport-layer: name: Publish Data Transport Layer Version ${{ needs.builder.outputs.data-transport-layer }} @@ -207,7 +207,7 @@ jobs: context: . file: ./ops/docker/Dockerfile.data-transport-layer push: true - tags: ethereumoptimism/data-transport-layer:${{ needs.builder.outputs.data-transport-layer }} + tags: ethereumoptimism/data-transport-layer:${{ GITHUB_SHA::8 }} contracts: name: Publish Deployer Version ${{ needs.builder.outputs.contracts }} @@ -233,7 +233,7 @@ jobs: context: . file: ./ops/docker/Dockerfile.deployer push: true - tags: ethereumoptimism/deployer:${{ needs.builder.outputs.contracts }} + tags: ethereumoptimism/deployer:${{ GITHUB_SHA::8 }} integration_tests: name: Publish Integration tests ${{ needs.builder.outputs.integration-tests }} @@ -259,4 +259,4 @@ jobs: context: . file: ./ops/docker/Dockerfile.integration-tests push: true - tags: ethereumoptimism/integration-tests:${{ needs.builder.outputs.integration-tests }} + tags: ethereumoptimism/integration-tests:${{ GITHUB_SHA::8 }} From 55ee461e3f0a051f23267b2b14f8e2fb9ffdc1c4 Mon Sep 17 00:00:00 2001 From: Liam Horne Date: Thu, 3 Jun 2021 17:32:54 -0400 Subject: [PATCH 043/125] refactor: improve logging for transactions being submitted to chain with gasPrice (#1016) * refactor: improve logging for transactions being submitted to chain with gasPrice * lint: apply lint autofixes --- .../src/batch-submitter/state-batch-submitter.ts | 7 +++++-- .../src/batch-submitter/tx-batch-submitter.ts | 14 ++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/packages/batch-submitter/src/batch-submitter/state-batch-submitter.ts b/packages/batch-submitter/src/batch-submitter/state-batch-submitter.ts index 2ccb68b8a8b9..319dae882081 100644 --- a/packages/batch-submitter/src/batch-submitter/state-batch-submitter.ts +++ b/packages/batch-submitter/src/batch-submitter/state-batch-submitter.ts @@ -178,15 +178,18 @@ export class StateBatchSubmitter extends BatchSubmitter { const nonce = await this.signer.getTransactionCount() const contractFunction = async (gasPrice): Promise => { + this.logger.info('Submitting appendStateBatch transaction', { + gasPrice, + nonce, + contractAddr: this.chainContract.address, + }) const contractTx = await this.chainContract.appendStateBatch( batch, offsetStartsAtIndex, { nonce, gasPrice } ) this.logger.info('Submitted appendStateBatch transaction', { - nonce, txHash: contractTx.hash, - contractAddr: this.chainContract.address, from: contractTx.from, }) this.logger.debug('appendStateBatch transaction data', { diff --git a/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts b/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts index b52be781aa52..bdcc59db48ed 100644 --- a/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts +++ b/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts @@ -143,14 +143,17 @@ export class TransactionBatchSubmitter extends BatchSubmitter { const contractFunction = async ( gasPrice ): Promise => { + this.logger.info('Submitting appendQueueBatch transaction', { + gasPrice, + nonce, + contractAddr: this.chainContract.address, + }) const tx = await this.chainContract.appendQueueBatch(99999999, { nonce, gasPrice, }) this.logger.info('Submitted appendQueueBatch transaction', { - nonce, txHash: tx.hash, - contractAddr: this.chainContract.address, from: tx.from, }) this.logger.debug('appendQueueBatch transaction data', { @@ -250,14 +253,17 @@ export class TransactionBatchSubmitter extends BatchSubmitter { const nonce = await this.signer.getTransactionCount() const contractFunction = async (gasPrice): Promise => { + this.logger.info('Submitting appendSequencerBatch transaction', { + gasPrice, + nonce, + contractAddr: this.chainContract.address, + }) const tx = await this.chainContract.appendSequencerBatch(batchParams, { nonce, gasPrice, }) this.logger.info('Submitted appendSequencerBatch transaction', { - nonce, txHash: tx.hash, - contractAddr: this.chainContract.address, from: tx.from, }) this.logger.debug('appendSequencerBatch transaction data', { From 8fee7bed6b63a861fa3e0300869d544bc3a75b45 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Thu, 3 Jun 2021 15:50:29 -0700 Subject: [PATCH 044/125] dtl: remove stringify from db logic + more overflow protection (#1010) * dtl: remove stringify from db logic * l2geth: overflow protection * dtl: overflow protection * chore: add changeset --- .changeset/cold-ways-grow.md | 6 ++++ l2geth/rollup/client.go | 4 +-- .../src/db/transport-db.ts | 28 ++----------------- .../handlers/sequencer-batch-appended.ts | 4 +-- .../l2-ingestion/handlers/transaction.ts | 4 +-- .../src/types/database-types.ts | 4 +-- 6 files changed, 16 insertions(+), 34 deletions(-) create mode 100644 .changeset/cold-ways-grow.md diff --git a/.changeset/cold-ways-grow.md b/.changeset/cold-ways-grow.md new file mode 100644 index 000000000000..a79702ddfa1e --- /dev/null +++ b/.changeset/cold-ways-grow.md @@ -0,0 +1,6 @@ +--- +'@eth-optimism/l2geth': patch +'@eth-optimism/data-transport-layer': patch +--- + +Add extra overflow protection for the DTL types diff --git a/l2geth/rollup/client.go b/l2geth/rollup/client.go index 5f8cd3edd12b..8a5e0530ed8d 100644 --- a/l2geth/rollup/client.go +++ b/l2geth/rollup/client.go @@ -104,8 +104,8 @@ type decoded struct { Signature signature `json:"sig"` Value hexutil.Uint64 `json:"value"` GasLimit uint64 `json:"gasLimit,string"` - GasPrice uint64 `json:"gasPrice"` - Nonce uint64 `json:"nonce"` + GasPrice uint64 `json:"gasPrice,string"` + Nonce uint64 `json:"nonce,string"` Target *common.Address `json:"target"` Data hexutil.Bytes `json:"data"` } diff --git a/packages/data-transport-layer/src/db/transport-db.ts b/packages/data-transport-layer/src/db/transport-db.ts index 777ba4423dde..c1c50c4eac53 100644 --- a/packages/data-transport-layer/src/db/transport-db.ts +++ b/packages/data-transport-layer/src/db/transport-db.ts @@ -379,9 +379,7 @@ export class TransportDB { if (index === null) { return null } - let entry = await this.db.get(`${key}:index`, index) - entry = stringify(entry) - return entry + return this.db.get(`${key}:index`, index) } private async _getEntries( @@ -389,28 +387,6 @@ export class TransportDB { startIndex: number, endIndex: number ): Promise { - const entries = await this.db.range( - `${key}:index`, - startIndex, - endIndex - ) - const results = [] - for (const entry of entries) { - results.push(stringify(entry)) - } - return results - } -} - -function stringify(entry) { - if (entry === null || entry === undefined) { - return entry - } - if (entry.gasLimit) { - entry.gasLimit = BigNumber.from(entry.gasLimit).toString() - } - if (entry.decoded) { - entry.decoded.gasLimit = BigNumber.from(entry.decoded.gasLimit).toString() + return this.db.range(`${key}:index`, startIndex, endIndex) } - return entry } diff --git a/packages/data-transport-layer/src/services/l1-ingestion/handlers/sequencer-batch-appended.ts b/packages/data-transport-layer/src/services/l1-ingestion/handlers/sequencer-batch-appended.ts index 0c90fa286277..877b452835c9 100644 --- a/packages/data-transport-layer/src/services/l1-ingestion/handlers/sequencer-batch-appended.ts +++ b/packages/data-transport-layer/src/services/l1-ingestion/handlers/sequencer-batch-appended.ts @@ -240,8 +240,8 @@ const maybeDecodeSequencerBatchTransaction = ( const decodedTx = ethers.utils.parseTransaction(transaction) return { - nonce: BigNumber.from(decodedTx.nonce).toNumber(), - gasPrice: BigNumber.from(decodedTx.gasPrice).toNumber(), + nonce: BigNumber.from(decodedTx.nonce).toString(), + gasPrice: BigNumber.from(decodedTx.gasPrice).toString(), gasLimit: BigNumber.from(decodedTx.gasLimit).toString(), value: toRpcHexString(decodedTx.value), target: toHexString(decodedTx.to), // Maybe null this out for creations? diff --git a/packages/data-transport-layer/src/services/l2-ingestion/handlers/transaction.ts b/packages/data-transport-layer/src/services/l2-ingestion/handlers/transaction.ts index be127cc2d0dd..0f4284533807 100644 --- a/packages/data-transport-layer/src/services/l2-ingestion/handlers/transaction.ts +++ b/packages/data-transport-layer/src/services/l2-ingestion/handlers/transaction.ts @@ -49,8 +49,8 @@ export const handleSequencerBlock = { }, value: transaction.value, gasLimit: BigNumber.from(transaction.gas).toString(), - gasPrice: BigNumber.from(transaction.gasPrice).toNumber(), // ? - nonce: BigNumber.from(transaction.nonce).toNumber(), + gasPrice: BigNumber.from(transaction.gasPrice).toString(), + nonce: BigNumber.from(transaction.nonce).toString(), target: transaction.to, data: transaction.input, } diff --git a/packages/data-transport-layer/src/types/database-types.ts b/packages/data-transport-layer/src/types/database-types.ts index 470b402c3590..3ad73da3e4f7 100644 --- a/packages/data-transport-layer/src/types/database-types.ts +++ b/packages/data-transport-layer/src/types/database-types.ts @@ -6,8 +6,8 @@ export interface DecodedSequencerBatchTransaction { } value: string gasLimit: string - gasPrice: number - nonce: number + gasPrice: string + nonce: string target: string data: string } From ed9fc79d2a9a4677ae78041b5ffc29e41c696359 Mon Sep 17 00:00:00 2001 From: Liam Horne Date: Fri, 4 Jun 2021 05:47:07 -0400 Subject: [PATCH 045/125] ci: upload logs for failed integration tests (#1020) --- .github/workflows/integration.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index f9ba9f19c20b..2e4697184a05 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -93,3 +93,21 @@ jobs: yarn compile yarn compile:ovm yarn test:integration:ovm + + - name: Collect docker logs on failure + if: failure() + uses: jwalton/gh-docker-logs@v1 + with: + images: 'ethereumoptimism/builder,ethereumoptimism/hardhat,ethereumoptimism/deployer,ethereumoptimism/data-transport-layer,ethereumoptimism/l2geth,ethereumoptimism/message-relayer,ethereumoptimism/batch-submitter,ethereumoptimism/l2geth,ethereumoptimism/integration-tests' + dest: './logs' + + - name: Tar logs + if: failure() + run: tar cvzf ./logs.tgz ./logs + + - name: Upload logs to GitHub + if: failure() + uses: actions/upload-artifact@master + with: + name: logs.tgz + path: ./logs.tgz \ No newline at end of file From 8ac4c74c943c61444b6e414ccb972e2e34b0db6b Mon Sep 17 00:00:00 2001 From: Tim Myers Date: Fri, 4 Jun 2021 03:48:02 -0600 Subject: [PATCH 046/125] fix(dtl): improve slow blocking JSON parsing that occurs during l2 sync (#1019) The use of eth_getBlockRange returns a large response which is very slow to parse in ethersjs, and can block the event loop for upwards of multiple seconds. When this happens, incoming http requests will likely timeout and fail. Instead, we will parse the incoming http stream directly with the bfj package, which yields the event loop periodically so that we don't fail to serve requests. --- .changeset/wet-falcons-talk.md | 5 +++ packages/data-transport-layer/package.json | 2 ++ .../src/services/l2-ingestion/service.ts | 28 ++++++++++++--- yarn.lock | 34 ++++++++++++++++++- 4 files changed, 63 insertions(+), 6 deletions(-) create mode 100644 .changeset/wet-falcons-talk.md diff --git a/.changeset/wet-falcons-talk.md b/.changeset/wet-falcons-talk.md new file mode 100644 index 000000000000..7698788db0e9 --- /dev/null +++ b/.changeset/wet-falcons-talk.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/data-transport-layer': patch +--- + +improve slow blocking JSON parsing that occurs during l2 sync diff --git a/packages/data-transport-layer/package.json b/packages/data-transport-layer/package.json index c959e434e2c1..da0ca5267abf 100644 --- a/packages/data-transport-layer/package.json +++ b/packages/data-transport-layer/package.json @@ -30,6 +30,7 @@ "@sentry/tracing": "^6.3.1", "@types/express": "^4.17.11", "bcfg": "^0.1.6", + "bfj": "^7.0.2", "browser-or-node": "^1.3.0", "cors": "^2.8.5", "dotenv": "^8.2.0", @@ -49,6 +50,7 @@ "@types/levelup": "^4.3.0", "@types/mocha": "^8.2.2", "@types/node-fetch": "^2.5.8", + "@types/workerpool": "^6.0.0", "chai": "^4.3.4", "chai-as-promised": "^7.1.1", "hardhat": "^2.2.1", diff --git a/packages/data-transport-layer/src/services/l2-ingestion/service.ts b/packages/data-transport-layer/src/services/l2-ingestion/service.ts index 120bb35ad734..6a32bc301a58 100644 --- a/packages/data-transport-layer/src/services/l2-ingestion/service.ts +++ b/packages/data-transport-layer/src/services/l2-ingestion/service.ts @@ -3,6 +3,8 @@ import { BaseService } from '@eth-optimism/common-ts' import { JsonRpcProvider } from '@ethersproject/providers' import { BigNumber } from 'ethers' import { LevelUp } from 'levelup' +import axios from 'axios'; +import bfj from 'bfj'; /* Imports: Internal */ import { TransportDB } from '../../db/transport-db' @@ -168,11 +170,27 @@ export class L2IngestionService extends BaseService { ) }) } else { - blocks = await this.state.l2RpcProvider.send('eth_getBlockRange', [ - toRpcHexString(startBlockNumber), - toRpcHexString(endBlockNumber), - true, - ]) + // This request returns a large response. Parsing it into JSON inside the ethers library is + // quite slow, and can block the event loop for upwards of multiple seconds. When this happens, + // incoming http requests will likely timeout and fail. + // Instead, we will parse the incoming http stream directly with the bfj package, which yields + // the event loop periodically so that we don't fail to serve requests. + const req = { + jsonrpc: '2.0', + method: 'eth_getBlockRange', + params: [ + toRpcHexString(startBlockNumber), + toRpcHexString(endBlockNumber), + true, + ], + id: '1', + }; + + const resp = await axios.post(this.state.l2RpcProvider.connection.url, req, {responseType: 'stream'}); + const respJson = await bfj.parse(resp.data, { + yieldRate: 4096 // this yields abit more often than the default of 16384 + }); + const blocks = respJson.data; } for (const block of blocks) { diff --git a/yarn.lock b/yarn.lock index 678b6dfabc8f..1be52e5f1a8e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2601,6 +2601,13 @@ "@types/bn.js" "*" "@types/underscore" "*" +"@types/workerpool@^6.0.0": + version "6.0.0" + resolved "https://registry.yarnpkg.com/@types/workerpool/-/workerpool-6.0.0.tgz#068c31191f7df9b3d49ebe348b1eeb601e75e2d3" + integrity sha512-BjbKVHFBWblQ3vZ5yFq29kbM2TsaUaTOwYgVxqnNjMrT6CktVF8AvMxOJZgHGgNbAzP4z8DK+EshyZcYpdvAhQ== + dependencies: + "@types/node" "*" + "@types/yargs-parser@*": version "20.2.0" resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-20.2.0.tgz#dd3e6699ba3237f0348cd085e4698780204842f9" @@ -3657,6 +3664,16 @@ better-path-resolve@1.0.0: dependencies: is-windows "^1.0.0" +bfj@^7.0.2: + version "7.0.2" + resolved "https://registry.yarnpkg.com/bfj/-/bfj-7.0.2.tgz#1988ce76f3add9ac2913fd8ba47aad9e651bfbb2" + integrity sha512-+e/UqUzwmzJamNF50tBV6tZPTORow7gQ96iFow+8b562OdMpEK0BcJEq2OSPEDmAbSMBQ7PKZ87ubFkgxpYWgw== + dependencies: + bluebird "^3.5.5" + check-types "^11.1.1" + hoopy "^0.1.4" + tryer "^1.0.1" + bignumber.js@^9.0.0, bignumber.js@^9.0.1: version "9.0.1" resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.0.1.tgz#8d7ba124c882bfd8e43260c67475518d0689e4e5" @@ -3711,7 +3728,7 @@ blakejs@^1.1.0: resolved "https://registry.yarnpkg.com/blakejs/-/blakejs-1.1.0.tgz#69df92ef953aa88ca51a32df6ab1c54a155fc7a5" integrity sha1-ad+S75U6qIylGjLfarHFShVfx6U= -bluebird@^3.5.0, bluebird@^3.5.2, bluebird@^3.5.3, bluebird@^3.7.2: +bluebird@^3.5.0, bluebird@^3.5.2, bluebird@^3.5.3, bluebird@^3.5.5, bluebird@^3.7.2: version "3.7.2" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== @@ -4190,6 +4207,11 @@ check-error@^1.0.2: resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82" integrity sha1-V00xLt2Iu13YkS6Sht1sCu1KrII= +check-types@^11.1.1: + version "11.1.2" + resolved "https://registry.yarnpkg.com/check-types/-/check-types-11.1.2.tgz#86a7c12bf5539f6324eb0e70ca8896c0e38f3e2f" + integrity sha512-tzWzvgePgLORb9/3a0YenggReLKAIb2owL03H2Xdoe5pKcUyWRSEQ8xfCar8t2SIAuEDwtmx2da1YB52YuHQMQ== + checkpoint-store@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/checkpoint-store/-/checkpoint-store-1.1.0.tgz#04e4cb516b91433893581e6d4601a78e9552ea06" @@ -7304,6 +7326,11 @@ home-or-tmp@^2.0.0: os-homedir "^1.0.0" os-tmpdir "^1.0.1" +hoopy@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/hoopy/-/hoopy-0.1.4.tgz#609207d661100033a9a9402ad3dea677381c1b1d" + integrity sha512-HRcs+2mr52W0K+x8RzcLzuPPmVIKMSv97RGHy0Ea9y/mpcaK+xTrjICA04KAHi4GRzxliNqNJEFYWHghy3rSfQ== + hosted-git-info@^2.1.4, hosted-git-info@^2.6.0: version "2.8.8" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.8.tgz#7539bd4bc1e0e0a895815a2e0262420b12858488" @@ -12743,6 +12770,11 @@ trim-right@^1.0.1: resolved "https://registry.yarnpkg.com/true-case-path/-/true-case-path-2.2.1.tgz#c5bf04a5bbec3fd118be4084461b3a27c4d796bf" integrity sha512-0z3j8R7MCjy10kc/g+qg7Ln3alJTodw9aDuVWZa3uiWqfuBMKeAeP2ocWcxoyM3D73yz3Jt/Pu4qPr4wHSdB/Q== +tryer@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/tryer/-/tryer-1.0.1.tgz#f2c85406800b9b0f74c9f7465b81eaad241252f8" + integrity sha512-c3zayb8/kWWpycWYg87P71E1S1ZL6b6IJxfb5fvsUgsf0S2MVGaDhDXXjDMpdCpfWXqptc+4mXwmiy1ypXqRAA== + ts-essentials@^1.0.0, ts-essentials@^1.0.2: version "1.0.4" resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-1.0.4.tgz#ce3b5dade5f5d97cf69889c11bf7d2da8555b15a" From e3dc90cb08fde9b842643efdc5908e54d6065c2c Mon Sep 17 00:00:00 2001 From: Karl Floersch Date: Sun, 6 Jun 2021 05:48:24 -0400 Subject: [PATCH 047/125] fix: lint errors in dtl (#1025) --- packages/data-transport-layer/package.json | 1 + .../src/services/l2-ingestion/service.ts | 20 +++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/packages/data-transport-layer/package.json b/packages/data-transport-layer/package.json index da0ca5267abf..ac98ed5bdad3 100644 --- a/packages/data-transport-layer/package.json +++ b/packages/data-transport-layer/package.json @@ -29,6 +29,7 @@ "@sentry/node": "^6.3.1", "@sentry/tracing": "^6.3.1", "@types/express": "^4.17.11", + "axios": "^0.21.1", "bcfg": "^0.1.6", "bfj": "^7.0.2", "browser-or-node": "^1.3.0", diff --git a/packages/data-transport-layer/src/services/l2-ingestion/service.ts b/packages/data-transport-layer/src/services/l2-ingestion/service.ts index 6a32bc301a58..fb6434f433c3 100644 --- a/packages/data-transport-layer/src/services/l2-ingestion/service.ts +++ b/packages/data-transport-layer/src/services/l2-ingestion/service.ts @@ -3,8 +3,8 @@ import { BaseService } from '@eth-optimism/common-ts' import { JsonRpcProvider } from '@ethersproject/providers' import { BigNumber } from 'ethers' import { LevelUp } from 'levelup' -import axios from 'axios'; -import bfj from 'bfj'; +import axios from 'axios' +import bfj from 'bfj' /* Imports: Internal */ import { TransportDB } from '../../db/transport-db' @@ -184,13 +184,17 @@ export class L2IngestionService extends BaseService { true, ], id: '1', - }; + } - const resp = await axios.post(this.state.l2RpcProvider.connection.url, req, {responseType: 'stream'}); - const respJson = await bfj.parse(resp.data, { - yieldRate: 4096 // this yields abit more often than the default of 16384 - }); - const blocks = respJson.data; + const resp = await axios.post( + this.state.l2RpcProvider.connection.url, + req, + { responseType: 'stream' } + ) + const respJson = await bfj.parse(resp.data, { + yieldRate: 4096, // this yields abit more often than the default of 16384 + }) + blocks = respJson.data } for (const block of blocks) { From a75f05b7904df73c8e4f04b85614e5629d3da943 Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Mon, 7 Jun 2021 14:29:48 -0400 Subject: [PATCH 048/125] fix[dtl]: fix dtl bug breaking verifiers (#1011) * fix[dtl]: fix dtl bug breaking verifiers * tweaks so tests pass * chore: add changeset --- .changeset/quick-pandas-laugh.md | 5 +++++ .../handlers/sequencer-batch-appended.ts | 11 ++++++---- .../src/services/l1-ingestion/service.ts | 13 ++++++++++-- .../l2-ingestion/handlers/transaction.ts | 3 ++- .../src/types/event-handler-types.ts | 3 ++- .../data-transport-layer/src/utils/eth-tx.ts | 9 +++++++++ .../data-transport-layer/src/utils/index.ts | 1 + .../handlers/sequencer-batch-appended.spec.ts | 7 ++++--- .../handlers/state-batch-appended.spec.ts | 11 ++++++++-- .../handlers/transaction-enqueued.spec.ts | 20 +++++++++++++------ .../l2-ingestion/handlers/transaction.spec.ts | 2 ++ 11 files changed, 66 insertions(+), 19 deletions(-) create mode 100644 .changeset/quick-pandas-laugh.md create mode 100644 packages/data-transport-layer/src/utils/eth-tx.ts diff --git a/.changeset/quick-pandas-laugh.md b/.changeset/quick-pandas-laugh.md new file mode 100644 index 000000000000..0faa252664d5 --- /dev/null +++ b/.changeset/quick-pandas-laugh.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/data-transport-layer': patch +--- + +Fixes a bug that prevented verifiers from syncing properly with the DTL diff --git a/packages/data-transport-layer/src/services/l1-ingestion/handlers/sequencer-batch-appended.ts b/packages/data-transport-layer/src/services/l1-ingestion/handlers/sequencer-batch-appended.ts index 0c90fa286277..114e04f3c5c1 100644 --- a/packages/data-transport-layer/src/services/l1-ingestion/handlers/sequencer-batch-appended.ts +++ b/packages/data-transport-layer/src/services/l1-ingestion/handlers/sequencer-batch-appended.ts @@ -20,6 +20,7 @@ import { import { SEQUENCER_ENTRYPOINT_ADDRESS, SEQUENCER_GAS_LIMIT, + parseSignatureVParam, } from '../../../utils' export const handleEventsSequencerBatchAppended: EventHandlerSet< @@ -76,7 +77,7 @@ export const handleEventsSequencerBatchAppended: EventHandlerSet< batchExtraData: batchSubmissionEvent.args._extraData, } }, - parseEvent: (event, extraData) => { + parseEvent: (event, extraData, l2ChainId) => { const transactionEntries: TransactionEntry[] = [] // It's easier to deal with this data if it's a Buffer. @@ -103,7 +104,8 @@ export const handleEventsSequencerBatchAppended: EventHandlerSet< ) const decoded = maybeDecodeSequencerBatchTransaction( - sequencerTransaction + sequencerTransaction, + l2ChainId ) transactionEntries.push({ @@ -234,7 +236,8 @@ const parseSequencerBatchTransaction = ( } const maybeDecodeSequencerBatchTransaction = ( - transaction: Buffer + transaction: Buffer, + l2ChainId: number ): DecodedSequencerBatchTransaction | null => { try { const decodedTx = ethers.utils.parseTransaction(transaction) @@ -247,7 +250,7 @@ const maybeDecodeSequencerBatchTransaction = ( target: toHexString(decodedTx.to), // Maybe null this out for creations? data: toHexString(decodedTx.data), sig: { - v: BigNumber.from(decodedTx.v).toNumber(), + v: parseSignatureVParam(decodedTx.v, l2ChainId), r: toHexString(decodedTx.r), s: toHexString(decodedTx.s), }, diff --git a/packages/data-transport-layer/src/services/l1-ingestion/service.ts b/packages/data-transport-layer/src/services/l1-ingestion/service.ts index 3bc862cf4feb..d682fa5436b8 100644 --- a/packages/data-transport-layer/src/services/l1-ingestion/service.ts +++ b/packages/data-transport-layer/src/services/l1-ingestion/service.ts @@ -3,6 +3,7 @@ import { fromHexString, EventArgsAddressSet } from '@eth-optimism/core-utils' import { BaseService } from '@eth-optimism/common-ts' import { JsonRpcProvider } from '@ethersproject/providers' import { LevelUp } from 'levelup' +import { ethers, constants } from 'ethers' /* Imports: Internal */ import { TransportDB } from '../../db/transport-db' @@ -18,7 +19,6 @@ import { handleEventsTransactionEnqueued } from './handlers/transaction-enqueued import { handleEventsSequencerBatchAppended } from './handlers/sequencer-batch-appended' import { handleEventsStateBatchAppended } from './handlers/state-batch-appended' import { L1DataTransportServiceOptions } from '../main/service' -import { constants } from 'ethers' export interface L1IngestionServiceOptions extends L1DataTransportServiceOptions { @@ -65,6 +65,7 @@ export class L1IngestionService extends BaseService { contracts: OptimismContracts l1RpcProvider: JsonRpcProvider startingL1BlockNumber: number + l2ChainId: number } = {} as any protected async _init(): Promise { @@ -114,6 +115,10 @@ export class L1IngestionService extends BaseService { this.options.addressManager ) + this.state.l2ChainId = ethers.BigNumber.from( + await this.state.contracts.OVM_ExecutionManager.ovmCHAINID() + ).toNumber() + const startingL1BlockNumber = await this.state.db.getStartingL1Block() if (startingL1BlockNumber) { this.state.startingL1BlockNumber = startingL1BlockNumber @@ -295,7 +300,11 @@ export class L1IngestionService extends BaseService { event, this.state.l1RpcProvider ) - const parsedEvent = await handlers.parseEvent(event, extraData) + const parsedEvent = await handlers.parseEvent( + event, + extraData, + this.state.l2ChainId + ) await handlers.storeEvent(parsedEvent, this.state.db) } diff --git a/packages/data-transport-layer/src/services/l2-ingestion/handlers/transaction.ts b/packages/data-transport-layer/src/services/l2-ingestion/handlers/transaction.ts index be127cc2d0dd..0c2bb410b1cd 100644 --- a/packages/data-transport-layer/src/services/l2-ingestion/handlers/transaction.ts +++ b/packages/data-transport-layer/src/services/l2-ingestion/handlers/transaction.ts @@ -13,6 +13,7 @@ import { padHexString, SEQUENCER_ENTRYPOINT_ADDRESS, SEQUENCER_GAS_LIMIT, + parseSignatureVParam, } from '../../../utils' export const handleSequencerBlock = { @@ -43,7 +44,7 @@ export const handleSequencerBlock = { if (transaction.queueOrigin === 'sequencer') { const decodedTransaction: DecodedSequencerBatchTransaction = { sig: { - v: BigNumber.from(transaction.v).toNumber() - 2 * chainId - 35, + v: parseSignatureVParam(transaction.v, chainId), r: padHexString(transaction.r, 32), s: padHexString(transaction.s, 32), }, diff --git a/packages/data-transport-layer/src/types/event-handler-types.ts b/packages/data-transport-layer/src/types/event-handler-types.ts index 82bf5bf7f198..1839796b527e 100644 --- a/packages/data-transport-layer/src/types/event-handler-types.ts +++ b/packages/data-transport-layer/src/types/event-handler-types.ts @@ -20,7 +20,8 @@ export type GetExtraDataHandler = ( export type ParseEventHandler = ( event: TypedEthersEvent, - extraData: TExtraData + extraData: TExtraData, + l2ChainId: number ) => TParsedEvent export type StoreEventHandler = ( diff --git a/packages/data-transport-layer/src/utils/eth-tx.ts b/packages/data-transport-layer/src/utils/eth-tx.ts new file mode 100644 index 000000000000..cce210d26909 --- /dev/null +++ b/packages/data-transport-layer/src/utils/eth-tx.ts @@ -0,0 +1,9 @@ +/* Imports: External */ +import { ethers } from 'ethers' + +export const parseSignatureVParam = ( + v: number | ethers.BigNumber, + chainId: number +): number => { + return ethers.BigNumber.from(v).toNumber() - 2 * chainId - 35 +} diff --git a/packages/data-transport-layer/src/utils/index.ts b/packages/data-transport-layer/src/utils/index.ts index 482c5161307c..411d8cdb6d80 100644 --- a/packages/data-transport-layer/src/utils/index.ts +++ b/packages/data-transport-layer/src/utils/index.ts @@ -2,3 +2,4 @@ export * from './common' export * from './constants' export * from './contracts' export * from './validation' +export * from './eth-tx' diff --git a/packages/data-transport-layer/test/unit-tests/services/l1-ingestion/handlers/sequencer-batch-appended.spec.ts b/packages/data-transport-layer/test/unit-tests/services/l1-ingestion/handlers/sequencer-batch-appended.spec.ts index 813f3c65c63a..f4ad79c89730 100644 --- a/packages/data-transport-layer/test/unit-tests/services/l1-ingestion/handlers/sequencer-batch-appended.spec.ts +++ b/packages/data-transport-layer/test/unit-tests/services/l1-ingestion/handlers/sequencer-batch-appended.spec.ts @@ -1,9 +1,9 @@ import { BigNumber, ethers } from 'ethers' + +/* Imports: Internal */ import { expect } from '../../../../setup' import { handleEventsSequencerBatchAppended } from '../../../../../src/services/l1-ingestion/handlers/sequencer-batch-appended' import { SequencerBatchAppendedExtraData } from '../../../../../src/types' -import { l1TransactionData } from '../../../examples/l1-data' -import { blocksOnL2 } from '../../../examples/l2-data' describe('Event Handlers: OVM_CanonicalTransactionChain.SequencerBatchAppended', () => { describe('handleEventsSequencerBatchAppended.parseEvent', () => { @@ -28,7 +28,7 @@ describe('Event Handlers: OVM_CanonicalTransactionChain.SequencerBatchAppended', } it('should error on malformed transaction data', async () => { - const input1: [any, SequencerBatchAppendedExtraData] = [ + const input1: [any, SequencerBatchAppendedExtraData, number] = [ { args: { _startingQueueIndex: ethers.constants.Zero, @@ -40,6 +40,7 @@ describe('Event Handlers: OVM_CanonicalTransactionChain.SequencerBatchAppended', l1TransactionData: '0x00000', ...exampleExtraData, }, + 0, ] expect(() => { diff --git a/packages/data-transport-layer/test/unit-tests/services/l1-ingestion/handlers/state-batch-appended.spec.ts b/packages/data-transport-layer/test/unit-tests/services/l1-ingestion/handlers/state-batch-appended.spec.ts index fb16de430cbe..8090a05cb4f4 100644 --- a/packages/data-transport-layer/test/unit-tests/services/l1-ingestion/handlers/state-batch-appended.spec.ts +++ b/packages/data-transport-layer/test/unit-tests/services/l1-ingestion/handlers/state-batch-appended.spec.ts @@ -1,7 +1,10 @@ +import { expect } from '../../../../setup' + +/* Imports: External */ import { BigNumber } from 'ethers' import { Block } from '@ethersproject/abstract-provider' -import { expect } from '../../../../setup' +/* Imports: Internal */ import { handleEventsStateBatchAppended } from '../../../../../src/services/l1-ingestion/handlers/state-batch-appended' import { StateBatchAppendedExtraData } from '../../../../../src/types' import { l1StateBatchData } from '../../../examples/l1-data' @@ -73,7 +76,11 @@ describe('Event Handlers: OVM_CanonicalTransactionChain.StateBatchAppended', () l1TransactionHash: '0x4ca72484e93cdb50fe1089984db152258c2bbffc2534dcafbfe032b596bd5b49', } - const input1: [any, StateBatchAppendedExtraData] = [event, extraData] + const input1: [any, StateBatchAppendedExtraData, number] = [ + event, + extraData, + 0, + ] const output1 = handleEventsStateBatchAppended.parseEvent(...input1) diff --git a/packages/data-transport-layer/test/unit-tests/services/l1-ingestion/handlers/transaction-enqueued.spec.ts b/packages/data-transport-layer/test/unit-tests/services/l1-ingestion/handlers/transaction-enqueued.spec.ts index b14d6ba505b9..0e3ef5e25541 100644 --- a/packages/data-transport-layer/test/unit-tests/services/l1-ingestion/handlers/transaction-enqueued.spec.ts +++ b/packages/data-transport-layer/test/unit-tests/services/l1-ingestion/handlers/transaction-enqueued.spec.ts @@ -1,6 +1,9 @@ +import { expect } from '../../../../setup' + +/* Imports: External */ import { ethers, BigNumber } from 'ethers' -import { expect } from '../../../../setup' +/* Imports: Internal */ import { handleEventsTransactionEnqueued } from '../../../../../src/services/l1-ingestion/handlers/transaction-enqueued' const MAX_ITERATIONS = 128 @@ -22,7 +25,7 @@ describe('Event Handlers: OVM_CanonicalTransactionChain.TransactionEnqueued', () // but it's probably better to get wider test coverage first. it('should have a ctcIndex equal to null', () => { - const input1: [any, any] = [ + const input1: [any, any, number] = [ { blockNumber: 0, args: { @@ -32,6 +35,7 @@ describe('Event Handlers: OVM_CanonicalTransactionChain.TransactionEnqueued', () }, }, null, + 0, ] const output1 = handleEventsTransactionEnqueued.parseEvent(...input1) @@ -47,7 +51,7 @@ describe('Event Handlers: OVM_CanonicalTransactionChain.TransactionEnqueued', () i < Number.MAX_SAFE_INTEGER; i += Math.floor(Number.MAX_SAFE_INTEGER / MAX_ITERATIONS) ) { - const input1: [any, any] = [ + const input1: [any, any, number] = [ { blockNumber: i, args: { @@ -57,6 +61,7 @@ describe('Event Handlers: OVM_CanonicalTransactionChain.TransactionEnqueued', () }, }, null, + 0, ] const output1 = handleEventsTransactionEnqueued.parseEvent(...input1) @@ -73,7 +78,7 @@ describe('Event Handlers: OVM_CanonicalTransactionChain.TransactionEnqueued', () i < Number.MAX_SAFE_INTEGER; i += Math.floor(Number.MAX_SAFE_INTEGER / MAX_ITERATIONS) ) { - const input1: [any, any] = [ + const input1: [any, any, number] = [ { blockNumber: 0, args: { @@ -83,6 +88,7 @@ describe('Event Handlers: OVM_CanonicalTransactionChain.TransactionEnqueued', () }, }, null, + 0, ] const output1 = handleEventsTransactionEnqueued.parseEvent(...input1) @@ -99,7 +105,7 @@ describe('Event Handlers: OVM_CanonicalTransactionChain.TransactionEnqueued', () i < Number.MAX_SAFE_INTEGER; i += Math.floor(Number.MAX_SAFE_INTEGER / MAX_ITERATIONS) ) { - const input1: [any, any] = [ + const input1: [any, any, number] = [ { blockNumber: 0, args: { @@ -109,6 +115,7 @@ describe('Event Handlers: OVM_CanonicalTransactionChain.TransactionEnqueued', () }, }, null, + 0, ] const output1 = handleEventsTransactionEnqueued.parseEvent(...input1) @@ -125,7 +132,7 @@ describe('Event Handlers: OVM_CanonicalTransactionChain.TransactionEnqueued', () i < Number.MAX_SAFE_INTEGER; i += Math.floor(Number.MAX_SAFE_INTEGER / MAX_ITERATIONS) ) { - const input1: [any, any] = [ + const input1: [any, any, number] = [ { blockNumber: 0, args: { @@ -135,6 +142,7 @@ describe('Event Handlers: OVM_CanonicalTransactionChain.TransactionEnqueued', () }, }, null, + 0, ] const output1 = handleEventsTransactionEnqueued.parseEvent(...input1) diff --git a/packages/data-transport-layer/test/unit-tests/services/l2-ingestion/handlers/transaction.spec.ts b/packages/data-transport-layer/test/unit-tests/services/l2-ingestion/handlers/transaction.spec.ts index dac1dcc3aa45..0f7a71323623 100644 --- a/packages/data-transport-layer/test/unit-tests/services/l2-ingestion/handlers/transaction.spec.ts +++ b/packages/data-transport-layer/test/unit-tests/services/l2-ingestion/handlers/transaction.spec.ts @@ -1,4 +1,6 @@ import { expect } from '../../../../setup' + +/* Imports: Internal */ import { l2Block } from '../../../examples/l2-data' import { handleSequencerBlock } from '../../../../../src/services/l2-ingestion/handlers/transaction' From cb4a928bf02e7609d49cf827a1f7faed8480deb3 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Mon, 7 Jun 2021 21:07:01 -0700 Subject: [PATCH 049/125] fix: deterministic blockhashes (#1032) * config: set etherbase * l2geth: add deterministic clique key * l2geth: default value * chore: add changeset * test: add sync test for deterministic blockhash Co-authored-by: Kevin Ho --- .changeset/chilled-apricots-tie.md | 5 +++++ .../sync-tests/sync-verifier.spec.ts | 10 +++++++++- l2geth/accounts/keystore/keystore.go | 18 ++++++++++++++++++ l2geth/cmd/utils/flags.go | 5 +++-- l2geth/consensus/clique/clique.go | 6 +++--- ops/envs/geth.env | 2 ++ 6 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 .changeset/chilled-apricots-tie.md diff --git a/.changeset/chilled-apricots-tie.md b/.changeset/chilled-apricots-tie.md new file mode 100644 index 000000000000..c01d75ebe149 --- /dev/null +++ b/.changeset/chilled-apricots-tie.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/l2geth': patch +--- + +Make block hashes deterministic by using the same clique signer key diff --git a/integration-tests/sync-tests/sync-verifier.spec.ts b/integration-tests/sync-tests/sync-verifier.spec.ts index c1fe1e7e40f1..2c931eb87c4f 100644 --- a/integration-tests/sync-tests/sync-verifier.spec.ts +++ b/integration-tests/sync-tests/sync-verifier.spec.ts @@ -60,7 +60,7 @@ describe('Syncing a verifier', () => { }) describe('Basic transactions', () => { - afterEach(async () => { + after(async () => { await verifier.stop('verifier') await verifier.rm() }) @@ -97,5 +97,13 @@ describe('Syncing a verifier', () => { latestSequencerBlock.stateRoot ) }) + + it('should have matching block data', async () => { + const sequencerTip = await sequencerProvider.getBlock('latest') + const verifierTip = await provider.getBlock('latest') + + expect(sequencerTip.number).to.deep.eq(verifierTip.number) + expect(sequencerTip.hash).to.deep.eq(verifierTip.hash) + }) }) }) diff --git a/l2geth/accounts/keystore/keystore.go b/l2geth/accounts/keystore/keystore.go index 5b55175b1f3e..1ddd98a4622f 100644 --- a/l2geth/accounts/keystore/keystore.go +++ b/l2geth/accounts/keystore/keystore.go @@ -21,6 +21,7 @@ package keystore import ( + "bytes" "crypto/ecdsa" crand "crypto/rand" "errors" @@ -36,8 +37,10 @@ import ( "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/event" + "github.com/ethereum/go-ethereum/log" ) var ( @@ -80,6 +83,21 @@ func NewKeyStore(keydir string, scryptN, scryptP int) *KeyStore { keydir, _ = filepath.Abs(keydir) ks := &KeyStore{storage: &keyStorePassphrase{keydir, scryptN, scryptP, false}} ks.init(keydir) + if vm.UsingOVM { + // Add a deterministic key to the key store so that + // all clique blocks are signed with the same key + input := make([]byte, 65) + rng := bytes.NewReader(input) + key, err := newKey(rng) + log.Info("Adding key to keyring", "address", key.Address.Hex()) + if err != nil { + panic(fmt.Sprintf("cannot create key: %s", err)) + } + _, err = ks.importKey(key, "") + if err != nil { + panic(fmt.Sprintf("cannot import key: %s", err)) + } + } return ks } diff --git a/l2geth/cmd/utils/flags.go b/l2geth/cmd/utils/flags.go index 6c5c4447401b..c28526ae252a 100644 --- a/l2geth/cmd/utils/flags.go +++ b/l2geth/cmd/utils/flags.go @@ -471,12 +471,13 @@ var ( MinerEtherbaseFlag = cli.StringFlag{ Name: "miner.etherbase", Usage: "Public address for block mining rewards (default = first account)", - Value: "0", + + Value: "0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf", + EnvVar: "ETHERBASE", } MinerLegacyEtherbaseFlag = cli.StringFlag{ Name: "etherbase", Usage: "Public address for block mining rewards (default = first account, deprecated, use --miner.etherbase)", - Value: "0", } MinerExtraDataFlag = cli.StringFlag{ Name: "miner.extradata", diff --git a/l2geth/consensus/clique/clique.go b/l2geth/consensus/clique/clique.go index 29201e2ba0d1..62bc27c1fe0f 100644 --- a/l2geth/consensus/clique/clique.go +++ b/l2geth/consensus/clique/clique.go @@ -23,7 +23,6 @@ import ( "io" "math/big" "math/rand" - "os" "sync" "time" @@ -34,6 +33,7 @@ import ( "github.com/ethereum/go-ethereum/consensus/misc" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/log" @@ -249,7 +249,7 @@ func (c *Clique) verifyHeader(chain consensus.ChainReader, header *types.Header, } number := header.Number.Uint64() - if os.Getenv("USING_OVM") != "true" { + if vm.UsingOVM { // Don't waste time checking blocks from the future if header.Time > uint64(time.Now().Unix()) { return consensus.ErrFutureBlock @@ -631,7 +631,7 @@ func (c *Clique) Seal(chain consensus.ChainReader, block *types.Block, results c log.Trace("Out-of-turn signing requested", "wiggle", common.PrettyDuration(wiggle)) } - if os.Getenv("USING_OVM") == "true" { + if vm.UsingOVM { delay = 0 } // Sign all the things! diff --git a/ops/envs/geth.env b/ops/envs/geth.env index 59519125b17b..358a41b0d366 100644 --- a/ops/envs/geth.env +++ b/ops/envs/geth.env @@ -9,6 +9,8 @@ ROLLUP_POLL_INTERVAL_FLAG=500ms ROLLUP_ENABLE_L2_GAS_POLLING=true # ROLLUP_ENFORCE_FEES= +ETHERBASE=0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf + RPC_ENABLE=true RPC_ADDR=0.0.0.0 RPC_PORT=8545 From 0cbaa9a46e23624e72676bb561049b44dd1d6d2d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 8 Jun 2021 10:28:21 -0400 Subject: [PATCH 050/125] Version Packages (#978) Co-authored-by: github-actions[bot] --- .changeset/chilled-apricots-tie.md | 5 ----- .changeset/chilled-books-grab.md | 5 ----- .changeset/cold-cows-cross.md | 5 ----- .changeset/cool-baboons-guess.md | 5 ----- .changeset/dull-fishes-type.md | 5 ----- .changeset/fair-maps-pretend.md | 6 ------ .changeset/fuzzy-dogs-share.md | 6 ------ .changeset/great-shrimps-rule.md | 5 ----- .changeset/kind-houses-rush.md | 5 ----- .changeset/late-countries-guess.md | 5 ----- .changeset/nasty-dots-grow.md | 6 ------ .changeset/neat-melons-lie.md | 5 ----- .changeset/nervous-bobcats-grow.md | 5 ----- .changeset/quick-pandas-laugh.md | 5 ----- .changeset/seven-carpets-tell.md | 5 ----- .changeset/sharp-files-knock.md | 5 ----- .changeset/silent-masks-hunt.md | 5 ----- .changeset/slimy-rivers-promise.md | 5 ----- .changeset/smooth-ears-pay.md | 7 ------- .changeset/ten-spiders-boil.md | 5 ----- .changeset/thin-waves-bathe.md | 5 ----- .changeset/unlucky-shoes-bake.md | 5 ----- .changeset/wet-falcons-talk.md | 5 ----- integration-tests/CHANGELOG.md | 8 ++++++++ integration-tests/package.json | 6 +++--- l2geth/CHANGELOG.md | 12 ++++++++++++ l2geth/package.json | 2 +- packages/batch-submitter/CHANGELOG.md | 14 ++++++++++++++ packages/batch-submitter/package.json | 8 ++++---- packages/contracts/CHANGELOG.md | 12 ++++++++++++ packages/contracts/package.json | 6 +++--- packages/core-utils/CHANGELOG.md | 8 ++++++++ packages/core-utils/package.json | 2 +- packages/data-transport-layer/CHANGELOG.md | 19 +++++++++++++++++++ packages/data-transport-layer/package.json | 6 +++--- packages/message-relayer/CHANGELOG.md | 16 ++++++++++++++++ packages/message-relayer/package.json | 8 ++++---- packages/smock/CHANGELOG.md | 11 +++++++++++ packages/smock/package.json | 4 ++-- 39 files changed, 121 insertions(+), 141 deletions(-) delete mode 100644 .changeset/chilled-apricots-tie.md delete mode 100644 .changeset/chilled-books-grab.md delete mode 100644 .changeset/cold-cows-cross.md delete mode 100644 .changeset/cool-baboons-guess.md delete mode 100644 .changeset/dull-fishes-type.md delete mode 100644 .changeset/fair-maps-pretend.md delete mode 100644 .changeset/fuzzy-dogs-share.md delete mode 100644 .changeset/great-shrimps-rule.md delete mode 100644 .changeset/kind-houses-rush.md delete mode 100644 .changeset/late-countries-guess.md delete mode 100644 .changeset/nasty-dots-grow.md delete mode 100644 .changeset/neat-melons-lie.md delete mode 100644 .changeset/nervous-bobcats-grow.md delete mode 100644 .changeset/quick-pandas-laugh.md delete mode 100644 .changeset/seven-carpets-tell.md delete mode 100644 .changeset/sharp-files-knock.md delete mode 100644 .changeset/silent-masks-hunt.md delete mode 100644 .changeset/slimy-rivers-promise.md delete mode 100644 .changeset/smooth-ears-pay.md delete mode 100644 .changeset/ten-spiders-boil.md delete mode 100644 .changeset/thin-waves-bathe.md delete mode 100644 .changeset/unlucky-shoes-bake.md delete mode 100644 .changeset/wet-falcons-talk.md diff --git a/.changeset/chilled-apricots-tie.md b/.changeset/chilled-apricots-tie.md deleted file mode 100644 index c01d75ebe149..000000000000 --- a/.changeset/chilled-apricots-tie.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/l2geth': patch ---- - -Make block hashes deterministic by using the same clique signer key diff --git a/.changeset/chilled-books-grab.md b/.changeset/chilled-books-grab.md deleted file mode 100644 index 10efc8f70022..000000000000 --- a/.changeset/chilled-books-grab.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/l2geth': patch ---- - -Fixes incorrect type parsing in the RollupClient. The gasLimit became greater than the largest safe JS number so it needs to be represented as a string diff --git a/.changeset/cold-cows-cross.md b/.changeset/cold-cows-cross.md deleted file mode 100644 index cc67cf4d950d..000000000000 --- a/.changeset/cold-cows-cross.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/integration-tests': patch ---- - -Reduce test timeout from 100 to 20 seconds diff --git a/.changeset/cool-baboons-guess.md b/.changeset/cool-baboons-guess.md deleted file mode 100644 index aa0ea6cea3e9..000000000000 --- a/.changeset/cool-baboons-guess.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/smock': patch ---- - -Fixes a bug that would break call assertions for overloaded smocked functions diff --git a/.changeset/dull-fishes-type.md b/.changeset/dull-fishes-type.md deleted file mode 100644 index 3a2e75a32a95..000000000000 --- a/.changeset/dull-fishes-type.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/data-transport-layer': patch ---- - -Represent gaslimit as a string to avoid an overflow diff --git a/.changeset/fair-maps-pretend.md b/.changeset/fair-maps-pretend.md deleted file mode 100644 index 2feeebb11b22..000000000000 --- a/.changeset/fair-maps-pretend.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@eth-optimism/batch-submitter': patch -'@eth-optimism/data-transport-layer': patch ---- - -Remove dead imports from core-utils diff --git a/.changeset/fuzzy-dogs-share.md b/.changeset/fuzzy-dogs-share.md deleted file mode 100644 index 3b890e4e9e8d..000000000000 --- a/.changeset/fuzzy-dogs-share.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@eth-optimism/l2geth': patch -'@eth-optimism/core-utils': patch ---- - -Implement the next fee spec in both geth and in core-utils diff --git a/.changeset/great-shrimps-rule.md b/.changeset/great-shrimps-rule.md deleted file mode 100644 index 388ad60eeaa7..000000000000 --- a/.changeset/great-shrimps-rule.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/message-relayer': patch ---- - -Adds a README and cleans up the interface for generating messages and proofs diff --git a/.changeset/kind-houses-rush.md b/.changeset/kind-houses-rush.md deleted file mode 100644 index 1819a8f8c93e..000000000000 --- a/.changeset/kind-houses-rush.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/l2geth': patch ---- - -fix potential underflow when launching the chain when the last verified index is 0 diff --git a/.changeset/late-countries-guess.md b/.changeset/late-countries-guess.md deleted file mode 100644 index 2edddd99dad3..000000000000 --- a/.changeset/late-countries-guess.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/contracts': patch ---- - -Update contracts README to add deploy instructions. diff --git a/.changeset/nasty-dots-grow.md b/.changeset/nasty-dots-grow.md deleted file mode 100644 index 417ca35c1d1f..000000000000 --- a/.changeset/nasty-dots-grow.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@eth-optimism/l2geth': patch -'@eth-optimism/data-transport-layer': patch ---- - -Fix gasLimit overflow diff --git a/.changeset/neat-melons-lie.md b/.changeset/neat-melons-lie.md deleted file mode 100644 index 833a9b34d248..000000000000 --- a/.changeset/neat-melons-lie.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/smock': patch ---- - -Fix a bug where overloaded functions would not be handled correctly diff --git a/.changeset/nervous-bobcats-grow.md b/.changeset/nervous-bobcats-grow.md deleted file mode 100644 index fc963b069701..000000000000 --- a/.changeset/nervous-bobcats-grow.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@eth-optimism/l2geth": patch ---- - -Refactor the SyncService to more closely implement the specification. This includes using query params to select the backend from the DTL, trailing syncing of batches for the sequencer, syncing by batches as the verifier as well as unified code paths for transaction ingestion to prevent double ingestion or missed ingestion diff --git a/.changeset/quick-pandas-laugh.md b/.changeset/quick-pandas-laugh.md deleted file mode 100644 index 0faa252664d5..000000000000 --- a/.changeset/quick-pandas-laugh.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/data-transport-layer': patch ---- - -Fixes a bug that prevented verifiers from syncing properly with the DTL diff --git a/.changeset/seven-carpets-tell.md b/.changeset/seven-carpets-tell.md deleted file mode 100644 index 9be51c0a6974..000000000000 --- a/.changeset/seven-carpets-tell.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/contracts': patch ---- - -Introduces the congestion price oracle contract diff --git a/.changeset/sharp-files-knock.md b/.changeset/sharp-files-knock.md deleted file mode 100644 index c74d2c14e4c3..000000000000 --- a/.changeset/sharp-files-knock.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/message-relayer': patch ---- - -Adds a new set of tools for generating messages to be relayed and their proofs diff --git a/.changeset/silent-masks-hunt.md b/.changeset/silent-masks-hunt.md deleted file mode 100644 index 46f0382c5a79..000000000000 --- a/.changeset/silent-masks-hunt.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/core-utils': patch ---- - -Delete dead transaction coders. These are no longer used now that RLP encoded transactions are used diff --git a/.changeset/slimy-rivers-promise.md b/.changeset/slimy-rivers-promise.md deleted file mode 100644 index 38b393bac00e..000000000000 --- a/.changeset/slimy-rivers-promise.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/data-transport-layer': patch ---- - -Logs the error stacktrace for a failed HTTP request diff --git a/.changeset/smooth-ears-pay.md b/.changeset/smooth-ears-pay.md deleted file mode 100644 index 9df7b7cc9289..000000000000 --- a/.changeset/smooth-ears-pay.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@eth-optimism/integration-tests': patch -'@eth-optimism/l2geth': patch -'@eth-optimism/core-utils': patch ---- - -Implement the latest fee spec such that the L2 gas limit is scaled and the tx.gasPrice/tx.gasLimit show correctly in metamask diff --git a/.changeset/ten-spiders-boil.md b/.changeset/ten-spiders-boil.md deleted file mode 100644 index 757827799789..000000000000 --- a/.changeset/ten-spiders-boil.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/message-relayer': patch ---- - -Removes spreadsheet mode from the message relayer diff --git a/.changeset/thin-waves-bathe.md b/.changeset/thin-waves-bathe.md deleted file mode 100644 index 605e410ac5df..000000000000 --- a/.changeset/thin-waves-bathe.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/contracts': patch ---- - -Minor change to how deploy.ts is invoked diff --git a/.changeset/unlucky-shoes-bake.md b/.changeset/unlucky-shoes-bake.md deleted file mode 100644 index 7b24244798b9..000000000000 --- a/.changeset/unlucky-shoes-bake.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/integration-tests': patch ---- - -Add verifier sync test and extra docker-compose functions diff --git a/.changeset/wet-falcons-talk.md b/.changeset/wet-falcons-talk.md deleted file mode 100644 index 7698788db0e9..000000000000 --- a/.changeset/wet-falcons-talk.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/data-transport-layer': patch ---- - -improve slow blocking JSON parsing that occurs during l2 sync diff --git a/integration-tests/CHANGELOG.md b/integration-tests/CHANGELOG.md index 1d370a90264e..ea2181a934dd 100644 --- a/integration-tests/CHANGELOG.md +++ b/integration-tests/CHANGELOG.md @@ -1,5 +1,13 @@ # @eth-optimism/integration-tests +## 0.0.7 + +### Patch Changes + +- d1680052: Reduce test timeout from 100 to 20 seconds +- c2b6e14b: Implement the latest fee spec such that the L2 gas limit is scaled and the tx.gasPrice/tx.gasLimit show correctly in metamask +- 77108d37: Add verifier sync test and extra docker-compose functions + ## 0.0.6 ### Patch Changes diff --git a/integration-tests/package.json b/integration-tests/package.json index 03629b169883..ca67edcc4fcf 100644 --- a/integration-tests/package.json +++ b/integration-tests/package.json @@ -1,6 +1,6 @@ { "name": "@eth-optimism/integration-tests", - "version": "0.0.6", + "version": "0.0.7", "description": "[Optimism] Integration Tests", "private": true, "author": "Optimism PBC", @@ -17,8 +17,8 @@ "clean": "rimraf cache artifacts artifacts-ovm cache-ovm" }, "devDependencies": { - "@eth-optimism/contracts": "^0.3.4", - "@eth-optimism/core-utils": "^0.4.4", + "@eth-optimism/contracts": "^0.3.5", + "@eth-optimism/core-utils": "^0.4.5", "@eth-optimism/hardhat-ovm": "^0.2.2", "@ethersproject/providers": "^5.0.24", "@nomiclabs/hardhat-ethers": "^2.0.2", diff --git a/l2geth/CHANGELOG.md b/l2geth/CHANGELOG.md index f50227477351..d1962b54be8f 100644 --- a/l2geth/CHANGELOG.md +++ b/l2geth/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## 0.3.7 + +### Patch Changes + +- cb4a928b: Make block hashes deterministic by using the same clique signer key +- f1b27318: Fixes incorrect type parsing in the RollupClient. The gasLimit became greater than the largest safe JS number so it needs to be represented as a string +- a64f8161: Implement the next fee spec in both geth and in core-utils +- 5e4eaea1: fix potential underflow when launching the chain when the last verified index is 0 +- 1293825c: Fix gasLimit overflow +- a25acbbd: Refactor the SyncService to more closely implement the specification. This includes using query params to select the backend from the DTL, trailing syncing of batches for the sequencer, syncing by batches as the verifier as well as unified code paths for transaction ingestion to prevent double ingestion or missed ingestion +- c2b6e14b: Implement the latest fee spec such that the L2 gas limit is scaled and the tx.gasPrice/tx.gasLimit show correctly in metamask + ## 0.3.6 ### Patch Changes diff --git a/l2geth/package.json b/l2geth/package.json index 494c2e3fef89..cf0f0a6d2fff 100644 --- a/l2geth/package.json +++ b/l2geth/package.json @@ -1,6 +1,6 @@ { "name": "@eth-optimism/l2geth", - "version": "0.3.6", + "version": "0.3.7", "private": true, "devDependencies": {} } diff --git a/packages/batch-submitter/CHANGELOG.md b/packages/batch-submitter/CHANGELOG.md index be440911b141..02cac6b87960 100644 --- a/packages/batch-submitter/CHANGELOG.md +++ b/packages/batch-submitter/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 0.3.3 + +### Patch Changes + +- 750a5021: Remove dead imports from core-utils +- Updated dependencies [a64f8161] +- Updated dependencies [4e03f8a9] +- Updated dependencies [8e2bfd07] +- Updated dependencies [750a5021] +- Updated dependencies [c2b6e14b] +- Updated dependencies [245136f1] + - @eth-optimism/core-utils@0.4.5 + - @eth-optimism/contracts@0.3.5 + ## 0.3.2 ### Patch Changes diff --git a/packages/batch-submitter/package.json b/packages/batch-submitter/package.json index a2b2ed31d71c..a1cdaeeaa09d 100644 --- a/packages/batch-submitter/package.json +++ b/packages/batch-submitter/package.json @@ -1,6 +1,6 @@ { "name": "@eth-optimism/batch-submitter", - "version": "0.3.2", + "version": "0.3.3", "private": true, "description": "[Optimism] Batch submission for sequencer & aggregators", "main": "dist/index", @@ -32,8 +32,8 @@ }, "dependencies": { "@eth-optimism/common-ts": "^0.1.2", - "@eth-optimism/contracts": "^0.3.1", - "@eth-optimism/core-utils": "^0.4.3", + "@eth-optimism/contracts": "^0.3.5", + "@eth-optimism/core-utils": "^0.4.5", "@eth-optimism/ynatm": "^0.2.2", "@ethersproject/abstract-provider": "^5.0.5", "@ethersproject/providers": "^5.0.14", @@ -45,7 +45,7 @@ "prom-client": "^13.1.0" }, "devDependencies": { - "@eth-optimism/smock": "^1.1.4", + "@eth-optimism/smock": "^1.1.5", "@nomiclabs/hardhat-ethers": "^2.0.2", "@nomiclabs/hardhat-waffle": "^2.0.1", "@types/bluebird": "^3.5.34", diff --git a/packages/contracts/CHANGELOG.md b/packages/contracts/CHANGELOG.md index ae5579530c4f..857f869507d8 100644 --- a/packages/contracts/CHANGELOG.md +++ b/packages/contracts/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## 0.3.5 + +### Patch Changes + +- 4e03f8a9: Update contracts README to add deploy instructions. +- 8e2bfd07: Introduces the congestion price oracle contract +- 245136f1: Minor change to how deploy.ts is invoked +- Updated dependencies [a64f8161] +- Updated dependencies [750a5021] +- Updated dependencies [c2b6e14b] + - @eth-optimism/core-utils@0.4.5 + ## 0.3.4 ### Patch Changes diff --git a/packages/contracts/package.json b/packages/contracts/package.json index ec5771a978c3..eb4e94dddf50 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -1,6 +1,6 @@ { "name": "@eth-optimism/contracts", - "version": "0.3.4", + "version": "0.3.5", "main": "dist/index", "files": [ "dist/**/*.js", @@ -50,7 +50,7 @@ "generate-markdown": "node \"./scripts/generate-markdown.js\"" }, "dependencies": { - "@eth-optimism/core-utils": "^0.4.4", + "@eth-optimism/core-utils": "^0.4.5", "@ethersproject/abstract-provider": "^5.0.8", "@ethersproject/abstract-signer": "^5.1.0", "@ethersproject/contracts": "^5.0.5", @@ -59,7 +59,7 @@ "devDependencies": { "@codechecks/client": "0.1.10-beta", "@eth-optimism/hardhat-ovm": "^0.2.2", - "@eth-optimism/smock": "^1.1.3", + "@eth-optimism/smock": "^1.1.5", "@nomiclabs/hardhat-ethers": "^2.0.1", "@nomiclabs/hardhat-waffle": "^2.0.1", "@openzeppelin/contracts": "^3.3.0", diff --git a/packages/core-utils/CHANGELOG.md b/packages/core-utils/CHANGELOG.md index a5d6db922774..69d1bbdd6ec8 100644 --- a/packages/core-utils/CHANGELOG.md +++ b/packages/core-utils/CHANGELOG.md @@ -1,5 +1,13 @@ # @eth-optimism/core-utils +## 0.4.5 + +### Patch Changes + +- a64f8161: Implement the next fee spec in both geth and in core-utils +- 750a5021: Delete dead transaction coders. These are no longer used now that RLP encoded transactions are used +- c2b6e14b: Implement the latest fee spec such that the L2 gas limit is scaled and the tx.gasPrice/tx.gasLimit show correctly in metamask + ## 0.4.4 ### Patch Changes diff --git a/packages/core-utils/package.json b/packages/core-utils/package.json index dea8684a4ccd..74166fb352bd 100644 --- a/packages/core-utils/package.json +++ b/packages/core-utils/package.json @@ -1,6 +1,6 @@ { "name": "@eth-optimism/core-utils", - "version": "0.4.4", + "version": "0.4.5", "main": "dist/index", "files": [ "dist/*" diff --git a/packages/data-transport-layer/CHANGELOG.md b/packages/data-transport-layer/CHANGELOG.md index 61c4944d5ac0..3f498d8914fe 100644 --- a/packages/data-transport-layer/CHANGELOG.md +++ b/packages/data-transport-layer/CHANGELOG.md @@ -1,5 +1,24 @@ # data transport layer +## 0.3.4 + +### Patch Changes + +- f1b27318: Represent gaslimit as a string to avoid an overflow +- 750a5021: Remove dead imports from core-utils +- 1293825c: Fix gasLimit overflow +- a75f05b7: Fixes a bug that prevented verifiers from syncing properly with the DTL +- e52ccd98: Logs the error stacktrace for a failed HTTP request +- 8ac4c74c: improve slow blocking JSON parsing that occurs during l2 sync +- Updated dependencies [a64f8161] +- Updated dependencies [4e03f8a9] +- Updated dependencies [8e2bfd07] +- Updated dependencies [750a5021] +- Updated dependencies [c2b6e14b] +- Updated dependencies [245136f1] + - @eth-optimism/core-utils@0.4.5 + - @eth-optimism/contracts@0.3.5 + ## 0.3.3 ### Patch Changes diff --git a/packages/data-transport-layer/package.json b/packages/data-transport-layer/package.json index ac98ed5bdad3..1dab5b320334 100644 --- a/packages/data-transport-layer/package.json +++ b/packages/data-transport-layer/package.json @@ -1,6 +1,6 @@ { "name": "@eth-optimism/data-transport-layer", - "version": "0.3.3", + "version": "0.3.4", "private": true, "main": "dist/index", "files": [ @@ -22,8 +22,8 @@ }, "dependencies": { "@eth-optimism/common-ts": "^0.1.2", - "@eth-optimism/contracts": "^0.3.3", - "@eth-optimism/core-utils": "^0.4.3", + "@eth-optimism/contracts": "^0.3.5", + "@eth-optimism/core-utils": "^0.4.5", "@ethersproject/providers": "^5.0.21", "@ethersproject/transactions": "^5.0.21", "@sentry/node": "^6.3.1", diff --git a/packages/message-relayer/CHANGELOG.md b/packages/message-relayer/CHANGELOG.md index 01e27330bcfe..587238e85699 100644 --- a/packages/message-relayer/CHANGELOG.md +++ b/packages/message-relayer/CHANGELOG.md @@ -1,5 +1,21 @@ # @eth-optimism/message-relayer +## 0.1.4 + +### Patch Changes + +- 9d39121b: Adds a README and cleans up the interface for generating messages and proofs +- 86708bb5: Adds a new set of tools for generating messages to be relayed and their proofs +- 064c03af: Removes spreadsheet mode from the message relayer +- Updated dependencies [a64f8161] +- Updated dependencies [4e03f8a9] +- Updated dependencies [8e2bfd07] +- Updated dependencies [750a5021] +- Updated dependencies [c2b6e14b] +- Updated dependencies [245136f1] + - @eth-optimism/core-utils@0.4.5 + - @eth-optimism/contracts@0.3.5 + ## 0.1.3 ### Patch Changes diff --git a/packages/message-relayer/package.json b/packages/message-relayer/package.json index 7cd1a0444edf..dbbfb14fd30b 100644 --- a/packages/message-relayer/package.json +++ b/packages/message-relayer/package.json @@ -1,6 +1,6 @@ { "name": "@eth-optimism/message-relayer", - "version": "0.1.3", + "version": "0.1.4", "description": "[Optimism] Cross Domain Message Relayer service", "main": "dist/index", "types": "dist/index", @@ -30,8 +30,8 @@ }, "dependencies": { "@eth-optimism/common-ts": "^0.1.2", - "@eth-optimism/contracts": "^0.3.3", - "@eth-optimism/core-utils": "^0.4.3", + "@eth-optimism/contracts": "^0.3.5", + "@eth-optimism/core-utils": "^0.4.5", "bcfg": "^0.1.6", "dotenv": "^8.2.0", "ethers": "^5.1.0", @@ -39,7 +39,7 @@ "rlp": "^2.2.6" }, "devDependencies": { - "@eth-optimism/smock": "^1.1.4", + "@eth-optimism/smock": "^1.1.5", "@nomiclabs/hardhat-ethers": "^2.0.2", "@nomiclabs/hardhat-waffle": "^2.0.1", "@types/chai": "^4.2.18", diff --git a/packages/smock/CHANGELOG.md b/packages/smock/CHANGELOG.md index 9d108ba56d19..1140eb913484 100644 --- a/packages/smock/CHANGELOG.md +++ b/packages/smock/CHANGELOG.md @@ -1,5 +1,16 @@ # @eth-optimism/smock +## 1.1.5 + +### Patch Changes + +- 5e3c5d1c: Fixes a bug that would break call assertions for overloaded smocked functions +- e6e87ae1: Fix a bug where overloaded functions would not be handled correctly +- Updated dependencies [a64f8161] +- Updated dependencies [750a5021] +- Updated dependencies [c2b6e14b] + - @eth-optimism/core-utils@0.4.5 + ## 1.1.4 ### Patch Changes diff --git a/packages/smock/package.json b/packages/smock/package.json index b21d1551f8ed..4a41c1d58444 100644 --- a/packages/smock/package.json +++ b/packages/smock/package.json @@ -3,7 +3,7 @@ "files": [ "dist/src/*" ], - "version": "1.1.4", + "version": "1.1.5", "main": "dist/src/index", "types": "dist/src/index", "author": "Optimism PBC", @@ -26,7 +26,7 @@ "hardhat": "^2.2.1" }, "dependencies": { - "@eth-optimism/core-utils": "^0.4.1", + "@eth-optimism/core-utils": "^0.4.5", "bn.js": "^5.2.0" }, "devDependencies": { From 958477be4f8e778864ddc383c1c62a898b55672a Mon Sep 17 00:00:00 2001 From: Annie Ke Date: Tue, 8 Jun 2021 09:17:56 -0700 Subject: [PATCH 051/125] ci: add sync test's own workflow (#1031) --- .github/workflows/sync-tests.yml | 44 ++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/sync-tests.yml diff --git a/.github/workflows/sync-tests.yml b/.github/workflows/sync-tests.yml new file mode 100644 index 000000000000..b70e12a9bdab --- /dev/null +++ b/.github/workflows/sync-tests.yml @@ -0,0 +1,44 @@ +name: sync-tests + +on: + push: + branches: + - 'master' + - 'develop' + - 'regenesis/*' + pull_request: + workflow_dispatch: + +jobs: + integration-sync-test: + runs-on: ubuntu-latest + env: + DOCKER_BUILDKIT: 1 + COMPOSE_DOCKER_CLI_BUILD: 1 + steps: + - uses: actions/checkout@v2 + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + + - uses: actions/cache@v2 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + - name: Build the services + working-directory: ./ops + run: ./scripts/build-ci.sh + + - name: Bring the stack up + working-directory: ./ops + run: docker-compose up -d && ./scripts/wait-for-sequencer.sh + + - name: Run the sync tests + working-directory: ./integration-tests + run: | + yarn + yarn test:sync From 1b692415464a44d18a85255c7c7e43dc0a1619b6 Mon Sep 17 00:00:00 2001 From: Tim Myers Date: Tue, 8 Jun 2021 14:09:21 -0600 Subject: [PATCH 052/125] fix(dtl): incorrect parsing of eth_getBlockRange result (#1037) --- .changeset/spotty-drinks-bathe.md | 5 +++++ .../src/services/l2-ingestion/service.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/spotty-drinks-bathe.md diff --git a/.changeset/spotty-drinks-bathe.md b/.changeset/spotty-drinks-bathe.md new file mode 100644 index 000000000000..9eb5d6357d5d --- /dev/null +++ b/.changeset/spotty-drinks-bathe.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/data-transport-layer': patch +--- + +incorrect parsing of eth_getBlockRange result diff --git a/packages/data-transport-layer/src/services/l2-ingestion/service.ts b/packages/data-transport-layer/src/services/l2-ingestion/service.ts index fb6434f433c3..a9f59f7cb261 100644 --- a/packages/data-transport-layer/src/services/l2-ingestion/service.ts +++ b/packages/data-transport-layer/src/services/l2-ingestion/service.ts @@ -194,7 +194,7 @@ export class L2IngestionService extends BaseService { const respJson = await bfj.parse(resp.data, { yieldRate: 4096, // this yields abit more often than the default of 16384 }) - blocks = respJson.data + blocks = respJson.result } for (const block of blocks) { From 0c18e1903f8a33a607f782c0081a8fb5071b71ef Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 8 Jun 2021 18:57:34 -0400 Subject: [PATCH 053/125] Version Packages (#1045) Co-authored-by: github-actions[bot] --- .changeset/spotty-drinks-bathe.md | 5 ----- packages/data-transport-layer/CHANGELOG.md | 6 ++++++ packages/data-transport-layer/package.json | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) delete mode 100644 .changeset/spotty-drinks-bathe.md diff --git a/.changeset/spotty-drinks-bathe.md b/.changeset/spotty-drinks-bathe.md deleted file mode 100644 index 9eb5d6357d5d..000000000000 --- a/.changeset/spotty-drinks-bathe.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/data-transport-layer': patch ---- - -incorrect parsing of eth_getBlockRange result diff --git a/packages/data-transport-layer/CHANGELOG.md b/packages/data-transport-layer/CHANGELOG.md index 3f498d8914fe..9b2978947a34 100644 --- a/packages/data-transport-layer/CHANGELOG.md +++ b/packages/data-transport-layer/CHANGELOG.md @@ -1,5 +1,11 @@ # data transport layer +## 0.3.5 + +### Patch Changes + +- 1b692415: incorrect parsing of eth_getBlockRange result + ## 0.3.4 ### Patch Changes diff --git a/packages/data-transport-layer/package.json b/packages/data-transport-layer/package.json index 1dab5b320334..47e0a8158f2e 100644 --- a/packages/data-transport-layer/package.json +++ b/packages/data-transport-layer/package.json @@ -1,6 +1,6 @@ { "name": "@eth-optimism/data-transport-layer", - "version": "0.3.4", + "version": "0.3.5", "private": true, "main": "dist/index", "files": [ From 0a7f5a46c912f7803fd5fe434a9bd781be277eb4 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Tue, 8 Jun 2021 17:59:38 -0700 Subject: [PATCH 054/125] fix: no gas refund (#1043) * l2geth: remove the gas refund * chore: add changeset --- .changeset/sharp-dragons-check.md | 5 +++++ l2geth/core/state_transition.go | 3 +++ 2 files changed, 8 insertions(+) create mode 100644 .changeset/sharp-dragons-check.md diff --git a/.changeset/sharp-dragons-check.md b/.changeset/sharp-dragons-check.md new file mode 100644 index 000000000000..6e23143b208e --- /dev/null +++ b/.changeset/sharp-dragons-check.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/l2geth': patch +--- + +Removes the gas refund for unused gas in geth since it is instead managed in the smart contracts diff --git a/l2geth/core/state_transition.go b/l2geth/core/state_transition.go index d66e5769934e..4c45eb153dae 100644 --- a/l2geth/core/state_transition.go +++ b/l2geth/core/state_transition.go @@ -280,6 +280,9 @@ func (st *StateTransition) TransitionDb() (ret []byte, usedGas uint64, failed bo } func (st *StateTransition) refundGas() { + if vm.UsingOVM { + return + } // Apply refund counter, capped to half of the used gas. refund := st.gasUsed() / 2 if refund > st.state.GetRefund() { From 014dea715864f66a331c1224d5efdb066b10b671 Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Tue, 8 Jun 2021 21:07:12 -0400 Subject: [PATCH 055/125] refactor[contracts]: remove one-off GasPriceOracle deployment file (#1046) * refactor[contracts]: remove one-off gpo deployment * chore: add changeset --- .changeset/real-pumpkins-shop.md | 5 +++ .../000-OVM_GasPriceOracle.deploy.ts | 31 ------------------- packages/contracts/tasks/deploy.ts | 6 ---- 3 files changed, 5 insertions(+), 37 deletions(-) create mode 100644 .changeset/real-pumpkins-shop.md delete mode 100644 packages/contracts/deploy-l2/000-OVM_GasPriceOracle.deploy.ts diff --git a/.changeset/real-pumpkins-shop.md b/.changeset/real-pumpkins-shop.md new file mode 100644 index 000000000000..07e9a21f96a0 --- /dev/null +++ b/.changeset/real-pumpkins-shop.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/contracts': patch +--- + +Removes one-off GasPriceOracle deployment file diff --git a/packages/contracts/deploy-l2/000-OVM_GasPriceOracle.deploy.ts b/packages/contracts/deploy-l2/000-OVM_GasPriceOracle.deploy.ts deleted file mode 100644 index 96eb8fd1b175..000000000000 --- a/packages/contracts/deploy-l2/000-OVM_GasPriceOracle.deploy.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* Imports: External */ -import { DeployFunction } from 'hardhat-deploy/dist/types' - -/* Imports: Internal */ -import { getContractDefinition } from '../src' - -const deployFn: DeployFunction = async (hre: any) => { - const { deployments, getNamedAccounts } = hre - const { deploy } = deployments - const { deployer } = await getNamedAccounts() - - const gasPriceOracle = getContractDefinition('OVM_GasPriceOracle', true) - - const gasOracleOwner = (hre as any).deployConfig.ovmSequencerAddress - const initialGasPrice = (hre as any).deployConfig.initialGasPriceOracleGasPrice - - if (!gasOracleOwner || !initialGasPrice) { - throw new Error('initialGasPrice & ovmSequencerAddress required to deploy gas price oracle') - } - - await deploy('OVM_GasPriceOracle', { - contract: gasPriceOracle, - from: deployer, - args: [gasOracleOwner, initialGasPrice], - log: true, - }); -} - -deployFn.tags = ['OVM_GasPriceOracle'] - -export default deployFn diff --git a/packages/contracts/tasks/deploy.ts b/packages/contracts/tasks/deploy.ts index 832b5c84626c..cfe3ad3e80bc 100644 --- a/packages/contracts/tasks/deploy.ts +++ b/packages/contracts/tasks/deploy.ts @@ -99,12 +99,6 @@ task('deploy') undefined, types.string ) - .addOptionalParam( - 'initialGasPriceOracleGasPrice', - 'The initial execution price for the gas price oracle.', - undefined, - types.int - ) .setAction(async (args, hre: any, runSuper) => { // Necessary because hardhat doesn't let us attach non-optional parameters to existing tasks. const validateAddressArg = (argName: string) => { From baacda34964506490adf6bddf07036cf7daa08c0 Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Wed, 9 Jun 2021 12:04:08 -0400 Subject: [PATCH 056/125] feat[contracts]: introduce new L1ChugSplashProxy contract (#1009) * feat[contracts]: add L1ChugSplashProxy * improve comments slightly * start adding tests * add more tests * make the system pausable * added another test * add some extra comments * Update packages/contracts/test/contracts/chugsplash/L1ChugSplashProxy.spec.ts Co-authored-by: Maurelian * Update packages/contracts/test/contracts/chugsplash/L1ChugSplashProxy.spec.ts Co-authored-by: Maurelian * chore: add changeset * address review feedback Co-authored-by: Maurelian --- .changeset/witty-horses-nail.md | 5 + .../chugsplash/L1ChugSplashProxy.sol | 357 ++++++++++++++++++ .../interfaces/iL1ChugSplashDeployer.sol | 14 + .../chugsplash/L1ChugSplashProxy.spec.ts | 190 ++++++++++ 4 files changed, 566 insertions(+) create mode 100644 .changeset/witty-horses-nail.md create mode 100644 packages/contracts/contracts/chugsplash/L1ChugSplashProxy.sol create mode 100644 packages/contracts/contracts/chugsplash/interfaces/iL1ChugSplashDeployer.sol create mode 100644 packages/contracts/test/contracts/chugsplash/L1ChugSplashProxy.spec.ts diff --git a/.changeset/witty-horses-nail.md b/.changeset/witty-horses-nail.md new file mode 100644 index 000000000000..daed003f40a6 --- /dev/null +++ b/.changeset/witty-horses-nail.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/contracts': patch +--- + +Introduce the L1ChugSplashProxy contract diff --git a/packages/contracts/contracts/chugsplash/L1ChugSplashProxy.sol b/packages/contracts/contracts/chugsplash/L1ChugSplashProxy.sol new file mode 100644 index 000000000000..61cb6a186523 --- /dev/null +++ b/packages/contracts/contracts/chugsplash/L1ChugSplashProxy.sol @@ -0,0 +1,357 @@ +// SPDX-License-Identifier: MIT +pragma solidity >0.5.0 <0.8.0; + +import { iL1ChugSplashDeployer } from "./interfaces/iL1ChugSplashDeployer.sol"; + +/** + * @title L1ChugSplashProxy + * @dev Basic ChugSplash proxy contract for L1. Very close to being a normal proxy but has added + * functions `setCode` and `setStorage` for changing the code or storage of the contract. Nifty! + * + * Note for future developers: do NOT make anything in this contract 'public' unless you know what + * you're doing. Anything public can potentially have a function signature that conflicts with a + * signature attached to the implementation contract. Public functions SHOULD always have the + * 'proxyCallIfNotOwner' modifier unless there's some *really* good reason not to have that + * modifier. And there almost certainly is not a good reason to not have that modifier. Beware! + */ +contract L1ChugSplashProxy { + + /************* + * Constants * + *************/ + + // "Magic" prefix. When prepended to some arbitrary bytecode and used to create a contract, the + // appended bytecode will be deployed as given. + bytes13 constant internal DEPLOY_CODE_PREFIX = 0x600D380380600D6000396000f3; + + // bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1) + bytes32 constant internal IMPLEMENTATION_KEY = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; + + // bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1) + bytes32 constant internal OWNER_KEY = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; + + + /*************** + * Constructor * + ***************/ + + /** + * @param _owner Address of the initial contract owner. + */ + constructor( + address _owner + ) { + _setOwner(_owner); + } + + + /********************** + * Function Modifiers * + **********************/ + + /** + * Blocks a function from being called when the parent signals that the system should be paused + * via an isUpgrading function. + */ + modifier onlyWhenNotPaused() { + address owner = _getOwner(); + + // We do a low-level call because there's no guarantee that the owner actually *is* an + // L1ChugSplashDeployer contract and Solidity will throw errors if we do a normal call and + // it turns out that it isn't the right type of contract. + (bool success, bytes memory returndata) = owner.staticcall( + abi.encodeWithSelector( + iL1ChugSplashDeployer.isUpgrading.selector + ) + ); + + // If the call was unsuccessful then we assume that there's no "isUpgrading" method and we + // can just continue as normal. We also expect that the return value is exactly 32 bytes + // long. If this isn't the case then we can safely ignore the result. + if (success && returndata.length == 32) { + // Although the expected value is a *boolean*, it's safer to decode as a uint256 in the + // case that the isUpgrading function returned something other than 0 or 1. But we only + // really care about the case where this value is 0 (= false). + uint256 ret = abi.decode(returndata, (uint256)); + require( + ret == 0, + "L1ChugSplashProxy: system is currently being upgraded" + ); + } + + _; + } + + /** + * Makes a proxy call instead of triggering the given function when the caller is either the + * owner or the zero address. Caller can only ever be the zero address if this function is + * being called off-chain via eth_call, which is totally fine and can be convenient for + * client-side tooling. Avoids situations where the proxy and implementation share a sighash + * and the proxy function ends up being called instead of the implementation one. + * + * Note: msg.sender == address(0) can ONLY be triggered off-chain via eth_call. If there's a + * way for someone to send a transaction with msg.sender == address(0) in any real context then + * we have much bigger problems. Primary reason to include this additional allowed sender is + * because the owner address can be changed dynamically and we do not want clients to have to + * keep track of the current owner in order to make an eth_call that doesn't trigger the + * proxied contract. + */ + modifier proxyCallIfNotOwner() { + if (msg.sender == _getOwner() || msg.sender == address(0)) { + _; + } else { + // This WILL halt the call frame on completion. + _doProxyCall(); + } + } + + + /********************* + * Fallback Function * + *********************/ + + fallback() + external + payable + { + // Proxy call by default. + _doProxyCall(); + } + + + /******************** + * Public Functions * + ********************/ + + /** + * Sets the code that should be running behind this proxy. Note that this scheme is a bit + * different from the standard proxy scheme where one would typically deploy the code + * separately and then set the implementation address. We're doing it this way because it gives + * us a lot more freedom on the client side. Can only be triggered by the contract owner. + * @param _code New contract code to run inside this contract. + */ + function setCode( + bytes memory _code + ) + proxyCallIfNotOwner + public + { + // Get the code hash of the current implementation. + address implementation = _getImplementation(); + + // If the code hash matches the new implementation then we return early. + if (keccak256(_code) == _getAccountCodeHash(implementation)) { + return; + } + + // Create the deploycode by appending the magic prefix. + bytes memory deploycode = abi.encodePacked( + DEPLOY_CODE_PREFIX, + _code + ); + + // Deploy the code and set the new implementation address. + address newImplementation; + assembly { + newImplementation := create(0x0, add(deploycode, 0x20), mload(deploycode)) + } + + // Check that the code was actually deployed correctly. I'm not sure if you can ever + // actually fail this check. Should only happen if the contract creation from above runs + // out of gas but this parent execution thread does NOT run out of gas. Seems like we + // should be doing this check anyway though. + require( + _getAccountCodeHash(newImplementation) == keccak256(_code), + "L1ChugSplashProxy: code was not correctly deployed." + ); + + _setImplementation(newImplementation); + } + + /** + * Modifies some storage slot within the proxy contract. Gives us a lot of power to perform + * upgrades in a more transparent way. Only callable by the owner. + * @param _key Storage key to modify. + * @param _value New value for the storage key. + */ + function setStorage( + bytes32 _key, + bytes32 _value + ) + proxyCallIfNotOwner + public + { + assembly { + sstore(_key, _value) + } + } + + /** + * Changes the owner of the proxy contract. Only callable by the owner. + * @param _owner New owner of the proxy contract. + */ + function setOwner( + address _owner + ) + proxyCallIfNotOwner + public + { + _setOwner(_owner); + } + + /** + * Queries the owner of the proxy contract. Can only be called by the owner OR by making an + * eth_call and setting the "from" address to address(0). + * @return Owner address. + */ + function getOwner() + proxyCallIfNotOwner + public + returns ( + address + ) + { + return _getOwner(); + } + + /** + * Queries the implementation address. Can only be called by the owner OR by making an + * eth_call and setting the "from" address to address(0). + * @return Implementation address. + */ + function getImplementation() + proxyCallIfNotOwner + public + returns ( + address + ) + { + return _getImplementation(); + } + + + /********************** + * Internal Functions * + **********************/ + + /** + * Sets the implementation address. + * @param _implementation New implementation address. + */ + function _setImplementation( + address _implementation + ) + internal + { + assembly { + sstore(IMPLEMENTATION_KEY, _implementation) + } + } + + /** + * Queries the implementation address. + * @return Implementation address. + */ + function _getImplementation() + internal + view + returns ( + address + ) + { + address implementation; + assembly { + implementation := sload(IMPLEMENTATION_KEY) + } + return implementation; + } + + /** + * Changes the owner of the proxy contract. + * @param _owner New owner of the proxy contract. + */ + function _setOwner( + address _owner + ) + internal + { + assembly { + sstore(OWNER_KEY, _owner) + } + } + + /** + * Queries the owner of the proxy contract. + * @return Owner address. + */ + function _getOwner() + internal + view + returns ( + address + ) + { + address owner; + assembly { + owner := sload(OWNER_KEY) + } + return owner; + } + + /** + * Gets the code hash for a given account. + * @param _account Address of the account to get a code hash for. + * @return Code hash for the account. + */ + function _getAccountCodeHash( + address _account + ) + internal + view + returns ( + bytes32 + ) + { + bytes32 codeHash; + assembly { + codeHash := extcodehash(_account) + } + return codeHash; + } + + /** + * Performs the proxy call via a delegatecall. + */ + function _doProxyCall() + onlyWhenNotPaused + internal + { + address implementation = _getImplementation(); + + require( + implementation != address(0), + "L1ChugSplashProxy: implementation is not set yet" + ); + + assembly { + // Copy calldata into memory at 0x0....calldatasize. + calldatacopy(0x0, 0x0, calldatasize()) + + // Perform the delegatecall, make sure to pass all available gas. + let success := delegatecall(gas(), implementation, 0x0, calldatasize(), 0x0, 0x0) + + // Copy returndata into memory at 0x0....returndatasize. Note that this *will* + // overwrite the calldata that we just copied into memory but that doesn't really + // matter because we'll be returning in a second anyway. + returndatacopy(0x0, 0x0, returndatasize()) + + // Success == 0 means a revert. We'll revert too and pass the data up. + if iszero(success) { + revert(0x0, returndatasize()) + } + + // Otherwise we'll just return and pass the data up. + return(0x0, returndatasize()) + } + } +} diff --git a/packages/contracts/contracts/chugsplash/interfaces/iL1ChugSplashDeployer.sol b/packages/contracts/contracts/chugsplash/interfaces/iL1ChugSplashDeployer.sol new file mode 100644 index 000000000000..4117b7701f9a --- /dev/null +++ b/packages/contracts/contracts/chugsplash/interfaces/iL1ChugSplashDeployer.sol @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MIT +pragma solidity >0.5.0 <0.8.0; + +/** + * @title iL1ChugSplashDeployer + */ +interface iL1ChugSplashDeployer { + function isUpgrading() + external + view + returns ( + bool + ); +} diff --git a/packages/contracts/test/contracts/chugsplash/L1ChugSplashProxy.spec.ts b/packages/contracts/test/contracts/chugsplash/L1ChugSplashProxy.spec.ts new file mode 100644 index 000000000000..f581fcdd1a57 --- /dev/null +++ b/packages/contracts/test/contracts/chugsplash/L1ChugSplashProxy.spec.ts @@ -0,0 +1,190 @@ +import { expect } from '../../setup' + +/* Imports: External */ +import hre from 'hardhat' +import { Contract, Signer } from 'ethers' +import { smockit } from '@eth-optimism/smock' + +/* Imports: Internal */ +import { getContractInterface } from '../../../src' + +describe('L1ChugSplashProxy', () => { + let signer1: Signer + let signer2: Signer + before(async () => { + ;[signer1, signer2] = await hre.ethers.getSigners() + }) + + let L1ChugSplashProxy: Contract + beforeEach(async () => { + const Factory__L1ChugSplashProxy = await hre.ethers.getContractFactory( + 'L1ChugSplashProxy' + ) + L1ChugSplashProxy = await Factory__L1ChugSplashProxy.deploy( + await signer1.getAddress() + ) + }) + + describe('getOwner', () => { + it('should return the owner if called by the owner', async () => { + expect( + await L1ChugSplashProxy.connect(signer1).callStatic.getOwner() + ).to.equal(await signer1.getAddress()) + }) + + it('should return the owner if called by the zero address in an eth_call', async () => { + expect( + await L1ChugSplashProxy.connect(signer1.provider).callStatic.getOwner({ + from: hre.ethers.constants.AddressZero, + }) + ).to.equal(await signer1.getAddress()) + }) + + it('should otherwise pass through to the proxied contract', async () => { + await expect( + L1ChugSplashProxy.connect(signer2).callStatic.getOwner() + ).to.be.revertedWith('L1ChugSplashProxy: implementation is not set yet') + }) + }) + + describe('setOwner', () => { + it('should succeed if called by the owner', async () => { + await expect( + L1ChugSplashProxy.connect(signer1).setOwner(await signer2.getAddress()) + ).to.not.be.reverted + + expect( + await L1ChugSplashProxy.connect(signer2).callStatic.getOwner() + ).to.equal(await signer2.getAddress()) + }) + + it('should otherwise pass through to the proxied contract', async () => { + await expect( + L1ChugSplashProxy.connect(signer2).setOwner(await signer1.getAddress()) + ).to.be.revertedWith('L1ChugSplashProxy: implementation is not set yet') + }) + }) + + describe('getImplementation', () => { + it('should succeed if called by the owner', async () => { + expect( + await L1ChugSplashProxy.connect(signer1).callStatic.getImplementation() + ).to.equal(hre.ethers.constants.AddressZero) + }) + + it('should succeed if called by the zero address in an eth_call', async () => { + expect( + await L1ChugSplashProxy.connect( + hre.ethers.provider + ).callStatic.getImplementation({ + from: hre.ethers.constants.AddressZero, + }) + ).to.equal(hre.ethers.constants.AddressZero) + }) + + it('should otherwise pass through to the proxied contract', async () => { + await expect( + L1ChugSplashProxy.connect(signer2).getImplementation() + ).to.be.revertedWith('L1ChugSplashProxy: implementation is not set yet') + }) + }) + + describe('setStorage', () => { + it('should succeed if called by the owner', async () => { + const storageKey = hre.ethers.utils.keccak256('0x1234') + const storageValue = hre.ethers.utils.keccak256('0x5678') + + await expect( + L1ChugSplashProxy.connect(signer1).setStorage(storageKey, storageValue) + ).to.not.be.reverted + + expect( + await hre.ethers.provider.getStorageAt( + L1ChugSplashProxy.address, + storageKey + ) + ).to.equal(storageValue) + }) + + it('should otherwise pass through to the proxied contract', async () => { + const storageKey = hre.ethers.utils.keccak256('0x1234') + const storageValue = hre.ethers.utils.keccak256('0x5678') + + await expect( + L1ChugSplashProxy.connect(signer2).setStorage(storageKey, storageValue) + ).to.be.revertedWith('L1ChugSplashProxy: implementation is not set yet') + }) + }) + + describe('setCode', () => { + it('should succeed if called by the owner', async () => { + const code = '0x1234' + + await expect(L1ChugSplashProxy.connect(signer1).setCode(code)).to.not.be + .reverted + + const implementation = await L1ChugSplashProxy.connect( + signer1 + ).callStatic.getImplementation() + + expect(await hre.ethers.provider.getCode(implementation)).to.equal(code) + }) + + it('should not change the implementation address if the code does not change', async () => { + const code = '0x1234' + + await L1ChugSplashProxy.connect(signer1).setCode(code) + + const implementation = await L1ChugSplashProxy.connect( + signer1 + ).callStatic.getImplementation() + + await L1ChugSplashProxy.connect(signer1).setCode(code) + + expect( + await L1ChugSplashProxy.connect(signer1).callStatic.getImplementation() + ).to.equal(implementation) + }) + }) + + describe('fallback', () => { + it('should revert if implementation is not set', async () => { + await expect( + signer1.sendTransaction({ + to: L1ChugSplashProxy.address, + data: '0x', + }) + ).to.be.revertedWith('L1ChugSplashProxy: implementation is not set yet') + }) + + it('should execute the proxied contract when the implementation is set', async () => { + const code = '0x00' // STOP + + await L1ChugSplashProxy.connect(signer1).setCode(code) + + await expect( + signer1.sendTransaction({ + to: L1ChugSplashProxy.address, + data: '0x', + }) + ).to.not.be.reverted + }) + + it('should throw an error if the owner has signalled an upgrade', async () => { + const owner = await smockit(getContractInterface('iL1ChugSplashDeployer')) + const factory = await hre.ethers.getContractFactory('L1ChugSplashProxy') + const proxy = await factory.deploy(owner.address) + + owner.smocked.isUpgrading.will.return.with(true) + + await expect( + owner.wallet.sendTransaction({ + to: proxy.address, + data: '0x', + }) + ).to.be.revertedWith( + 'L1ChugSplashProxy: system is currently being upgraded' + ) + }) + }) +}) From e045f58279eb9b413f1422d71af5305fdc7c95fb Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Wed, 9 Jun 2021 12:04:48 -0400 Subject: [PATCH 057/125] feat[contracts]: add sequencer fee wallet (#1029) * wip: first draft of the fee wallet * add fee wallet to dump * rename to sequencer vault * add L1 fee wallet to geth config * add unit tests * fix geth linting error * add a basic integration test * fix broken integration test * add test for correct storage slot * add integration test for fee withdrawal * fix typo in integration tests * fix a bug bin integration tests * Update OVM_SequencerFeeVault.sol * fix bug in contract tests * chore: add changeset * fix bug in contract tests --- .changeset/shy-brooms-divide.md | 7 ++ integration-tests/test/fee-payment.spec.ts | 71 ++++++++++++++-- integration-tests/test/shared/env.ts | 2 +- l2geth/README.md | 1 + l2geth/cmd/geth/main.go | 1 + l2geth/cmd/geth/usage.go | 1 + l2geth/cmd/utils/flags.go | 13 ++- l2geth/console/console_test.go | 2 +- l2geth/core/genesis.go | 15 +++- l2geth/rollup/config.go | 1 + l2geth/scripts/start.sh | 11 +++ .../OVM/accounts/OVM_ECDSAContractAccount.sol | 8 +- .../OVM/predeploys/OVM_SequencerFeeVault.sol | 73 +++++++++++++++++ .../constants/Lib_PredeployAddresses.sol | 1 + .../src/contract-deployment/config.ts | 4 + packages/contracts/src/predeploys.ts | 1 + .../contracts/src/state-dump/make-dump.ts | 2 + .../precompiles/OVM_SequencerFeeVault.spec.ts | 80 +++++++++++++++++++ 18 files changed, 279 insertions(+), 15 deletions(-) create mode 100644 .changeset/shy-brooms-divide.md create mode 100644 packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerFeeVault.sol create mode 100644 packages/contracts/test/contracts/OVM/precompiles/OVM_SequencerFeeVault.spec.ts diff --git a/.changeset/shy-brooms-divide.md b/.changeset/shy-brooms-divide.md new file mode 100644 index 000000000000..75837f9b5a4b --- /dev/null +++ b/.changeset/shy-brooms-divide.md @@ -0,0 +1,7 @@ +--- +'@eth-optimism/integration-tests': patch +'@eth-optimism/l2geth': patch +'@eth-optimism/contracts': patch +--- + +Adds new SequencerFeeVault contract to store generated fees diff --git a/integration-tests/test/fee-payment.spec.ts b/integration-tests/test/fee-payment.spec.ts index f7de4d3611a2..0e0c878fcc70 100644 --- a/integration-tests/test/fee-payment.spec.ts +++ b/integration-tests/test/fee-payment.spec.ts @@ -1,18 +1,33 @@ import chai, { expect } from 'chai' import chaiAsPromised from 'chai-as-promised' chai.use(chaiAsPromised) -import { BigNumber, utils } from 'ethers' -import { OptimismEnv } from './shared/env' + +/* Imports: External */ +import { BigNumber, Contract, utils } from 'ethers' import { TxGasLimit, TxGasPrice } from '@eth-optimism/core-utils' +import { predeploys, getContractInterface } from '@eth-optimism/contracts' + +/* Imports: Internal */ +import { OptimismEnv } from './shared/env' +import { Direction } from './shared/watcher-utils' describe('Fee Payment Integration Tests', async () => { - let env: OptimismEnv const other = '0x1234123412341234123412341234123412341234' + let env: OptimismEnv before(async () => { env = await OptimismEnv.new() }) + let ovmSequencerFeeVault: Contract + before(async () => { + ovmSequencerFeeVault = new Contract( + predeploys.OVM_SequencerFeeVault, + getContractInterface('OVM_SequencerFeeVault'), + env.l2Wallet + ) + }) + it(`Should return a gasPrice of ${TxGasPrice.toString()} wei`, async () => { const gasPrice = await env.l2Wallet.getGasPrice() expect(gasPrice).to.deep.eq(TxGasPrice) @@ -36,6 +51,9 @@ describe('Fee Payment Integration Tests', async () => { it('Paying a nonzero but acceptable gasPrice fee', async () => { const amount = utils.parseEther('0.5') const balanceBefore = await env.l2Wallet.getBalance() + const feeVaultBalanceBefore = await env.l2Wallet.provider.getBalance( + ovmSequencerFeeVault.address + ) expect(balanceBefore.gt(amount)) const tx = await env.ovmEth.transfer(other, amount) @@ -43,10 +61,53 @@ describe('Fee Payment Integration Tests', async () => { expect(receipt.status).to.eq(1) const balanceAfter = await env.l2Wallet.getBalance() + const feeVaultBalanceAfter = await env.l2Wallet.provider.getBalance( + ovmSequencerFeeVault.address + ) + const expectedFeePaid = tx.gasPrice.mul(tx.gasLimit) + // The fee paid MUST be the receipt.gasUsed, and not the tx.gasLimit // https://github.com/ethereum-optimism/optimism/blob/0de7a2f9c96a7c4860658822231b2d6da0fefb1d/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol#L103 - expect(balanceBefore.sub(balanceAfter)).to.be.deep.eq( - tx.gasPrice.mul(tx.gasLimit).add(amount) + expect(balanceBefore.sub(balanceAfter)).to.deep.equal( + expectedFeePaid.add(amount) + ) + + // Make sure the fee was transferred to the vault. + expect(feeVaultBalanceAfter.sub(feeVaultBalanceBefore)).to.deep.equal( + expectedFeePaid + ) + }) + + it('should not be able to withdraw fees before the minimum is met', async () => { + await expect(ovmSequencerFeeVault.withdraw()).to.be.rejected + }) + + it('should be able to withdraw fees back to L1 once the minimum is met', async () => { + const l1FeeWallet = await ovmSequencerFeeVault.l1FeeWallet() + const balanceBefore = await env.l1Wallet.provider.getBalance(l1FeeWallet) + + // Transfer the minimum required to withdraw. + await env.ovmEth.transfer( + ovmSequencerFeeVault.address, + await ovmSequencerFeeVault.MIN_WITHDRAWAL_AMOUNT() + ) + + const vaultBalance = await env.ovmEth.balanceOf( + ovmSequencerFeeVault.address + ) + + // Submit the withdrawal. + const withdrawTx = await ovmSequencerFeeVault.withdraw({ + gasPrice: 0, // Need a gasprice of 0 or the balances will include the fee paid during this tx. + }) + + // Wait for the withdrawal to be relayed to L1. + await env.waitForXDomainTransaction(withdrawTx, Direction.L2ToL1) + + // Balance difference should be equal to old L2 balance. + const balanceAfter = await env.l1Wallet.provider.getBalance(l1FeeWallet) + expect(balanceAfter.sub(balanceBefore)).to.deep.equal( + BigNumber.from(vaultBalance) ) }) }) diff --git a/integration-tests/test/shared/env.ts b/integration-tests/test/shared/env.ts index 98ef9ce13682..ccce5a9698e1 100644 --- a/integration-tests/test/shared/env.ts +++ b/integration-tests/test/shared/env.ts @@ -58,7 +58,7 @@ export class OptimismEnv { // fund the user if needed const balance = await l2Wallet.getBalance() if (balance.isZero()) { - await fundUser(watcher, gateway, utils.parseEther('10')) + await fundUser(watcher, gateway, utils.parseEther('20')) } const ovmEth = getOvmEth(l2Wallet) diff --git a/l2geth/README.md b/l2geth/README.md index 2578ca233596..871a0adbbcad 100644 --- a/l2geth/README.md +++ b/l2geth/README.md @@ -50,6 +50,7 @@ $ USING_OVM=true ./build/bin/geth \ --eth1.chainid $LAYER1_CHAIN_ID \ --eth1.l1gatewayaddress $ETH1_L1_GATEWAY_ADDRESS \ --eth1.l1crossdomainmessengeraddress $ETH1_L1_CROSS_DOMAIN_MESSENGER_ADDRESS \ + --eth1.l1feewalletaddress $ETH1_L1_FEE_WALLET_ADDRESS \ --eth1.addressresolveraddress $ETH1_ADDRESS_RESOLVER_ADDRESS \ --eth1.ctcdeploymentheight $CTC_DEPLOY_HEIGHT \ --eth1.syncservice \ diff --git a/l2geth/cmd/geth/main.go b/l2geth/cmd/geth/main.go index 32d00ffb1432..957a7f1655c3 100644 --- a/l2geth/cmd/geth/main.go +++ b/l2geth/cmd/geth/main.go @@ -153,6 +153,7 @@ var ( utils.Eth1SyncServiceEnable, utils.Eth1CanonicalTransactionChainDeployHeightFlag, utils.Eth1L1CrossDomainMessengerAddressFlag, + utils.Eth1L1FeeWalletAddressFlag, utils.Eth1ETHGatewayAddressFlag, utils.Eth1ChainIdFlag, utils.RollupClientHttpFlag, diff --git a/l2geth/cmd/geth/usage.go b/l2geth/cmd/geth/usage.go index 25837b9ec7da..ea5462fa4591 100644 --- a/l2geth/cmd/geth/usage.go +++ b/l2geth/cmd/geth/usage.go @@ -68,6 +68,7 @@ var AppHelpFlagGroups = []flagGroup{ utils.Eth1SyncServiceEnable, utils.Eth1CanonicalTransactionChainDeployHeightFlag, utils.Eth1L1CrossDomainMessengerAddressFlag, + utils.Eth1L1FeeWalletAddressFlag, utils.Eth1ETHGatewayAddressFlag, utils.Eth1ChainIdFlag, utils.RollupClientHttpFlag, diff --git a/l2geth/cmd/utils/flags.go b/l2geth/cmd/utils/flags.go index 6c5c4447401b..684a151c576f 100644 --- a/l2geth/cmd/utils/flags.go +++ b/l2geth/cmd/utils/flags.go @@ -822,6 +822,12 @@ var ( Value: "0x0000000000000000000000000000000000000000", EnvVar: "ETH1_L1_CROSS_DOMAIN_MESSENGER_ADDRESS", } + Eth1L1FeeWalletAddressFlag = cli.StringFlag{ + Name: "eth1.l1feewalletaddress", + Usage: "Address of the L1 wallet that will collect fees", + Value: "0x0000000000000000000000000000000000000000", + EnvVar: "ETH1_L1_FEE_WALLET_ADDRESS", + } Eth1ETHGatewayAddressFlag = cli.StringFlag{ Name: "eth1.l1ethgatewayaddress", Usage: "Deployment address of the Ethereum gateway", @@ -1148,6 +1154,10 @@ func setEth1(ctx *cli.Context, cfg *rollup.Config) { addr := ctx.GlobalString(Eth1L1CrossDomainMessengerAddressFlag.Name) cfg.L1CrossDomainMessengerAddress = common.HexToAddress(addr) } + if ctx.GlobalIsSet(Eth1L1FeeWalletAddressFlag.Name) { + addr := ctx.GlobalString(Eth1L1FeeWalletAddressFlag.Name) + cfg.L1FeeWalletAddress = common.HexToAddress(addr) + } if ctx.GlobalIsSet(Eth1ETHGatewayAddressFlag.Name) { addr := ctx.GlobalString(Eth1ETHGatewayAddressFlag.Name) cfg.L1ETHGatewayAddress = common.HexToAddress(addr) @@ -1777,10 +1787,11 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) { gasLimit = params.GenesisGasLimit } xdomainAddress := cfg.Rollup.L1CrossDomainMessengerAddress + l1FeeWalletAddress := cfg.Rollup.L1FeeWalletAddress addrManagerOwnerAddress := cfg.Rollup.AddressManagerOwnerAddress l1ETHGatewayAddress := cfg.Rollup.L1ETHGatewayAddress stateDumpPath := cfg.Rollup.StateDumpPath - cfg.Genesis = core.DeveloperGenesisBlock(uint64(ctx.GlobalInt(DeveloperPeriodFlag.Name)), developer.Address, xdomainAddress, l1ETHGatewayAddress, addrManagerOwnerAddress, stateDumpPath, chainID, gasLimit) + cfg.Genesis = core.DeveloperGenesisBlock(uint64(ctx.GlobalInt(DeveloperPeriodFlag.Name)), developer.Address, xdomainAddress, l1ETHGatewayAddress, addrManagerOwnerAddress, l1FeeWalletAddress, stateDumpPath, chainID, gasLimit) if !ctx.GlobalIsSet(MinerGasPriceFlag.Name) && !ctx.GlobalIsSet(MinerLegacyGasPriceFlag.Name) { cfg.Miner.GasPrice = big.NewInt(1) } diff --git a/l2geth/console/console_test.go b/l2geth/console/console_test.go index 3060da5c6f7a..22da70013845 100644 --- a/l2geth/console/console_test.go +++ b/l2geth/console/console_test.go @@ -98,7 +98,7 @@ func newTester(t *testing.T, confOverride func(*eth.Config)) *tester { t.Fatalf("failed to create node: %v", err) } ethConf := ð.Config{ - Genesis: core.DeveloperGenesisBlock(15, common.Address{}, common.Address{}, common.Address{}, common.Address{}, "", nil, 12000000), + Genesis: core.DeveloperGenesisBlock(15, common.Address{}, common.Address{}, common.Address{}, common.Address{}, common.Address{}, "", nil, 12000000), Miner: miner.Config{ Etherbase: common.HexToAddress(testAddress), }, diff --git a/l2geth/core/genesis.go b/l2geth/core/genesis.go index 61e37b0f4464..465fcbb52b4f 100644 --- a/l2geth/core/genesis.go +++ b/l2geth/core/genesis.go @@ -69,6 +69,7 @@ type Genesis struct { // OVM Specific, used to initialize the l1XDomainMessengerAddress // in the genesis state + L1FeeWalletAddress common.Address `json:"-"` L1CrossDomainMessengerAddress common.Address `json:"-"` AddressManagerOwnerAddress common.Address `json:"-"` L1ETHGatewayAddress common.Address `json:"-"` @@ -266,7 +267,7 @@ func (g *Genesis) configOrDefault(ghash common.Hash) *params.ChainConfig { } // ApplyOvmStateToState applies the initial OVM state to a state object. -func ApplyOvmStateToState(statedb *state.StateDB, stateDump *dump.OvmDump, l1XDomainMessengerAddress common.Address, l1ETHGatewayAddress common.Address, addrManagerOwnerAddress common.Address, chainID *big.Int, gasLimit uint64) { +func ApplyOvmStateToState(statedb *state.StateDB, stateDump *dump.OvmDump, l1XDomainMessengerAddress common.Address, l1ETHGatewayAddress common.Address, addrManagerOwnerAddress common.Address, l1FeeWalletAddress common.Address, chainID *big.Int, gasLimit uint64) { if len(stateDump.Accounts) == 0 { return } @@ -330,6 +331,13 @@ func ApplyOvmStateToState(statedb *state.StateDB, stateDump *dump.OvmDump, l1XDo maxTxGasLimitValue := common.BytesToHash(new(big.Int).SetUint64(gasLimit).Bytes()) statedb.SetState(ExecutionManager.Address, maxTxGasLimitSlot, maxTxGasLimitValue) } + OVM_SequencerFeeVault, ok := stateDump.Accounts["OVM_SequencerFeeVault"] + if ok { + log.Info("Setting l1FeeWallet in OVM_SequencerFeeVault", "wallet", l1FeeWalletAddress.Hex()) + l1FeeWalletSlot := common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000") + l1FeeWalletValue := common.BytesToHash(l1FeeWalletAddress.Bytes()) + statedb.SetState(OVM_SequencerFeeVault.Address, l1FeeWalletSlot, l1FeeWalletValue) + } } // ToBlock creates the genesis block and writes state of a genesis specification @@ -342,7 +350,7 @@ func (g *Genesis) ToBlock(db ethdb.Database) *types.Block { if vm.UsingOVM { // OVM_ENABLED - ApplyOvmStateToState(statedb, g.Config.StateDump, g.L1CrossDomainMessengerAddress, g.L1ETHGatewayAddress, g.AddressManagerOwnerAddress, g.ChainID, g.GasLimit) + ApplyOvmStateToState(statedb, g.Config.StateDump, g.L1CrossDomainMessengerAddress, g.L1ETHGatewayAddress, g.AddressManagerOwnerAddress, g.L1FeeWalletAddress, g.ChainID, g.GasLimit) } for addr, account := range g.Alloc { @@ -469,7 +477,7 @@ func DefaultGoerliGenesisBlock() *Genesis { } // DeveloperGenesisBlock returns the 'geth --dev' genesis block. -func DeveloperGenesisBlock(period uint64, faucet, l1XDomainMessengerAddress common.Address, l1ETHGatewayAddress common.Address, addrManagerOwnerAddress common.Address, stateDumpPath string, chainID *big.Int, gasLimit uint64) *Genesis { +func DeveloperGenesisBlock(period uint64, faucet, l1XDomainMessengerAddress common.Address, l1ETHGatewayAddress common.Address, addrManagerOwnerAddress common.Address, l1FeeWalletAddress common.Address, stateDumpPath string, chainID *big.Int, gasLimit uint64) *Genesis { // Override the default period to the user requested one config := *params.AllCliqueProtocolChanges config.Clique.Period = period @@ -525,6 +533,7 @@ func DeveloperGenesisBlock(period uint64, faucet, l1XDomainMessengerAddress comm common.BytesToAddress([]byte{8}): {Balance: big.NewInt(1)}, // ECPairing }, L1CrossDomainMessengerAddress: l1XDomainMessengerAddress, + L1FeeWalletAddress: l1FeeWalletAddress, AddressManagerOwnerAddress: addrManagerOwnerAddress, L1ETHGatewayAddress: l1ETHGatewayAddress, ChainID: config.ChainID, diff --git a/l2geth/rollup/config.go b/l2geth/rollup/config.go index 22d9b3f35ce5..b5778fab0a88 100644 --- a/l2geth/rollup/config.go +++ b/l2geth/rollup/config.go @@ -23,6 +23,7 @@ type Config struct { // HTTP endpoint of the data transport layer RollupClientHttp string L1CrossDomainMessengerAddress common.Address + L1FeeWalletAddress common.Address AddressManagerOwnerAddress common.Address L1ETHGatewayAddress common.Address GasPriceOracleAddress common.Address diff --git a/l2geth/scripts/start.sh b/l2geth/scripts/start.sh index cb346a627489..bcfd3aa71231 100755 --- a/l2geth/scripts/start.sh +++ b/l2geth/scripts/start.sh @@ -33,6 +33,7 @@ CLI Arguments: --eth1.chainid - eth1 chain id --eth1.ctcdeploymentheight - eth1 ctc deploy height --eth1.l1crossdomainmessengeraddress - eth1 l1 xdomain messenger address + --eth1.l1feewalletaddress - eth l1 fee wallet address --rollup.statedumppath - http path to the initial state dump --rollup.clienthttp - rollup client http --rollup.pollinterval - polling interval for the rollup client @@ -127,6 +128,15 @@ while (( "$#" )); do exit 1 fi ;; + --eth1.l1feewalletaddress) + if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then + ETH1_L1_FEE_WALLET_ADDRESS="$2" + shift 2 + else + echo "Error: Argument for $1 is missing" >&2 + exit 1 + fi + ;; --eth1.l1ethgatewayaddress) if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then ETH1_L1_ETH_GATEWAY_ADDRESS="$2" @@ -230,6 +240,7 @@ if [[ ! -z "$ROLLUP_SYNC_SERVICE_ENABLE" ]]; then fi cmd="$cmd --datadir $DATADIR" cmd="$cmd --eth1.l1crossdomainmessengeraddress $ETH1_L1_CROSS_DOMAIN_MESSENGER_ADDRESS" +cmd="$cmd --eth1.l1feewalletaddress $ETH1_L1_FEE_WALLET_ADDRESS" cmd="$cmd --rollup.addressmanagerowneraddress $ADDRESS_MANAGER_OWNER_ADDRESS" cmd="$cmd --rollup.statedumppath $ROLLUP_STATE_DUMP_PATH" cmd="$cmd --eth1.ctcdeploymentheight $ETH1_CTC_DEPLOYMENT_HEIGHT" diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol index 37d267f72ca3..c70902499a5c 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol @@ -8,6 +8,7 @@ import { iOVM_ECDSAContractAccount } from "../../iOVM/accounts/iOVM_ECDSAContrac /* Library Imports */ import { Lib_EIP155Tx } from "../../libraries/codec/Lib_EIP155Tx.sol"; import { Lib_ExecutionManagerWrapper } from "../../libraries/wrappers/Lib_ExecutionManagerWrapper.sol"; +import { Lib_PredeployAddresses } from "../../libraries/constants/Lib_PredeployAddresses.sol"; /* Contract Imports */ import { OVM_ETH } from "../predeploys/OVM_ETH.sol"; @@ -40,7 +41,6 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount { // 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. uint256 constant EXECUTION_VALIDATION_GAS_OVERHEAD = 25000; - OVM_ETH constant ovmETH = OVM_ETH(0x4200000000000000000000000000000000000006); /******************** @@ -92,8 +92,8 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount { // Transfer fee to relayer. require( - ovmETH.transfer( - msg.sender, + OVM_ETH(Lib_PredeployAddresses.OVM_ETH).transfer( + Lib_PredeployAddresses.SEQUENCER_FEE_WALLET, SafeMath.mul(transaction.gasLimit, transaction.gasPrice) ), "Fee was not transferred to relayer." @@ -131,7 +131,7 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount { ); require( - ovmETH.transfer( + OVM_ETH(Lib_PredeployAddresses.OVM_ETH).transfer( transaction.to, transaction.value ), diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerFeeVault.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerFeeVault.sol new file mode 100644 index 000000000000..4212d6c71a28 --- /dev/null +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerFeeVault.sol @@ -0,0 +1,73 @@ +// SPDX-License-Identifier: MIT +pragma solidity >0.5.0 <0.8.0; + +/* Library Imports */ +import { Lib_PredeployAddresses } from "../../libraries/constants/Lib_PredeployAddresses.sol"; + +/* Contract Imports */ +import { OVM_ETH } from "../predeploys/OVM_ETH.sol"; + +/** + * @title OVM_SequencerFeeVault + * @dev Simple holding contract for fees paid to the Sequencer. Likely to be replaced in the future + * but "good enough for now". + * + * Compiler used: optimistic-solc + * Runtime target: OVM + */ +contract OVM_SequencerFeeVault { + + /************* + * Constants * + *************/ + + // Minimum ETH balance that can be withdrawn in a single withdrawal. + uint256 public constant MIN_WITHDRAWAL_AMOUNT = 15 ether; + + + /************* + * Variables * + *************/ + + // Address on L1 that will hold the fees once withdrawn. Dynamically initialized within l2geth. + address public l1FeeWallet; + + + /*************** + * Constructor * + ***************/ + + /** + * @param _l1FeeWallet Initial address for the L1 wallet that will hold fees once withdrawn. + * Currently HAS NO EFFECT in production because l2geth will mutate this storage slot during + * the genesis block. This is ONLY for testing purposes. + */ + constructor( + address _l1FeeWallet + ) { + l1FeeWallet = _l1FeeWallet; + } + + + /******************** + * Public Functions * + ********************/ + + function withdraw() + public + { + uint256 balance = OVM_ETH(Lib_PredeployAddresses.OVM_ETH).balanceOf(address(this)); + + require( + balance >= MIN_WITHDRAWAL_AMOUNT, + "OVM_SequencerFeeVault: withdrawal amount must be greater than minimum withdrawal amount" + ); + + OVM_ETH(Lib_PredeployAddresses.OVM_ETH).withdrawTo( + l1FeeWallet, + balance, + 0, + bytes("") + ); + } +} diff --git a/packages/contracts/contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol b/packages/contracts/contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol index db667bc95bc0..ab68135f36a5 100644 --- a/packages/contracts/contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol +++ b/packages/contracts/contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol @@ -14,5 +14,6 @@ library Lib_PredeployAddresses { address internal constant L2_CROSS_DOMAIN_MESSENGER = 0x4200000000000000000000000000000000000007; address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008; address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009; + address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011; address internal constant ERC1820_REGISTRY = 0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24; } diff --git a/packages/contracts/src/contract-deployment/config.ts b/packages/contracts/src/contract-deployment/config.ts index ba04437c0708..124b680fbfcd 100644 --- a/packages/contracts/src/contract-deployment/config.ts +++ b/packages/contracts/src/contract-deployment/config.ts @@ -275,5 +275,9 @@ export const makeContractDeployConfig = async ( config.gasPriceOracleConfig.initialGasPrice, ], }, + OVM_SequencerFeeVault: { + factory: getContractFactory('OVM_SequencerFeeVault'), + params: [`0x${'11'.repeat(20)}`], + }, } } diff --git a/packages/contracts/src/predeploys.ts b/packages/contracts/src/predeploys.ts index 1fbcc692d548..edc316f04fac 100644 --- a/packages/contracts/src/predeploys.ts +++ b/packages/contracts/src/predeploys.ts @@ -19,5 +19,6 @@ export const predeploys = { OVM_ProxyEOA: '0x4200000000000000000000000000000000000009', OVM_ExecutionManagerWrapper: '0x420000000000000000000000000000000000000B', OVM_GasPriceOracle: '0x420000000000000000000000000000000000000F', + OVM_SequencerFeeVault: '0x4200000000000000000000000000000000000011', ERC1820Registry: '0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24', } diff --git a/packages/contracts/src/state-dump/make-dump.ts b/packages/contracts/src/state-dump/make-dump.ts index 19c1ce682e46..1828feceebde 100644 --- a/packages/contracts/src/state-dump/make-dump.ts +++ b/packages/contracts/src/state-dump/make-dump.ts @@ -137,6 +137,7 @@ export const makeStateDump = async (cfg: RollupDeployConfig): Promise => { 'OVM_ETH', 'OVM_ExecutionManagerWrapper', 'OVM_GasPriceOracle', + 'OVM_SequencerFeeVault', ], deployOverrides: {}, waitForReceipts: false, @@ -159,6 +160,7 @@ export const makeStateDump = async (cfg: RollupDeployConfig): Promise => { 'OVM_ProxyEOA', 'OVM_ExecutionManagerWrapper', 'OVM_GasPriceOracle', + 'OVM_SequencerFeeVault', ] const deploymentResult = await deploy(config) diff --git a/packages/contracts/test/contracts/OVM/precompiles/OVM_SequencerFeeVault.spec.ts b/packages/contracts/test/contracts/OVM/precompiles/OVM_SequencerFeeVault.spec.ts new file mode 100644 index 000000000000..66be51e08a13 --- /dev/null +++ b/packages/contracts/test/contracts/OVM/precompiles/OVM_SequencerFeeVault.spec.ts @@ -0,0 +1,80 @@ +import { expect } from '../../../setup' + +/* Imports: External */ +import hre from 'hardhat' +import { MockContract, smockit } from '@eth-optimism/smock' +import { Contract, Signer } from 'ethers' + +/* Imports: Internal */ +import { predeploys } from '../../../../src' + +describe('OVM_SequencerFeeVault', () => { + let signer1: Signer + before(async () => { + ;[signer1] = await hre.ethers.getSigners() + }) + + let Mock__OVM_ETH: MockContract + before(async () => { + Mock__OVM_ETH = await smockit('OVM_ETH', { + address: predeploys.OVM_ETH, + }) + }) + + let OVM_SequencerFeeVault: Contract + beforeEach(async () => { + const factory = await hre.ethers.getContractFactory('OVM_SequencerFeeVault') + OVM_SequencerFeeVault = await factory.deploy(await signer1.getAddress()) + }) + + describe('withdraw', async () => { + it('should fail if the contract does not have more than the minimum balance', async () => { + Mock__OVM_ETH.smocked.balanceOf.will.return.with(0) + + await expect(OVM_SequencerFeeVault.withdraw()).to.be.reverted + }) + + it('should succeed when the contract has exactly sufficient balance', async () => { + const amount = await OVM_SequencerFeeVault.MIN_WITHDRAWAL_AMOUNT() + Mock__OVM_ETH.smocked.balanceOf.will.return.with(amount) + + await expect(OVM_SequencerFeeVault.withdraw()).to.not.be.reverted + + expect(Mock__OVM_ETH.smocked.withdrawTo.calls[0]).to.deep.equal([ + await signer1.getAddress(), + amount, + 0, + '0x', + ]) + }) + + it('should succeed when the contract has more than sufficient balance', async () => { + const amount = hre.ethers.utils.parseEther('100') + Mock__OVM_ETH.smocked.balanceOf.will.return.with(amount) + + await expect(OVM_SequencerFeeVault.withdraw()).to.not.be.reverted + + expect(Mock__OVM_ETH.smocked.withdrawTo.calls[0]).to.deep.equal([ + await signer1.getAddress(), + amount, + 0, + '0x', + ]) + }) + + it('should have an owner in storage slot 0x00...00', async () => { + // Deploy a new temporary instance with an address that's easier to make assertions about. + const factory = await hre.ethers.getContractFactory( + 'OVM_SequencerFeeVault' + ) + OVM_SequencerFeeVault = await factory.deploy(`0x${'11'.repeat(20)}`) + + expect( + await hre.ethers.provider.getStorageAt( + OVM_SequencerFeeVault.address, + hre.ethers.constants.HashZero + ) + ).to.equal(`0x000000000000000000000000${'11'.repeat(20)}`) + }) + }) +}) From 859437f9eb94665606d826b6eb1f66be13b4a545 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Jun 2021 12:06:05 -0400 Subject: [PATCH 058/125] build(deps): bump glob-parent from 5.1.1 to 5.1.2 (#1036) Bumps [glob-parent](https://github.com/gulpjs/glob-parent) from 5.1.1 to 5.1.2. - [Release notes](https://github.com/gulpjs/glob-parent/releases) - [Changelog](https://github.com/gulpjs/glob-parent/blob/main/CHANGELOG.md) - [Commits](https://github.com/gulpjs/glob-parent/compare/v5.1.1...v5.1.2) --- updated-dependencies: - dependency-name: glob-parent dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: smartcontracts Co-authored-by: Liam Horne --- yarn.lock | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/yarn.lock b/yarn.lock index 1be52e5f1a8e..84e59fa04878 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6860,20 +6860,13 @@ github-from-package@0.0.0: resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce" integrity sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4= -glob-parent@^5.1.0, glob-parent@^5.1.1: +glob-parent@^5.1.0, glob-parent@^5.1.1, glob-parent@~5.1.0: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== dependencies: is-glob "^4.0.1" -glob-parent@~5.1.0: - version "5.1.1" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.1.tgz#b6c1ef417c4e5663ea498f1c45afac6916bbc229" - integrity sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ== - dependencies: - is-glob "^4.0.1" - glob@7.1.3: version "7.1.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1" From 01646a0a3d68e68b64eee4bff9951ee25f499f7b Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Wed, 9 Jun 2021 10:39:13 -0700 Subject: [PATCH 059/125] fix: predeploy gasprice oracle (#1039) * l2geth: delete extra config options * l2geth: stop using extra config options * l2geth: more stop using extra config options * chore: add changeset * l2geth: add new config for gpo owner * chore: add changeset * l2geth: fix tests * tests: fix build --- .changeset/calm-ants-dream.md | 5 +++ .changeset/odd-shrimps-laugh.md | 5 +++ l2geth/cmd/geth/main.go | 5 +-- l2geth/cmd/geth/usage.go | 5 +-- l2geth/cmd/utils/flags.go | 47 ++++++-------------------- l2geth/console/console_test.go | 2 +- l2geth/core/genesis.go | 17 +++++++--- l2geth/eth/backend.go | 4 +-- l2geth/eth/config.go | 2 -- l2geth/eth/gasprice/rollup_gasprice.go | 8 +++-- l2geth/rollup/config.go | 6 +--- l2geth/rollup/sync_service.go | 12 ++----- l2geth/rollup/sync_service_test.go | 8 ++--- 13 files changed, 49 insertions(+), 77 deletions(-) create mode 100644 .changeset/calm-ants-dream.md create mode 100644 .changeset/odd-shrimps-laugh.md diff --git a/.changeset/calm-ants-dream.md b/.changeset/calm-ants-dream.md new file mode 100644 index 000000000000..15908ea02cba --- /dev/null +++ b/.changeset/calm-ants-dream.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/l2geth': patch +--- + +Add new config `ROLLUP_GAS_PRICE_ORACLE_OWNER_ADDRESS` to set the owner of the gas price oracle at runtime diff --git a/.changeset/odd-shrimps-laugh.md b/.changeset/odd-shrimps-laugh.md new file mode 100644 index 000000000000..cf599708e9af --- /dev/null +++ b/.changeset/odd-shrimps-laugh.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/l2geth': patch +--- + +Removes config options that are no longer required. `ROLLUP_DATAPRICE`, `ROLLUP_EXECUTION_PRICE`, `ROLLUP_GAS_PRICE_ORACLE_ADDRESS` and `ROLLUP_ENABLE_L2_GAS_POLLING`. The oracle was moved to a predeploy 0x42.. address and polling is always enabled as it no longer needs to be backwards compatible diff --git a/l2geth/cmd/geth/main.go b/l2geth/cmd/geth/main.go index 957a7f1655c3..5a183bd1d0bb 100644 --- a/l2geth/cmd/geth/main.go +++ b/l2geth/cmd/geth/main.go @@ -164,12 +164,9 @@ var ( utils.RollupStateDumpPathFlag, utils.RollupDiffDbFlag, utils.RollupMaxCalldataSizeFlag, - utils.RollupDataPriceFlag, - utils.RollupExecutionPriceFlag, utils.RollupBackendFlag, - utils.RollupEnableL2GasPollingFlag, - utils.RollupGasPriceOracleAddressFlag, utils.RollupEnforceFeesFlag, + utils.GasPriceOracleOwnerAddress, } rpcFlags = []cli.Flag{ diff --git a/l2geth/cmd/geth/usage.go b/l2geth/cmd/geth/usage.go index ea5462fa4591..8b9cf2231668 100644 --- a/l2geth/cmd/geth/usage.go +++ b/l2geth/cmd/geth/usage.go @@ -79,12 +79,9 @@ var AppHelpFlagGroups = []flagGroup{ utils.RollupStateDumpPathFlag, utils.RollupDiffDbFlag, utils.RollupMaxCalldataSizeFlag, - utils.RollupDataPriceFlag, - utils.RollupExecutionPriceFlag, utils.RollupBackendFlag, - utils.RollupEnableL2GasPollingFlag, - utils.RollupGasPriceOracleAddressFlag, utils.RollupEnforceFeesFlag, + utils.GasPriceOracleOwnerAddress, }, }, { diff --git a/l2geth/cmd/utils/flags.go b/l2geth/cmd/utils/flags.go index 684a151c576f..9c29027f2498 100644 --- a/l2geth/cmd/utils/flags.go +++ b/l2geth/cmd/utils/flags.go @@ -863,7 +863,6 @@ var ( Value: "l1", EnvVar: "ROLLUP_BACKEND", } - // Flag to enable verifier mode RollupEnableVerifierFlag = cli.BoolFlag{ Name: "rollup.verifier", Usage: "Enable the verifier", @@ -893,34 +892,16 @@ var ( Value: eth.DefaultConfig.Rollup.MaxCallDataSize, EnvVar: "ROLLUP_MAX_CALLDATA_SIZE", } - RollupDataPriceFlag = BigFlag{ - Name: "rollup.dataprice", - Usage: "The L1 calldata price to use for the sequencer fees", - Value: eth.DefaultConfig.Rollup.DataPrice, - EnvVar: "ROLLUP_DATAPRICE", - } - RollupExecutionPriceFlag = BigFlag{ - Name: "rollup.executionprice", - Usage: "The execution gas price to use for the sequencer fees", - Value: eth.DefaultConfig.Rollup.ExecutionPrice, - EnvVar: "ROLLUP_EXECUTIONPRICE", - } - RollupGasPriceOracleAddressFlag = cli.StringFlag{ - Name: "rollup.gaspriceoracleaddress", - Usage: "Address of the rollup gas price oracle", - Value: "0x0000000000000000000000000000000000000000", - EnvVar: "ROLLUP_GAS_PRICE_ORACLE_ADDRESS", - } - RollupEnableL2GasPollingFlag = cli.BoolFlag{ - Name: "rollup.enablel2gaspolling", - Usage: "Poll for the L2 gas price from the L2 state", - EnvVar: "ROLLUP_ENABLE_L2_GAS_POLLING", - } RollupEnforceFeesFlag = cli.BoolFlag{ Name: "rollup.enforcefeesflag", Usage: "Disable transactions with 0 gas price", EnvVar: "ROLLUP_ENFORCE_FEES", } + GasPriceOracleOwnerAddress = cli.StringFlag{ + Name: "rollup.gaspriceoracleowneraddress", + Usage: "Owner of the OVM_GasPriceOracle", + EnvVar: "ROLLUP_GAS_PRICE_ORACLE_OWNER_ADDRESS", + } ) // MakeDataDir retrieves the currently requested data directory, terminating @@ -1198,11 +1179,9 @@ func setRollup(ctx *cli.Context, cfg *rollup.Config) { if ctx.GlobalIsSet(RollupTimstampRefreshFlag.Name) { cfg.TimestampRefreshThreshold = ctx.GlobalDuration(RollupTimstampRefreshFlag.Name) } - if ctx.GlobalIsSet(RollupDataPriceFlag.Name) { - cfg.DataPrice = GlobalBig(ctx, RollupDataPriceFlag.Name) - } - if ctx.GlobalIsSet(RollupExecutionPriceFlag.Name) { - cfg.ExecutionPrice = GlobalBig(ctx, RollupExecutionPriceFlag.Name) + if ctx.GlobalIsSet(GasPriceOracleOwnerAddress.Name) { + addr := ctx.GlobalString(GasPriceOracleOwnerAddress.Name) + cfg.GasPriceOracleOwnerAddress = common.HexToAddress(addr) } if ctx.GlobalIsSet(RollupBackendFlag.Name) { val := ctx.GlobalString(RollupBackendFlag.Name) @@ -1213,13 +1192,6 @@ func setRollup(ctx *cli.Context, cfg *rollup.Config) { } cfg.Backend = backend } - if ctx.GlobalIsSet(RollupGasPriceOracleAddressFlag.Name) { - addr := ctx.GlobalString(RollupGasPriceOracleAddressFlag.Name) - cfg.GasPriceOracleAddress = common.HexToAddress(addr) - } - if ctx.GlobalIsSet(RollupEnableL2GasPollingFlag.Name) { - cfg.EnableL2GasPolling = true - } if ctx.GlobalIsSet(RollupEnforceFeesFlag.Name) { cfg.EnforceFees = true } @@ -1790,8 +1762,9 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) { l1FeeWalletAddress := cfg.Rollup.L1FeeWalletAddress addrManagerOwnerAddress := cfg.Rollup.AddressManagerOwnerAddress l1ETHGatewayAddress := cfg.Rollup.L1ETHGatewayAddress + gpoOwnerAddress := cfg.Rollup.GasPriceOracleOwnerAddress stateDumpPath := cfg.Rollup.StateDumpPath - cfg.Genesis = core.DeveloperGenesisBlock(uint64(ctx.GlobalInt(DeveloperPeriodFlag.Name)), developer.Address, xdomainAddress, l1ETHGatewayAddress, addrManagerOwnerAddress, l1FeeWalletAddress, stateDumpPath, chainID, gasLimit) + cfg.Genesis = core.DeveloperGenesisBlock(uint64(ctx.GlobalInt(DeveloperPeriodFlag.Name)), developer.Address, xdomainAddress, l1ETHGatewayAddress, addrManagerOwnerAddress, gpoOwnerAddress, l1FeeWalletAddress, stateDumpPath, chainID, gasLimit) if !ctx.GlobalIsSet(MinerGasPriceFlag.Name) && !ctx.GlobalIsSet(MinerLegacyGasPriceFlag.Name) { cfg.Miner.GasPrice = big.NewInt(1) } diff --git a/l2geth/console/console_test.go b/l2geth/console/console_test.go index 22da70013845..4a835d2b9519 100644 --- a/l2geth/console/console_test.go +++ b/l2geth/console/console_test.go @@ -98,7 +98,7 @@ func newTester(t *testing.T, confOverride func(*eth.Config)) *tester { t.Fatalf("failed to create node: %v", err) } ethConf := ð.Config{ - Genesis: core.DeveloperGenesisBlock(15, common.Address{}, common.Address{}, common.Address{}, common.Address{}, common.Address{}, "", nil, 12000000), + Genesis: core.DeveloperGenesisBlock(15, common.Address{}, common.Address{}, common.Address{}, common.Address{}, common.Address{}, common.Address{}, "", nil, 12000000), Miner: miner.Config{ Etherbase: common.HexToAddress(testAddress), }, diff --git a/l2geth/core/genesis.go b/l2geth/core/genesis.go index 465fcbb52b4f..6fd5a812cbe5 100644 --- a/l2geth/core/genesis.go +++ b/l2geth/core/genesis.go @@ -73,6 +73,7 @@ type Genesis struct { L1CrossDomainMessengerAddress common.Address `json:"-"` AddressManagerOwnerAddress common.Address `json:"-"` L1ETHGatewayAddress common.Address `json:"-"` + GasPriceOracleOwnerAddress common.Address `json:"-"` ChainID *big.Int `json:"-"` } @@ -267,7 +268,7 @@ func (g *Genesis) configOrDefault(ghash common.Hash) *params.ChainConfig { } // ApplyOvmStateToState applies the initial OVM state to a state object. -func ApplyOvmStateToState(statedb *state.StateDB, stateDump *dump.OvmDump, l1XDomainMessengerAddress common.Address, l1ETHGatewayAddress common.Address, addrManagerOwnerAddress common.Address, l1FeeWalletAddress common.Address, chainID *big.Int, gasLimit uint64) { +func ApplyOvmStateToState(statedb *state.StateDB, stateDump *dump.OvmDump, l1XDomainMessengerAddress, l1ETHGatewayAddress, addrManagerOwnerAddress, gpoOwnerAddress, l1FeeWalletAddress common.Address, chainID *big.Int, gasLimit uint64) { if len(stateDump.Accounts) == 0 { return } @@ -305,7 +306,7 @@ func ApplyOvmStateToState(statedb *state.StateDB, stateDump *dump.OvmDump, l1XDo log.Info("Setting OVM_L1ETHGateway in OVM_ETH", "address", l1ETHGatewayAddress.Hex()) if strings.Contains(OVM_ETH.Code, "a84ce98") { // Set the gateway of OVM_ETH at new dump - log.Info("Detected current OVM_ETH dump, setting slot 0x1 ") + log.Info("Detected current OVM_ETH dump, setting slot 0x1") l1GatewaySlot := common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000001") l1GatewayValue := common.BytesToHash(l1ETHGatewayAddress.Bytes()) statedb.SetState(OVM_ETH.Address, l1GatewaySlot, l1GatewayValue) @@ -337,6 +338,13 @@ func ApplyOvmStateToState(statedb *state.StateDB, stateDump *dump.OvmDump, l1XDo l1FeeWalletSlot := common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000") l1FeeWalletValue := common.BytesToHash(l1FeeWalletAddress.Bytes()) statedb.SetState(OVM_SequencerFeeVault.Address, l1FeeWalletSlot, l1FeeWalletValue) + GasPriceOracle, ok := stateDump.Accounts["OVM_GasPriceOracle"] + if ok { + ownerSlot := common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000") + ownerValue := common.BytesToHash(gpoOwnerAddress.Bytes()) + statedb.SetState(GasPriceOracle.Address, ownerSlot, ownerValue) + log.Info("Setting GasPriceOracle Owner", "owner", gpoOwnerAddress.Hex()) + } } } @@ -350,7 +358,7 @@ func (g *Genesis) ToBlock(db ethdb.Database) *types.Block { if vm.UsingOVM { // OVM_ENABLED - ApplyOvmStateToState(statedb, g.Config.StateDump, g.L1CrossDomainMessengerAddress, g.L1ETHGatewayAddress, g.AddressManagerOwnerAddress, g.L1FeeWalletAddress, g.ChainID, g.GasLimit) + ApplyOvmStateToState(statedb, g.Config.StateDump, g.L1CrossDomainMessengerAddress, g.L1ETHGatewayAddress, g.AddressManagerOwnerAddress, g.GasPriceOracleOwnerAddress, g.L1FeeWalletAddress, g.ChainID, g.GasLimit) } for addr, account := range g.Alloc { @@ -477,7 +485,7 @@ func DefaultGoerliGenesisBlock() *Genesis { } // DeveloperGenesisBlock returns the 'geth --dev' genesis block. -func DeveloperGenesisBlock(period uint64, faucet, l1XDomainMessengerAddress common.Address, l1ETHGatewayAddress common.Address, addrManagerOwnerAddress common.Address, l1FeeWalletAddress common.Address, stateDumpPath string, chainID *big.Int, gasLimit uint64) *Genesis { +func DeveloperGenesisBlock(period uint64, faucet, l1XDomainMessengerAddress common.Address, l1ETHGatewayAddress common.Address, addrManagerOwnerAddress, gpoOwnerAddress, l1FeeWalletAddress common.Address, stateDumpPath string, chainID *big.Int, gasLimit uint64) *Genesis { // Override the default period to the user requested one config := *params.AllCliqueProtocolChanges config.Clique.Period = period @@ -536,6 +544,7 @@ func DeveloperGenesisBlock(period uint64, faucet, l1XDomainMessengerAddress comm L1FeeWalletAddress: l1FeeWalletAddress, AddressManagerOwnerAddress: addrManagerOwnerAddress, L1ETHGatewayAddress: l1ETHGatewayAddress, + GasPriceOracleOwnerAddress: gpoOwnerAddress, ChainID: config.ChainID, } } diff --git a/l2geth/eth/backend.go b/l2geth/eth/backend.go index 740b73ac1ff7..1892d2f3ef75 100644 --- a/l2geth/eth/backend.go +++ b/l2geth/eth/backend.go @@ -226,7 +226,7 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) { eth.miner = miner.New(eth, &config.Miner, chainConfig, eth.EventMux(), eth.engine, eth.isLocalBlock) eth.miner.SetExtra(makeExtraData(config.Miner.ExtraData)) - log.Info("Backend Config", "max-calldata-size", config.Rollup.MaxCallDataSize, "gas-limit", config.Rollup.GasLimit, "is-verifier", config.Rollup.IsVerifier, "using-ovm", vm.UsingOVM, "data-price", config.Rollup.DataPrice, "execution-price", config.Rollup.ExecutionPrice) + log.Info("Backend Config", "max-calldata-size", config.Rollup.MaxCallDataSize, "gas-limit", config.Rollup.GasLimit, "is-verifier", config.Rollup.IsVerifier, "using-ovm", vm.UsingOVM) eth.APIBackend = &EthAPIBackend{ctx.ExtRPCEnabled(), eth, nil, nil, config.Rollup.IsVerifier, config.Rollup.GasLimit, vm.UsingOVM, config.Rollup.MaxCallDataSize} gpoParams := config.GPO if gpoParams.Default == nil { @@ -234,7 +234,7 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) { } eth.APIBackend.gpo = gasprice.NewOracle(eth.APIBackend, gpoParams) // create the Rollup GPO and allow the API backend and the sync service to access it - rollupGpo := gasprice.NewRollupOracle(config.Rollup.DataPrice, config.Rollup.ExecutionPrice) + rollupGpo := gasprice.NewRollupOracle() eth.APIBackend.rollupGpo = rollupGpo eth.syncService.RollupGpo = rollupGpo return eth, nil diff --git a/l2geth/eth/config.go b/l2geth/eth/config.go index 33186b0935cc..63b0e1ad091d 100644 --- a/l2geth/eth/config.go +++ b/l2geth/eth/config.go @@ -81,8 +81,6 @@ var DefaultConfig = Config{ // is additional overhead that is unaccounted. Round down to 127000 for // safety. MaxCallDataSize: 127000, - DataPrice: big.NewInt(100 * params.GWei), - ExecutionPrice: big.NewInt(0), }, DiffDbCache: 256, } diff --git a/l2geth/eth/gasprice/rollup_gasprice.go b/l2geth/eth/gasprice/rollup_gasprice.go index 7b0a062e6c41..ac4166dea95e 100644 --- a/l2geth/eth/gasprice/rollup_gasprice.go +++ b/l2geth/eth/gasprice/rollup_gasprice.go @@ -17,10 +17,12 @@ type RollupOracle struct { } // NewRollupOracle returns an initialized RollupOracle -func NewRollupOracle(l1GasPrice *big.Int, l2GasPrice *big.Int) *RollupOracle { +func NewRollupOracle() *RollupOracle { return &RollupOracle{ - l1GasPrice: l1GasPrice, - l2GasPrice: l2GasPrice, + l1GasPrice: new(big.Int), + l2GasPrice: new(big.Int), + l1GasPriceLock: sync.RWMutex{}, + l2GasPriceLock: sync.RWMutex{}, } } diff --git a/l2geth/rollup/config.go b/l2geth/rollup/config.go index b5778fab0a88..a2b87011a26b 100644 --- a/l2geth/rollup/config.go +++ b/l2geth/rollup/config.go @@ -26,7 +26,7 @@ type Config struct { L1FeeWalletAddress common.Address AddressManagerOwnerAddress common.Address L1ETHGatewayAddress common.Address - GasPriceOracleAddress common.Address + GasPriceOracleOwnerAddress common.Address // Turns on checking of state for L2 gas price EnableL2GasPolling bool // Deployment Height of the canonical transaction chain @@ -37,10 +37,6 @@ type Config struct { PollInterval time.Duration // Interval for updating the timestamp TimestampRefreshThreshold time.Duration - // The gas price to use when estimating L1 calldata publishing costs - DataPrice *big.Int - // The gas price to use for L2 congestion costs - ExecutionPrice *big.Int // Represents the source of the transactions that is being synced Backend Backend // Only accept transactions with fees diff --git a/l2geth/rollup/sync_service.go b/l2geth/rollup/sync_service.go index ad674a799e8d..72f7209ad43e 100644 --- a/l2geth/rollup/sync_service.go +++ b/l2geth/rollup/sync_service.go @@ -31,6 +31,7 @@ var errShortRemoteTip = errors.New("Unexpected remote less than tip") // L2GasPrice slot refers to the storage slot that the execution price is stored // in the L2 predeploy contract, the GasPriceOracle var l2GasPriceSlot = common.BigToHash(big.NewInt(1)) +var l2GasPriceOracleAddress = common.HexToAddress("0x420000000000000000000000000000000000000F") // SyncService implements the main functionality around pulling in transactions // and executing them. It can be configured to run in both sequencer mode and in @@ -58,8 +59,6 @@ type SyncService struct { timestampRefreshThreshold time.Duration chainHeadCh chan core.ChainHeadEvent backend Backend - gpoAddress common.Address - enableL2GasPolling bool enforceFees bool } @@ -114,8 +113,6 @@ func NewSyncService(ctx context.Context, cfg Config, txpool *core.TxPool, bc *co pollInterval: pollInterval, timestampRefreshThreshold: timestampRefreshThreshold, backend: cfg.Backend, - gpoAddress: cfg.GasPriceOracleAddress, - enableL2GasPolling: cfg.EnableL2GasPolling, enforceFees: cfg.EnforceFees, } @@ -430,11 +427,6 @@ func (s *SyncService) updateL1GasPrice() error { // price oracle at the state that corresponds to the state root. If no state // root is passed in, then the tip is used. func (s *SyncService) updateL2GasPrice(hash *common.Hash) error { - // TODO(mark): this is temporary and will be able to be rmoved when the - // OVM_GasPriceOracle is moved into the predeploy contracts - if !s.enableL2GasPolling { - return nil - } var state *state.StateDB var err error if hash != nil { @@ -445,7 +437,7 @@ func (s *SyncService) updateL2GasPrice(hash *common.Hash) error { if err != nil { return err } - result := state.GetState(s.gpoAddress, l2GasPriceSlot) + result := state.GetState(l2GasPriceOracleAddress, l2GasPriceSlot) s.RollupGpo.SetL2GasPrice(result.Big()) return nil } diff --git a/l2geth/rollup/sync_service_test.go b/l2geth/rollup/sync_service_test.go index 8ba60a3facb5..62e543d690f4 100644 --- a/l2geth/rollup/sync_service_test.go +++ b/l2geth/rollup/sync_service_test.go @@ -516,8 +516,6 @@ func TestSyncServiceL2GasPrice(t *testing.T) { if err != nil { t.Fatal(err) } - service.enableL2GasPolling = true - service.gpoAddress = common.HexToAddress("0xF20b338752976878754518183873602902360704") price, err := service.RollupGpo.SuggestL2GasPrice(context.Background()) if err != nil { @@ -533,7 +531,7 @@ func TestSyncServiceL2GasPrice(t *testing.T) { t.Fatal("Cannot get state db") } l2GasPrice := big.NewInt(100000000000) - state.SetState(service.gpoAddress, l2GasPriceSlot, common.BigToHash(l2GasPrice)) + state.SetState(l2GasPriceOracleAddress, l2GasPriceSlot, common.BigToHash(l2GasPrice)) root, _ := state.Commit(false) service.updateL2GasPrice(&root) @@ -695,7 +693,7 @@ func newTestSyncService(isVerifier bool) (*SyncService, chan core.NewTxsEvent, e return nil, nil, nil, fmt.Errorf("Cannot initialize syncservice: %w", err) } - service.RollupGpo = gasprice.NewRollupOracle(big.NewInt(0), big.NewInt(0)) + service.RollupGpo = gasprice.NewRollupOracle() txCh := make(chan core.NewTxsEvent, 1) sub := service.SubscribeNewTxsEvent(txCh) @@ -717,7 +715,7 @@ type mockClient struct { func setupMockClient(service *SyncService, responses map[string]interface{}) { client := newMockClient(responses) service.client = client - service.RollupGpo = gasprice.NewRollupOracle(big.NewInt(0), big.NewInt(0)) + service.RollupGpo = gasprice.NewRollupOracle() } func newMockClient(responses map[string]interface{}) *mockClient { From 989a3027ab52b63859bfb40006f92fef11ba9d09 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Wed, 9 Jun 2021 13:08:22 -0700 Subject: [PATCH 060/125] l2geth: optimize loops (#1027) * l2geth: optimize loops * l2geth: stop ticker when done * l2geth: don't wait for first tick * chore: add changeset --- .changeset/angry-numbers-swim.md | 5 +++++ l2geth/rollup/sync_service.go | 13 +++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 .changeset/angry-numbers-swim.md diff --git a/.changeset/angry-numbers-swim.md b/.changeset/angry-numbers-swim.md new file mode 100644 index 000000000000..59883f090bb0 --- /dev/null +++ b/.changeset/angry-numbers-swim.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/l2geth': patch +--- + +Optimize main polling loops diff --git a/l2geth/rollup/sync_service.go b/l2geth/rollup/sync_service.go index 473acff61afe..b3bcfa952853 100644 --- a/l2geth/rollup/sync_service.go +++ b/l2geth/rollup/sync_service.go @@ -138,17 +138,18 @@ func NewSyncService(ctx context.Context, cfg Config, txpool *core.TxPool, bc *co } // Wait until the remote service is done syncing - for { + t := time.NewTicker(10 * time.Second) + for ; true; <-t.C { status, err := service.client.SyncStatus(service.backend) if err != nil { log.Error("Cannot get sync status") continue } if !status.Syncing { + t.Stop() break } log.Info("Still syncing", "index", status.CurrentTransactionIndex, "tip", status.HighestKnownTransactionIndex) - time.Sleep(10 * time.Second) } // Initialize the latest L1 data here to make sure that @@ -320,7 +321,8 @@ func (s *SyncService) Stop() error { // VerifierLoop is the main loop for Verifier mode func (s *SyncService) VerifierLoop() { log.Info("Starting Verifier Loop", "poll-interval", s.pollInterval, "timestamp-refresh-threshold", s.timestampRefreshThreshold) - for { + t := time.NewTicker(s.pollInterval) + for ; true; <-t.C { if err := s.updateL1GasPrice(); err != nil { log.Error("Cannot update L1 gas price", "msg", err) } @@ -330,7 +332,6 @@ func (s *SyncService) VerifierLoop() { if err := s.updateL2GasPrice(nil); err != nil { log.Error("Cannot update L2 gas price", "msg", err) } - time.Sleep(s.pollInterval) } } @@ -354,7 +355,8 @@ func (s *SyncService) verify() error { // transactions and then updates the EthContext. func (s *SyncService) SequencerLoop() { log.Info("Starting Sequencer Loop", "poll-interval", s.pollInterval, "timestamp-refresh-threshold", s.timestampRefreshThreshold) - for { + t := time.NewTicker(s.pollInterval) + for ; true; <-t.C { if err := s.updateL1GasPrice(); err != nil { log.Error("Cannot update L1 gas price", "msg", err) } @@ -370,7 +372,6 @@ func (s *SyncService) SequencerLoop() { if err := s.updateContext(); err != nil { log.Error("Could not update execution context", "error", err) } - time.Sleep(s.pollInterval) } } From c451060f1ec909820f4d2128e1c9211885f7068d Mon Sep 17 00:00:00 2001 From: Liam Horne Date: Wed, 9 Jun 2021 17:06:20 -0400 Subject: [PATCH 061/125] Enable custom tagging of release docker image (#1048) * ci: enable custom tagging of release docker image * ci: refactor to add prerelease prefix for secuirty * doc: typo --- .github/workflows/publish-canary.yml | 30 ++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish-canary.yml b/.github/workflows/publish-canary.yml index 5669f25dabd7..4bb0ff10cbc6 100644 --- a/.github/workflows/publish-canary.yml +++ b/.github/workflows/publish-canary.yml @@ -2,7 +2,12 @@ name: Publish Packages (canary) on: # enable users to manually trigger with workflow_dispatch - workflow_dispatch: {} + workflow_dispatch: + inputs: + customImageName: + description: 'Custom Docker Image Tag (keep empty for git hash)' + required: false + default: '0.0.0-rc-0' jobs: canary-publish: @@ -66,6 +71,19 @@ jobs: run: | node ops/scripts/ci-versions.js ${{ toJSON(steps.changesets.outputs.publishedPackages) }} + - name: Docker Image Name + id: docker_image_name + run: | + if [ $CUSTOM_IMAGE_NAME == '' ] + then + echo "::set-output name=canary-docker-tag::$GITHUB_SHA_PREFIX" + else + echo "::set-output name=canary-docker-tag::prerelease-$CUSTOM_IMAGE_NAME" + fi + env: + GITHUB_SHA_PREFIX: ${{ GITHUB_SHA::8 }} + CUSTOM_IMAGE_NAME: ${{ github.event.inputs.customImageName }} + # The below code is duplicated, would be ideal if we could use a matrix with a # key/value being dynamically generated from the `publishedPackages` output @@ -155,7 +173,7 @@ jobs: context: . file: ./ops/docker/Dockerfile.message-relayer push: true - tags: ethereumoptimism/message-relayer:${{ GITHUB_SHA::8 }} + tags: ethereumoptimism/message-relayer:${{ steps.docker_image_name.outputs.canary-docker-tag }} batch-submitter: name: Publish Batch Submitter Version ${{ needs.builder.outputs.batch-submitter }} @@ -181,7 +199,7 @@ jobs: context: . file: ./ops/docker/Dockerfile.batch-submitter push: true - tags: ethereumoptimism/batch-submitter:${{ GITHUB_SHA::8 }} + tags: ethereumoptimism/batch-submitter:${{ steps.docker_image_name.outputs.canary-docker-tag }} data-transport-layer: name: Publish Data Transport Layer Version ${{ needs.builder.outputs.data-transport-layer }} @@ -207,7 +225,7 @@ jobs: context: . file: ./ops/docker/Dockerfile.data-transport-layer push: true - tags: ethereumoptimism/data-transport-layer:${{ GITHUB_SHA::8 }} + tags: ethereumoptimism/data-transport-layer:${{ steps.docker_image_name.outputs.canary-docker-tag }} contracts: name: Publish Deployer Version ${{ needs.builder.outputs.contracts }} @@ -233,7 +251,7 @@ jobs: context: . file: ./ops/docker/Dockerfile.deployer push: true - tags: ethereumoptimism/deployer:${{ GITHUB_SHA::8 }} + tags: ethereumoptimism/deployer:${{ steps.docker_image_name.outputs.canary-docker-tag }} integration_tests: name: Publish Integration tests ${{ needs.builder.outputs.integration-tests }} @@ -259,4 +277,4 @@ jobs: context: . file: ./ops/docker/Dockerfile.integration-tests push: true - tags: ethereumoptimism/integration-tests:${{ GITHUB_SHA::8 }} + tags: ethereumoptimism/integration-tests:${{ steps.docker_image_name.outputs.canary-docker-tag }} From f03bb3e5cecc2e1d232e8263b0ba804ab3d761cf Mon Sep 17 00:00:00 2001 From: Liam Horne Date: Wed, 9 Jun 2021 17:09:46 -0400 Subject: [PATCH 062/125] ci: fix indentation issue of canary workflow --- .github/workflows/publish-canary.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-canary.yml b/.github/workflows/publish-canary.yml index 4bb0ff10cbc6..93176ce4360d 100644 --- a/.github/workflows/publish-canary.yml +++ b/.github/workflows/publish-canary.yml @@ -4,10 +4,10 @@ on: # enable users to manually trigger with workflow_dispatch workflow_dispatch: inputs: - customImageName: - description: 'Custom Docker Image Tag (keep empty for git hash)' - required: false - default: '0.0.0-rc-0' + customImageName: + description: 'Custom Docker Image Tag (keep empty for git hash)' + required: false + default: '0.0.0-rc-0' jobs: canary-publish: From 85d5ce136e31b934a3655712bf2cb00c990727cc Mon Sep 17 00:00:00 2001 From: Liam Horne Date: Wed, 9 Jun 2021 17:13:16 -0400 Subject: [PATCH 063/125] ci: fix typo with GITHUB_SHA --- .github/workflows/publish-canary.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/publish-canary.yml b/.github/workflows/publish-canary.yml index 93176ce4360d..d5cb35ddb93f 100644 --- a/.github/workflows/publish-canary.yml +++ b/.github/workflows/publish-canary.yml @@ -76,12 +76,11 @@ jobs: run: | if [ $CUSTOM_IMAGE_NAME == '' ] then - echo "::set-output name=canary-docker-tag::$GITHUB_SHA_PREFIX" + echo "::set-output name=canary-docker-tag::${GITHUB_SHA::8}" else echo "::set-output name=canary-docker-tag::prerelease-$CUSTOM_IMAGE_NAME" fi env: - GITHUB_SHA_PREFIX: ${{ GITHUB_SHA::8 }} CUSTOM_IMAGE_NAME: ${{ github.event.inputs.customImageName }} From cc742715ecbca98248367d67f51a5f03038f5ba2 Mon Sep 17 00:00:00 2001 From: Karl Floersch Date: Wed, 9 Jun 2021 17:26:30 -0400 Subject: [PATCH 064/125] fix: typo in USE_HARDHAT config (#1023) --- .changeset/popular-feet-suffer.md | 5 +++++ packages/batch-submitter/src/exec/run-batch-submitter.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/popular-feet-suffer.md diff --git a/.changeset/popular-feet-suffer.md b/.changeset/popular-feet-suffer.md new file mode 100644 index 000000000000..afb71d29cdb1 --- /dev/null +++ b/.changeset/popular-feet-suffer.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/batch-submitter': patch +--- + +Fix typo in USE_HARDHAT config diff --git a/packages/batch-submitter/src/exec/run-batch-submitter.ts b/packages/batch-submitter/src/exec/run-batch-submitter.ts index d1439d64520f..9174cfab3b44 100644 --- a/packages/batch-submitter/src/exec/run-batch-submitter.ts +++ b/packages/batch-submitter/src/exec/run-batch-submitter.ts @@ -116,7 +116,7 @@ export const run = async () => { logger = new Logger({ name }) } - const useHardhat = config.bool('use-hardhat', !!env.USE_HARDAT) + const useHardhat = config.bool('use-hardhat', !!env.USE_HARDHAT) const DEBUG_IMPERSONATE_SEQUENCER_ADDRESS = config.str( 'debug-impersonate-sequencer-address', env.DEBUG_IMPERSONATE_SEQUENCER_ADDRESS From c2a0489372c2e2b34f779574c4b875d0e39b6e83 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Thu, 10 Jun 2021 15:06:30 -0700 Subject: [PATCH 065/125] fix: abi encoded tx (#1049) * contracts: don't double rlp decode * chore: add changeset * lint: fix * deps: update * linting: cleanup * feat: contracts: use selector * fix: contracts: use typescript * contracts: use interface --- .changeset/witty-chefs-learn.md | 5 + .../OVM/accounts/OVM_ECDSAContractAccount.sol | 41 ++++----- .../predeploys/OVM_SequencerEntrypoint.sol | 7 +- .../accounts/iOVM_ECDSAContractAccount.sol | 4 +- .../libraries/codec/Lib_EIP155Tx.sol | 6 +- packages/contracts/package.json | 1 + .../accounts/OVM_ECDSAContractAccount.spec.ts | 42 +++++---- .../OVM/accounts/OVM_ProxyEOA.spec.ts | 30 ++++-- .../OVM_SequencerEntrypoint.spec.ts | 38 +++++--- .../contracts/test/helpers/types/ovm-types.ts | 24 ++++- yarn.lock | 91 ++++++++++++++++++- 11 files changed, 219 insertions(+), 70 deletions(-) create mode 100644 .changeset/witty-chefs-learn.md diff --git a/.changeset/witty-chefs-learn.md b/.changeset/witty-chefs-learn.md new file mode 100644 index 000000000000..e2b245c416b4 --- /dev/null +++ b/.changeset/witty-chefs-learn.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/contracts': patch +--- + +Do not RLP decode the transaction in the OVM_ECDSAContractAccount diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol index c70902499a5c..dfc65fd183c7 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol @@ -19,7 +19,7 @@ import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol"; /** * @title OVM_ECDSAContractAccount * @dev The ECDSA Contract Account can be used as the implementation for a ProxyEOA deployed by the - * ovmCREATEEOA operation. It enables backwards compatibility with Ethereum's Layer 1, by + * ovmCREATEEOA operation. It enables backwards compatibility with Ethereum's Layer 1, by * providing EIP155 formatted transaction encodings. * * Compiler used: optimistic-solc @@ -49,12 +49,12 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount { /** * Executes a signed transaction. - * @param _encodedTransaction Signed EIP155 transaction. + * @param _transaction Signed EIP155 transaction. * @return Whether or not the call returned (rather than reverted). * @return Data returned by the call. */ function execute( - bytes memory _encodedTransaction + Lib_EIP155Tx.EIP155Tx memory _transaction ) override public @@ -63,23 +63,22 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount { bytes memory ) { - // Attempt to decode the transaction. - Lib_EIP155Tx.EIP155Tx memory transaction = Lib_EIP155Tx.decode( - _encodedTransaction, - Lib_ExecutionManagerWrapper.ovmCHAINID() - ); - // Address of this contract within the ovm (ovmADDRESS) should be the same as the // recovered address of the user who signed this message. This is how we manage to shim // account abstraction even though the user isn't a contract. require( - transaction.sender() == Lib_ExecutionManagerWrapper.ovmADDRESS(), + _transaction.sender() == Lib_ExecutionManagerWrapper.ovmADDRESS(), "Signature provided for EOA transaction execution is invalid." ); + require( + _transaction.chainId == Lib_ExecutionManagerWrapper.ovmCHAINID(), + "Transaction signed with wrong chain ID" + ); + // Need to make sure that the transaction nonce is right. require( - transaction.nonce == Lib_ExecutionManagerWrapper.ovmGETNONCE(), + _transaction.nonce == Lib_ExecutionManagerWrapper.ovmGETNONCE(), "Transaction nonce does not match the expected nonce." ); @@ -94,20 +93,20 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount { require( OVM_ETH(Lib_PredeployAddresses.OVM_ETH).transfer( Lib_PredeployAddresses.SEQUENCER_FEE_WALLET, - SafeMath.mul(transaction.gasLimit, transaction.gasPrice) + SafeMath.mul(_transaction.gasLimit, _transaction.gasPrice) ), "Fee was not transferred to relayer." ); - if (transaction.isCreate) { + if (_transaction.isCreate) { // TEMPORARY: Disable value transfer for contract creations. require( - transaction.value == 0, + _transaction.value == 0, "Value transfer in contract creation not supported." ); (address created, bytes memory revertdata) = Lib_ExecutionManagerWrapper.ovmCREATE( - transaction.data + _transaction.data ); // Return true if the contract creation succeeded, false w/ revertdata otherwise. @@ -123,17 +122,17 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount { Lib_ExecutionManagerWrapper.ovmINCREMENTNONCE(); // Value transfer currently only supported for CALL but not for CREATE. - if (transaction.value > 0) { + if (_transaction.value > 0) { // TEMPORARY: Block value transfer if the transaction has input data. require( - transaction.data.length == 0, + _transaction.data.length == 0, "Value is nonzero but input data was provided." ); require( OVM_ETH(Lib_PredeployAddresses.OVM_ETH).transfer( - transaction.to, - transaction.value + _transaction.to, + _transaction.value ), "Value could not be transferred to recipient." ); @@ -144,11 +143,11 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount { // so that they don't have to pay any fees to the sequencer. Function will remain disabled // until a robust solution is in place. require( - transaction.to != Lib_ExecutionManagerWrapper.ovmADDRESS(), + _transaction.to != Lib_ExecutionManagerWrapper.ovmADDRESS(), "Calls to self are disabled until upgradability is re-enabled." ); - return transaction.to.call(transaction.data); + return _transaction.to.call(_transaction.data); } } } diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerEntrypoint.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerEntrypoint.sol index 895e68a658f0..8581624d75c9 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerEntrypoint.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerEntrypoint.sol @@ -1,9 +1,11 @@ // SPDX-License-Identifier: MIT pragma solidity >0.5.0 <0.8.0; +pragma experimental ABIEncoderV2; /* Library Imports */ import { Lib_EIP155Tx } from "../../libraries/codec/Lib_EIP155Tx.sol"; import { Lib_ExecutionManagerWrapper } from "../../libraries/wrappers/Lib_ExecutionManagerWrapper.sol"; +import { iOVM_ECDSAContractAccount } from "../../iOVM/accounts/iOVM_ECDSAContractAccount.sol"; /** * @title OVM_SequencerEntrypoint @@ -63,10 +65,7 @@ contract OVM_SequencerEntrypoint { // Forward the transaction over to the EOA. (bool success, bytes memory returndata) = target.call( - abi.encodeWithSignature( - "execute(bytes)", - encodedTx - ) + abi.encodeWithSelector(iOVM_ECDSAContractAccount.execute.selector, transaction) ); if (success) { diff --git a/packages/contracts/contracts/optimistic-ethereum/iOVM/accounts/iOVM_ECDSAContractAccount.sol b/packages/contracts/contracts/optimistic-ethereum/iOVM/accounts/iOVM_ECDSAContractAccount.sol index 2b2830577ccf..a7d677159ac8 100644 --- a/packages/contracts/contracts/optimistic-ethereum/iOVM/accounts/iOVM_ECDSAContractAccount.sol +++ b/packages/contracts/contracts/optimistic-ethereum/iOVM/accounts/iOVM_ECDSAContractAccount.sol @@ -3,7 +3,7 @@ pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Library Imports */ -import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; +import { Lib_EIP155Tx } from "../../libraries/codec/Lib_EIP155Tx.sol"; /** * @title iOVM_ECDSAContractAccount @@ -15,7 +15,7 @@ interface iOVM_ECDSAContractAccount { ********************/ function execute( - bytes memory _encodedTransaction + Lib_EIP155Tx.EIP155Tx memory _transaction ) external returns ( diff --git a/packages/contracts/contracts/optimistic-ethereum/libraries/codec/Lib_EIP155Tx.sol b/packages/contracts/contracts/optimistic-ethereum/libraries/codec/Lib_EIP155Tx.sol index d1f64819199e..b96abf5e7cbf 100644 --- a/packages/contracts/contracts/optimistic-ethereum/libraries/codec/Lib_EIP155Tx.sol +++ b/packages/contracts/contracts/optimistic-ethereum/libraries/codec/Lib_EIP155Tx.sol @@ -48,12 +48,12 @@ library Lib_EIP155Tx { // didn't use a uint8, then recovery_parameter would always be a negative number for chain // IDs greater than 110 (`255 - 110 * 2 - 35 = 0`). So we need to wrap around to support // anything larger. - uint8 recoveryParam; + uint8 recoveryParam; // Whether or not the transaction is a creation. Necessary because we can't make an address // "nil". Using the zero address creates a potential conflict if the user did actually // intend to send a transaction to the zero address. - bool isCreate; + bool isCreate; } // Lets us use nicer syntax. @@ -152,7 +152,7 @@ library Lib_EIP155Tx { raw[8] = Lib_RLPWriter.writeBytes32(_transaction.s); } else { // Chain ID *is* included in the unsigned transaction. - raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId); + raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId); raw[7] = Lib_RLPWriter.writeBytes(''); raw[8] = Lib_RLPWriter.writeBytes(''); } diff --git a/packages/contracts/package.json b/packages/contracts/package.json index ec5771a978c3..9ad48bedb2d7 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -60,6 +60,7 @@ "@codechecks/client": "0.1.10-beta", "@eth-optimism/hardhat-ovm": "^0.2.2", "@eth-optimism/smock": "^1.1.3", + "@ethersproject/transactions": "^5.0.31", "@nomiclabs/hardhat-ethers": "^2.0.1", "@nomiclabs/hardhat-waffle": "^2.0.1", "@openzeppelin/contracts": "^3.3.0", diff --git a/packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts b/packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts index caaf33330025..a933fa1134ff 100644 --- a/packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts +++ b/packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts @@ -7,7 +7,7 @@ import { MockContract, smockit } from '@eth-optimism/smock' import { toPlainObject } from 'lodash' /* Internal Imports */ -import { DEFAULT_EIP155_TX } from '../../../helpers' +import { LibEIP155TxStruct, DEFAULT_EIP155_TX } from '../../../helpers' import { predeploys } from '../../../../src' describe('OVM_ECDSAContractAccount', () => { @@ -54,14 +54,18 @@ describe('OVM_ECDSAContractAccount', () => { const transaction = DEFAULT_EIP155_TX const encodedTransaction = await wallet.signTransaction(transaction) - await OVM_ECDSAContractAccount.execute(encodedTransaction) + await OVM_ECDSAContractAccount.execute( + LibEIP155TxStruct(encodedTransaction) + ) }) it(`should ovmCREATE if EIP155Transaction.to is zero address`, async () => { const transaction = { ...DEFAULT_EIP155_TX, to: '' } const encodedTransaction = await wallet.signTransaction(transaction) - await OVM_ECDSAContractAccount.execute(encodedTransaction) + await OVM_ECDSAContractAccount.execute( + LibEIP155TxStruct(encodedTransaction) + ) const ovmCREATE: any = Mock__OVM_ExecutionManager.smocked.ovmCREATE.calls[0] @@ -76,7 +80,7 @@ describe('OVM_ECDSAContractAccount', () => { ) await expect( - OVM_ECDSAContractAccount.execute(encodedTransaction) + OVM_ECDSAContractAccount.execute(LibEIP155TxStruct(encodedTransaction)) ).to.be.revertedWith( 'Signature provided for EOA transaction execution is invalid.' ) @@ -87,7 +91,7 @@ describe('OVM_ECDSAContractAccount', () => { const encodedTransaction = await wallet.signTransaction(transaction) await expect( - OVM_ECDSAContractAccount.execute(encodedTransaction) + OVM_ECDSAContractAccount.execute(LibEIP155TxStruct(encodedTransaction)) ).to.be.revertedWith( 'Transaction nonce does not match the expected nonce.' ) @@ -98,10 +102,8 @@ describe('OVM_ECDSAContractAccount', () => { const encodedTransaction = await wallet.signTransaction(transaction) await expect( - OVM_ECDSAContractAccount.execute(encodedTransaction) - ).to.be.revertedWith( - 'Lib_EIP155Tx: Transaction signed with wrong chain ID' - ) + OVM_ECDSAContractAccount.execute(LibEIP155TxStruct(encodedTransaction)) + ).to.be.revertedWith('Transaction signed with wrong chain ID') }) // TEMPORARY: Skip gas checks for minnet. @@ -109,8 +111,9 @@ describe('OVM_ECDSAContractAccount', () => { const transaction = { ...DEFAULT_EIP155_TX, gasLimit: 200000000 } const encodedTransaction = await wallet.signTransaction(transaction) + const tx = LibEIP155TxStruct(encodedTransaction) await expect( - OVM_ECDSAContractAccount.execute(encodedTransaction, { + OVM_ECDSAContractAccount.execute(tx, { gasLimit: 40000000, }) ).to.be.revertedWith('Gas is not sufficient to execute the transaction.') @@ -122,16 +125,19 @@ describe('OVM_ECDSAContractAccount', () => { Mock__OVM_ETH.smocked.transfer.will.return.with(false) - await expect( - OVM_ECDSAContractAccount.execute(encodedTransaction) - ).to.be.revertedWith('Fee was not transferred to relayer.') + const tx = LibEIP155TxStruct(encodedTransaction) + await expect(OVM_ECDSAContractAccount.execute(tx)).to.be.revertedWith( + 'Fee was not transferred to relayer.' + ) }) it(`should transfer value if value is greater than 0`, async () => { const transaction = { ...DEFAULT_EIP155_TX, value: 1234, data: '0x' } const encodedTransaction = await wallet.signTransaction(transaction) - await OVM_ECDSAContractAccount.execute(encodedTransaction) + await OVM_ECDSAContractAccount.execute( + LibEIP155TxStruct(encodedTransaction) + ) // First call transfers fee, second transfers value (since value > 0). expect( @@ -155,7 +161,7 @@ describe('OVM_ECDSAContractAccount', () => { }) await expect( - OVM_ECDSAContractAccount.execute(encodedTransaction) + OVM_ECDSAContractAccount.execute(LibEIP155TxStruct(encodedTransaction)) ).to.be.revertedWith('Value could not be transferred to recipient.') }) @@ -164,7 +170,7 @@ describe('OVM_ECDSAContractAccount', () => { const encodedTransaction = await wallet.signTransaction(transaction) await expect( - OVM_ECDSAContractAccount.execute(encodedTransaction) + OVM_ECDSAContractAccount.execute(LibEIP155TxStruct(encodedTransaction)) ).to.be.revertedWith('Value transfer in contract creation not supported.') }) @@ -173,7 +179,7 @@ describe('OVM_ECDSAContractAccount', () => { const encodedTransaction = await wallet.signTransaction(transaction) await expect( - OVM_ECDSAContractAccount.execute(encodedTransaction) + OVM_ECDSAContractAccount.execute(LibEIP155TxStruct(encodedTransaction)) ).to.be.revertedWith('Value is nonzero but input data was provided.') }) @@ -184,7 +190,7 @@ describe('OVM_ECDSAContractAccount', () => { const encodedTransaction = await wallet.signTransaction(transaction) await expect( - OVM_ECDSAContractAccount.execute(encodedTransaction) + OVM_ECDSAContractAccount.execute(LibEIP155TxStruct(encodedTransaction)) ).to.be.revertedWith( 'Calls to self are disabled until upgradability is re-enabled.' ) diff --git a/packages/contracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts b/packages/contracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts index a80e97a48cdc..1d5528ec3e89 100644 --- a/packages/contracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts +++ b/packages/contracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts @@ -1,18 +1,22 @@ import { expect } from '../../../setup' /* External Imports */ -import { ethers } from 'hardhat' -import { ContractFactory, Contract, Signer } from 'ethers' +import { ethers, waffle } from 'hardhat' +import { ContractFactory, Contract, Signer, Wallet } from 'ethers' import { MockContract, smockit } from '@eth-optimism/smock' import { toPlainObject } from 'lodash' /* Internal Imports */ import { getContractInterface, predeploys } from '../../../../src' +import { DEFAULT_EIP155_TX, LibEIP155TxStruct } from '../../../helpers' describe('OVM_ProxyEOA', () => { let signer: Signer + let wallet: Wallet before(async () => { ;[signer] = await ethers.getSigners() + const provider = waffle.provider + ;[wallet] = provider.getWallets() }) let Mock__OVM_ExecutionManager: MockContract @@ -67,9 +71,12 @@ describe('OVM_ProxyEOA', () => { describe('fallback()', () => { it(`should call delegateCall with right calldata`, async () => { + const transaction = { ...DEFAULT_EIP155_TX } + const encodedTransaction = await wallet.signTransaction(transaction) + const data = Mock__OVM_ECDSAContractAccount.interface.encodeFunctionData( 'execute', - ['0x12341234'] + [LibEIP155TxStruct(encodedTransaction)] ) await signer.sendTransaction({ @@ -77,11 +84,18 @@ describe('OVM_ProxyEOA', () => { data, }) - expect( - toPlainObject(Mock__OVM_ECDSAContractAccount.smocked.execute.calls[0]) - ).to.deep.include({ - _encodedTransaction: '0x12341234', - }) + const call = toPlainObject( + Mock__OVM_ECDSAContractAccount.smocked.execute.calls[0] + ) + const _transaction = call._transaction + + expect(_transaction[0]).to.deep.equal(transaction.nonce) + expect(_transaction.nonce).to.deep.equal(transaction.nonce) + expect(_transaction.gasPrice).to.deep.equal(transaction.gasPrice) + expect(_transaction.gasLimit).to.deep.equal(transaction.gasLimit) + expect(_transaction.to).to.deep.equal(transaction.to) + expect(_transaction.data).to.deep.equal(transaction.data) + expect(_transaction.isCreate).to.deep.equal(false) }) it.skip(`should return data from fallback`, async () => { diff --git a/packages/contracts/test/contracts/OVM/precompiles/OVM_SequencerEntrypoint.spec.ts b/packages/contracts/test/contracts/OVM/precompiles/OVM_SequencerEntrypoint.spec.ts index 8510e7d09958..920e00705be6 100644 --- a/packages/contracts/test/contracts/OVM/precompiles/OVM_SequencerEntrypoint.spec.ts +++ b/packages/contracts/test/contracts/OVM/precompiles/OVM_SequencerEntrypoint.spec.ts @@ -7,8 +7,12 @@ import { smockit, MockContract, unbind } from '@eth-optimism/smock' import { toPlainObject } from 'lodash' /* Internal Imports */ -import { DEFAULT_EIP155_TX } from '../../../helpers' -import { getContractInterface, predeploys } from '../../../../src' +import { DEFAULT_EIP155_TX, LibEIP155TxStruct } from '../../../helpers' +import { + getContractInterface, + predeploys, + getContractFactory, +} from '../../../../src' describe('OVM_SequencerEntrypoint', () => { const iOVM_ECDSAContractAccount = getContractInterface( @@ -84,11 +88,16 @@ describe('OVM_SequencerEntrypoint', () => { data: encodedTransaction, }) - expect( - toPlainObject(Mock__wallet.smocked.execute.calls[0]) - ).to.deep.include({ - _encodedTransaction: encodedTransaction, - }) + const call = toPlainObject(Mock__wallet.smocked.execute.calls[0]) + const _transaction = call._transaction + + expect(_transaction[0]).to.deep.equal(transaction.nonce) + expect(_transaction.nonce).to.deep.equal(transaction.nonce) + expect(_transaction.gasPrice).to.deep.equal(transaction.gasPrice) + expect(_transaction.gasLimit).to.deep.equal(transaction.gasLimit) + expect(_transaction.to).to.deep.equal(transaction.to) + expect(_transaction.data).to.deep.equal(transaction.data) + expect(_transaction.isCreate).to.deep.equal(false) }) it('should send correct calldata if tx is a create', async () => { @@ -104,11 +113,16 @@ describe('OVM_SequencerEntrypoint', () => { data: encodedTransaction, }) - expect( - toPlainObject(Mock__wallet.smocked.execute.calls[0]) - ).to.deep.include({ - _encodedTransaction: encodedTransaction, - }) + const call = toPlainObject(Mock__wallet.smocked.execute.calls[0]) + const _transaction = call._transaction + + expect(_transaction[0]).to.deep.equal(transaction.nonce) + expect(_transaction.nonce).to.deep.equal(transaction.nonce) + expect(_transaction.gasPrice).to.deep.equal(transaction.gasPrice) + expect(_transaction.gasLimit).to.deep.equal(transaction.gasLimit) + expect(_transaction.to).to.deep.equal(ethers.constants.AddressZero) + expect(_transaction.data).to.deep.equal(transaction.data) + expect(_transaction.isCreate).to.deep.equal(true) }) }) }) diff --git a/packages/contracts/test/helpers/types/ovm-types.ts b/packages/contracts/test/helpers/types/ovm-types.ts index 73de4f75446b..8ffa8989590c 100644 --- a/packages/contracts/test/helpers/types/ovm-types.ts +++ b/packages/contracts/test/helpers/types/ovm-types.ts @@ -1,5 +1,6 @@ /* External Imports */ -import { BigNumber } from 'ethers' +import { BigNumber, constants } from 'ethers' +import { parse, Transaction } from '@ethersproject/transactions' export interface OVMAccount { nonce: number | BigNumber @@ -8,3 +9,24 @@ export interface OVMAccount { codeHash: string ethAddress: string } + +export const LibEIP155TxStruct = (tx: Transaction | string): Array => { + if (typeof tx === 'string') { + tx = parse(tx) + } + const values = [ + tx.nonce, + tx.gasPrice, + tx.gasLimit, + tx.to ? tx.to : constants.AddressZero, + tx.value, + tx.data, + tx.v % 256, + tx.r, + tx.s, + tx.chainId, + tx.v === 0 ? 0 : tx.v - 2 * tx.chainId - 35, + tx.to === null, + ] + return values +} diff --git a/yarn.lock b/yarn.lock index 678b6dfabc8f..fa0b9717ae75 100644 --- a/yarn.lock +++ b/yarn.lock @@ -481,6 +481,17 @@ "@ethersproject/logger" "^5.1.0" "@ethersproject/rlp" "^5.1.0" +"@ethersproject/address@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.3.0.tgz#e53b69eacebf332e8175de814c5e6507d6932518" + integrity sha512-29TgjzEBK+gUEUAOfWCG7s9IxLNLCqvr+oDSk6L9TXD0VLvZJKhJV479tKQqheVA81OeGxfpdxYtUVH8hqlCvA== + dependencies: + "@ethersproject/bignumber" "^5.3.0" + "@ethersproject/bytes" "^5.3.0" + "@ethersproject/keccak256" "^5.3.0" + "@ethersproject/logger" "^5.3.0" + "@ethersproject/rlp" "^5.3.0" + "@ethersproject/base64@5.1.0", "@ethersproject/base64@^5.0.0", "@ethersproject/base64@^5.1.0": version "5.1.0" resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.1.0.tgz#27240c174d0a4e13f6eae87416fd876caf7f42b6" @@ -505,6 +516,15 @@ "@ethersproject/logger" "^5.1.0" bn.js "^4.4.0" +"@ethersproject/bignumber@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.3.0.tgz#74ab2ec9c3bda4e344920565720a6ee9c794e9db" + integrity sha512-5xguJ+Q1/zRMgHgDCaqAexx/8DwDVLRemw2i6uR8KyGjwGdXI8f32QZZ1cKGucBN6ekJvpUpHy6XAuQnTv0mPA== + dependencies: + "@ethersproject/bytes" "^5.3.0" + "@ethersproject/logger" "^5.3.0" + bn.js "^4.11.9" + "@ethersproject/bytes@5.1.0", "@ethersproject/bytes@>=5.0.0-beta.129", "@ethersproject/bytes@^5.0.0", "@ethersproject/bytes@^5.0.2", "@ethersproject/bytes@^5.1.0": version "5.1.0" resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.1.0.tgz#55dfa9c4c21df1b1b538be3accb50fb76d5facfd" @@ -512,6 +532,13 @@ dependencies: "@ethersproject/logger" "^5.1.0" +"@ethersproject/bytes@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.3.0.tgz#473e0da7f831d535b2002be05e6f4ca3729a1bc9" + integrity sha512-rqLJjdVqCcn7glPer7Fxh87PRqlnRScVAoxcIP3PmOUNApMWJ6yRdOFfo2KvPAdO7Le3yEI1o0YW+Yvr7XCYvw== + dependencies: + "@ethersproject/logger" "^5.3.0" + "@ethersproject/constants@5.1.0", "@ethersproject/constants@>=5.0.0-beta.128", "@ethersproject/constants@^5.0.0", "@ethersproject/constants@^5.1.0": version "5.1.0" resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.1.0.tgz#4e7da6367ea0e9be87585d8b09f3fccf384b1452" @@ -519,6 +546,13 @@ dependencies: "@ethersproject/bignumber" "^5.1.0" +"@ethersproject/constants@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.3.0.tgz#a5d6d86c0eec2c64c3024479609493b9afb3fc77" + integrity sha512-4y1feNOwEpgjAfiCFWOHznvv6qUF/H6uI0UKp8xdhftb+H+FbKflXg1pOgH5qs4Sr7EYBL+zPyPb+YD5g1aEyw== + dependencies: + "@ethersproject/bignumber" "^5.3.0" + "@ethersproject/contracts@5.1.0", "@ethersproject/contracts@^5.0.0", "@ethersproject/contracts@^5.0.2", "@ethersproject/contracts@^5.0.5": version "5.1.0" resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.1.0.tgz#f7c3451f1af77e029005733ccab3419d07d23f6b" @@ -606,11 +640,24 @@ "@ethersproject/bytes" "^5.1.0" js-sha3 "0.5.7" +"@ethersproject/keccak256@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.3.0.tgz#fb5cd36bdfd6fa02e2ea84964078a9fc6bd731be" + integrity sha512-Gv2YqgIUmRbYVNIibafT0qGaeGYLIA/EdWHJ7JcVxVSs2vyxafGxOJ5VpSBHWeOIsE6OOaCelYowhuuTicgdFQ== + dependencies: + "@ethersproject/bytes" "^5.3.0" + js-sha3 "0.5.7" + "@ethersproject/logger@5.1.0", "@ethersproject/logger@>=5.0.0-beta.129", "@ethersproject/logger@^5.0.0", "@ethersproject/logger@^5.1.0": version "5.1.0" resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.1.0.tgz#4cdeeefac029373349d5818f39c31b82cc6d9bbf" integrity sha512-wtUaD1lBX10HBXjjKV9VHCBnTdUaKQnQ2XSET1ezglqLdPdllNOIlLfhyCRqXm5xwcjExVI5ETokOYfjPtaAlw== +"@ethersproject/logger@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.3.0.tgz#7a69fa1d4ca0d4b7138da1627eb152f763d84dd0" + integrity sha512-8bwJ2gxJGkZZnpQSq5uSiZSJjyVTWmlGft4oH8vxHdvO1Asy4TwVepAhPgxIQIMxXZFUNMych1YjIV4oQ4I7dA== + "@ethersproject/networks@5.1.0", "@ethersproject/networks@^5.0.0", "@ethersproject/networks@^5.1.0": version "5.1.0" resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.1.0.tgz#f537290cb05aa6dc5e81e910926c04cfd5814bca" @@ -633,6 +680,13 @@ dependencies: "@ethersproject/logger" "^5.1.0" +"@ethersproject/properties@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.3.0.tgz#feef4c4babeb7c10a6b3449575016f4ad2c092b2" + integrity sha512-PaHxJyM5/bfusk6vr3yP//JMnm4UEojpzuWGTmtL5X4uNhNnFNvlYilZLyDr4I9cTkIbipCMsAuIcXWsmdRnEw== + dependencies: + "@ethersproject/logger" "^5.3.0" + "@ethersproject/providers@5.1.0", "@ethersproject/providers@^5.0.0", "@ethersproject/providers@^5.0.14", "@ethersproject/providers@^5.0.21", "@ethersproject/providers@^5.0.24", "@ethersproject/providers@^5.0.5": version "5.1.0" resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.1.0.tgz#27695a02cfafa370428cde1c7a4abab13afb6a35" @@ -674,6 +728,14 @@ "@ethersproject/bytes" "^5.1.0" "@ethersproject/logger" "^5.1.0" +"@ethersproject/rlp@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.3.0.tgz#7cb93a7b5dfa69163894153c9d4b0d936f333188" + integrity sha512-oI0joYpsRanl9guDubaW+1NbcpK0vJ3F/6Wpcanzcnqq+oaW9O5E98liwkEDPcb16BUTLIJ+ZF8GPIHYxJ/5Pw== + dependencies: + "@ethersproject/bytes" "^5.3.0" + "@ethersproject/logger" "^5.3.0" + "@ethersproject/sha2@5.1.0", "@ethersproject/sha2@^5.0.0", "@ethersproject/sha2@^5.1.0": version "5.1.0" resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.1.0.tgz#6ca42d1a26884b3e32ffa943fe6494af7211506c" @@ -694,6 +756,18 @@ bn.js "^4.4.0" elliptic "6.5.4" +"@ethersproject/signing-key@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.3.0.tgz#a96c88f8173e1abedfa35de32d3e5db7c48e5259" + integrity sha512-+DX/GwHAd0ok1bgedV1cKO0zfK7P/9aEyNoaYiRsGHpCecN7mhLqcdoUiUzE7Uz86LBsxm5ssK0qA1kBB47fbQ== + dependencies: + "@ethersproject/bytes" "^5.3.0" + "@ethersproject/logger" "^5.3.0" + "@ethersproject/properties" "^5.3.0" + bn.js "^4.11.9" + elliptic "6.5.4" + hash.js "1.1.7" + "@ethersproject/solidity@5.1.0", "@ethersproject/solidity@^5.0.0", "@ethersproject/solidity@^5.0.2": version "5.1.0" resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.1.0.tgz#095a9c75244edccb26c452c155736d363399b954" @@ -744,6 +818,21 @@ "@ethersproject/rlp" "^5.1.0" "@ethersproject/signing-key" "^5.1.0" +"@ethersproject/transactions@^5.0.31": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.3.0.tgz#49b86f2bafa4d0bdf8e596578fc795ee47c50458" + integrity sha512-cdfK8VVyW2oEBCXhURG0WQ6AICL/r6Gmjh0e4Bvbv6MCn/GBd8FeBH3rtl7ho+AW50csMKeGv3m3K1HSHB2jMQ== + dependencies: + "@ethersproject/address" "^5.3.0" + "@ethersproject/bignumber" "^5.3.0" + "@ethersproject/bytes" "^5.3.0" + "@ethersproject/constants" "^5.3.0" + "@ethersproject/keccak256" "^5.3.0" + "@ethersproject/logger" "^5.3.0" + "@ethersproject/properties" "^5.3.0" + "@ethersproject/rlp" "^5.3.0" + "@ethersproject/signing-key" "^5.3.0" + "@ethersproject/units@5.1.0", "@ethersproject/units@^5.0.0": version "5.1.0" resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.1.0.tgz#b6ab3430ebc22adc3cb4839516496f167bee3ad5" @@ -7269,7 +7358,7 @@ hash.js@1.1.3: inherits "^2.0.3" minimalistic-assert "^1.0.0" -hash.js@^1.0.0, hash.js@^1.0.3, hash.js@^1.1.7: +hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3, hash.js@^1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== From cc6c7f0794831e9ed4760b5b3a178914269f723c Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Thu, 10 Jun 2021 15:51:08 -0700 Subject: [PATCH 066/125] l2geth: bump to go 1.15 (#1058) * l2geth: bump to go 1.15 * chore: add changeset --- .changeset/grumpy-spiders-yell.md | 5 +++++ l2geth/go.mod | 2 +- ops/docker/Dockerfile.geth | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/grumpy-spiders-yell.md diff --git a/.changeset/grumpy-spiders-yell.md b/.changeset/grumpy-spiders-yell.md new file mode 100644 index 000000000000..c231b337cf97 --- /dev/null +++ b/.changeset/grumpy-spiders-yell.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/l2geth': patch +--- + +Bump golang version to 1.15 diff --git a/l2geth/go.mod b/l2geth/go.mod index 47277f950dba..d8239f1d0c52 100644 --- a/l2geth/go.mod +++ b/l2geth/go.mod @@ -1,6 +1,6 @@ module github.com/ethereum/go-ethereum -go 1.13 +go 1.15 require ( github.com/Azure/azure-pipeline-go v0.2.2 // indirect diff --git a/ops/docker/Dockerfile.geth b/ops/docker/Dockerfile.geth index 03f4a8b25bff..9b52339f9dd6 100644 --- a/ops/docker/Dockerfile.geth +++ b/ops/docker/Dockerfile.geth @@ -1,5 +1,5 @@ # Build Geth in a stock Go builder container -FROM golang:1.14-alpine as builder +FROM golang:1.15-alpine as builder RUN apk add --no-cache make gcc musl-dev linux-headers git From 98b7839f6d49cc9780277f8b5c9ebb93d34a0a62 Mon Sep 17 00:00:00 2001 From: Liam Horne Date: Thu, 10 Jun 2021 18:56:52 -0400 Subject: [PATCH 067/125] Change monotonicity band-aid code to log warnings not errors (#1060) * refactor: change monotonicity band-aid code to log warnings not errors * build: add changeset --- .changeset/shaggy-dogs-attend.md | 5 +++++ .../src/batch-submitter/tx-batch-submitter.ts | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .changeset/shaggy-dogs-attend.md diff --git a/.changeset/shaggy-dogs-attend.md b/.changeset/shaggy-dogs-attend.md new file mode 100644 index 000000000000..66480b391ab0 --- /dev/null +++ b/.changeset/shaggy-dogs-attend.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/batch-submitter': patch +--- + +Change monotonicity band-aid code to log warnings not errors diff --git a/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts b/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts index bdcc59db48ed..7515b1028b62 100644 --- a/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts +++ b/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts @@ -469,7 +469,7 @@ export class TransactionBatchSubmitter extends BatchSubmitter { ] = await this.chainContract.getQueueElement(nextQueueIndex) if (timestamp < ele.timestamp || blockNumber < ele.blockNumber) { - this.logger.error('Fixing skipped deposit', { + this.logger.warn('Fixing skipped deposit', { badTimestamp: ele.timestamp, skippedQueueTimestamp: timestamp, badBlockNumber: ele.blockNumber, @@ -563,7 +563,7 @@ export class TransactionBatchSubmitter extends BatchSubmitter { ele.timestamp < earliestTimestamp || ele.blockNumber < earliestBlockNumber ) { - this.logger.error('Fixing timestamp/blockNumber too small', { + this.logger.warn('Fixing timestamp/blockNumber too small', { oldTimestamp: ele.timestamp, newTimestamp: earliestTimestamp, oldBlockNumber: ele.blockNumber, @@ -581,7 +581,7 @@ export class TransactionBatchSubmitter extends BatchSubmitter { ele.timestamp > latestTimestamp || ele.blockNumber > latestBlockNumber ) { - this.logger.error('Fixing timestamp/blockNumber too large.', { + this.logger.warn('Fixing timestamp/blockNumber too large.', { oldTimestamp: ele.timestamp, newTimestamp: latestTimestamp, oldBlockNumber: ele.blockNumber, From e04de624cd0593e90189d3444bfbe30eb9ef3a4d Mon Sep 17 00:00:00 2001 From: ben-chain Date: Thu, 10 Jun 2021 19:37:27 -0400 Subject: [PATCH 068/125] feat(contracts, l2geth): native ETH value support for ovmCALL (#1038) * feat(contracts): add ovmCALL-types with native value * add ovmCALLVALUE context * add ovmBALANCE * test success and revert cases * test empty contract case * chore: lint * test(integration-tests): ovmCALL-types with value (compiler and wrapper) * fix ovmDELEGATECALL type, update tests * add ovmSELFBALANCE * fix ovmDELEGATECALL jumping to CALL * chore: lint * fix(contracts): account for intrinsic gas of OVM_ETH sends * fix(contracts): merge conflict bug * fix(contracts): update gas benchmark * feat(contracts, integration-tests): use new value-compatible compiler * feat(contracts,l2geth): support value calls in OVM_ECDSAContractAccount * fix(contracts): ovmDELEGATECALL does not change message context * feat(contracts): sending value between EOAs * test(integration-tests): ovmDELEGATECALL preserves ovmCALLVALUE * test(integration-tests): assert ovmSELFBALANCEs correct * test(integration-tests): intrinsic gas for eth value calls * test(integration-tests): update gas values * chore(contracts): lint * feat(contracts, l2geth): eth_calls with nonzero value * chore: minor fixups and comments based on PR feedback * test(integration-tests): add requested tests from PR reviews * test(integration-tests): ovmSELFBALANCE is preserved in ovmDELEGATECALLs * fix(contracts): fix bug where ovmDELEGATECALL could fail if balance was lower than the ovmCALLVALUE * chore: add changeset * fix(contracts): update intrinsic gas for worst-case value sends * chore: address final PR nits/improvements Co-authored-by: Kelvin Fichter --- .changeset/quiet-ladybugs-burn.md | 7 + integration-tests/contracts/TestOOG.sol | 8 +- integration-tests/contracts/ValueCalls.sol | 131 +++++ integration-tests/hardhat.config.ts | 2 +- .../test/native-eth-ovm-calls.spec.ts | 454 ++++++++++++++++++ integration-tests/test/native-eth.spec.ts | 8 +- integration-tests/test/rpc.spec.ts | 36 +- l2geth/core/state_transition_ovm.go | 6 + l2geth/eth/api_backend.go | 8 - .../OVM/accounts/OVM_ECDSAContractAccount.sol | 47 +- .../OVM/accounts/OVM_ProxyEOA.sol | 1 + .../OVM/execution/OVM_ExecutionManager.sol | 344 +++++++++++-- .../OVM_ExecutionManagerWrapper.sol | 1 + .../iOVM/execution/iOVM_ExecutionManager.sol | 20 + .../wrappers/Lib_ExecutionManagerWrapper.sol | 76 +++ packages/contracts/hardhat.config.ts | 2 +- .../accounts/OVM_ECDSAContractAccount.spec.ts | 69 +-- .../OVM/accounts/OVM_ProxyEOA.spec.ts | 2 +- .../OVM_ExecutionManager.gas-spec.ts | 2 +- .../OVM_ExecutionManager/native-eth.spec.ts | 343 +++++++++++++ .../test/helpers/test-runner/test-runner.ts | 92 +++- .../test/helpers/test-runner/test.types.ts | 31 +- 22 files changed, 1553 insertions(+), 137 deletions(-) create mode 100644 .changeset/quiet-ladybugs-burn.md create mode 100644 integration-tests/contracts/ValueCalls.sol create mode 100644 integration-tests/test/native-eth-ovm-calls.spec.ts create mode 100644 packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/native-eth.spec.ts diff --git a/.changeset/quiet-ladybugs-burn.md b/.changeset/quiet-ladybugs-burn.md new file mode 100644 index 000000000000..e1feefe6f800 --- /dev/null +++ b/.changeset/quiet-ladybugs-burn.md @@ -0,0 +1,7 @@ +--- +'@eth-optimism/integration-tests': minor +'@eth-optimism/l2geth': minor +'@eth-optimism/contracts': minor +--- + +Add support for ovmCALL with nonzero ETH value diff --git a/integration-tests/contracts/TestOOG.sol b/integration-tests/contracts/TestOOG.sol index 87fa638f1cb6..2f2a1377dfb1 100644 --- a/integration-tests/contracts/TestOOG.sol +++ b/integration-tests/contracts/TestOOG.sol @@ -2,10 +2,16 @@ pragma solidity >=0.7.0; contract TestOOG { - constructor() { + function runOutOfGas() public { bytes32 h; for (uint256 i = 0; i < 100000; i++) { h = keccak256(abi.encodePacked(h)); } } } + +contract TestOOGInConstructor is TestOOG { + constructor() { + runOutOfGas(); + } +} diff --git a/integration-tests/contracts/ValueCalls.sol b/integration-tests/contracts/ValueCalls.sol new file mode 100644 index 000000000000..e7de67f680ab --- /dev/null +++ b/integration-tests/contracts/ValueCalls.sol @@ -0,0 +1,131 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.7.0; + +contract ValueContext { + function getSelfBalance() external payable returns(uint256) { + uint selfBalance; + assembly { + selfBalance := selfbalance() + } + return selfBalance; + } + + function getAddressThisBalance() external view returns(uint256) { + return address(this).balance; + } + + function getBalance( + address _address + ) external payable returns(uint256) { + return _address.balance; + } + + function getCallValue() public payable returns(uint256) { + return msg.value; + } +} + +contract ValueCalls is ValueContext { + receive() external payable {} + + function nonPayable() external {} + + function simpleSend( + address _address, + uint _value + ) external payable returns (bool, bytes memory) { + return sendWithData(_address, _value, hex""); + } + + function sendWithDataAndGas( + address _address, + uint _value, + uint _gasLimit, + bytes memory _calldata + ) public returns (bool, bytes memory) { + return _address.call{value: _value, gas: _gasLimit}(_calldata); + } + + function sendWithData( + address _address, + uint _value, + bytes memory _calldata + ) public returns (bool, bytes memory) { + return _address.call{value: _value}(_calldata); + } + + function verifyCallValueAndRevert( + uint256 _expectedValue + ) external payable { + bool correct = _checkCallValue(_expectedValue); + // do the opposite of expected if the value is wrong. + if (correct) { + revert("expected revert"); + } else { + return; + } + } + + function verifyCallValueAndReturn( + uint256 _expectedValue + ) external payable { + bool correct = _checkCallValue(_expectedValue); + // do the opposite of expected if the value is wrong. + if (correct) { + return; + } else { + revert("unexpected revert"); + } + } + + function delegateCallToCallValue( + address _valueContext + ) public payable returns(bool, bytes memory) { + bytes memory data = abi.encodeWithSelector(ValueContext.getCallValue.selector); + return _valueContext.delegatecall(data); + } + + function delegateCallToAddressThisBalance( + address _valueContext + ) public payable returns(bool, bytes memory) { + bytes memory data = abi.encodeWithSelector(ValueContext.getAddressThisBalance.selector); + return _valueContext.delegatecall(data); + } + + function _checkCallValue( + uint256 _expectedValue + ) internal returns(bool) { + return getCallValue() == _expectedValue; + } +} + +contract ValueGasMeasurer { + function measureGasOfTransferingEthViaCall( + address target, + uint256 value, + uint256 gasLimit + ) public returns(uint256) { + uint256 gasBefore = gasleft(); + assembly { + pop(call(gasLimit, target, value, 0, 0, 0, 0)) + } + return gasBefore - gasleft(); + } +} + +contract PayableConstant { + function returnValue() external payable returns(uint256) { + return 42; + } +} + +contract SendETHAwayAndDelegateCall { + function emptySelfAndDelegateCall( + address _delegateTo, + bytes memory _data + ) public payable returns (bool, bytes memory) { + address(0).call{value: address(this).balance}(_data); + + return _delegateTo.delegatecall(_data); + } +} diff --git a/integration-tests/hardhat.config.ts b/integration-tests/hardhat.config.ts index 0fcc9b23325f..50c0b7b2756e 100644 --- a/integration-tests/hardhat.config.ts +++ b/integration-tests/hardhat.config.ts @@ -20,7 +20,7 @@ const config: HardhatUserConfig = { }, solidity: '0.7.6', ovm: { - solcVersion: '0.7.6', + solcVersion: '0.7.6+commit.3b061308', }, gasReporter: { enabled: enableGasReport, diff --git a/integration-tests/test/native-eth-ovm-calls.spec.ts b/integration-tests/test/native-eth-ovm-calls.spec.ts new file mode 100644 index 000000000000..13d64ef1d79e --- /dev/null +++ b/integration-tests/test/native-eth-ovm-calls.spec.ts @@ -0,0 +1,454 @@ +import { BigNumber, Contract, ContractFactory, Wallet } from 'ethers' +import { ethers } from 'hardhat' +import chai, { expect } from 'chai' +import { GWEI, fundUser, encodeSolidityRevertMessage } from './shared/utils' +import { OptimismEnv } from './shared/env' +import { solidity } from 'ethereum-waffle' +import { sleep } from '../../packages/core-utils/dist' +import { + getContractFactory, + getContractInterface, +} from '../../packages/contracts/dist' +import { Interface } from 'ethers/lib/utils' + +chai.use(solidity) + +describe('Native ETH value integration tests', () => { + let env: OptimismEnv + let wallet: Wallet + let other: Wallet + + before(async () => { + env = await OptimismEnv.new() + wallet = env.l2Wallet + other = Wallet.createRandom().connect(wallet.provider) + }) + + it('should allow an L2 EOA to send to a new account and back again', async () => { + const getBalances = async (): Promise => { + return [ + await wallet.provider.getBalance(wallet.address), + await wallet.provider.getBalance(other.address), + ] + } + + const checkBalances = async ( + expectedBalances: BigNumber[] + ): Promise => { + const realBalances = await getBalances() + expect(realBalances[0]).to.deep.eq(expectedBalances[0]) + expect(realBalances[1]).to.deep.eq(expectedBalances[1]) + } + + const value = 10 + await fundUser(env.watcher, env.gateway, value, wallet.address) + + const initialBalances = await getBalances() + + const there = await wallet.sendTransaction({ + to: other.address, + value, + gasPrice: 0, + }) + await there.wait() + + await checkBalances([ + initialBalances[0].sub(value), + initialBalances[1].add(value), + ]) + + const backAgain = await other.sendTransaction({ + to: wallet.address, + value, + gasPrice: 0, + }) + await backAgain.wait() + + await checkBalances(initialBalances) + }) + + describe(`calls between OVM contracts with native ETH value and relevant opcodes`, async () => { + const initialBalance0 = 42000 + + let Factory__ValueCalls: ContractFactory + let ValueCalls0: Contract + let ValueCalls1: Contract + + const checkBalances = async (expectedBalances: number[]) => { + // query geth as one check + const balance0 = await wallet.provider.getBalance(ValueCalls0.address) + const balance1 = await wallet.provider.getBalance(ValueCalls1.address) + expect(balance0).to.deep.eq(BigNumber.from(expectedBalances[0])) + expect(balance1).to.deep.eq(BigNumber.from(expectedBalances[1])) + // query ovmBALANCE() opcode via eth_call as another check + const ovmBALANCE0 = await ValueCalls0.callStatic.getBalance( + ValueCalls0.address + ) + const ovmBALANCE1 = await ValueCalls0.callStatic.getBalance( + ValueCalls1.address + ) + expect(ovmBALANCE0).to.deep.eq( + BigNumber.from(expectedBalances[0]), + 'geth RPC does not match ovmBALANCE' + ) + expect(ovmBALANCE1).to.deep.eq( + BigNumber.from(expectedBalances[1]), + 'geth RPC does not match ovmBALANCE' + ) + // query ovmSELFBALANCE() opcode via eth_call as another check + const ovmSELFBALANCE0 = await ValueCalls0.callStatic.getSelfBalance() + const ovmSELFBALANCE1 = await ValueCalls1.callStatic.getSelfBalance() + expect(ovmSELFBALANCE0).to.deep.eq( + BigNumber.from(expectedBalances[0]), + 'geth RPC does not match ovmSELFBALANCE' + ) + expect(ovmSELFBALANCE1).to.deep.eq( + BigNumber.from(expectedBalances[1]), + 'geth RPC does not match ovmSELFBALANCE' + ) + // query ovmSELFBALANCE() opcode via eth_call as another check + const ovmEthBalanceOf0 = await env.ovmEth.balanceOf(ValueCalls0.address) + const ovmEthBalanceOf1 = await env.ovmEth.balanceOf(ValueCalls1.address) + expect(ovmEthBalanceOf0).to.deep.eq( + BigNumber.from(expectedBalances[0]), + 'geth RPC does not match OVM_ETH.balanceOf' + ) + expect(ovmEthBalanceOf1).to.deep.eq( + BigNumber.from(expectedBalances[1]), + 'geth RPC does not match OVM_ETH.balanceOf' + ) + // query address(this).balance solidity via eth_call as final check + const ovmAddressThisBalance0 = await ValueCalls0.callStatic.getAddressThisBalance() + const ovmAddressThisBalance01 = await ValueCalls1.callStatic.getAddressThisBalance() + expect(ovmAddressThisBalance0).to.deep.eq( + BigNumber.from(expectedBalances[0]), + 'geth RPC does not match address(this).balance' + ) + expect(ovmAddressThisBalance01).to.deep.eq( + BigNumber.from(expectedBalances[1]), + 'geth RPC does not match address(this).balance' + ) + } + + before(async () => { + Factory__ValueCalls = await ethers.getContractFactory( + 'ValueCalls', + wallet + ) + }) + + beforeEach(async () => { + ValueCalls0 = await Factory__ValueCalls.deploy() + ValueCalls1 = await Factory__ValueCalls.deploy() + await fundUser( + env.watcher, + env.gateway, + initialBalance0, + ValueCalls0.address + ) + // These tests ass assume ValueCalls0 starts with a balance, but ValueCalls1 does not. + await checkBalances([initialBalance0, 0]) + }) + + it('should allow ETH to be sent', async () => { + const sendAmount = 15 + const tx = await ValueCalls0.simpleSend(ValueCalls1.address, sendAmount, { + gasPrice: 0, + }) + await tx.wait() + + await checkBalances([initialBalance0 - sendAmount, sendAmount]) + }) + + it('should revert if a function is nonpayable', async () => { + const sendAmount = 15 + const [success, returndata] = await ValueCalls0.callStatic.sendWithData( + ValueCalls1.address, + sendAmount, + ValueCalls1.interface.encodeFunctionData('nonPayable') + ) + + expect(success).to.be.false + expect(returndata).to.eq('0x') + }) + + it('should allow ETH to be sent and have the correct ovmCALLVALUE', async () => { + const sendAmount = 15 + const [success, returndata] = await ValueCalls0.callStatic.sendWithData( + ValueCalls1.address, + sendAmount, + ValueCalls1.interface.encodeFunctionData('getCallValue') + ) + + expect(success).to.be.true + expect(BigNumber.from(returndata)).to.deep.eq(BigNumber.from(sendAmount)) + }) + + it('should have the correct ovmSELFBALANCE which includes the msg.value', async () => { + // give an initial balance which the ovmCALLVALUE should be added to when calculating ovmSELFBALANCE + const initialBalance = 10 + await fundUser( + env.watcher, + env.gateway, + initialBalance, + ValueCalls1.address + ) + + const sendAmount = 15 + const [success, returndata] = await ValueCalls0.callStatic.sendWithData( + ValueCalls1.address, + sendAmount, + ValueCalls1.interface.encodeFunctionData('getSelfBalance') + ) + + expect(success).to.be.true + expect(BigNumber.from(returndata)).to.deep.eq( + BigNumber.from(initialBalance + sendAmount) + ) + }) + + it('should have the correct callvalue but not persist the transfer if the target reverts', async () => { + const sendAmount = 15 + const internalCalldata = ValueCalls1.interface.encodeFunctionData( + 'verifyCallValueAndRevert', + [sendAmount] + ) + const [success, returndata] = await ValueCalls0.callStatic.sendWithData( + ValueCalls1.address, + sendAmount, + internalCalldata + ) + + expect(success).to.be.false + expect(returndata).to.eq(encodeSolidityRevertMessage('expected revert')) + + await checkBalances([initialBalance0, 0]) + }) + + it('should look like the subcall reverts with no data if value exceeds balance', async () => { + const sendAmount = initialBalance0 + 1 + const internalCalldata = ValueCalls1.interface.encodeFunctionData( + 'verifyCallValueAndReturn', + [sendAmount] // this would be correct and return successfuly, IF it could get here + ) + const [success, returndata] = await ValueCalls0.callStatic.sendWithData( + ValueCalls1.address, + sendAmount, + internalCalldata + ) + + expect(success).to.be.false + expect(returndata).to.eq('0x') + }) + + it('should preserve msg.value through ovmDELEGATECALLs', async () => { + const Factory__ValueContext = await ethers.getContractFactory( + 'ValueContext', + wallet + ) + const ValueContext = await Factory__ValueContext.deploy() + await ValueContext.deployTransaction.wait() + + const sendAmount = 10 + + const [ + outerSuccess, + outerReturndata, + ] = await ValueCalls0.callStatic.sendWithData( + ValueCalls1.address, + sendAmount, + ValueCalls1.interface.encodeFunctionData('delegateCallToCallValue', [ + ValueContext.address, + ]) + ) + const [ + innerSuccess, + innerReturndata, + ] = ValueCalls1.interface.decodeFunctionResult( + 'delegateCallToCallValue', + outerReturndata + ) + const delegatedOvmCALLVALUE = ValueContext.interface.decodeFunctionResult( + 'getCallValue', + innerReturndata + )[0] + + expect(outerSuccess).to.be.true + expect(innerSuccess).to.be.true + expect(delegatedOvmCALLVALUE).to.deep.eq(BigNumber.from(sendAmount)) + }) + + it('should have correct address(this).balance through ovmDELEGATECALLs to another account', async () => { + const Factory__ValueContext = await ethers.getContractFactory( + 'ValueContext', + wallet + ) + const ValueContext = await Factory__ValueContext.deploy() + await ValueContext.deployTransaction.wait() + + const [ + delegatedSuccess, + delegatedReturndata, + ] = await ValueCalls0.callStatic.delegateCallToAddressThisBalance( + ValueContext.address + ) + + expect(delegatedSuccess).to.be.true + expect(delegatedReturndata).to.deep.eq(BigNumber.from(initialBalance0)) + }) + + it('should have correct address(this).balance through ovmDELEGATECALLs to same account', async () => { + const [ + delegatedSuccess, + delegatedReturndata, + ] = await ValueCalls0.callStatic.delegateCallToAddressThisBalance( + ValueCalls0.address + ) + + expect(delegatedSuccess).to.be.true + expect(delegatedReturndata).to.deep.eq(BigNumber.from(initialBalance0)) + }) + + it('should allow delegate calls which preserve msg.value even with no balance going into the inner call', async () => { + const Factory__SendETHAwayAndDelegateCall: ContractFactory = await ethers.getContractFactory( + 'SendETHAwayAndDelegateCall', + wallet + ) + const SendETHAwayAndDelegateCall: Contract = await Factory__SendETHAwayAndDelegateCall.deploy() + await SendETHAwayAndDelegateCall.deployTransaction.wait() + + const value = 17 + const [ + delegatedSuccess, + delegatedReturndata, + ] = await SendETHAwayAndDelegateCall.callStatic.emptySelfAndDelegateCall( + ValueCalls0.address, + ValueCalls0.interface.encodeFunctionData('getCallValue'), + { + value, + } + ) + + expect(delegatedSuccess).to.be.true + expect(delegatedReturndata).to.deep.eq(BigNumber.from(value)) + }) + + describe('Intrinsic gas for ovmCALL types', async () => { + let CALL_WITH_VALUE_INTRINSIC_GAS + let ValueGasMeasurer: Contract + before(async () => { + // Grab public variable from the EM + const OVM_ExecutionManager = new Contract( + await env.addressManager.getAddress('OVM_ExecutionManager'), + getContractInterface('OVM_ExecutionManager', false), + env.l1Wallet.provider + ) + const CALL_WITH_VALUE_INTRINSIC_GAS_BIGNUM = await OVM_ExecutionManager.CALL_WITH_VALUE_INTRINSIC_GAS() + CALL_WITH_VALUE_INTRINSIC_GAS = CALL_WITH_VALUE_INTRINSIC_GAS_BIGNUM.toNumber() + + const Factory__ValueGasMeasurer = await ethers.getContractFactory( + 'ValueGasMeasurer', + wallet + ) + ValueGasMeasurer = await Factory__ValueGasMeasurer.deploy() + await ValueGasMeasurer.deployTransaction.wait() + }) + + it('a call with value to an empty account consumes <= the intrinsic gas including a buffer', async () => { + const value = 1 + const gasLimit = 1_000_000 + const minimalSendGas = await ValueGasMeasurer.callStatic.measureGasOfTransferingEthViaCall( + ethers.constants.AddressZero, + value, + gasLimit, + { + gasLimit: 2_000_000, + } + ) + + const buffer = 1.2 + expect(minimalSendGas * buffer).to.be.lte(CALL_WITH_VALUE_INTRINSIC_GAS) + }) + + it('a call with value to an reverting account consumes <= the intrinsic gas including a buffer', async () => { + // [magic deploy prefix] . [MSTORE] (will throw exception from no stack args) + const AutoRevertInitcode = '0x600D380380600D6000396000f3' + '52' + const Factory__AutoRevert = new ContractFactory( + new Interface([]), + AutoRevertInitcode, + wallet + ) + const AutoRevert: Contract = await Factory__AutoRevert.deploy() + await AutoRevert.deployTransaction.wait() + + const value = 1 + const gasLimit = 1_000_000 + // A revert, causing the ETH to be sent back, should consume the minimal possible gas for a nonzero ETH send + const minimalSendGas = await ValueGasMeasurer.callStatic.measureGasOfTransferingEthViaCall( + AutoRevert.address, + value, + gasLimit, + { + gasLimit: 2_000_000, + } + ) + + const buffer = 1.2 + expect(minimalSendGas * buffer).to.be.lte(CALL_WITH_VALUE_INTRINSIC_GAS) + }) + + it('a value call passing less than the intrinsic gas should appear to revert', async () => { + const Factory__PayableConstant: ContractFactory = await ethers.getContractFactory( + 'PayableConstant', + wallet + ) + const PayableConstant: Contract = await Factory__PayableConstant.deploy() + await PayableConstant.deployTransaction.wait() + + const sendAmount = 15 + const [ + success, + returndata, + ] = await ValueCalls0.callStatic.sendWithDataAndGas( + PayableConstant.address, + sendAmount, + PayableConstant.interface.encodeFunctionData('returnValue'), + CALL_WITH_VALUE_INTRINSIC_GAS - 1, + { + gasLimit: 2_000_000, + } + ) + + expect(success).to.eq(false) + expect(returndata).to.eq('0x') + }) + + it('a value call which runs out of gas does not out-of-gas the parent', async () => { + const Factory__TestOOG: ContractFactory = await ethers.getContractFactory( + 'TestOOG', + wallet + ) + const TestOOG: Contract = await Factory__TestOOG.deploy() + await TestOOG.deployTransaction.wait() + + const sendAmount = 15 + // Implicitly test that this call is not rejected + const [ + success, + returndata, + ] = await ValueCalls0.callStatic.sendWithDataAndGas( + TestOOG.address, + sendAmount, + TestOOG.interface.encodeFunctionData('runOutOfGas'), + CALL_WITH_VALUE_INTRINSIC_GAS * 2, + { + gasLimit: 2_000_000, + } + ) + + expect(success).to.eq(false) + expect(returndata).to.eq('0x') + }) + }) + }) +}) diff --git a/integration-tests/test/native-eth.spec.ts b/integration-tests/test/native-eth.spec.ts index eb8eecacb37c..192759804121 100644 --- a/integration-tests/test/native-eth.spec.ts +++ b/integration-tests/test/native-eth.spec.ts @@ -5,8 +5,8 @@ import { Direction } from './shared/watcher-utils' import { PROXY_SEQUENCER_ENTRYPOINT_ADDRESS } from './shared/utils' import { OptimismEnv } from './shared/env' -const DEFAULT_TEST_GAS_L1 = 230_000 -const DEFAULT_TEST_GAS_L2 = 825_000 +const DEFAULT_TEST_GAS_L1 = 330_000 +const DEFAULT_TEST_GAS_L2 = 1_000_000 // TX size enforced by CTC: const MAX_ROLLUP_TX_SIZE = 50_000 @@ -50,13 +50,13 @@ describe('Native ETH Integration Tests', async () => { const amount = utils.parseEther('0.5') const addr = '0x' + '1234'.repeat(10) const gas = await env.ovmEth.estimateGas.transfer(addr, amount) - expect(gas).to.be.deep.eq(BigNumber.from(6430020)) + expect(gas).to.be.deep.eq(BigNumber.from(6430021)) }) it('Should estimate gas for ETH withdraw', async () => { const amount = utils.parseEther('0.5') const gas = await env.ovmEth.estimateGas.withdraw(amount, 0, '0xFFFF') - expect(gas).to.be.deep.eq(BigNumber.from(6580050)) + expect(gas).to.be.deep.eq(BigNumber.from(6580054)) }) }) diff --git a/integration-tests/test/rpc.spec.ts b/integration-tests/test/rpc.spec.ts index 5c37d28626af..06d1517e6b58 100644 --- a/integration-tests/test/rpc.spec.ts +++ b/integration-tests/test/rpc.spec.ts @@ -4,10 +4,10 @@ import { TxGasPrice, toRpcHexString, } from '@eth-optimism/core-utils' -import { Wallet, BigNumber, Contract } from 'ethers' +import { Wallet, BigNumber, Contract, ContractFactory } from 'ethers' import { ethers } from 'hardhat' import chai, { expect } from 'chai' -import { sleep, l2Provider, l1Provider } from './shared/utils' +import { sleep, l2Provider, l1Provider, fundUser } from './shared/utils' import chaiAsPromised from 'chai-as-promised' import { OptimismEnv } from './shared/env' import { @@ -154,7 +154,7 @@ describe('Basic RPC tests', () => { }) it('should correctly report OOG for contract creations', async () => { - const factory = await ethers.getContractFactory('TestOOG') + const factory = await ethers.getContractFactory('TestOOGInConstructor') await expect(factory.connect(wallet).deploy()).to.be.rejectedWith( 'gas required exceeds allowance' @@ -207,6 +207,32 @@ describe('Basic RPC tests', () => { 'Contract creation code contains unsafe opcodes. Did you use the right compiler or pass an unsafe constructor argument?' ) }) + + it('should allow eth_calls with nonzero value', async () => { + // Deploy a contract to check msg.value of the call + const Factory__ValueContext: ContractFactory = await ethers.getContractFactory( + 'ValueContext', + wallet + ) + const ValueContext: Contract = await Factory__ValueContext.deploy() + await ValueContext.deployTransaction.wait() + + // Fund account to call from + const from = wallet.address + const value = 15 + await fundUser(env.watcher, env.gateway, value, from) + + // Do the call and check msg.value + const data = ValueContext.interface.encodeFunctionData('getCallValue') + const res = await provider.call({ + to: ValueContext.address, + from, + data, + value, + }) + + expect(res).to.eq(BigNumber.from(value)) + }) }) describe('eth_getTransactionReceipt', () => { @@ -236,7 +262,7 @@ describe('Basic RPC tests', () => { it('correctly exposes revert data for contract creations', async () => { const req: TransactionRequest = { ...revertingDeployTx, - gasLimit: 17700899, // override gas estimation + gasLimit: 27700899, // override gas estimation } const tx = await wallet.sendTransaction(req) @@ -353,7 +379,7 @@ describe('Basic RPC tests', () => { to: DEFAULT_TRANSACTION.to, value: 0, }) - expect(estimate).to.be.eq(5920012) + expect(estimate).to.be.eq(5920013) }) it('should return a gas estimate that grows with the size of data', async () => { diff --git a/l2geth/core/state_transition_ovm.go b/l2geth/core/state_transition_ovm.go index b9e625d1b7fe..fbdf124d3cbc 100644 --- a/l2geth/core/state_transition_ovm.go +++ b/l2geth/core/state_transition_ovm.go @@ -100,6 +100,11 @@ func EncodeSimulatedMessage(msg Message, timestamp, blockNumber *big.Int, execut to = &common.Address{0} } + value := msg.Value() + if value == nil { + value = common.Big0 + } + tx := ovmTransaction{ timestamp, blockNumber, @@ -114,6 +119,7 @@ func EncodeSimulatedMessage(msg Message, timestamp, blockNumber *big.Int, execut var args = []interface{}{ tx, from, + value, stateManager.Address, } diff --git a/l2geth/eth/api_backend.go b/l2geth/eth/api_backend.go index 65d89c8ae3dd..c26b337b5b5d 100644 --- a/l2geth/eth/api_backend.go +++ b/l2geth/eth/api_backend.go @@ -321,14 +321,6 @@ func (b *EthAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) if len(signedTx.Data()) > b.MaxCallDataSize { return fmt.Errorf("Calldata cannot be larger than %d, sent %d", b.MaxCallDataSize, len(signedTx.Data())) } - // If there is a value field set then reject transactions that - // contain calldata. The feature of sending transactions with value - // and calldata will be added in the future. - if signedTx.Value().Cmp(common.Big0) != 0 { - if len(signedTx.Data()) > 0 { - return errors.New("Cannot send transactions with value and calldata") - } - } } return b.eth.syncService.ValidateAndApplySequencerTransaction(signedTx) } diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol index dfc65fd183c7..c364e095b295 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol @@ -47,6 +47,16 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount { * Public Functions * ********************/ + /** + * No-op fallback mirrors behavior of calling an EOA on L1. + */ + fallback() + external + payable + { + return; + } + /** * Executes a signed transaction. * @param _transaction Signed EIP155 transaction. @@ -121,34 +131,15 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount { // cases, but since this is a contract we'd end up bumping the nonce twice. Lib_ExecutionManagerWrapper.ovmINCREMENTNONCE(); - // Value transfer currently only supported for CALL but not for CREATE. - if (_transaction.value > 0) { - // TEMPORARY: Block value transfer if the transaction has input data. - require( - _transaction.data.length == 0, - "Value is nonzero but input data was provided." - ); - - require( - OVM_ETH(Lib_PredeployAddresses.OVM_ETH).transfer( - _transaction.to, - _transaction.value - ), - "Value could not be transferred to recipient." - ); - - return (true, bytes("")); - } else { - // NOTE: Upgrades are temporarily disabled because users can, in theory, modify their EOA - // so that they don't have to pay any fees to the sequencer. Function will remain disabled - // until a robust solution is in place. - require( - _transaction.to != Lib_ExecutionManagerWrapper.ovmADDRESS(), - "Calls to self are disabled until upgradability is re-enabled." - ); - - return _transaction.to.call(_transaction.data); - } + // NOTE: Upgrades are temporarily disabled because users can, in theory, modify their EOA + // so that they don't have to pay any fees to the sequencer. Function will remain disabled + // until a robust solution is in place. + require( + _transaction.to != Lib_ExecutionManagerWrapper.ovmADDRESS(), + "Calls to self are disabled until upgradability is re-enabled." + ); + + return _transaction.to.call{value: _transaction.value}(_transaction.data); } } } diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol index abcb63f65363..2220c1d7173d 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol @@ -39,6 +39,7 @@ contract OVM_ProxyEOA { fallback() external + payable { (bool success, bytes memory returndata) = getImplementation().delegatecall(msg.data); diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol index f75a4659ff31..700348d9640d 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol @@ -6,6 +6,7 @@ pragma experimental ABIEncoderV2; /* Library Imports */ import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; +import { Lib_Bytes32Utils } from "../../libraries/utils/Lib_Bytes32Utils.sol"; import { Lib_EthUtils } from "../../libraries/utils/Lib_EthUtils.sol"; import { Lib_ErrorUtils } from "../../libraries/utils/Lib_ErrorUtils.sol"; import { Lib_PredeployAddresses } from "../../libraries/constants/Lib_PredeployAddresses.sol"; @@ -14,10 +15,14 @@ import { Lib_PredeployAddresses } from "../../libraries/constants/Lib_PredeployA import { iOVM_ExecutionManager } from "../../iOVM/execution/iOVM_ExecutionManager.sol"; import { iOVM_StateManager } from "../../iOVM/execution/iOVM_StateManager.sol"; import { iOVM_SafetyChecker } from "../../iOVM/execution/iOVM_SafetyChecker.sol"; +import { IUniswapV2ERC20 } from "../../libraries/standards/IUniswapV2ERC20.sol"; /* Contract Imports */ import { OVM_DeployerWhitelist } from "../predeploys/OVM_DeployerWhitelist.sol"; +/* External Imports */ +import { Math } from "@openzeppelin/contracts/math/Math.sol"; + /** * @title OVM_ExecutionManager * @dev The Execution Manager (EM) is the core of our OVM implementation, and provides a sandboxed @@ -66,6 +71,15 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { uint256 constant NUISANCE_GAS_PER_CONTRACT_BYTE = 100; uint256 constant MIN_GAS_FOR_INVALID_STATE_ACCESS = 30000; + + /************************** + * Native Value Constants * + **************************/ + + // Public so we can access and make assertions in integration tests. + uint256 public constant CALL_WITH_VALUE_INTRINSIC_GAS = 90000; + + /************************** * Default Context Values * **************************/ @@ -220,6 +234,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { (, bytes memory returndata) = ovmCALL( _transaction.gasLimit - gasMeterConfig.minTransactionGasLimit, _transaction.entrypoint, + 0, _transaction.data ); @@ -269,6 +284,21 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { return messageContext.ovmADDRESS; } + /** + * @notice Overrides CALLVALUE. + * @return _CALLVALUE Value sent along with the call according to the current message context. + */ + function ovmCALLVALUE() + override + public + view + returns ( + uint256 _CALLVALUE + ) + { + return messageContext.ovmCALLVALUE; + } + /** * @notice Overrides TIMESTAMP. * @return _TIMESTAMP Value of the TIMESTAMP within the transaction context. @@ -418,7 +448,8 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { return _createContract( contractAddress, - _bytecode + _bytecode, + MessageType.ovmCREATE ); } @@ -458,7 +489,8 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { return _createContract( contractAddress, - _bytecode + _bytecode, + MessageType.ovmCREATE2 ); } @@ -591,6 +623,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { * @notice Overrides CALL. * @param _gasLimit Amount of gas to be passed into this call. * @param _address Address of the contract to call. + * @param _value ETH value to pass with the call. * @param _calldata Data to send along with the call. * @return _success Whether or not the call returned (rather than reverted). * @return _returndata Data returned by the call. @@ -598,6 +631,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { function ovmCALL( uint256 _gasLimit, address _address, + uint256 _value, bytes memory _calldata ) override @@ -612,12 +646,14 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { MessageContext memory nextMessageContext = messageContext; nextMessageContext.ovmCALLER = nextMessageContext.ovmADDRESS; nextMessageContext.ovmADDRESS = _address; + nextMessageContext.ovmCALLVALUE = _value; return _callContract( nextMessageContext, _gasLimit, _address, - _calldata + _calldata, + MessageType.ovmCALL ); } @@ -635,24 +671,26 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { bytes memory _calldata ) override - external + public fixedGasDiscount(80000) returns ( bool _success, bytes memory _returndata ) { - // STATICCALL updates the CALLER, updates the ADDRESS, and runs in a static context. + // STATICCALL updates the CALLER, updates the ADDRESS, and runs in a static, valueless context. MessageContext memory nextMessageContext = messageContext; nextMessageContext.ovmCALLER = nextMessageContext.ovmADDRESS; nextMessageContext.ovmADDRESS = _address; nextMessageContext.isStatic = true; + nextMessageContext.ovmCALLVALUE = 0; return _callContract( nextMessageContext, _gasLimit, _address, - _calldata + _calldata, + MessageType.ovmSTATICCALL ); } @@ -670,7 +708,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { bytes memory _calldata ) override - external + public fixedGasDiscount(40000) returns ( bool _success, @@ -684,6 +722,36 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { nextMessageContext, _gasLimit, _address, + _calldata, + MessageType.ovmDELEGATECALL + ); + } + + /** + * @notice Legacy ovmCALL function which did not support ETH value; this maintains backwards compatibility. + * @param _gasLimit Amount of gas to be passed into this call. + * @param _address Address of the contract to call. + * @param _calldata Data to send along with the call. + * @return _success Whether or not the call returned (rather than reverted). + * @return _returndata Data returned by the call. + */ + function ovmCALL( + uint256 _gasLimit, + address _address, + bytes memory _calldata + ) + override + public + returns( + bool _success, + bytes memory _returndata + ) + { + // Legacy ovmCALL assumed always-0 value. + return ovmCALL( + _gasLimit, + _address, + 0, _calldata ); } @@ -809,6 +877,63 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { ); } + + /*************************************** + * Public Functions: ETH Value Opcodes * + ***************************************/ + + /** + * @notice Overrides BALANCE. + * NOTE: In the future, this could be optimized to directly invoke EM._getContractStorage(...). + * @param _contract Address of the contract to query the OVM_ETH balance of. + * @return _BALANCE OVM_ETH balance of the requested contract. + */ + function ovmBALANCE( + address _contract + ) + override + public + returns ( + uint256 _BALANCE + ) + { + // Easiest way to get the balance is query OVM_ETH as normal. + bytes memory balanceOfCalldata = abi.encodeWithSelector( + IUniswapV2ERC20.balanceOf.selector, + _contract + ); + + // Static call because this should be a read-only query. + (bool success, bytes memory returndata) = ovmSTATICCALL( + gasleft(), + Lib_PredeployAddresses.OVM_ETH, + balanceOfCalldata + ); + + // All balanceOf queries should successfully return a uint, otherwise this must be an OOG. + if (!success || returndata.length != 32) { + _revertWithFlag(RevertFlag.OUT_OF_GAS); + } + + // Return the decoded balance. + return abi.decode(returndata, (uint256)); + } + + /** + * @notice Overrides SELFBALANCE. + * @return _BALANCE OVM_ETH balance of the requesting contract. + */ + function ovmSELFBALANCE() + override + external + returns ( + uint256 _BALANCE + ) + { + return ovmBALANCE(ovmADDRESS()); + } + + /*************************************** * Public Functions: Execution Context * ***************************************/ @@ -839,10 +964,13 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { { // From an OVM semantics perspective, this will appear identical to // the deployer ovmCALLing the whitelist. This is fine--in a sense, we are forcing them to. - (bool success, bytes memory data) = ovmCALL( + (bool success, bytes memory data) = ovmSTATICCALL( gasleft(), Lib_PredeployAddresses.DEPLOYER_WHITELIST, - abi.encodeWithSignature("isDeployerAllowed(address)", _deployerAddress) + abi.encodeWithSelector( + OVM_DeployerWhitelist.isDeployerAllowed.selector, + _deployerAddress + ) ); bool isAllowed = abi.decode(data, (bool)); @@ -864,7 +992,8 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { */ function _createContract( address _contractAddress, - bytes memory _bytecode + bytes memory _bytecode, + MessageType _messageType ) internal returns ( @@ -888,7 +1017,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { gasleft(), _contractAddress, _bytecode, - true + _messageType ); // Yellow paper requires that address returned is zero if the contract deployment fails. @@ -911,7 +1040,8 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { MessageContext memory _nextMessageContext, uint256 _gasLimit, address _contract, - bytes memory _calldata + bytes memory _calldata, + MessageType _messageType ) internal returns ( @@ -940,7 +1070,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { _gasLimit, codeContractAddress, _calldata, - false + _messageType ); } @@ -949,19 +1079,20 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { * Ensures that OVM-related measures are enforced, including L2 gas refunds, nuisance gas, and flagged reversions. * * @param _nextMessageContext Message context to be used for the external message. - * @param _gasLimit Amount of gas to be passed into this message. + * @param _gasLimit Amount of gas to be passed into this message. NOTE: this argument is overwritten in some cases to avoid stack-too-deep. * @param _contract OVM address being called or deployed to * @param _data Data for the message (either calldata or creation code) - * @param _isCreate Whether this is a create-type message. + * @param _messageType What type of ovmOPCODE this message corresponds to. * @return Whether or not the message (either a call or deployment) succeeded. * @return Data returned by the message. */ function _handleExternalMessage( MessageContext memory _nextMessageContext, + // NOTE: this argument is overwritten in some cases to avoid stack-too-deep. uint256 _gasLimit, address _contract, bytes memory _data, - bool _isCreate + MessageType _messageType ) internal returns ( @@ -969,6 +1100,43 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { bytes memory ) { + uint256 messageValue = _nextMessageContext.ovmCALLVALUE; + // If there is value in this message, we need to transfer the ETH over before switching contexts. + if ( + messageValue > 0 + && _isValueType(_messageType) + ) { + // Handle out-of-intrinsic gas consistent with EVM behavior -- the subcall "appears to revert" if we don't have enough gas to transfer the ETH. + // Similar to dynamic gas cost of value exceeding gas here: + // https://github.com/ethereum/go-ethereum/blob/c503f98f6d5e80e079c1d8a3601d188af2a899da/core/vm/interpreter.go#L268-L273 + if (gasleft() < CALL_WITH_VALUE_INTRINSIC_GAS) { + return (false, hex""); + } + + // If there *is* enough gas to transfer ETH, then we need to make sure this amount of gas is reserved (i.e. not + // given to the _contract.call below) to guarantee that _handleExternalMessage can't run out of gas. + // In particular, in the event that the call fails, we will need to transfer the ETH back to the sender. + // Taking the lesser of _gasLimit and gasleft() - CALL_WITH_VALUE_INTRINSIC_GAS guarantees that the second + // _attemptForcedEthTransfer below, if needed, always has enough gas to succeed. + _gasLimit = Math.min( + _gasLimit, + gasleft() - CALL_WITH_VALUE_INTRINSIC_GAS // Cannot overflow due to the above check. + ); + + // Now transfer the value of the call. + // The target is interpreted to be the next message's ovmADDRESS account. + bool transferredOvmEth = _attemptForcedEthTransfer( + _nextMessageContext.ovmADDRESS, + messageValue + ); + + // If the ETH transfer fails (should only be possible in the case of insufficient balance), then treat this as a revert. + // This mirrors EVM behavior, see https://github.com/ethereum/go-ethereum/blob/2dee31930c9977af2a9fcb518fb9838aa609a7cf/core/vm/evm.go#L298 + if (!transferredOvmEth) { + return (false, hex""); + } + } + // We need to switch over to our next message context for the duration of this call. MessageContext memory prevMessageContext = messageContext; _switchMessageContext(prevMessageContext, _nextMessageContext); @@ -989,14 +1157,13 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { bool success; bytes memory returndata; - if (_isCreate) { + if (_isCreateType(_messageType)) { // safeCREATE() is a function which replicates a CREATE message, but uses return values // Which match that of CALL (i.e. bool, bytes). This allows many security checks to be // to be shared between untrusted call and create call frames. - (success, returndata) = address(this).call( + (success, returndata) = address(this).call{gas: _gasLimit}( abi.encodeWithSelector( this.safeCREATE.selector, - _gasLimit, _data, _contract ) @@ -1005,7 +1172,29 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { (success, returndata) = _contract.call{gas: _gasLimit}(_data); } - // Switch back to the original message context now that we're out of the call. + // If the message threw an exception, its value should be returned back to the sender. + // So, we force it back, BEFORE returning the messageContext to the previous addresses. + // This operation is part of the reason we "reserved the intrinsic gas" above. + if ( + messageValue > 0 + && _isValueType(_messageType) + && !success + ) { + bool transferredOvmEth = _attemptForcedEthTransfer( + prevMessageContext.ovmADDRESS, + messageValue + ); + + // Since we transferred it in above and the call reverted, the transfer back should always pass. + // This code path should NEVER be triggered since we sent `messageValue` worth of OVM_ETH into the target + // and reserved sufficient gas to execute the transfer, but in case there is some edge case which has + // been missed, we revert the entire frame (and its parent) to make sure the ETH gets sent back. + if (!transferredOvmEth) { + _revertWithFlag(RevertFlag.OUT_OF_GAS); + } + } + + // Switch back to the original message context now that we're out of the call and all OVM_ETH is in the right place. _switchMessageContext(_nextMessageContext, prevMessageContext); // Assuming there were no reverts, the message record should be accurate here. We'll update @@ -1042,10 +1231,12 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { } // INTENTIONAL_REVERT needs to pass up the user-provided return data encoded into the - // flag, *not* the full encoded flag. All other revert types return no data. + // flag, *not* the full encoded flag. Additionally, we surface custom error messages + // to developers in the case of unsafe creations for improved devex. + // All other revert types return no data. if ( flag == RevertFlag.INTENTIONAL_REVERT - || _isCreate + || flag == RevertFlag.UNSAFE_BYTECODE ) { returndata = returndataFromFlag; } else { @@ -1077,12 +1268,10 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { * Having this step occur as a separate call frame also allows us to easily revert the * contract deployment in the event that the code is unsafe. * - * @param _gasLimit Amount of gas to be passed into this creation. * @param _creationCode Code to pass into CREATE for deployment. * @param _address OVM address being deployed to. */ function safeCREATE( - uint _gasLimit, bytes memory _creationCode, address _address ) @@ -1098,13 +1287,14 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { // Note: in the EVM, this case burns all allotted gas. For improved // developer experience, we do return the remaining gas. _revertWithFlag( - RevertFlag.CREATE_COLLISION, - Lib_ErrorUtils.encodeRevertString("A contract has already been deployed to this address") + RevertFlag.CREATE_COLLISION ); } // Check the creation bytecode against the OVM_SafetyChecker. if (ovmSafetyChecker.isBytecodeSafe(_creationCode) == false) { + // Note: in the EVM, this case burns all allotted gas. For improved + // developer experience, we do return the remaining gas. _revertWithFlag( RevertFlag.UNSAFE_BYTECODE, Lib_ErrorUtils.encodeRevertString("Contract creation code contains unsafe opcodes. Did you use the right compiler or pass an unsafe constructor argument?") @@ -1146,6 +1336,46 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { ); } + /****************************************** + * Internal Functions: Value Manipulation * + ******************************************/ + + /** + * Invokes an ovmCALL to OVM_ETH.transfer on behalf of the current ovmADDRESS, allowing us to force movement of OVM_ETH in correspondence with ETH's native value functionality. + * WARNING: this will send on behalf of whatever the messageContext.ovmADDRESS is in storage at the time of the call. + * NOTE: In the future, this could be optimized to directly invoke EM._setContractStorage(...). + * @param _to Amount of OVM_ETH to be sent. + * @param _value Amount of OVM_ETH to send. + * @return _success Whether or not the transfer worked. + */ + function _attemptForcedEthTransfer( + address _to, + uint256 _value + ) + internal + returns( + bool _success + ) + { + bytes memory transferCalldata = abi.encodeWithSelector( + IUniswapV2ERC20.transfer.selector, + _to, + _value + ); + + // OVM_ETH inherits from the UniswapV2ERC20 standard. In this implementation, its return type + // is a boolean. However, the implementation always returns true if it does not revert. + // Thus, success of the call frame is sufficient to infer success of the transfer itself. + (bool success, ) = ovmCALL( + gasleft(), + Lib_PredeployAddresses.OVM_ETH, + 0, + transferCalldata + ); + + return success; + } + /****************************************** * Internal Functions: State Manipulation * ******************************************/ @@ -1817,20 +2047,23 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { ) internal { - // Avoid unnecessary the SSTORE. + // These conditionals allow us to avoid unneccessary SSTOREs. However, they do mean that the current storage + // value for the messageContext MUST equal the _prevMessageContext argument, or an SSTORE might be erroneously skipped. if (_prevMessageContext.ovmCALLER != _nextMessageContext.ovmCALLER) { messageContext.ovmCALLER = _nextMessageContext.ovmCALLER; } - // Avoid unnecessary the SSTORE. if (_prevMessageContext.ovmADDRESS != _nextMessageContext.ovmADDRESS) { messageContext.ovmADDRESS = _nextMessageContext.ovmADDRESS; } - // Avoid unnecessary the SSTORE. if (_prevMessageContext.isStatic != _nextMessageContext.isStatic) { messageContext.isStatic = _nextMessageContext.isStatic; } + + if (_prevMessageContext.ovmCALLVALUE != _nextMessageContext.ovmCALLVALUE) { + messageContext.ovmCALLVALUE = _nextMessageContext.ovmCALLVALUE; + } } /** @@ -1877,6 +2110,52 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { ovmStateManager = iOVM_StateManager(address(0)); } + + /****************************************** + * Internal Functions: Message Typechecks * + ******************************************/ + + /** + * Returns whether or not the given message type is a CREATE-type. + * @param _messageType the message type in question. + */ + function _isCreateType( + MessageType _messageType + ) + internal + pure + returns( + bool + ) + { + return ( + _messageType == MessageType.ovmCREATE + || _messageType == MessageType.ovmCREATE2 + ); + } + + /** + * Returns whether or not the given message type (potentially) requires the transfer of ETH value along with the message. + * @param _messageType the message type in question. + */ + function _isValueType( + MessageType _messageType + ) + internal + pure + returns( + bool + ) + { + // ovmSTATICCALL and ovmDELEGATECALL types do not accept or transfer value. + return ( + _messageType == MessageType.ovmCALL + || _messageType == MessageType.ovmCREATE + || _messageType == MessageType.ovmCREATE2 + ); + } + + /***************************** * L2-only Helper Functions * *****************************/ @@ -1886,10 +2165,13 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { * This function will throw an exception in all cases other than when used as a custom entrypoint in L2 Geth to simulate eth_call. * @param _transaction the message transaction to simulate. * @param _from the OVM account the simulated call should be from. + * @param _value the amount of ETH value to send. + * @param _ovmStateManager the address of the OVM_StateManager precompile in the L2 state. */ function simulateMessage( Lib_OVMCodec.Transaction memory _transaction, address _from, + uint256 _value, iOVM_StateManager _ovmStateManager ) external @@ -1900,12 +2182,15 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { // Prevent this call from having any effect unless in a custom-set VM frame require(msg.sender == address(0)); + // Initialize the EM's internal state, ignoring nuisance gas. ovmStateManager = _ovmStateManager; _initContext(_transaction); messageRecord.nuisanceGasLeft = uint(-1); + // Set the ovmADDRESS to the _from so that the subsequent call frame "comes from" them. messageContext.ovmADDRESS = _from; + // Execute the desired message. bool isCreate = _transaction.entrypoint == address(0); if (isCreate) { (address created, bytes memory revertData) = ovmCREATE(_transaction.data); @@ -1920,6 +2205,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { (bool success, bytes memory returndata) = ovmCALL( _transaction.gasLimit, _transaction.entrypoint, + _value, _transaction.data ); return abi.encode(success, returndata); diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_ExecutionManagerWrapper.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_ExecutionManagerWrapper.sol index e7b2c151b8ae..eb5ba045fa33 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_ExecutionManagerWrapper.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_ExecutionManagerWrapper.sol @@ -22,6 +22,7 @@ contract OVM_ExecutionManagerWrapper { fallback() external + payable { bytes memory data = msg.data; assembly { diff --git a/packages/contracts/contracts/optimistic-ethereum/iOVM/execution/iOVM_ExecutionManager.sol b/packages/contracts/contracts/optimistic-ethereum/iOVM/execution/iOVM_ExecutionManager.sol index 0ecbc2274bf6..cc074d358cee 100644 --- a/packages/contracts/contracts/optimistic-ethereum/iOVM/execution/iOVM_ExecutionManager.sol +++ b/packages/contracts/contracts/optimistic-ethereum/iOVM/execution/iOVM_ExecutionManager.sol @@ -29,6 +29,14 @@ interface iOVM_ExecutionManager { PREV_EPOCH_L1TOL2_QUEUE_GAS } + enum MessageType { + ovmCALL, + ovmSTATICCALL, + ovmDELEGATECALL, + ovmCREATE, + ovmCREATE2 + } + /*********** * Structs * ***********/ @@ -60,6 +68,7 @@ interface iOVM_ExecutionManager { struct MessageContext { address ovmCALLER; address ovmADDRESS; + uint256 ovmCALLVALUE; bool isStatic; } @@ -84,6 +93,7 @@ interface iOVM_ExecutionManager { function ovmCALLER() external view returns (address _caller); function ovmADDRESS() external view returns (address _address); + function ovmCALLVALUE() external view returns (uint _callValue); function ovmTIMESTAMP() external view returns (uint256 _timestamp); function ovmNUMBER() external view returns (uint256 _number); function ovmGASLIMIT() external view returns (uint256 _gasLimit); @@ -126,7 +136,9 @@ interface iOVM_ExecutionManager { * Contract Calling Opcodes * ****************************/ + // Valueless ovmCALL for maintaining backwards compatibility with legacy OVM bytecode. function ovmCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata); + function ovmCALL(uint256 _gasLimit, address _address, uint256 _value, bytes memory _calldata) external returns (bool _success, bytes memory _returndata); function ovmSTATICCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata); function ovmDELEGATECALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata); @@ -148,6 +160,14 @@ interface iOVM_ExecutionManager { function ovmEXTCODEHASH(address _contract) external returns (bytes32 _hash); + /********************* + * ETH Value Opcodes * + *********************/ + + function ovmBALANCE(address _contract) external returns (uint256 _balance); + function ovmSELFBALANCE() external returns (uint256 _balance); + + /*************************************** * Public Functions: Execution Context * ***************************************/ diff --git a/packages/contracts/contracts/optimistic-ethereum/libraries/wrappers/Lib_ExecutionManagerWrapper.sol b/packages/contracts/contracts/optimistic-ethereum/libraries/wrappers/Lib_ExecutionManagerWrapper.sol index 695cdaa86306..7a2dc61c53a0 100644 --- a/packages/contracts/contracts/optimistic-ethereum/libraries/wrappers/Lib_ExecutionManagerWrapper.sol +++ b/packages/contracts/contracts/optimistic-ethereum/libraries/wrappers/Lib_ExecutionManagerWrapper.sol @@ -158,6 +158,82 @@ library Lib_ExecutionManagerWrapper { return abi.decode(returndata, (address)); } + /** + * Calls the value-enabled ovmCALL opcode. + * @param _gasLimit Amount of gas to be passed into this call. + * @param _address Address of the contract to call. + * @param _value ETH value to pass with the call. + * @param _calldata Data to send along with the call. + * @return _success Whether or not the call returned (rather than reverted). + * @return _returndata Data returned by the call. + */ + function ovmCALL( + uint256 _gasLimit, + address _address, + uint256 _value, + bytes memory _calldata + ) + internal + returns ( + bool, + bytes memory + ) + { + bytes memory returndata = _callWrapperContract( + abi.encodeWithSignature( + "ovmCALL(uint256,address,uint256,bytes)", + _gasLimit, + _address, + _value, + _calldata + ) + ); + + return abi.decode(returndata, (bool, bytes)); + } + + /** + * Calls the ovmBALANCE opcode. + * @param _address OVM account to query the balance of. + * @return Balance of the account. + */ + function ovmBALANCE( + address _address + ) + internal + returns ( + uint256 + ) + { + bytes memory returndata = _callWrapperContract( + abi.encodeWithSignature( + "ovmBALANCE(address)", + _address + ) + ); + + return abi.decode(returndata, (uint256)); + } + + /** + * Calls the ovmCALLVALUE opcode. + * @return Value of the current call frame. + */ + function ovmCALLVALUE() + internal + returns ( + uint256 + ) + { + bytes memory returndata = _callWrapperContract( + abi.encodeWithSignature( + "ovmCALLVALUE()" + ) + ); + + return abi.decode(returndata, (uint256)); + } + /********************* * Private Functions * diff --git a/packages/contracts/hardhat.config.ts b/packages/contracts/hardhat.config.ts index 1708509fde72..4688c68c7bd1 100644 --- a/packages/contracts/hardhat.config.ts +++ b/packages/contracts/hardhat.config.ts @@ -53,7 +53,7 @@ const config: HardhatUserConfig = { }, }, ovm: { - solcVersion: '0.7.6', + solcVersion: '0.7.6+commit.3b061308', }, typechain: { outDir: 'dist/types', diff --git a/packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts b/packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts index a933fa1134ff..5ac6ca33cf92 100644 --- a/packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts +++ b/packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts @@ -49,7 +49,18 @@ describe('OVM_ECDSAContractAccount', () => { Mock__OVM_ETH.smocked.transfer.will.return.with(true) }) - describe('fallback()', () => { + describe('fallback', async () => { + it('should successfully accept value sent to it', async () => { + await expect( + wallet.sendTransaction({ + to: OVM_ECDSAContractAccount.address, + value: 1, + }) + ).to.not.be.reverted + }) + }) + + describe('execute()', () => { it(`should successfully execute an EIP155Transaction`, async () => { const transaction = DEFAULT_EIP155_TX const encodedTransaction = await wallet.signTransaction(transaction) @@ -132,37 +143,36 @@ describe('OVM_ECDSAContractAccount', () => { }) it(`should transfer value if value is greater than 0`, async () => { - const transaction = { ...DEFAULT_EIP155_TX, value: 1234, data: '0x' } + const value = 100 + const valueRecipient = '0x' + '34'.repeat(20) + const transaction = { + ...DEFAULT_EIP155_TX, + to: valueRecipient, + value, + data: '0x', + } const encodedTransaction = await wallet.signTransaction(transaction) + // fund the contract account + await wallet.sendTransaction({ + to: OVM_ECDSAContractAccount.address, + value: value * 10, + gasLimit: 1_000_000, + }) + + const receipientBalanceBefore = await wallet.provider.getBalance( + valueRecipient + ) await OVM_ECDSAContractAccount.execute( LibEIP155TxStruct(encodedTransaction) ) + const recipientBalanceAfter = await wallet.provider.getBalance( + valueRecipient + ) - // First call transfers fee, second transfers value (since value > 0). expect( - toPlainObject(Mock__OVM_ETH.smocked.transfer.calls[1]) - ).to.deep.include({ - to: transaction.to, - value: BigNumber.from(transaction.value), - }) - }) - - it(`should revert if the value is not transferred to the recipient`, async () => { - const transaction = { ...DEFAULT_EIP155_TX, value: 1234, data: '0x' } - const encodedTransaction = await wallet.signTransaction(transaction) - - Mock__OVM_ETH.smocked.transfer.will.return.with((to, value) => { - if (to === transaction.to) { - return false - } else { - return true - } - }) - - await expect( - OVM_ECDSAContractAccount.execute(LibEIP155TxStruct(encodedTransaction)) - ).to.be.revertedWith('Value could not be transferred to recipient.') + recipientBalanceAfter.sub(receipientBalanceBefore).toNumber() + ).to.eq(value) }) it(`should revert if trying to send value with a contract creation`, async () => { @@ -174,15 +184,6 @@ describe('OVM_ECDSAContractAccount', () => { ).to.be.revertedWith('Value transfer in contract creation not supported.') }) - it(`should revert if trying to send value with non-empty transaction data`, async () => { - const transaction = { ...DEFAULT_EIP155_TX, value: 1234, data: '0x1234' } - const encodedTransaction = await wallet.signTransaction(transaction) - - await expect( - OVM_ECDSAContractAccount.execute(LibEIP155TxStruct(encodedTransaction)) - ).to.be.revertedWith('Value is nonzero but input data was provided.') - }) - // NOTE: Upgrades are disabled for now but will be re-enabled at a later point in time. See // comment in OVM_ECDSAContractAccount.sol for additional information. it(`should revert if trying call itself`, async () => { diff --git a/packages/contracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts b/packages/contracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts index 1d5528ec3e89..3d6d00dbe950 100644 --- a/packages/contracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts +++ b/packages/contracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts @@ -7,7 +7,7 @@ import { MockContract, smockit } from '@eth-optimism/smock' import { toPlainObject } from 'lodash' /* Internal Imports */ -import { getContractInterface, predeploys } from '../../../../src' +import { predeploys } from '../../../../src' import { DEFAULT_EIP155_TX, LibEIP155TxStruct } from '../../../helpers' describe('OVM_ProxyEOA', () => { diff --git a/packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager.gas-spec.ts b/packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager.gas-spec.ts index c6fdaa0577b2..f61dbc9ae473 100644 --- a/packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager.gas-spec.ts +++ b/packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager.gas-spec.ts @@ -110,7 +110,7 @@ describe('OVM_ExecutionManager gas consumption', () => { ) console.log(`calculated gas cost of ${gasCost}`) - const benchmark: number = 106_000 + const benchmark: number = 110_000 expect(gasCost).to.be.lte(benchmark) expect(gasCost).to.be.gte( benchmark - 1_000, diff --git a/packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/native-eth.spec.ts b/packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/native-eth.spec.ts new file mode 100644 index 000000000000..9c3b53fd2ea3 --- /dev/null +++ b/packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/native-eth.spec.ts @@ -0,0 +1,343 @@ +/* Internal Imports */ +import { remove0x, toHexString } from '@eth-optimism/core-utils' +import { ethers } from 'ethers' +import { predeploys } from '../../../../../src' +import { + ExecutionManagerTestRunner, + TestDefinition, + OVM_TX_GAS_LIMIT, + NON_NULL_BYTES32, + REVERT_FLAGS, + VERIFIED_EMPTY_CONTRACT_HASH, +} from '../../../../helpers' + +const uniswapERC20BalanceOfStorageLayoutKey = + '0000000000000000000000000000000000000000000000000000000000000005' +// TODO: use fancy chugsplash storage getter once possible +const getOvmEthBalanceSlot = (addressOrPlaceholder: string): string => { + let address: string + if (addressOrPlaceholder.startsWith('$DUMMY_OVM_ADDRESS_')) { + address = ExecutionManagerTestRunner.getDummyAddress(addressOrPlaceholder) + } else { + address = addressOrPlaceholder + } + const balanceOfSlotPreimage = + ethers.utils.hexZeroPad(address, 32) + uniswapERC20BalanceOfStorageLayoutKey + const balanceOfSlot = ethers.utils.keccak256(balanceOfSlotPreimage) + return balanceOfSlot +} + +const INITIAL_BALANCE = 1234 +const CALL_VALUE = 69 + +const test_nativeETH: TestDefinition = { + name: 'Basic tests for ovmCALL', + preState: { + ExecutionManager: { + ovmStateManager: '$OVM_STATE_MANAGER', + ovmSafetyChecker: '$OVM_SAFETY_CHECKER', + messageRecord: { + nuisanceGasLeft: OVM_TX_GAS_LIMIT, + }, + }, + StateManager: { + owner: '$OVM_EXECUTION_MANAGER', + accounts: { + $DUMMY_OVM_ADDRESS_1: { + codeHash: NON_NULL_BYTES32, + ethAddress: '$OVM_CALL_HELPER', + }, + $DUMMY_OVM_ADDRESS_2: { + codeHash: NON_NULL_BYTES32, + ethAddress: '$OVM_CALL_HELPER', + }, + $DUMMY_OVM_ADDRESS_3: { + codeHash: VERIFIED_EMPTY_CONTRACT_HASH, + ethAddress: '0x' + '00'.repeat(20), + }, + }, + contractStorage: { + [predeploys.OVM_ETH]: { + [getOvmEthBalanceSlot('$DUMMY_OVM_ADDRESS_1')]: { + getStorageXOR: true, + value: toHexString(INITIAL_BALANCE), + }, + [getOvmEthBalanceSlot('$DUMMY_OVM_ADDRESS_2')]: { + getStorageXOR: true, + value: '0x00', + }, + [getOvmEthBalanceSlot('$DUMMY_OVM_ADDRESS_3')]: { + getStorageXOR: true, + value: '0x00', + }, + }, + }, + verifiedContractStorage: { + [predeploys.OVM_ETH]: { + [getOvmEthBalanceSlot('$DUMMY_OVM_ADDRESS_1')]: true, + [getOvmEthBalanceSlot('$DUMMY_OVM_ADDRESS_2')]: true, + [getOvmEthBalanceSlot('$DUMMY_OVM_ADDRESS_3')]: true, + }, + }, + }, + }, + parameters: [ + { + name: 'ovmCALL(ADDRESS_1) => ovmBALANCE(ADDRESS_1)', + steps: [ + { + functionName: 'ovmCALL', + functionParams: { + gasLimit: OVM_TX_GAS_LIMIT, + target: '$DUMMY_OVM_ADDRESS_1', + subSteps: [ + { + functionName: 'ovmBALANCE', + functionParams: { + address: '$DUMMY_OVM_ADDRESS_1', + }, + expectedReturnStatus: true, + expectedReturnValue: INITIAL_BALANCE, + }, + ], + }, + expectedReturnStatus: true, + }, + ], + }, + { + name: 'ovmCALL(ADDRESS_1) => ovmCALL(EMPTY_ACCOUNT, value)', + steps: [ + { + functionName: 'ovmCALL', + functionParams: { + gasLimit: OVM_TX_GAS_LIMIT, + target: '$DUMMY_OVM_ADDRESS_1', + subSteps: [ + { + functionName: 'ovmCALL', + functionParams: { + gasLimit: OVM_TX_GAS_LIMIT, + target: '$DUMMY_OVM_ADDRESS_3', + value: CALL_VALUE, + calldata: '0x', + }, + expectedReturnStatus: true, + }, + // Check balances are still applied: + { + functionName: 'ovmBALANCE', + functionParams: { + address: '$DUMMY_OVM_ADDRESS_1', + }, + expectedReturnStatus: true, + expectedReturnValue: INITIAL_BALANCE - CALL_VALUE, + }, + { + functionName: 'ovmBALANCE', + functionParams: { + address: '$DUMMY_OVM_ADDRESS_3', + }, + expectedReturnStatus: true, + expectedReturnValue: CALL_VALUE, + }, + ], + }, + expectedReturnStatus: true, + }, + ], + }, + { + name: 'ovmCALL(ADDRESS_1) => ovmCALL(ADDRESS_2, value) [successful call]', + steps: [ + { + functionName: 'ovmCALL', + functionParams: { + gasLimit: OVM_TX_GAS_LIMIT, + target: '$DUMMY_OVM_ADDRESS_1', + subSteps: [ + // expected initial balances: + { + functionName: 'ovmBALANCE', + functionParams: { + address: '$DUMMY_OVM_ADDRESS_1', + }, + expectedReturnStatus: true, + expectedReturnValue: INITIAL_BALANCE, + }, + { + functionName: 'ovmBALANCE', + functionParams: { + address: '$DUMMY_OVM_ADDRESS_2', + }, + expectedReturnStatus: true, + expectedReturnValue: 0, + }, + // do the call with some value + { + functionName: 'ovmCALL', + functionParams: { + gasLimit: OVM_TX_GAS_LIMIT, + target: '$DUMMY_OVM_ADDRESS_2', + value: CALL_VALUE, + subSteps: [ + // check that the ovmCALLVALUE is updated + { + functionName: 'ovmCALLVALUE', + expectedReturnValue: CALL_VALUE, + }, + // check that the balances have been updated + { + functionName: 'ovmBALANCE', + functionParams: { + address: '$DUMMY_OVM_ADDRESS_1', + }, + expectedReturnStatus: true, + expectedReturnValue: INITIAL_BALANCE - CALL_VALUE, + }, + { + functionName: 'ovmBALANCE', + functionParams: { + address: '$DUMMY_OVM_ADDRESS_2', + }, + expectedReturnStatus: true, + expectedReturnValue: CALL_VALUE, + }, + ], + }, + expectedReturnStatus: true, + }, + // check that the ovmCALLVALUE is reset back to 0 + { + functionName: 'ovmCALLVALUE', + expectedReturnValue: 0, + }, + // check that the balances have persisted + { + functionName: 'ovmBALANCE', + functionParams: { + address: '$DUMMY_OVM_ADDRESS_1', + }, + expectedReturnStatus: true, + expectedReturnValue: INITIAL_BALANCE - CALL_VALUE, + }, + { + functionName: 'ovmBALANCE', + functionParams: { + address: '$DUMMY_OVM_ADDRESS_2', + }, + expectedReturnStatus: true, + expectedReturnValue: CALL_VALUE, + }, + ], + }, + expectedReturnStatus: true, + }, + ], + }, + { + name: 'ovmCALL(ADDRESS_1) => ovmCALL(ADDRESS_2, value) [reverting call]', + steps: [ + { + functionName: 'ovmCALL', + functionParams: { + gasLimit: OVM_TX_GAS_LIMIT, + target: '$DUMMY_OVM_ADDRESS_1', + subSteps: [ + // expected initial balances: + { + functionName: 'ovmBALANCE', + functionParams: { + address: '$DUMMY_OVM_ADDRESS_1', + }, + expectedReturnStatus: true, + expectedReturnValue: INITIAL_BALANCE, + }, + { + functionName: 'ovmBALANCE', + functionParams: { + address: '$DUMMY_OVM_ADDRESS_2', + }, + expectedReturnStatus: true, + expectedReturnValue: 0, + }, + // do the call with some value + { + functionName: 'ovmCALL', + functionParams: { + gasLimit: OVM_TX_GAS_LIMIT, + target: '$DUMMY_OVM_ADDRESS_2', + value: CALL_VALUE, + subSteps: [ + // check that the ovmCALLVALUE is updated + { + functionName: 'ovmCALLVALUE', + expectedReturnValue: CALL_VALUE, + }, + // check that the balances have been updated + { + functionName: 'ovmBALANCE', + functionParams: { + address: '$DUMMY_OVM_ADDRESS_1', + }, + expectedReturnStatus: true, + expectedReturnValue: INITIAL_BALANCE - CALL_VALUE, + }, + { + functionName: 'ovmBALANCE', + functionParams: { + address: '$DUMMY_OVM_ADDRESS_2', + }, + expectedReturnStatus: true, + expectedReturnValue: CALL_VALUE, + }, + // now revert everything + { + functionName: 'ovmREVERT', + expectedReturnStatus: false, + expectedReturnValue: { + flag: REVERT_FLAGS.INTENTIONAL_REVERT, + onlyValidateFlag: true, + }, + }, + ], + }, + expectedReturnStatus: true, + expectedReturnValue: { + ovmSuccess: false, + returnData: '0x', + }, + }, + // check that the ovmCALLVALUE is reset back to 0 + { + functionName: 'ovmCALLVALUE', + expectedReturnValue: 0, + }, + // check that the balances have NOT persisted + { + functionName: 'ovmBALANCE', + functionParams: { + address: '$DUMMY_OVM_ADDRESS_1', + }, + expectedReturnStatus: true, + expectedReturnValue: INITIAL_BALANCE, + }, + { + functionName: 'ovmBALANCE', + functionParams: { + address: '$DUMMY_OVM_ADDRESS_2', + }, + expectedReturnStatus: true, + expectedReturnValue: 0, + }, + ], + }, + expectedReturnStatus: true, + }, + ], + }, + ], +} + +const runner = new ExecutionManagerTestRunner() +runner.run(test_nativeETH) diff --git a/packages/contracts/test/helpers/test-runner/test-runner.ts b/packages/contracts/test/helpers/test-runner/test-runner.ts index 0e80f525d9ca..5e68a54229c5 100644 --- a/packages/contracts/test/helpers/test-runner/test-runner.ts +++ b/packages/contracts/test/helpers/test-runner/test-runner.ts @@ -12,12 +12,12 @@ import { ParsedTestStep, TestParameter, TestStep, - TestStep_CALL, + TestStep_CALLType, TestStep_Run, isRevertFlagError, isTestStep_SSTORE, isTestStep_SLOAD, - isTestStep_CALL, + isTestStep_CALLType, isTestStep_CREATE, isTestStep_CREATE2, isTestStep_CREATEEOA, @@ -27,7 +27,9 @@ import { isTestStep_EXTCODESIZE, isTestStep_EXTCODEHASH, isTestStep_EXTCODECOPY, + isTestStep_BALANCE, isTestStep_REVERT, + isTestStep_CALL, } from './test.types' import { encodeRevertData, REVERT_FLAGS } from '../codec' import { @@ -49,6 +51,7 @@ export class ExecutionManagerTestRunner { Factory__Helper_TestRunner_CREATE: ContractFactory OVM_DeployerWhitelist: Contract OVM_ProxyEOA: Contract + OVM_ETH: Contract } = { OVM_SafetyChecker: undefined, OVM_StateManager: undefined, @@ -57,6 +60,7 @@ export class ExecutionManagerTestRunner { Factory__Helper_TestRunner_CREATE: undefined, OVM_DeployerWhitelist: undefined, OVM_ProxyEOA: undefined, + OVM_ETH: undefined, } // Default pre-state with contract deployer whitelist NOT initialized. @@ -68,6 +72,10 @@ export class ExecutionManagerTestRunner { codeHash: NON_NULL_BYTES32, ethAddress: '$OVM_DEPLOYER_WHITELIST', }, + [predeploys.OVM_ETH]: { + codeHash: NON_NULL_BYTES32, + ethAddress: '$OVM_ETH', + }, [predeploys.OVM_ProxyEOA]: { codeHash: NON_NULL_BYTES32, ethAddress: '$OVM_PROXY_EOA', @@ -227,6 +235,14 @@ export class ExecutionManagerTestRunner { this.contracts.OVM_DeployerWhitelist = DeployerWhitelist + const OvmEth = await getContractFactory( + 'OVM_ETH', + AddressManager.signer, + true + ).deploy(ethers.constants.AddressZero, ethers.constants.AddressZero) + + this.contracts.OVM_ETH = OvmEth + this.contracts.OVM_ProxyEOA = await getContractFactory( 'OVM_ProxyEOA', AddressManager.signer, @@ -282,6 +298,8 @@ export class ExecutionManagerTestRunner { return this.contracts.Helper_TestRunner.address } else if (kv === '$OVM_DEPLOYER_WHITELIST') { return this.contracts.OVM_DeployerWhitelist.address + } else if (kv === '$OVM_ETH') { + return this.contracts.OVM_ETH.address } else if (kv === '$OVM_PROXY_EOA') { return this.contracts.OVM_ProxyEOA.address } else if (kv.startsWith('$DUMMY_OVM_ADDRESS_')) { @@ -328,7 +346,7 @@ export class ExecutionManagerTestRunner { if (step.functionParams.data) { calldata = step.functionParams.data } else { - const runStep: TestStep_CALL = { + const runStep: TestStep_CALLType = { functionName: 'ovmCALL', functionParams: { gasLimit: OVM_TX_GAS_LIMIT, @@ -362,9 +380,12 @@ export class ExecutionManagerTestRunner { await toRun } } else { - await this.contracts.OVM_ExecutionManager.ovmCALL( + await this.contracts.OVM_ExecutionManager[ + 'ovmCALL(uint256,address,uint256,bytes)' + ]( OVM_TX_GAS_LIMIT, ExecutionManagerTestRunner.getDummyAddress('$DUMMY_OVM_ADDRESS_1'), + 0, this.contracts.Helper_TestRunner.interface.encodeFunctionData( 'runSingleTestStep', [this.parseTestStep(step)] @@ -398,7 +419,7 @@ export class ExecutionManagerTestRunner { return false } else if (isTestStep_Context(step)) { return true - } else if (isTestStep_CALL(step)) { + } else if (isTestStep_CALLType(step)) { if ( isRevertFlagError(step.expectedReturnValue) && (step.expectedReturnValue.flag === REVERT_FLAGS.INVALID_STATE_ACCESS || @@ -435,23 +456,36 @@ export class ExecutionManagerTestRunner { isTestStep_EXTCODESIZE(step) || isTestStep_EXTCODEHASH(step) || isTestStep_EXTCODECOPY(step) || + isTestStep_BALANCE(step) || isTestStep_CREATEEOA(step) ) { functionParams = Object.values(step.functionParams) - } else if (isTestStep_CALL(step)) { - functionParams = [ - step.functionParams.gasLimit, - step.functionParams.target, + } else if (isTestStep_CALLType(step)) { + const innnerCalldata = step.functionParams.calldata || - this.contracts.Helper_TestRunner.interface.encodeFunctionData( - 'runMultipleTestSteps', - [ - step.functionParams.subSteps.map((subStep) => { - return this.parseTestStep(subStep) - }), - ] - ), - ] + this.contracts.Helper_TestRunner.interface.encodeFunctionData( + 'runMultipleTestSteps', + [ + step.functionParams.subSteps.map((subStep) => { + return this.parseTestStep(subStep) + }), + ] + ) + // only ovmCALL accepts a value parameter. + if (isTestStep_CALL(step)) { + functionParams = [ + step.functionParams.gasLimit, + step.functionParams.target, + step.functionParams.value || 0, + innnerCalldata, + ] + } else { + functionParams = [ + step.functionParams.gasLimit, + step.functionParams.target, + innnerCalldata, + ] + } } else if (isTestStep_CREATE(step)) { functionParams = [ this.contracts.Factory__Helper_TestRunner_CREATE.getDeployTransaction( @@ -475,8 +509,16 @@ export class ExecutionManagerTestRunner { functionParams = [step.revertData || '0x'] } + // legacy ovmCALL causes multiple matching functions without the full signature + let functionName + if (step.functionName === 'ovmCALL') { + functionName = 'ovmCALL(uint256,address,uint256,bytes)' + } else { + functionName = step.functionName + } + return this.contracts.OVM_ExecutionManager.interface.encodeFunctionData( - step.functionName, + functionName, functionParams ) } @@ -500,7 +542,7 @@ export class ExecutionManagerTestRunner { } let returnData: any[] = [] - if (isTestStep_CALL(step)) { + if (isTestStep_CALLType(step)) { if (step.expectedReturnValue === '0x00') { return step.expectedReturnValue } else if ( @@ -540,8 +582,16 @@ export class ExecutionManagerTestRunner { } } + // legacy ovmCALL causes multiple matching functions without the full signature + let functionName + if (step.functionName === 'ovmCALL') { + functionName = 'ovmCALL(uint256,address,uint256,bytes)' + } else { + functionName = step.functionName + } + return this.contracts.OVM_ExecutionManager.interface.encodeFunctionResult( - step.functionName, + functionName, returnData ) } diff --git a/packages/contracts/test/helpers/test-runner/test.types.ts b/packages/contracts/test/helpers/test-runner/test.types.ts index fa799dd6b4e1..95c34b4058cb 100644 --- a/packages/contracts/test/helpers/test-runner/test.types.ts +++ b/packages/contracts/test/helpers/test-runner/test.types.ts @@ -11,6 +11,7 @@ export type ContextOpcode = | 'ovmGASLIMIT' | 'ovmCHAINID' | 'ovmGETNONCE' + | 'ovmCALLVALUE' type CallOpcode = 'ovmCALL' | 'ovmSTATICCALL' | 'ovmDELEGATECALL' @@ -68,6 +69,15 @@ interface TestStep_EXTCODECOPY { expectedReturnValue: string | RevertFlagError } +interface TestStep_BALANCE { + functionName: 'ovmBALANCE' + functionParams: { + address: string + } + expectedReturnStatus: boolean + expectedReturnValue: number | RevertFlagError +} + interface TestStep_SSTORE { functionName: 'ovmSSTORE' functionParams: { @@ -93,11 +103,12 @@ interface TestStep_INCREMENTNONCE { expectedReturnValue?: RevertFlagError } -export interface TestStep_CALL { +export interface TestStep_CALLType { functionName: CallOpcode functionParams: { gasLimit: number | BigNumber target: string + value?: number | BigNumber calldata?: string subSteps?: TestStep[] } @@ -174,13 +185,14 @@ export type TestStep = | TestStep_SSTORE | TestStep_SLOAD | TestStep_INCREMENTNONCE - | TestStep_CALL + | TestStep_CALLType | TestStep_CREATE | TestStep_CREATE2 | TestStep_CREATEEOA | TestStep_EXTCODESIZE | TestStep_EXTCODEHASH | TestStep_EXTCODECOPY + | TestStep_BALANCE | TestStep_REVERT | TestStep_evm @@ -220,6 +232,7 @@ export const isTestStep_Context = ( 'ovmCHAINID', 'ovmL1QUEUEORIGIN', 'ovmGETNONCE', + 'ovmCALLVALUE', ].includes(step.functionName) } @@ -255,16 +268,28 @@ export const isTestStep_EXTCODECOPY = ( return step.functionName === 'ovmEXTCODECOPY' } +export const isTestStep_BALANCE = ( + step: TestStep +): step is TestStep_BALANCE => { + return step.functionName === 'ovmBALANCE' +} + export const isTestStep_REVERT = (step: TestStep): step is TestStep_REVERT => { return step.functionName === 'ovmREVERT' } -export const isTestStep_CALL = (step: TestStep): step is TestStep_CALL => { +export const isTestStep_CALLType = ( + step: TestStep +): step is TestStep_CALLType => { return ['ovmCALL', 'ovmSTATICCALL', 'ovmDELEGATECALL'].includes( step.functionName ) } +export const isTestStep_CALL = (step: TestStep): boolean => { + return step.functionName === 'ovmCALL' +} + export const isTestStep_CREATE = (step: TestStep): step is TestStep_CREATE => { return step.functionName === 'ovmCREATE' } From 25f09abd691daac07b051064b9ff2972a628ab46 Mon Sep 17 00:00:00 2001 From: Kevin Ho Date: Thu, 10 Jun 2021 23:42:49 -0400 Subject: [PATCH 069/125] Add erc1271 support to contract account (#1052) * add ERC1271 support, failing unit tests * add integration test for isValidSignature * remove .only * lint * add changeset * clean up 1271 tests and lint * switch back to using waffle wallet * lint * fix import --- .changeset/blue-cooks-join.md | 6 +++ integration-tests/test/predeploys.spec.ts | 49 +++++++++++++++++++ integration-tests/test/rpc.spec.ts | 15 +++--- integration-tests/test/shared/utils.ts | 8 +++ .../OVM/accounts/OVM_ECDSAContractAccount.sol | 21 ++++++++ .../accounts/OVM_ECDSAContractAccount.spec.ts | 28 ++++++++++- 6 files changed, 116 insertions(+), 11 deletions(-) create mode 100644 .changeset/blue-cooks-join.md create mode 100644 integration-tests/test/predeploys.spec.ts diff --git a/.changeset/blue-cooks-join.md b/.changeset/blue-cooks-join.md new file mode 100644 index 000000000000..acf5dc675b40 --- /dev/null +++ b/.changeset/blue-cooks-join.md @@ -0,0 +1,6 @@ +--- +'@eth-optimism/integration-tests': patch +'@eth-optimism/contracts': patch +--- + +Adds ERC1271 support to default contract account diff --git a/integration-tests/test/predeploys.spec.ts b/integration-tests/test/predeploys.spec.ts new file mode 100644 index 000000000000..59598ac467de --- /dev/null +++ b/integration-tests/test/predeploys.spec.ts @@ -0,0 +1,49 @@ +import { expect } from 'chai' +import { ethers } from 'hardhat' + +/* Imports: External */ +import { Contract, Wallet } from 'ethers' +import { OptimismEnv } from './shared/env' +import { DEFAULT_TRANSACTION } from './shared/utils' +import { getContractInterface } from '@eth-optimism/contracts' + +describe('ECDSAContractAccount', () => { + let l2Wallet: Wallet + + before(async () => { + const env = await OptimismEnv.new() + l2Wallet = env.l2Wallet + }) + + let ProxyEOA: Contract + let messageHash: string + let signature: string + + before(async () => { + // Send a transaction to ensure there is a ProxyEOA deployed at l2Wallet.address + const result = await l2Wallet.sendTransaction(DEFAULT_TRANSACTION) + await result.wait() + ProxyEOA = new Contract( + l2Wallet.address, + getContractInterface('OVM_ECDSAContractAccount'), + l2Wallet + ) + const message = '0x42' + messageHash = ethers.utils.hashMessage(message) + signature = await l2Wallet.signMessage(message) + }) + + it('should correctly evaluate isValidSignature from this wallet', async () => { + const isValid = await ProxyEOA.isValidSignature(messageHash, signature) + expect(isValid).to.equal('0x1626ba7e') + }) + + it('should correctly evaluate isValidSignature from other wallet', async () => { + const otherWallet = Wallet.createRandom().connect(l2Wallet.provider) + const isValid = await ProxyEOA.connect(otherWallet).isValidSignature( + messageHash, + signature + ) + expect(isValid).to.equal('0x1626ba7e') + }) +}) diff --git a/integration-tests/test/rpc.spec.ts b/integration-tests/test/rpc.spec.ts index 06d1517e6b58..841a7de9bcda 100644 --- a/integration-tests/test/rpc.spec.ts +++ b/integration-tests/test/rpc.spec.ts @@ -7,7 +7,12 @@ import { import { Wallet, BigNumber, Contract, ContractFactory } from 'ethers' import { ethers } from 'hardhat' import chai, { expect } from 'chai' -import { sleep, l2Provider, l1Provider, fundUser } from './shared/utils' +import { + sleep, + l2Provider, + DEFAULT_TRANSACTION, + fundUser, +} from './shared/utils' import chaiAsPromised from 'chai-as-promised' import { OptimismEnv } from './shared/env' import { @@ -22,14 +27,6 @@ describe('Basic RPC tests', () => { let env: OptimismEnv let wallet: Wallet - const DEFAULT_TRANSACTION = { - to: '0x' + '1234'.repeat(10), - gasLimit: 33600000000001, - gasPrice: 0, - data: '0x', - value: 0, - } - const provider = injectL2Context(l2Provider) let Reverter: Contract diff --git a/integration-tests/test/shared/utils.ts b/integration-tests/test/shared/utils.ts index 33f69c6b6323..6c39d7b57c3b 100644 --- a/integration-tests/test/shared/utils.ts +++ b/integration-tests/test/shared/utils.ts @@ -113,3 +113,11 @@ const abiCoder = new utils.AbiCoder() export const encodeSolidityRevertMessage = (_reason: string): string => { return '0x08c379a0' + remove0x(abiCoder.encode(['string'], [_reason])) } + +export const DEFAULT_TRANSACTION = { + to: '0x' + '1234'.repeat(10), + gasLimit: 33600000000001, + gasPrice: 0, + data: '0x', + value: 0, +} diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol index c364e095b295..f6a41466f530 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol @@ -15,6 +15,7 @@ import { OVM_ETH } from "../predeploys/OVM_ETH.sol"; /* External Imports */ import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol"; +import { ECDSA } from "@openzeppelin/contracts/cryptography/ECDSA.sol"; /** * @title OVM_ECDSAContractAccount @@ -57,6 +58,26 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount { return; } + /** + * @dev Should return whether the signature provided is valid for the provided data + * @param hash Hash of the data to be signed + * @param signature Signature byte array associated with _data + */ + function isValidSignature( + bytes32 hash, + bytes memory signature + ) + public + view + returns ( + bytes4 magicValue + ) + { + return ECDSA.recover(hash, signature) == address(this) ? + this.isValidSignature.selector : + bytes4(0); + } + /** * Executes a signed transaction. * @param _transaction Signed EIP155 transaction. diff --git a/packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts b/packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts index 5ac6ca33cf92..d15a65c8c6b2 100644 --- a/packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts +++ b/packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts @@ -2,7 +2,7 @@ import { expect } from '../../../setup' /* External Imports */ import { ethers, waffle } from 'hardhat' -import { ContractFactory, Contract, Wallet, BigNumber } from 'ethers' +import { ContractFactory, Contract, Wallet, BigNumber, utils } from 'ethers' import { MockContract, smockit } from '@eth-optimism/smock' import { toPlainObject } from 'lodash' @@ -187,7 +187,10 @@ describe('OVM_ECDSAContractAccount', () => { // NOTE: Upgrades are disabled for now but will be re-enabled at a later point in time. See // comment in OVM_ECDSAContractAccount.sol for additional information. it(`should revert if trying call itself`, async () => { - const transaction = { ...DEFAULT_EIP155_TX, to: wallet.address } + const transaction = { + ...DEFAULT_EIP155_TX, + to: wallet.address, + } const encodedTransaction = await wallet.signTransaction(transaction) await expect( @@ -197,4 +200,25 @@ describe('OVM_ECDSAContractAccount', () => { ) }) }) + + describe('isValidSignature()', () => { + const message = '0x42' + const messageHash = ethers.utils.hashMessage(message) + it(`should revert for a malformed signature`, async () => { + await expect( + OVM_ECDSAContractAccount.isValidSignature(messageHash, '0xdeadbeef') + ).to.be.revertedWith('ECDSA: invalid signature length') + }) + + it(`should return 0 for an invalid signature`, async () => { + const signature = await wallet.signMessage(message) + const bytes = await OVM_ECDSAContractAccount.isValidSignature( + messageHash, + signature + ) + expect(bytes).to.equal('0x00000000') + }) + // NOTE: There is no good way to unit test verifying a valid signature + // An integration test exists testing this instead + }) }) From 48ece14c1adf0d76332db9cbc6d867d30883941c Mon Sep 17 00:00:00 2001 From: Kevin Ho Date: Fri, 11 Jun 2021 02:12:09 -0400 Subject: [PATCH 070/125] feat[contracts]: slightly better account funding for hardhat accounts (rebased) (#1065) * feat[contracts]: better account funding for hardhat accounts * add a sleep to avoid any potential problems * chore: add changeset * fix: bug with gas estimation in funding step * fix: limit to 20 accounts max Co-authored-by: Kelvin Fichter --- .changeset/poor-owls-wash.md | 5 ++ .../014-OVM_L1MultiMessageRelayer.deploy.ts | 2 +- .../contracts/deploy/018-fund-accounts.ts | 64 +++++++++++++++++++ packages/contracts/package.json | 2 +- 4 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 .changeset/poor-owls-wash.md create mode 100644 packages/contracts/deploy/018-fund-accounts.ts diff --git a/.changeset/poor-owls-wash.md b/.changeset/poor-owls-wash.md new file mode 100644 index 000000000000..a966e8b709e0 --- /dev/null +++ b/.changeset/poor-owls-wash.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/contracts': patch +--- + +Adds a temporary way to fund hardhat accounts when testing locally diff --git a/packages/contracts/deploy/014-OVM_L1MultiMessageRelayer.deploy.ts b/packages/contracts/deploy/014-OVM_L1MultiMessageRelayer.deploy.ts index 21040b0bf6db..e814688b95bf 100644 --- a/packages/contracts/deploy/014-OVM_L1MultiMessageRelayer.deploy.ts +++ b/packages/contracts/deploy/014-OVM_L1MultiMessageRelayer.deploy.ts @@ -30,7 +30,7 @@ const deployFn: DeployFunction = async (hre) => { await registerAddress({ hre, name: 'OVM_L2MessageRelayer', - address: OVM_L1MultiMessageRelayer.address + address: OVM_L1MultiMessageRelayer.address, }) } } diff --git a/packages/contracts/deploy/018-fund-accounts.ts b/packages/contracts/deploy/018-fund-accounts.ts new file mode 100644 index 000000000000..3dc7c9b0a4fe --- /dev/null +++ b/packages/contracts/deploy/018-fund-accounts.ts @@ -0,0 +1,64 @@ +/* Imports: External */ +import { sleep } from '@eth-optimism/core-utils' +import { DeployFunction } from 'hardhat-deploy/dist/types' +import { + defaultHardhatNetworkHdAccountsConfigParams, + defaultHardhatNetworkParams, +} from 'hardhat/internal/core/config/default-config' +import { normalizeHardhatNetworkAccountsConfig } from 'hardhat/internal/core/providers/util' + +/* Imports: Internal */ +import { getDeployedContract } from '../src/hardhat-deploy-ethers' + +// This is a TEMPORARY way to fund the default hardhat accounts on L2. The better way to do this is +// to make a modification to hardhat-ovm. However, I don't have the time right now to figure the +// details of how to make that work cleanly. This is fine in the meantime. +const deployFn: DeployFunction = async (hre) => { + // Only execute this step if we're on the hardhat chain ID. + const { chainId } = await hre.ethers.provider.getNetwork() + if (chainId === defaultHardhatNetworkParams.chainId) { + const Proxy__OVM_L1ETHGateway = await getDeployedContract( + hre, + 'Proxy__OVM_L1ETHGateway', + { + iface: 'OVM_L1ETHGateway', + } + ) + + // Default has 20 accounts but we restrict to 20 accounts manually as well just to prevent + // future problems if the number of default accounts increases for whatever reason. + const accounts = normalizeHardhatNetworkAccountsConfig( + defaultHardhatNetworkHdAccountsConfigParams + ).slice(0, 20) + + // Fund the accounts in parallel to speed things up. + await Promise.all( + accounts.map(async (account, index) => { + // Add a sleep here to avoid any potential issues with spamming hardhat. Not sure if this + // is strictly necessary but it can't hurt. + await sleep(200 * index) + + const wallet = new hre.ethers.Wallet( + account.privateKey, + hre.ethers.provider + ) + const balance = await wallet.getBalance() + const depositAmount = balance.div(2) // Deposit half of the wallet's balance into L2. + await Proxy__OVM_L1ETHGateway.connect(wallet).deposit(8_000_000, '0x', { + value: depositAmount, + gasLimit: 2_000_000, // Idk, gas estimation was broken and this fixes it. + }) + console.log( + `✓ Funded ${wallet.address} on L2 with ${hre.ethers.utils.formatEther( + depositAmount + )} ETH` + ) + }) + ) + } +} + +deployFn.dependencies = ['Proxy__OVM_L1ETHGateway'] +deployFn.tags = ['fund-accounts'] + +export default deployFn diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 0ca16f5048d0..46881b7c926b 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -37,7 +37,7 @@ "posttest:slither": "rm -f @openzeppelin && rm -f @ens && rm -f hardhat", "lint": "yarn lint:fix && yarn lint:check", "lint:fix": "yarn run lint:fix:typescript", - "lint:fix:typescript": "prettier --config .prettierrc.json --write \"hardhat.config.ts\" \"{src,test}/**/*.ts\"", + "lint:fix:typescript": "prettier --config .prettierrc.json --write \"hardhat.config.ts\" \"{src,test,deploy}/**/*.ts\"", "lint:check": "yarn run lint:typescript", "lint:typescript": "tslint --format stylish --project .", "clean": "rm -rf ./dist ./artifacts ./artifacts-ovm ./cache ./cache-ovm ./tsconfig.build.tsbuildinfo", From baa3b761cd5693dd57b1acf7b4bd42500a83b34f Mon Sep 17 00:00:00 2001 From: Liam Horne Date: Fri, 11 Jun 2021 14:29:09 -0400 Subject: [PATCH 071/125] Ensure Sentry is correctly set up for DTL and MR (#1054) * refactor: add logger and metrics to options for BaseService * refactor: thread sentryOptions through from message-relayer into BaseService * refactor: ensure DTL Logger is using Sentry for errors * style: lint base-service.ts * refactor: init Sentry on batch-submitter too * refactor: init Sentry on message-relayer too * refactor: pass in basic logger to MessageRelayerService * build: provide changeset * fix: correct usage of use-sentry boolean config * refactor: appropriately type loggingOptions * build: add @sentry/node * build: add @sentry/node to message-relayer and fix linting issue --- .changeset/modern-chicken-listen.md | 8 ++ packages/batch-submitter/package.json | 1 + .../src/exec/run-batch-submitter.ts | 15 ++- packages/common-ts/src/base-service.ts | 16 ++- .../src/services/main/service.ts | 2 +- .../src/services/server/service.ts | 11 +- packages/message-relayer/package.json | 1 + packages/message-relayer/src/exec/run.ts | 24 ++++ packages/message-relayer/src/service.ts | 8 +- yarn.lock | 124 +++++++++--------- 10 files changed, 136 insertions(+), 74 deletions(-) create mode 100644 .changeset/modern-chicken-listen.md diff --git a/.changeset/modern-chicken-listen.md b/.changeset/modern-chicken-listen.md new file mode 100644 index 000000000000..22cda8e2674a --- /dev/null +++ b/.changeset/modern-chicken-listen.md @@ -0,0 +1,8 @@ +--- +'@eth-optimism/batch-submitter': patch +'@eth-optimism/common-ts': patch +'@eth-optimism/data-transport-layer': patch +'@eth-optimism/message-relayer': patch +--- + +Improve Sentry support, initializing as needed and ensuring ERROR logs route to Sentry diff --git a/packages/batch-submitter/package.json b/packages/batch-submitter/package.json index a1cdaeeaa09d..099278ef041b 100644 --- a/packages/batch-submitter/package.json +++ b/packages/batch-submitter/package.json @@ -37,6 +37,7 @@ "@eth-optimism/ynatm": "^0.2.2", "@ethersproject/abstract-provider": "^5.0.5", "@ethersproject/providers": "^5.0.14", + "@sentry/node": "^6.2.5", "bcfg": "^0.1.6", "bluebird": "^3.7.2", "dotenv": "^8.2.0", diff --git a/packages/batch-submitter/src/exec/run-batch-submitter.ts b/packages/batch-submitter/src/exec/run-batch-submitter.ts index 9174cfab3b44..e3f21a3139cd 100644 --- a/packages/batch-submitter/src/exec/run-batch-submitter.ts +++ b/packages/batch-submitter/src/exec/run-batch-submitter.ts @@ -1,5 +1,6 @@ /* External Imports */ import { injectL2Context, Bcfg } from '@eth-optimism/core-utils' +import * as Sentry from '@sentry/node' import { Logger, Metrics, createMetricsServer } from '@eth-optimism/common-ts' import { exit } from 'process' import { Signer, Wallet } from 'ethers' @@ -101,15 +102,17 @@ export const run = async () => { let logger if (config.bool('use-sentry', env.USE_SENTRY === 'true')) { + const sentryOptions = { + release, + dsn: sentryDsn, + tracesSampleRate: sentryTraceRate, + environment: network, + } + Sentry.init(sentryOptions) // Initialize Sentry for Batch Submitter deployed to a network logger = new Logger({ name, - sentryOptions: { - release, - dsn: sentryDsn, - tracesSampleRate: sentryTraceRate, - environment: network, - }, + sentryOptions, }) } else { // Skip initializing Sentry diff --git a/packages/common-ts/src/base-service.ts b/packages/common-ts/src/base-service.ts index df21cf200601..1f1fee6bfd7b 100644 --- a/packages/common-ts/src/base-service.ts +++ b/packages/common-ts/src/base-service.ts @@ -9,6 +9,11 @@ type OptionSettings = { } } +type BaseServiceOptions = T & { + logger?: Logger + metrics?: Metrics +} + /** * Base for other "Service" objects. Handles your standard initialization process, can dynamically * start and stop. @@ -21,11 +26,18 @@ export class BaseService { protected initialized: boolean = false protected running: boolean = false - constructor(name: string, options: T, optionSettings: OptionSettings) { + constructor( + name: string, + options: BaseServiceOptions, + optionSettings: OptionSettings + ) { validateOptions(options, optionSettings) this.name = name this.options = mergeDefaultOptions(options, optionSettings) - this.logger = new Logger({ name }) + this.logger = options.logger || new Logger({ name }) + if (options.metrics) { + this.metrics = options.metrics + } } /** diff --git a/packages/data-transport-layer/src/services/main/service.ts b/packages/data-transport-layer/src/services/main/service.ts index d4a16923e2f6..b4d0839a360e 100644 --- a/packages/data-transport-layer/src/services/main/service.ts +++ b/packages/data-transport-layer/src/services/main/service.ts @@ -1,5 +1,5 @@ /* Imports: External */ -import { BaseService } from '@eth-optimism/common-ts' +import { BaseService, Logger } from '@eth-optimism/common-ts' import { LevelUp } from 'levelup' import level from 'level' diff --git a/packages/data-transport-layer/src/services/server/service.ts b/packages/data-transport-layer/src/services/server/service.ts index 4e781114d92d..7accc0bd8dec 100644 --- a/packages/data-transport-layer/src/services/server/service.ts +++ b/packages/data-transport-layer/src/services/server/service.ts @@ -1,5 +1,5 @@ /* Imports: External */ -import { BaseService, Metrics } from '@eth-optimism/common-ts' +import { BaseService, Logger, Metrics } from '@eth-optimism/common-ts' import express, { Request, Response } from 'express' import promBundle from 'express-prom-bundle' import cors from 'cors' @@ -125,10 +125,17 @@ export class L1TransportServer extends BaseService { * Initialize Sentry and related middleware */ private _initSentry() { - Sentry.init({ + const sentryOptions = { dsn: this.options.sentryDsn, release: this.options.release, environment: this.options.ethNetworkName, + } + this.logger = new Logger({ + name: this.name, + sentryOptions, + }) + Sentry.init({ + ...sentryOptions, integrations: [ new Sentry.Integrations.Http({ tracing: true }), new Tracing.Integrations.Express({ diff --git a/packages/message-relayer/package.json b/packages/message-relayer/package.json index dbbfb14fd30b..08026c85efe6 100644 --- a/packages/message-relayer/package.json +++ b/packages/message-relayer/package.json @@ -32,6 +32,7 @@ "@eth-optimism/common-ts": "^0.1.2", "@eth-optimism/contracts": "^0.3.5", "@eth-optimism/core-utils": "^0.4.5", + "@sentry/node": "6.2.5", "bcfg": "^0.1.6", "dotenv": "^8.2.0", "ethers": "^5.1.0", diff --git a/packages/message-relayer/src/exec/run.ts b/packages/message-relayer/src/exec/run.ts index 0ee3a0abeefc..1cca64005d0a 100644 --- a/packages/message-relayer/src/exec/run.ts +++ b/packages/message-relayer/src/exec/run.ts @@ -1,6 +1,8 @@ import { Wallet, providers } from 'ethers' import { MessageRelayerService } from '../service' import { Bcfg } from '@eth-optimism/core-utils' +import { Logger, LoggerOptions } from '@eth-optimism/common-ts' +import * as Sentry from '@sentry/node' import * as dotenv from 'dotenv' import Config from 'bcfg' @@ -14,6 +16,27 @@ const main = async () => { }) const env = process.env + + const SENTRY_DSN = config.str('sentry-dsn', env.SENTRY_DSN) + const USE_SENTRY = config.bool('use-sentry', env.USE_SENTRY === 'true') + const ETH_NETWORK_NAME = config.str('eth-network-name', env.ETH_NETWORK_NAME) + + const loggerOptions: LoggerOptions = { + name: 'Message_Relayer', + } + + if (USE_SENTRY) { + const sentryOptions = { + release: `message-relayer@${process.env.npm_package_version}`, + dsn: SENTRY_DSN, + environment: ETH_NETWORK_NAME, + } + loggerOptions.sentryOptions = sentryOptions + Sentry.init(sentryOptions) + } + + const logger = new Logger(loggerOptions) + const L2_NODE_WEB3_URL = config.str('l2-node-web3-url', env.L2_NODE_WEB3_URL) const L1_NODE_WEB3_URL = config.str('l1-node-web3-url', env.L1_NODE_WEB3_URL) const ADDRESS_MANAGER_ADDRESS = config.str( @@ -82,6 +105,7 @@ const main = async () => { l2BlockOffset: L2_BLOCK_OFFSET, l1StartOffset: L1_START_OFFSET, getLogsInterval: GET_LOGS_INTERVAL, + logger, }) await service.start() diff --git a/packages/message-relayer/src/service.ts b/packages/message-relayer/src/service.ts index 1851dc7f0005..c69305fd262c 100644 --- a/packages/message-relayer/src/service.ts +++ b/packages/message-relayer/src/service.ts @@ -5,7 +5,7 @@ import { MerkleTree } from 'merkletreejs' /* Imports: Internal */ import { fromHexString, sleep } from '@eth-optimism/core-utils' -import { BaseService } from '@eth-optimism/common-ts' +import { Logger, BaseService, Metrics } from '@eth-optimism/common-ts' import { loadContract, loadContractFromManager } from '@eth-optimism/contracts' import { StateRootBatchHeader, SentMessage, SentMessageProof } from './types' @@ -40,6 +40,12 @@ interface MessageRelayerOptions { // Number of blocks within each getLogs query - max is 2000 getLogsInterval?: number + + // A custom logger to transport logs via; default STDOUT + logger?: Logger + + // A custom metrics tracker to manage metrics; default undefined + metrics?: Metrics } const optionSettings = { diff --git a/yarn.lock b/yarn.lock index 84e59fa04878..cc075769cbea 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1875,15 +1875,15 @@ "@sentry/utils" "6.2.5" tslib "^1.9.3" -"@sentry/core@6.3.5": - version "6.3.5" - resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.3.5.tgz#6b73de736eb9d0040be94cdbb06a744cd6b9172e" - integrity sha512-VR2ibDy33mryD0mT6d9fGhKjdNzS2FSwwZPe9GvmNOjkyjly/oV91BKVoYJneCqOeq8fyj2lvkJGKuupdJNDqg== - dependencies: - "@sentry/hub" "6.3.5" - "@sentry/minimal" "6.3.5" - "@sentry/types" "6.3.5" - "@sentry/utils" "6.3.5" +"@sentry/core@6.6.0": + version "6.6.0" + resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.6.0.tgz#51661d2dd5023d6cd07467422de1854282ced7e5" + integrity sha512-EjdeT6paAdxAZgfsVCB8wneahQF3nAUt9GxOJxaOBUv8BSc3HQ/svcTU3RU7k8YsP26PseEOIsedaxsEVZ+7og== + dependencies: + "@sentry/hub" "6.6.0" + "@sentry/minimal" "6.6.0" + "@sentry/types" "6.6.0" + "@sentry/utils" "6.6.0" tslib "^1.9.3" "@sentry/hub@5.30.0": @@ -1913,13 +1913,13 @@ "@sentry/utils" "6.3.1" tslib "^1.9.3" -"@sentry/hub@6.3.5": - version "6.3.5" - resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.3.5.tgz#c5bc6760f7e4e53e87149703b106804299060389" - integrity sha512-ZYFo7VYKwdPVjuV9BDFiYn+MpANn6eZMz5QDBfZ2dugIvIVbuOyOOLx8PSa3ZXJoVTZZ7s2wD2fi/ZxKjNjZOQ== +"@sentry/hub@6.6.0": + version "6.6.0" + resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.6.0.tgz#1b9fa22ee104b7d6afd2dc4c40a1459fda259366" + integrity sha512-1Yw0kbxcvO7njZUDGvCKB6DxU5jQio7Be3Kx5qxwcx8ojpT9lo9p+IYZajgl6zQqkjjbVm/4SoYqU24ozu5vxw== dependencies: - "@sentry/types" "6.3.5" - "@sentry/utils" "6.3.5" + "@sentry/types" "6.6.0" + "@sentry/utils" "6.6.0" tslib "^1.9.3" "@sentry/minimal@5.30.0": @@ -1949,13 +1949,28 @@ "@sentry/types" "6.3.1" tslib "^1.9.3" -"@sentry/minimal@6.3.5": - version "6.3.5" - resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.3.5.tgz#ef4894771243d01d81e91819400d2ecdcb34b411" - integrity sha512-4RqIGAU0+8iI/1sw0GYPTr4SUA88/i2+JPjFJ+qloh5ANVaNwhFPRChw+Ys9xpre8LV9JZrEsEf8AvQr4fkNbA== +"@sentry/minimal@6.6.0": + version "6.6.0" + resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.6.0.tgz#48684734e3c380e5e63a9357d05f0c18bae84419" + integrity sha512-xVBlZIDxSvHvNdvD5KmjTf8Xgi78vLpT4xqJaDUkW7B+DqWMVJZe5aUdQmcp7X/zWxctBwyMKsdHO7oiHkpS+Q== dependencies: - "@sentry/hub" "6.3.5" - "@sentry/types" "6.3.5" + "@sentry/hub" "6.6.0" + "@sentry/types" "6.6.0" + tslib "^1.9.3" + +"@sentry/node@6.2.5", "@sentry/node@^6.2.5": + version "6.2.5" + resolved "https://registry.yarnpkg.com/@sentry/node/-/node-6.2.5.tgz#6e6694c0c3ce6ca231710f40da0cac7fd5c645ef" + integrity sha512-/iM3khzGnUH713VFhZBAEYJhb/saEQSVz7Udogml+O7mFQ4rutnwJhgoGcB9YYrwMv2m7qOSszkdZbemDV6k2g== + dependencies: + "@sentry/core" "6.2.5" + "@sentry/hub" "6.2.5" + "@sentry/tracing" "6.2.5" + "@sentry/types" "6.2.5" + "@sentry/utils" "6.2.5" + cookie "^0.4.1" + https-proxy-agent "^5.0.0" + lru_map "^0.3.3" tslib "^1.9.3" "@sentry/node@^5.18.1": @@ -1973,31 +1988,16 @@ lru_map "^0.3.3" tslib "^1.9.3" -"@sentry/node@^6.2.5": - version "6.2.5" - resolved "https://registry.yarnpkg.com/@sentry/node/-/node-6.2.5.tgz#6e6694c0c3ce6ca231710f40da0cac7fd5c645ef" - integrity sha512-/iM3khzGnUH713VFhZBAEYJhb/saEQSVz7Udogml+O7mFQ4rutnwJhgoGcB9YYrwMv2m7qOSszkdZbemDV6k2g== - dependencies: - "@sentry/core" "6.2.5" - "@sentry/hub" "6.2.5" - "@sentry/tracing" "6.2.5" - "@sentry/types" "6.2.5" - "@sentry/utils" "6.2.5" - cookie "^0.4.1" - https-proxy-agent "^5.0.0" - lru_map "^0.3.3" - tslib "^1.9.3" - "@sentry/node@^6.3.1": - version "6.3.5" - resolved "https://registry.yarnpkg.com/@sentry/node/-/node-6.3.5.tgz#d5cbf941d0a4caf7b8e644d71cc6b463eeda214e" - integrity sha512-scPB+DoAEPaqkYuyb8d/gVWbFmX5PhaYSNHybeHncaP/P4itLdq/AoAWGNxl0Hj4EQokfT4OZWxaaJi7SCYnaw== - dependencies: - "@sentry/core" "6.3.5" - "@sentry/hub" "6.3.5" - "@sentry/tracing" "6.3.5" - "@sentry/types" "6.3.5" - "@sentry/utils" "6.3.5" + version "6.6.0" + resolved "https://registry.yarnpkg.com/@sentry/node/-/node-6.6.0.tgz#e535e1e679cf894752810529ffdee93cbfd078f0" + integrity sha512-heKie/AOanYq3mCsKR1igPn1sUIxBmGibBp79Xc0iSAgliPKnnLkqUjvAIKu6mcevL9UOUhpMDLzhilkaG+bAA== + dependencies: + "@sentry/core" "6.6.0" + "@sentry/hub" "6.6.0" + "@sentry/tracing" "6.6.0" + "@sentry/types" "6.6.0" + "@sentry/utils" "6.6.0" cookie "^0.4.1" https-proxy-agent "^5.0.0" lru_map "^0.3.3" @@ -2025,15 +2025,15 @@ "@sentry/utils" "6.2.5" tslib "^1.9.3" -"@sentry/tracing@6.3.5": - version "6.3.5" - resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-6.3.5.tgz#f76c362159141f860081ec7df80aa9f85b545860" - integrity sha512-TNKAST1ge2g24BlTfVxNp4gP5t3drbi0OVCh8h8ah+J7UjHSfdiqhd9W2h5qv1GO61gGlpWeN/TyioyQmOxu0Q== +"@sentry/tracing@6.6.0": + version "6.6.0" + resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-6.6.0.tgz#ce62fcb951faa6447cf47889f91efe3617b9eed2" + integrity sha512-tjXrmAOFfVBfx+ZmgE5bkpDPs/euNj0xrUg8MowCWGfCRn01W679tTb+dyNeP6faxQTo2RcaD68xD8oLroJwwA== dependencies: - "@sentry/hub" "6.3.5" - "@sentry/minimal" "6.3.5" - "@sentry/types" "6.3.5" - "@sentry/utils" "6.3.5" + "@sentry/hub" "6.6.0" + "@sentry/minimal" "6.6.0" + "@sentry/types" "6.6.0" + "@sentry/utils" "6.6.0" tslib "^1.9.3" "@sentry/tracing@^6.3.1": @@ -2062,10 +2062,10 @@ resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.3.1.tgz#af3b54728b29f633f38fbe51b8c10e3834fbc158" integrity sha512-BEBn8JX1yaooCAuonbaMci9z0RjwwMbQ3Eny/eyDdd+rjXprZCZaStZnCvSThbNBqAJ8YaUqY2YBMnEwJxarAw== -"@sentry/types@6.3.5": - version "6.3.5" - resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.3.5.tgz#d5eca7e76c250882ab78c01a8df894a9a9ca537d" - integrity sha512-tY/3pkAmGYJ3F0BtwInsdt/uclNvF8aNG7XHsTPQNzk7BkNVWjCXx0sjxi6CILirl5nwNxYxVeTr2ZYAEZ/dSQ== +"@sentry/types@6.6.0": + version "6.6.0" + resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.6.0.tgz#55cbca23859bad87411f0f32135a968e6e40a639" + integrity sha512-lZ1uFN0lSNftAohi0lciEoSL58Gk/Ib1lLKaj0FSOvB1PAUmvo5dPtLdd0qjtNdtoaM8zqhrAbwCTQ8XZCDRsg== "@sentry/utils@5.30.0": version "5.30.0" @@ -2091,12 +2091,12 @@ "@sentry/types" "6.3.1" tslib "^1.9.3" -"@sentry/utils@6.3.5": - version "6.3.5" - resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.3.5.tgz#a4805448cb0314d3d119688162aa695598a10bbb" - integrity sha512-kHUcZ37QYlNzz7c9LVdApITXHaNmQK7+sw/If3M/qpff1fd5XoecA8laLfcYuz+Cw5mRhVmdhPcCRM3Xi1IGXg== +"@sentry/utils@6.6.0": + version "6.6.0" + resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.6.0.tgz#b34d342d05eefc25b7ddd3f27f41c050f1e7e1ef" + integrity sha512-FK9yqz2x+ef50B54tueeJ6mfb7Pf3lN75omx/YQBDL5cicyOV4j4kJDqn8/VKYhcSuX+ZaCZ/8bvOf0lxe0aHg== dependencies: - "@sentry/types" "6.3.5" + "@sentry/types" "6.6.0" tslib "^1.9.3" "@sindresorhus/is@^0.14.0": From 85362d44fc13966f00bee26172dd04e6a442a6c6 Mon Sep 17 00:00:00 2001 From: Liam Horne Date: Fri, 11 Jun 2021 16:28:12 -0400 Subject: [PATCH 072/125] Add more logging information to monotonicity violation logs (#1066) * refactor: log idx of monotonicity violation from batch * build: add changeset --- .changeset/weak-terms-worry.md | 5 +++++ .../src/batch-submitter/tx-batch-submitter.ts | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 .changeset/weak-terms-worry.md diff --git a/.changeset/weak-terms-worry.md b/.changeset/weak-terms-worry.md new file mode 100644 index 000000000000..dd9653d4c69a --- /dev/null +++ b/.changeset/weak-terms-worry.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/batch-submitter': patch +--- + +Log additional data in monotonicity violation diff --git a/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts b/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts index 7515b1028b62..ff7449b730c3 100644 --- a/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts +++ b/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts @@ -356,13 +356,17 @@ export class TransactionBatchSubmitter extends BatchSubmitter { // Verify all of the batch elements are monotonic let lastTimestamp: number let lastBlockNumber: number - for (const ele of batch) { + for (const [idx, ele] of batch.entries()) { if (ele.timestamp < lastTimestamp) { - this.logger.error('Timestamp monotonicity violated! Element', { ele }) + this.logger.error('Timestamp monotonicity violated! Element', { + idx, + ele, + }) return false } if (ele.blockNumber < lastBlockNumber) { this.logger.error('Block Number monotonicity violated! Element', { + idx, ele, }) return false From ed088ee16e7845fb8d07ed309cf063faf459ba82 Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Fri, 11 Jun 2021 16:53:14 -0400 Subject: [PATCH 073/125] temporarily disable hardhat example tests (#1071) --- .github/workflows/integration.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 2e4697184a05..b1a6f15d73ab 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -45,18 +45,18 @@ jobs: run: docker-compose run integration_tests # Examples Tests - - name: Test & deploy hardhat-example on Ethereum (regression) - working-directory: ./examples/hardhat - run: | - yarn - yarn deploy - yarn test:integration - - - name: Test & deploy hardhat-example on Optimistic Ethereum - working-directory: ./examples/hardhat - run: | - yarn deploy:ovm - yarn test:integration:ovm + #- name: Test & deploy hardhat-example on Ethereum (regression) + # working-directory: ./examples/hardhat + # run: | + # yarn + # yarn deploy + # yarn test:integration + + #- name: Test & deploy hardhat-example on Optimistic Ethereum + # working-directory: ./examples/hardhat + # run: | + # yarn deploy:ovm + # yarn test:integration:ovm - name: Test & deploy waffle-example on Ethereum (regression) working-directory: ./examples/waffle @@ -110,4 +110,4 @@ jobs: uses: actions/upload-artifact@master with: name: logs.tgz - path: ./logs.tgz \ No newline at end of file + path: ./logs.tgz From c520100d04df5be8de6a55c83f516ce370de442c Mon Sep 17 00:00:00 2001 From: Karl Floersch Date: Fri, 11 Jun 2021 18:15:13 -0400 Subject: [PATCH 074/125] fix: monotonicity auto healer (#1070) * fix: monotonicity auto healer * add: changeset --- .changeset/slimy-snails-roll.md | 5 +++++ .../src/batch-submitter/tx-batch-submitter.ts | 19 ++++++------------- 2 files changed, 11 insertions(+), 13 deletions(-) create mode 100644 .changeset/slimy-snails-roll.md diff --git a/.changeset/slimy-snails-roll.md b/.changeset/slimy-snails-roll.md new file mode 100644 index 000000000000..742d78e6d9f3 --- /dev/null +++ b/.changeset/slimy-snails-roll.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/batch-submitter': patch +--- + +Fix a bug in fixMonotonicity auto healer diff --git a/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts b/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts index ff7449b730c3..713c2a560aa8 100644 --- a/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts +++ b/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts @@ -573,12 +573,8 @@ export class TransactionBatchSubmitter extends BatchSubmitter { oldBlockNumber: ele.blockNumber, newBlockNumber: earliestBlockNumber, }) - fixedBatch.push({ - ...ele, - timestamp: earliestTimestamp, - blockNumber: earliestBlockNumber, - }) - continue + ele.timestamp = earliestTimestamp + ele.blockNumber = earliestBlockNumber } // Fix the element if its timestammp/blockNumber is too large if ( @@ -591,14 +587,11 @@ export class TransactionBatchSubmitter extends BatchSubmitter { oldBlockNumber: ele.blockNumber, newBlockNumber: latestBlockNumber, }) - fixedBatch.push({ - ...ele, - timestamp: latestTimestamp, - blockNumber: latestBlockNumber, - }) - continue + ele.timestamp = latestTimestamp + ele.blockNumber = latestBlockNumber } - // No fixes needed! + earliestTimestamp = ele.timestamp + earliestBlockNumber = ele.blockNumber fixedBatch.push(ele) } return fixedBatch From e389ba105fa167d195444d047cdeae29182d1e45 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 11 Jun 2021 18:18:36 -0400 Subject: [PATCH 075/125] Version Packages (#1053) Co-authored-by: github-actions[bot] --- .changeset/angry-numbers-swim.md | 5 ----- .changeset/grumpy-spiders-yell.md | 5 ----- .changeset/modern-chicken-listen.md | 8 -------- .changeset/popular-feet-suffer.md | 5 ----- .changeset/shaggy-dogs-attend.md | 5 ----- .changeset/slimy-snails-roll.md | 5 ----- .changeset/weak-terms-worry.md | 5 ----- l2geth/CHANGELOG.md | 7 +++++++ l2geth/package.json | 2 +- packages/batch-submitter/CHANGELOG.md | 12 ++++++++++++ packages/batch-submitter/package.json | 4 ++-- packages/common-ts/CHANGELOG.md | 6 ++++++ packages/common-ts/package.json | 2 +- packages/data-transport-layer/CHANGELOG.md | 8 ++++++++ packages/data-transport-layer/package.json | 4 ++-- packages/message-relayer/CHANGELOG.md | 8 ++++++++ packages/message-relayer/package.json | 4 ++-- 17 files changed, 49 insertions(+), 46 deletions(-) delete mode 100644 .changeset/angry-numbers-swim.md delete mode 100644 .changeset/grumpy-spiders-yell.md delete mode 100644 .changeset/modern-chicken-listen.md delete mode 100644 .changeset/popular-feet-suffer.md delete mode 100644 .changeset/shaggy-dogs-attend.md delete mode 100644 .changeset/slimy-snails-roll.md delete mode 100644 .changeset/weak-terms-worry.md diff --git a/.changeset/angry-numbers-swim.md b/.changeset/angry-numbers-swim.md deleted file mode 100644 index 59883f090bb0..000000000000 --- a/.changeset/angry-numbers-swim.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/l2geth': patch ---- - -Optimize main polling loops diff --git a/.changeset/grumpy-spiders-yell.md b/.changeset/grumpy-spiders-yell.md deleted file mode 100644 index c231b337cf97..000000000000 --- a/.changeset/grumpy-spiders-yell.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/l2geth': patch ---- - -Bump golang version to 1.15 diff --git a/.changeset/modern-chicken-listen.md b/.changeset/modern-chicken-listen.md deleted file mode 100644 index 22cda8e2674a..000000000000 --- a/.changeset/modern-chicken-listen.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -'@eth-optimism/batch-submitter': patch -'@eth-optimism/common-ts': patch -'@eth-optimism/data-transport-layer': patch -'@eth-optimism/message-relayer': patch ---- - -Improve Sentry support, initializing as needed and ensuring ERROR logs route to Sentry diff --git a/.changeset/popular-feet-suffer.md b/.changeset/popular-feet-suffer.md deleted file mode 100644 index afb71d29cdb1..000000000000 --- a/.changeset/popular-feet-suffer.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/batch-submitter': patch ---- - -Fix typo in USE_HARDHAT config diff --git a/.changeset/shaggy-dogs-attend.md b/.changeset/shaggy-dogs-attend.md deleted file mode 100644 index 66480b391ab0..000000000000 --- a/.changeset/shaggy-dogs-attend.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/batch-submitter': patch ---- - -Change monotonicity band-aid code to log warnings not errors diff --git a/.changeset/slimy-snails-roll.md b/.changeset/slimy-snails-roll.md deleted file mode 100644 index 742d78e6d9f3..000000000000 --- a/.changeset/slimy-snails-roll.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/batch-submitter': patch ---- - -Fix a bug in fixMonotonicity auto healer diff --git a/.changeset/weak-terms-worry.md b/.changeset/weak-terms-worry.md deleted file mode 100644 index dd9653d4c69a..000000000000 --- a/.changeset/weak-terms-worry.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/batch-submitter': patch ---- - -Log additional data in monotonicity violation diff --git a/l2geth/CHANGELOG.md b/l2geth/CHANGELOG.md index d1962b54be8f..d0a0f3a73c23 100644 --- a/l2geth/CHANGELOG.md +++ b/l2geth/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 0.3.8 + +### Patch Changes + +- 989a3027: Optimize main polling loops +- cc6c7f07: Bump golang version to 1.15 + ## 0.3.7 ### Patch Changes diff --git a/l2geth/package.json b/l2geth/package.json index cf0f0a6d2fff..56a9a6a93700 100644 --- a/l2geth/package.json +++ b/l2geth/package.json @@ -1,6 +1,6 @@ { "name": "@eth-optimism/l2geth", - "version": "0.3.7", + "version": "0.3.8", "private": true, "devDependencies": {} } diff --git a/packages/batch-submitter/CHANGELOG.md b/packages/batch-submitter/CHANGELOG.md index 02cac6b87960..6b0e1457b7fb 100644 --- a/packages/batch-submitter/CHANGELOG.md +++ b/packages/batch-submitter/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## 0.3.4 + +### Patch Changes + +- baa3b761: Improve Sentry support, initializing as needed and ensuring ERROR logs route to Sentry +- cc742715: Fix typo in USE_HARDHAT config +- 98b7839f: Change monotonicity band-aid code to log warnings not errors +- c520100d: Fix a bug in fixMonotonicity auto healer +- 85362d44: Log additional data in monotonicity violation +- Updated dependencies [baa3b761] + - @eth-optimism/common-ts@0.1.3 + ## 0.3.3 ### Patch Changes diff --git a/packages/batch-submitter/package.json b/packages/batch-submitter/package.json index 099278ef041b..102b8c8f6773 100644 --- a/packages/batch-submitter/package.json +++ b/packages/batch-submitter/package.json @@ -1,6 +1,6 @@ { "name": "@eth-optimism/batch-submitter", - "version": "0.3.3", + "version": "0.3.4", "private": true, "description": "[Optimism] Batch submission for sequencer & aggregators", "main": "dist/index", @@ -31,7 +31,7 @@ "url": "https://github.com/ethereum-optimism/optimism-monorepo.git" }, "dependencies": { - "@eth-optimism/common-ts": "^0.1.2", + "@eth-optimism/common-ts": "^0.1.3", "@eth-optimism/contracts": "^0.3.5", "@eth-optimism/core-utils": "^0.4.5", "@eth-optimism/ynatm": "^0.2.2", diff --git a/packages/common-ts/CHANGELOG.md b/packages/common-ts/CHANGELOG.md index 85386b02aaad..60781b255f87 100644 --- a/packages/common-ts/CHANGELOG.md +++ b/packages/common-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @eth-optimism/common-ts +## 0.1.3 + +### Patch Changes + +- baa3b761: Improve Sentry support, initializing as needed and ensuring ERROR logs route to Sentry + ## 0.1.2 ### Patch Changes diff --git a/packages/common-ts/package.json b/packages/common-ts/package.json index 8bf3d9b75052..ac3f92b2d573 100644 --- a/packages/common-ts/package.json +++ b/packages/common-ts/package.json @@ -1,6 +1,6 @@ { "name": "@eth-optimism/common-ts", - "version": "0.1.2", + "version": "0.1.3", "main": "dist/index", "files": [ "dist/*" diff --git a/packages/data-transport-layer/CHANGELOG.md b/packages/data-transport-layer/CHANGELOG.md index 9b2978947a34..cd696595dba6 100644 --- a/packages/data-transport-layer/CHANGELOG.md +++ b/packages/data-transport-layer/CHANGELOG.md @@ -1,5 +1,13 @@ # data transport layer +## 0.3.6 + +### Patch Changes + +- baa3b761: Improve Sentry support, initializing as needed and ensuring ERROR logs route to Sentry +- Updated dependencies [baa3b761] + - @eth-optimism/common-ts@0.1.3 + ## 0.3.5 ### Patch Changes diff --git a/packages/data-transport-layer/package.json b/packages/data-transport-layer/package.json index 47e0a8158f2e..940bb46393f8 100644 --- a/packages/data-transport-layer/package.json +++ b/packages/data-transport-layer/package.json @@ -1,6 +1,6 @@ { "name": "@eth-optimism/data-transport-layer", - "version": "0.3.5", + "version": "0.3.6", "private": true, "main": "dist/index", "files": [ @@ -21,7 +21,7 @@ "build": "tsc -p tsconfig.build.json" }, "dependencies": { - "@eth-optimism/common-ts": "^0.1.2", + "@eth-optimism/common-ts": "^0.1.3", "@eth-optimism/contracts": "^0.3.5", "@eth-optimism/core-utils": "^0.4.5", "@ethersproject/providers": "^5.0.21", diff --git a/packages/message-relayer/CHANGELOG.md b/packages/message-relayer/CHANGELOG.md index 587238e85699..0a8a41e3a2bb 100644 --- a/packages/message-relayer/CHANGELOG.md +++ b/packages/message-relayer/CHANGELOG.md @@ -1,5 +1,13 @@ # @eth-optimism/message-relayer +## 0.1.5 + +### Patch Changes + +- baa3b761: Improve Sentry support, initializing as needed and ensuring ERROR logs route to Sentry +- Updated dependencies [baa3b761] + - @eth-optimism/common-ts@0.1.3 + ## 0.1.4 ### Patch Changes diff --git a/packages/message-relayer/package.json b/packages/message-relayer/package.json index 08026c85efe6..2847bc3af931 100644 --- a/packages/message-relayer/package.json +++ b/packages/message-relayer/package.json @@ -1,6 +1,6 @@ { "name": "@eth-optimism/message-relayer", - "version": "0.1.4", + "version": "0.1.5", "description": "[Optimism] Cross Domain Message Relayer service", "main": "dist/index", "types": "dist/index", @@ -29,7 +29,7 @@ "url": "https://github.com/ethereum-optimism/optimism.git" }, "dependencies": { - "@eth-optimism/common-ts": "^0.1.2", + "@eth-optimism/common-ts": "^0.1.3", "@eth-optimism/contracts": "^0.3.5", "@eth-optimism/core-utils": "^0.4.5", "@sentry/node": "6.2.5", From 5fc728da7381eda6b6f858c091636c947186a3ce Mon Sep 17 00:00:00 2001 From: Elena Gesheva Date: Sat, 12 Jun 2021 04:25:56 +0300 Subject: [PATCH 076/125] Standard token bridge (#988) * Remove abstract token gateway and deposited token implementations * Further simplification of bridge contracts * Standart token bridge and L2 token implementation * Fix spacing * Implement case when a bad deposit happens to a nonexistent L1<>L2 token pair * Use SafeMath in common token bridge accounting * test(contracts): fix finalizeWithdrawal test * fix(contracts): use SafeERC20 on token deposits * Rename OVM_L1ERC20Gateway to OVM_L1ERC20Bridge contract * Rename iOVM_L1ERC20Gateway to iOVM_L1ERC20Bridge contract * Cleanup gateway to bridge rename * Better name for the mapping holding l1->l2 deposit amounts * Use OZ SafeMath * Rename local variables in OVM_L2DepositedERC20 from gateway to bridge * Merge ETH and ERC20 bridge contracts * Rename OVM_L1ERC20Bridge to OVM_L1StandardBridge and fix tests from merging the ETH and ERC20 bridges * Better name for iAbs_BaseCrossDomainMessenger -> iOVM_CrossDomainMessenger * Correct the bounce back of deposit sender and recipient properties * Remove obsoleted event from OVM_L2DepositedERC20 * chore(contracts): change references from ETHGateway to Bridge * Fix a linting error * fix(contracts): add bridge to deployer * Split off ERC20Bridge interface for the purposes of being reused in custom ERC20 bridges * Split off interface natspec definitions * Draft version of OVM_L2DepositedERC20 splitted into a standard L2 erc20: L2StandardERC20 and a common L2 bridge: OVM_L2StandardBridge * style(contracts): define L1_ETH_ADDRESS as constant * test(integration): update interface to use depositETH * test(contracts): fix OVM_L1StandardBridge tests * test(contracts): fix L2 Standard Bridge tests * test(contracts): lint and remove an obsolete test case * Fix modifier check to comply with the L2 bridge distinction from L2 token * Simplify address <> interface casting in bridges * Ensure natspec comments are correct also add l1 and l2 token params to WithdrawalInitiated event for consistency * Fix issues in L1 and L2 bridges to ensure cross domain messages are sent only between the two bridges also adjusted withdrawals to send to either finalizeETHWithdrawal or finalizeERC20Withdrawal depending on which asset is being withdrawn * Remove AddressManager from the L1 standard bridge * REVERT ME: instruments cross domain enabled * fix(contracts): remove Address Manager from L1 Bridge * feat(contracts): make L2 Standard Bridge a predeploy * WIP: update deployments for standard bridges * WIP: update deployments for standard bridges * l2geth: TEMP log contract calls * chore(l2geth): replace eth gateway with standard bridge * fix(contracts): make contract-deployment/config work * WIP fix(integration): update integration tests for bridge * Remove ovmEth from L1 Standard bridge as obsoleted * Separate ERC20 standard implementation from L2 bridge * Formatting fixes * chore(l2geth): replace eth gateway with standard bridge * Revert "REVERT ME: instruments cross domain enabled" This reverts commit d5bb8f8f67974d0a3e65fc000f08858328a4bbbc. * fix: lint ts * Implement EIP-165 in the Standard L2 ERC20 token Also switch that to be based off the OpenZeppelin default implementation plus mint and burn Additionally remove the obsoleted iOVM_ERC20 * fix(contracts): add deployment check on bridge proxy fix(contracts): whitespace fix(contracts): init bridge implementation with non-zero address * Remove dependency on Ownable contract for the StandardERC20 token on L2 * fix(contracts): update deployment scripts * fix: lint * remove debugging code * fix: correct rpc get balance slot * restore l2 cross domain messenger * fix: lint * Add a test for a non compliant token deposit * Only allow EOAs to deposit ETH and ERC20 * Add comments and tests for ERC165 implementation * Decide against using explicit ETH MOCK address as we're not using it for checks * Fix linting issues * Add onlyEOAContract restriction to standard bridge withdrawals * Update codehashes in L2 Standard bridge * fix(ops): remove unintentionally added file * feat(contracts): add expectApproxGasCost function * fix(integration): proper arrayify input on fundUser * fix(integration): proper gas value checks * Revert "Add onlyEOAContract restriction to standard bridge withdrawals" This reverts commit 2713c06ceb2609e4f13718e1034a4d76210d9758. * fix(contracts): removed unused expectApproxGasCost for now * fix(contracts): update OVM_SequencerFeeVault for bridge changes * lint * Update deployment for L1 Bridge w/ ChugSplash * Revert "l2geth: TEMP log contract calls" This reverts commit 21d42259278449f221bf34605162229b3d9d4fa9. * Apply suggestions from code review * Apply suggestions from code review * fix(contracts): deploy with chugsplash proxy * fix(contracts): add working bridge and chugsplash proxy deployment * fix(contracts,integration): 500k gas for depositETH * comment(contracts): describe failed deposit handling on l2 * Apply suggestions from code review Co-authored-by: ben-chain * docs: add changeset * fix(integration): set working l2 gas amount on funduser * test(integration): add receive() test * fix(contracts): reset receive to 1.2MM l2 gas * test(examples): skip l1-l2 example test for now * fix(contracts): drop hardcoded gas to 500k in receive() * fix(contracts): use abi.encodeWithSignature * fix(contracts): resolve merge conflicts * feat(integration): add expectApprox for flexible gas testing * fix(integration): fix failing gas tests * fix: incorrect l2 gas for deposit * Update utils.ts * fix(workflow): disable l1-l2 example until npm imports are fixed * chore: final round of PR review nits and tests Co-authored-by: Maurelian Co-authored-by: Mark Tyneway Co-authored-by: ben-chain Co-authored-by: Kelvin Fichter --- .changeset/fast-oranges-happen.md | 9 + .github/workflows/integration.yml | 18 +- .../test/example.test.js | 18 +- .../test/native-eth-ovm-calls.spec.ts | 6 +- integration-tests/test/native-eth.spec.ts | 112 ++-- integration-tests/test/rpc.spec.ts | 6 +- integration-tests/test/shared/env.ts | 20 +- integration-tests/test/shared/utils.ts | 81 ++- l2geth/README.md | 2 +- l2geth/cmd/geth/main.go | 2 +- l2geth/cmd/geth/usage.go | 2 +- l2geth/cmd/utils/flags.go | 18 +- l2geth/core/genesis.go | 31 +- l2geth/core/state/statedb.go | 2 +- l2geth/core/vm/evm.go | 4 +- l2geth/rollup/config.go | 2 +- l2geth/scripts/start.sh | 17 +- ops/scripts/geth.sh | 6 +- .../OVM/bridge/tokens/Abs_L1TokenGateway.sol | 217 ------- .../bridge/tokens/Abs_L2DepositedToken.sol | 247 -------- .../OVM/bridge/tokens/OVM_L1ERC20Gateway.sol | 100 ---- .../OVM/bridge/tokens/OVM_L1ETHGateway.sol | 232 -------- .../bridge/tokens/OVM_L1StandardBridge.sol | 325 +++++++++++ .../bridge/tokens/OVM_L2DepositedERC20.sol | 67 --- .../bridge/tokens/OVM_L2StandardBridge.sol | 219 +++++++ .../OVM/execution/OVM_ExecutionManager.sol | 15 +- .../OVM/predeploys/OVM_ETH.sol | 28 +- .../OVM/predeploys/OVM_SequencerFeeVault.sol | 6 +- ...nger.sol => iOVM_CrossDomainMessenger.sol} | 4 +- .../messaging/iOVM_L1CrossDomainMessenger.sol | 4 +- .../messaging/iOVM_L2CrossDomainMessenger.sol | 4 +- .../iOVM/bridge/tokens/iOVM_L1ERC20Bridge.sol | 104 ++++ .../iOVM/bridge/tokens/iOVM_L1ETHGateway.sol | 59 -- .../bridge/tokens/iOVM_L1StandardBridge.sol | 85 +++ .../bridge/tokens/iOVM_L1TokenGateway.sol | 61 -- .../bridge/tokens/iOVM_L2DepositedToken.sol | 61 -- .../iOVM/bridge/tokens/iOVM_L2ERC20Bridge.sol | 109 ++++ .../iOVM/predeploys/iOVM_ERC20.sol | 53 -- .../bridge/OVM_CrossDomainEnabled.sol | 6 +- .../constants/Lib_PredeployAddresses.sol | 1 + .../libraries/standards/IL2StandardERC20.sol | 16 + .../libraries/standards/IUniswapV2ERC20.sol | 24 - .../libraries/standards/L2StandardERC20.sol | 52 ++ .../libraries/standards/UniSafeMath.sol | 18 - .../libraries/standards/UniswapV2ERC20.sol | 98 ---- .../deploy/015-OVM_L1ETHGateway.deploy.ts | 59 -- .../015-Proxy__OVM_L1StandardBridge.deploy.ts | 104 ++++ .../016-Proxy__OVM_L1ETHGateway.deploy.ts | 62 -- .../{017-finalize.ts => 016-finalize.ts} | 0 .../contracts/deploy/018-fund-accounts.ts | 8 +- .../src/contract-deployment/config.ts | 34 +- packages/contracts/src/predeploys.ts | 1 + .../contracts/src/state-dump/make-dump.ts | 2 + .../accounts/OVM_ECDSAContractAccount.spec.ts | 2 +- .../bridge/assets/OVM_L1ERC20Gateway.spec.ts | 255 --------- .../bridge/assets/OVM_L1ETHGateway.spec.ts | 315 ---------- .../assets/OVM_L1StandardBridge.spec.ts | 540 ++++++++++++++++++ .../assets/OVM_L2DepositedERC20.spec.ts | 260 --------- .../assets/OVM_L2StandardBridge.spec.ts | 332 +++++++++++ .../OVM_ExecutionManager/native-eth.spec.ts | 6 +- .../precompiles/OVM_SequencerFeeVault.spec.ts | 18 +- packages/contracts/test/helpers/gas/gas.ts | 3 +- .../test/helpers/test-runner/test-runner.ts | 2 +- packages/data-transport-layer/package.json | 1 + 64 files changed, 2188 insertions(+), 2387 deletions(-) create mode 100644 .changeset/fast-oranges-happen.md delete mode 100644 packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/Abs_L1TokenGateway.sol delete mode 100644 packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/Abs_L2DepositedToken.sol delete mode 100644 packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ERC20Gateway.sol delete mode 100644 packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ETHGateway.sol create mode 100644 packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1StandardBridge.sol delete mode 100644 packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L2DepositedERC20.sol create mode 100644 packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L2StandardBridge.sol rename packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/messaging/{iAbs_BaseCrossDomainMessenger.sol => iOVM_CrossDomainMessenger.sol} (91%) create mode 100644 packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1ERC20Bridge.sol delete mode 100644 packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1ETHGateway.sol create mode 100644 packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1StandardBridge.sol delete mode 100644 packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1TokenGateway.sol delete mode 100644 packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L2DepositedToken.sol create mode 100644 packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L2ERC20Bridge.sol delete mode 100644 packages/contracts/contracts/optimistic-ethereum/iOVM/predeploys/iOVM_ERC20.sol create mode 100644 packages/contracts/contracts/optimistic-ethereum/libraries/standards/IL2StandardERC20.sol delete mode 100644 packages/contracts/contracts/optimistic-ethereum/libraries/standards/IUniswapV2ERC20.sol create mode 100644 packages/contracts/contracts/optimistic-ethereum/libraries/standards/L2StandardERC20.sol delete mode 100644 packages/contracts/contracts/optimistic-ethereum/libraries/standards/UniSafeMath.sol delete mode 100644 packages/contracts/contracts/optimistic-ethereum/libraries/standards/UniswapV2ERC20.sol delete mode 100644 packages/contracts/deploy/015-OVM_L1ETHGateway.deploy.ts create mode 100644 packages/contracts/deploy/015-Proxy__OVM_L1StandardBridge.deploy.ts delete mode 100644 packages/contracts/deploy/016-Proxy__OVM_L1ETHGateway.deploy.ts rename packages/contracts/deploy/{017-finalize.ts => 016-finalize.ts} (100%) delete mode 100644 packages/contracts/test/contracts/OVM/bridge/assets/OVM_L1ERC20Gateway.spec.ts delete mode 100644 packages/contracts/test/contracts/OVM/bridge/assets/OVM_L1ETHGateway.spec.ts create mode 100644 packages/contracts/test/contracts/OVM/bridge/assets/OVM_L1StandardBridge.spec.ts delete mode 100644 packages/contracts/test/contracts/OVM/bridge/assets/OVM_L2DepositedERC20.spec.ts create mode 100644 packages/contracts/test/contracts/OVM/bridge/assets/OVM_L2StandardBridge.spec.ts diff --git a/.changeset/fast-oranges-happen.md b/.changeset/fast-oranges-happen.md new file mode 100644 index 000000000000..78b72c2b4834 --- /dev/null +++ b/.changeset/fast-oranges-happen.md @@ -0,0 +1,9 @@ +--- +'@eth-optimism/contracts': minor +'@eth-optimism/integration-tests': patch +'@eth-optimism/l2geth': patch +--- + +Add a new Standard Token Bridge, to handle deposits and withdrawals of any ERC20 token. +For projects developing a custom bridge, if you were previously importing `iAbs_BaseCrossDomainMessenger`, you should now +import `iOVM_CrossDomainMessenger`. diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index b1a6f15d73ab..a4915f014439 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -45,14 +45,14 @@ jobs: run: docker-compose run integration_tests # Examples Tests - #- name: Test & deploy hardhat-example on Ethereum (regression) + # - name: Test & deploy hardhat-example on Ethereum (regression) # working-directory: ./examples/hardhat # run: | # yarn # yarn deploy # yarn test:integration - #- name: Test & deploy hardhat-example on Optimistic Ethereum + # - name: Test & deploy hardhat-example on Optimistic Ethereum # working-directory: ./examples/hardhat # run: | # yarn deploy:ovm @@ -86,13 +86,13 @@ jobs: yarn test:integration:ovm yarn deploy:ovm - - name: Test l1-l2-deposit-withdrawal example on Optimistic Ethereum with cross-domain message passing - working-directory: ./examples/l1-l2-deposit-withdrawal - run: | - yarn - yarn compile - yarn compile:ovm - yarn test:integration:ovm + # - name: Test l1-l2-deposit-withdrawal example on Optimistic Ethereum with cross-domain message passing + # working-directory: ./examples/l1-l2-deposit-withdrawal + # run: | + # yarn + # yarn compile + # yarn compile:ovm + # yarn test:integration:ovm - name: Collect docker logs on failure if: failure() diff --git a/examples/l1-l2-deposit-withdrawal/test/example.test.js b/examples/l1-l2-deposit-withdrawal/test/example.test.js index 821072ada621..be3b70cce71a 100644 --- a/examples/l1-l2-deposit-withdrawal/test/example.test.js +++ b/examples/l1-l2-deposit-withdrawal/test/example.test.js @@ -11,7 +11,7 @@ const factory = (name, ovm = false) => { } const factory__L1_ERC20 = factory('ERC20') const factory__L2_ERC20 = factory('L2DepositedERC20', true) -const factory__L1_ERC20Gateway = getContractFactory('OVM_L1ERC20Gateway') +const factory__L1StandardBridge = getContractFactory('OVM_L1StandardBridge') describe(`L1 <> L2 Deposit and Withdrawal`, () => { @@ -50,7 +50,7 @@ describe(`L1 <> L2 Deposit and Withdrawal`, () => { let L1_ERC20, L2_ERC20, - L1_ERC20Gateway + L1StandardBridge before(`deploy contracts`, async () => { // Deploy an ERC20 token on L1. @@ -75,8 +75,8 @@ describe(`L1 <> L2 Deposit and Withdrawal`, () => { await L2_ERC20.deployTransaction.wait() - // Create a gateway that connects the two contracts. - L1_ERC20Gateway = await factory__L1_ERC20Gateway.connect(l1Wallet).deploy( + // Create a bridge that connects the two contracts. + L1StandardBridge = await factory__L1StandardBridge.connect(l1Wallet).deploy( L1_ERC20.address, L2_ERC20.address, l1MessengerAddress, @@ -85,12 +85,12 @@ describe(`L1 <> L2 Deposit and Withdrawal`, () => { } ) - await L1_ERC20Gateway.deployTransaction.wait() + await L1StandardBridge.deployTransaction.wait() }) describe('Initialization and initial balances', async () => { it(`should initialize L2 ERC20`, async () => { - const tx = await L2_ERC20.init(L1_ERC20Gateway.address, { gasPrice: 0 }) + const tx = await L2_ERC20.init(L1StandardBridge.address, { gasPrice: 0 }) await tx.wait() const txHashPrefix = tx.hash.slice(0, 2) expect(txHashPrefix).to.eq('0x') @@ -107,15 +107,15 @@ describe(`L1 <> L2 Deposit and Withdrawal`, () => { describe('L1 to L2 deposit', async () => { let l1Tx1 - it(`should approve 1234 tokens for ERC20 gateway`, async () => { - const tx = await L1_ERC20.approve(L1_ERC20Gateway.address, 1234) + it(`should approve 1234 tokens for ERC20 bridge`, async () => { + const tx = await L1_ERC20.approve(L1StandardBridge.address, 1234) await tx.wait() const txHashPrefix = tx.hash.slice(0, 2) expect(txHashPrefix).to.eq('0x') }) it(`should deposit 1234 tokens into L2 ERC20`, async () => { - l1Tx1 = await L1_ERC20Gateway.deposit(1234, { gasPrice: 0 }) + l1Tx1 = await L1StandardBridge.deposit(1234, { gasPrice: 0 }) await l1Tx1.wait() const txHashPrefix = l1Tx1.hash.slice(0, 2) expect(txHashPrefix).to.eq('0x') diff --git a/integration-tests/test/native-eth-ovm-calls.spec.ts b/integration-tests/test/native-eth-ovm-calls.spec.ts index 13d64ef1d79e..73c1a0bd281c 100644 --- a/integration-tests/test/native-eth-ovm-calls.spec.ts +++ b/integration-tests/test/native-eth-ovm-calls.spec.ts @@ -41,7 +41,7 @@ describe('Native ETH value integration tests', () => { } const value = 10 - await fundUser(env.watcher, env.gateway, value, wallet.address) + await fundUser(env.watcher, env.l1Bridge, value, wallet.address) const initialBalances = await getBalances() @@ -142,7 +142,7 @@ describe('Native ETH value integration tests', () => { ValueCalls1 = await Factory__ValueCalls.deploy() await fundUser( env.watcher, - env.gateway, + env.l1Bridge, initialBalance0, ValueCalls0.address ) @@ -189,7 +189,7 @@ describe('Native ETH value integration tests', () => { const initialBalance = 10 await fundUser( env.watcher, - env.gateway, + env.l1Bridge, initialBalance, ValueCalls1.address ) diff --git a/integration-tests/test/native-eth.spec.ts b/integration-tests/test/native-eth.spec.ts index 192759804121..1b873eda147e 100644 --- a/integration-tests/test/native-eth.spec.ts +++ b/integration-tests/test/native-eth.spec.ts @@ -1,12 +1,17 @@ +import { predeploys } from '@eth-optimism/contracts' + import { expect } from 'chai' import { Wallet, utils, BigNumber } from 'ethers' import { Direction } from './shared/watcher-utils' -import { PROXY_SEQUENCER_ENTRYPOINT_ADDRESS } from './shared/utils' +import { + expectApprox, + PROXY_SEQUENCER_ENTRYPOINT_ADDRESS, +} from './shared/utils' import { OptimismEnv } from './shared/env' const DEFAULT_TEST_GAS_L1 = 330_000 -const DEFAULT_TEST_GAS_L2 = 1_000_000 +const DEFAULT_TEST_GAS_L2 = 1_300_000 // TX size enforced by CTC: const MAX_ROLLUP_TX_SIZE = 50_000 @@ -25,8 +30,8 @@ describe('Native ETH Integration Tests', async () => { const sequencerBalance = await _env.ovmEth.balanceOf( PROXY_SEQUENCER_ENTRYPOINT_ADDRESS ) - const l1GatewayBalance = await _env.l1Wallet.provider.getBalance( - _env.gateway.address + const l1BridgeBalance = await _env.l1Wallet.provider.getBalance( + _env.l1Bridge.address ) return { @@ -34,7 +39,7 @@ describe('Native ETH Integration Tests', async () => { l2UserBalance, l1BobBalance, l2BobBalance, - l1GatewayBalance, + l1BridgeBalance, sequencerBalance, } } @@ -50,21 +55,29 @@ describe('Native ETH Integration Tests', async () => { const amount = utils.parseEther('0.5') const addr = '0x' + '1234'.repeat(10) const gas = await env.ovmEth.estimateGas.transfer(addr, amount) - expect(gas).to.be.deep.eq(BigNumber.from(6430021)) + // Expect gas to be less than or equal to the target plus 1% + expectApprox(gas, 6430020, 1) }) it('Should estimate gas for ETH withdraw', async () => { const amount = utils.parseEther('0.5') - const gas = await env.ovmEth.estimateGas.withdraw(amount, 0, '0xFFFF') - expect(gas).to.be.deep.eq(BigNumber.from(6580054)) + const gas = await env.l2Bridge.estimateGas.withdraw( + predeploys.OVM_ETH, + amount, + 0, + '0xFFFF' + ) + // Expect gas to be less than or equal to the target plus 1% + expectApprox(gas, 6700060, 1) }) }) - it('deposit', async () => { + it('receive', async () => { const depositAmount = 10 const preBalances = await getBalances(env) const { tx, receipt } = await env.waitForXDomainTransaction( - env.gateway.deposit(DEFAULT_TEST_GAS_L2, '0xFFFF', { + env.l1Wallet.sendTransaction({ + to: env.l1Bridge.address, value: depositAmount, gasLimit: DEFAULT_TEST_GAS_L1, }), @@ -74,8 +87,8 @@ describe('Native ETH Integration Tests', async () => { const l1FeePaid = receipt.gasUsed.mul(tx.gasPrice) const postBalances = await getBalances(env) - expect(postBalances.l1GatewayBalance).to.deep.eq( - preBalances.l1GatewayBalance.add(depositAmount) + expect(postBalances.l1BridgeBalance).to.deep.eq( + preBalances.l1BridgeBalance.add(depositAmount) ) expect(postBalances.l2UserBalance).to.deep.eq( preBalances.l2UserBalance.add(depositAmount) @@ -85,11 +98,36 @@ describe('Native ETH Integration Tests', async () => { ) }) - it('depositTo', async () => { + it('depositETH', async () => { + const depositAmount = 10 + const preBalances = await getBalances(env) + const { tx, receipt } = await env.waitForXDomainTransaction( + env.l1Bridge.depositETH(DEFAULT_TEST_GAS_L2, '0xFFFF', { + value: depositAmount, + gasLimit: DEFAULT_TEST_GAS_L1, + }), + Direction.L1ToL2 + ) + + const l1FeePaid = receipt.gasUsed.mul(tx.gasPrice) + const postBalances = await getBalances(env) + + expect(postBalances.l1BridgeBalance).to.deep.eq( + preBalances.l1BridgeBalance.add(depositAmount) + ) + expect(postBalances.l2UserBalance).to.deep.eq( + preBalances.l2UserBalance.add(depositAmount) + ) + expect(postBalances.l1UserBalance).to.deep.eq( + preBalances.l1UserBalance.sub(l1FeePaid.add(depositAmount)) + ) + }) + + it('depositETHTo', async () => { const depositAmount = 10 const preBalances = await getBalances(env) const depositReceipts = await env.waitForXDomainTransaction( - env.gateway.depositTo(l2Bob.address, DEFAULT_TEST_GAS_L2, '0xFFFF', { + env.l1Bridge.depositETHTo(l2Bob.address, DEFAULT_TEST_GAS_L2, '0xFFFF', { value: depositAmount, gasLimit: DEFAULT_TEST_GAS_L1, }), @@ -100,8 +138,8 @@ describe('Native ETH Integration Tests', async () => { depositReceipts.tx.gasPrice ) const postBalances = await getBalances(env) - expect(postBalances.l1GatewayBalance).to.deep.eq( - preBalances.l1GatewayBalance.add(depositAmount) + expect(postBalances.l1BridgeBalance).to.deep.eq( + preBalances.l1BridgeBalance.add(depositAmount) ) expect(postBalances.l2BobBalance).to.deep.eq( preBalances.l2BobBalance.add(depositAmount) @@ -120,7 +158,7 @@ describe('Native ETH Integration Tests', async () => { // to allow for encoding and other arguments const data = `0x` + 'ab'.repeat(MAX_ROLLUP_TX_SIZE - 500) const { tx, receipt } = await env.waitForXDomainTransaction( - env.gateway.deposit(ASSUMED_L2_GAS_LIMIT, data, { + env.l1Bridge.depositETH(ASSUMED_L2_GAS_LIMIT, data, { value: depositAmount, gasLimit: 4_000_000, }), @@ -129,9 +167,8 @@ describe('Native ETH Integration Tests', async () => { const l1FeePaid = receipt.gasUsed.mul(tx.gasPrice) const postBalances = await getBalances(env) - - expect(postBalances.l1GatewayBalance).to.deep.eq( - preBalances.l1GatewayBalance.add(depositAmount) + expect(postBalances.l1BridgeBalance).to.deep.eq( + preBalances.l1BridgeBalance.add(depositAmount) ) expect(postBalances.l2UserBalance).to.deep.eq( preBalances.l2UserBalance.add(depositAmount) @@ -141,12 +178,12 @@ describe('Native ETH Integration Tests', async () => { ) }) - it('deposit fails with a TOO large data argument', async () => { + it('depositETH fails with a TOO large data argument', async () => { const depositAmount = 10 const data = `0x` + 'ab'.repeat(MAX_ROLLUP_TX_SIZE + 1) await expect( - env.gateway.deposit(DEFAULT_TEST_GAS_L2, data, { + env.l1Bridge.depositETH(DEFAULT_TEST_GAS_L2, data, { value: depositAmount, gasLimit: 4_000_000, }) @@ -164,15 +201,20 @@ describe('Native ETH Integration Tests', async () => { ) const receipts = await env.waitForXDomainTransaction( - env.ovmEth.withdraw(withdrawAmount, DEFAULT_TEST_GAS_L1, '0xFFFF'), + env.l2Bridge.withdraw( + predeploys.OVM_ETH, + withdrawAmount, + DEFAULT_TEST_GAS_L2, + '0xFFFF' + ), Direction.L2ToL1 ) const fee = receipts.tx.gasLimit.mul(receipts.tx.gasPrice) const postBalances = await getBalances(env) - expect(postBalances.l1GatewayBalance).to.deep.eq( - preBalances.l1GatewayBalance.sub(withdrawAmount) + expect(postBalances.l1BridgeBalance).to.deep.eq( + preBalances.l1BridgeBalance.sub(withdrawAmount) ) expect(postBalances.l2UserBalance).to.deep.eq( preBalances.l2UserBalance.sub(withdrawAmount.add(fee)) @@ -193,10 +235,11 @@ describe('Native ETH Integration Tests', async () => { ) const receipts = await env.waitForXDomainTransaction( - env.ovmEth.withdrawTo( + env.l2Bridge.withdrawTo( + predeploys.OVM_ETH, l1Bob.address, withdrawAmount, - DEFAULT_TEST_GAS_L1, + DEFAULT_TEST_GAS_L2, '0xFFFF' ), Direction.L2ToL1 @@ -205,8 +248,8 @@ describe('Native ETH Integration Tests', async () => { const postBalances = await getBalances(env) - expect(postBalances.l1GatewayBalance).to.deep.eq( - preBalances.l1GatewayBalance.sub(withdrawAmount) + expect(postBalances.l1BridgeBalance).to.deep.eq( + preBalances.l1BridgeBalance.sub(withdrawAmount) ) expect(postBalances.l2UserBalance).to.deep.eq( preBalances.l2UserBalance.sub(withdrawAmount.add(fee)) @@ -220,7 +263,7 @@ describe('Native ETH Integration Tests', async () => { // 1. deposit const amount = utils.parseEther('1') await env.waitForXDomainTransaction( - env.gateway.deposit(DEFAULT_TEST_GAS_L2, '0xFFFF', { + env.l1Bridge.depositETH(DEFAULT_TEST_GAS_L2, '0xFFFF', { value: amount, gasLimit: DEFAULT_TEST_GAS_L1, }), @@ -239,9 +282,14 @@ describe('Native ETH Integration Tests', async () => { // 3. do withdrawal const withdrawnAmount = utils.parseEther('0.95') const receipts = await env.waitForXDomainTransaction( - env.ovmEth + env.l2Bridge .connect(other) - .withdraw(withdrawnAmount, DEFAULT_TEST_GAS_L1, '0xFFFF'), + .withdraw( + predeploys.OVM_ETH, + withdrawnAmount, + DEFAULT_TEST_GAS_L1, + '0xFFFF' + ), Direction.L2ToL1 ) diff --git a/integration-tests/test/rpc.spec.ts b/integration-tests/test/rpc.spec.ts index 841a7de9bcda..29a816cf9659 100644 --- a/integration-tests/test/rpc.spec.ts +++ b/integration-tests/test/rpc.spec.ts @@ -12,6 +12,7 @@ import { l2Provider, DEFAULT_TRANSACTION, fundUser, + expectApprox, } from './shared/utils' import chaiAsPromised from 'chai-as-promised' import { OptimismEnv } from './shared/env' @@ -217,7 +218,7 @@ describe('Basic RPC tests', () => { // Fund account to call from const from = wallet.address const value = 15 - await fundUser(env.watcher, env.gateway, value, from) + await fundUser(env.watcher, env.l1Bridge, value, from) // Do the call and check msg.value const data = ValueContext.interface.encodeFunctionData('getCallValue') @@ -376,7 +377,8 @@ describe('Basic RPC tests', () => { to: DEFAULT_TRANSACTION.to, value: 0, }) - expect(estimate).to.be.eq(5920013) + // Expect gas to be less than or equal to the target plus 1% + expectApprox(estimate, 5920012, 1) }) it('should return a gas estimate that grows with the size of data', async () => { diff --git a/integration-tests/test/shared/env.ts b/integration-tests/test/shared/env.ts index ccce5a9698e1..4b4f29e5071f 100644 --- a/integration-tests/test/shared/env.ts +++ b/integration-tests/test/shared/env.ts @@ -9,7 +9,8 @@ import { l2Wallet, fundUser, getOvmEth, - getGateway, + getL1Bridge, + getL2Bridge, } from './utils' import { initWatcher, @@ -23,12 +24,13 @@ import { TransactionResponse } from '@ethersproject/providers' export class OptimismEnv { // L1 Contracts addressManager: Contract - gateway: Contract + l1Bridge: Contract l1Messenger: Contract ctc: Contract // L2 Contracts ovmEth: Contract + l2Bridge: Contract l2Messenger: Contract // The L1 <> L2 State watcher @@ -40,9 +42,10 @@ export class OptimismEnv { constructor(args: any) { this.addressManager = args.addressManager - this.gateway = args.gateway + this.l1Bridge = args.l1Bridge this.l1Messenger = args.l1Messenger this.ovmEth = args.ovmEth + this.l2Bridge = args.l2Bridge this.l2Messenger = args.l2Messenger this.watcher = args.watcher this.l1Wallet = args.l1Wallet @@ -53,18 +56,18 @@ export class OptimismEnv { static async new(): Promise { const addressManager = getAddressManager(l1Wallet) const watcher = await initWatcher(l1Provider, l2Provider, addressManager) - const gateway = await getGateway(l1Wallet, addressManager) + const l1Bridge = await getL1Bridge(l1Wallet, addressManager) // fund the user if needed const balance = await l2Wallet.getBalance() if (balance.isZero()) { - await fundUser(watcher, gateway, utils.parseEther('20')) + await fundUser(watcher, l1Bridge, utils.parseEther('20')) } - - const ovmEth = getOvmEth(l2Wallet) const l1Messenger = getContractFactory('iOVM_L1CrossDomainMessenger') .connect(l1Wallet) .attach(watcher.l1.messengerAddress) + const ovmEth = getOvmEth(l2Wallet) + const l2Bridge = await getL2Bridge(l2Wallet) const l2Messenger = getContractFactory('iOVM_L2CrossDomainMessenger') .connect(l2Wallet) .attach(watcher.l2.messengerAddress) @@ -78,10 +81,11 @@ export class OptimismEnv { return new OptimismEnv({ addressManager, - gateway, + l1Bridge, ctc, l1Messenger, ovmEth, + l2Bridge, l2Messenger, watcher, l1Wallet, diff --git a/integration-tests/test/shared/utils.ts b/integration-tests/test/shared/utils.ts index 6c39d7b57c3b..47fdca63851e 100644 --- a/integration-tests/test/shared/utils.ts +++ b/integration-tests/test/shared/utils.ts @@ -1,3 +1,5 @@ +import { expect } from 'chai' + import { Direction, waitForXDomainTransaction } from './watcher-utils' import { @@ -63,24 +65,37 @@ export const getAddressManager = (provider: any) => { .attach(env.ADDRESS_MANAGER) } -// Gets the gateway using the proxy if available -export const getGateway = async (wallet: Wallet, AddressManager: Contract) => { - const l1GatewayInterface = getContractInterface('OVM_L1ETHGateway') - const ProxyGatewayAddress = await AddressManager.getAddress( - 'Proxy__OVM_L1ETHGateway' +// Gets the bridge contract +export const getL1Bridge = async (wallet: Wallet, AddressManager: Contract) => { + const l1BridgeInterface = getContractInterface('OVM_L1StandardBridge') + const ProxyBridgeAddress = await AddressManager.getAddress( + 'Proxy__OVM_L1StandardBridge' ) - const addressToUse = - ProxyGatewayAddress !== constants.AddressZero - ? ProxyGatewayAddress - : await AddressManager.getAddress('OVM_L1ETHGateway') - - const OVM_L1ETHGateway = new Contract( - addressToUse, - l1GatewayInterface, + + if ( + !utils.isAddress(ProxyBridgeAddress) || + ProxyBridgeAddress === constants.AddressZero + ) { + throw new Error('Proxy__OVM_L1StandardBridge not found') + } + + const OVM_L1StandardBridge = new Contract( + ProxyBridgeAddress, + l1BridgeInterface, wallet ) + return OVM_L1StandardBridge +} + +export const getL2Bridge = async (wallet: Wallet) => { + const L2BridgeInterface = getContractInterface('OVM_L2StandardBridge') - return OVM_L1ETHGateway + const OVM_L2StandardBridge = new Contract( + predeploys.OVM_L2StandardBridge, + L2BridgeInterface, + wallet + ) + return OVM_L2StandardBridge } export const getOvmEth = (wallet: Wallet) => { @@ -95,14 +110,14 @@ export const getOvmEth = (wallet: Wallet) => { export const fundUser = async ( watcher: Watcher, - gateway: Contract, + bridge: Contract, amount: BigNumberish, recipient?: string ) => { const value = BigNumber.from(amount) const tx = recipient - ? gateway.depositTo(recipient, 1_000_000, '0xFFFF', { value }) - : gateway.deposit(1_000_000, '0xFFFF', { value }) + ? bridge.depositETHTo(recipient, 1_300_000, '0x', { value }) + : bridge.depositETH(1_300_000, '0x', { value }) await waitForXDomainTransaction(watcher, tx, Direction.L1ToL2) } @@ -121,3 +136,35 @@ export const DEFAULT_TRANSACTION = { data: '0x', value: 0, } + +export const expectApprox = ( + actual: BigNumber | number, + target: BigNumber | number, + upperDeviation: number, + lowerDeviation: number = 100 +) => { + actual = BigNumber.from(actual) + target = BigNumber.from(target) + + const validDeviations = + upperDeviation >= 0 && + upperDeviation <= 100 && + lowerDeviation >= 0 && + lowerDeviation <= 100 + if (!validDeviations) { + throw new Error( + 'Upper and lower deviation percentage arguments should be between 0 and 100' + ) + } + const upper = target.mul(100 + upperDeviation).div(100) + const lower = target.mul(100 - lowerDeviation).div(100) + + expect( + actual.lte(upper), + `Actual value is more than ${upperDeviation}% greater than target` + ).to.be.true + expect( + actual.gte(lower), + `Actual value is more than ${lowerDeviation}% less than target` + ).to.be.true +} diff --git a/l2geth/README.md b/l2geth/README.md index 871a0adbbcad..0f2e8595d974 100644 --- a/l2geth/README.md +++ b/l2geth/README.md @@ -48,7 +48,7 @@ $ USING_OVM=true ./build/bin/geth \ --rollup.pollinterval 3s \ --eth1.networkid $LAYER1_NETWORK_ID \ --eth1.chainid $LAYER1_CHAIN_ID \ - --eth1.l1gatewayaddress $ETH1_L1_GATEWAY_ADDRESS \ + --eth1.l1standardbridgeaddress $ETH1_L1_STANDARD_BRIDGE_ADDRESS \ --eth1.l1crossdomainmessengeraddress $ETH1_L1_CROSS_DOMAIN_MESSENGER_ADDRESS \ --eth1.l1feewalletaddress $ETH1_L1_FEE_WALLET_ADDRESS \ --eth1.addressresolveraddress $ETH1_ADDRESS_RESOLVER_ADDRESS \ diff --git a/l2geth/cmd/geth/main.go b/l2geth/cmd/geth/main.go index 5a183bd1d0bb..799033ce15df 100644 --- a/l2geth/cmd/geth/main.go +++ b/l2geth/cmd/geth/main.go @@ -154,7 +154,7 @@ var ( utils.Eth1CanonicalTransactionChainDeployHeightFlag, utils.Eth1L1CrossDomainMessengerAddressFlag, utils.Eth1L1FeeWalletAddressFlag, - utils.Eth1ETHGatewayAddressFlag, + utils.Eth1StandardBridgeAddressFlag, utils.Eth1ChainIdFlag, utils.RollupClientHttpFlag, utils.RollupEnableVerifierFlag, diff --git a/l2geth/cmd/geth/usage.go b/l2geth/cmd/geth/usage.go index 8b9cf2231668..5859e53d75c1 100644 --- a/l2geth/cmd/geth/usage.go +++ b/l2geth/cmd/geth/usage.go @@ -69,7 +69,7 @@ var AppHelpFlagGroups = []flagGroup{ utils.Eth1CanonicalTransactionChainDeployHeightFlag, utils.Eth1L1CrossDomainMessengerAddressFlag, utils.Eth1L1FeeWalletAddressFlag, - utils.Eth1ETHGatewayAddressFlag, + utils.Eth1StandardBridgeAddressFlag, utils.Eth1ChainIdFlag, utils.RollupClientHttpFlag, utils.RollupAddressManagerOwnerAddressFlag, diff --git a/l2geth/cmd/utils/flags.go b/l2geth/cmd/utils/flags.go index 52533aa93a58..e0506de278a7 100644 --- a/l2geth/cmd/utils/flags.go +++ b/l2geth/cmd/utils/flags.go @@ -829,11 +829,11 @@ var ( Value: "0x0000000000000000000000000000000000000000", EnvVar: "ETH1_L1_FEE_WALLET_ADDRESS", } - Eth1ETHGatewayAddressFlag = cli.StringFlag{ - Name: "eth1.l1ethgatewayaddress", - Usage: "Deployment address of the Ethereum gateway", + Eth1StandardBridgeAddressFlag = cli.StringFlag{ + Name: "eth1.l1standardbridgeaddress", + Usage: "Deployment address of the Standard Bridge", Value: "0x0000000000000000000000000000000000000000", - EnvVar: "ETH1_L1_ETH_GATEWAY_ADDRESS", + EnvVar: "ETH1_L1_STANDARD_BRIDGE_ADDRESS", } Eth1ChainIdFlag = cli.Uint64Flag{ Name: "eth1.chainid", @@ -1140,9 +1140,9 @@ func setEth1(ctx *cli.Context, cfg *rollup.Config) { addr := ctx.GlobalString(Eth1L1FeeWalletAddressFlag.Name) cfg.L1FeeWalletAddress = common.HexToAddress(addr) } - if ctx.GlobalIsSet(Eth1ETHGatewayAddressFlag.Name) { - addr := ctx.GlobalString(Eth1ETHGatewayAddressFlag.Name) - cfg.L1ETHGatewayAddress = common.HexToAddress(addr) + if ctx.GlobalIsSet(Eth1StandardBridgeAddressFlag.Name) { + addr := ctx.GlobalString(Eth1StandardBridgeAddressFlag.Name) + cfg.L1StandardBridgeAddress = common.HexToAddress(addr) } if ctx.GlobalIsSet(Eth1ChainIdFlag.Name) { cfg.Eth1ChainId = ctx.GlobalUint64(Eth1ChainIdFlag.Name) @@ -1762,10 +1762,10 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) { xdomainAddress := cfg.Rollup.L1CrossDomainMessengerAddress l1FeeWalletAddress := cfg.Rollup.L1FeeWalletAddress addrManagerOwnerAddress := cfg.Rollup.AddressManagerOwnerAddress - l1ETHGatewayAddress := cfg.Rollup.L1ETHGatewayAddress + l1StandardBridgeAddress := cfg.Rollup.L1StandardBridgeAddress gpoOwnerAddress := cfg.Rollup.GasPriceOracleOwnerAddress stateDumpPath := cfg.Rollup.StateDumpPath - cfg.Genesis = core.DeveloperGenesisBlock(uint64(ctx.GlobalInt(DeveloperPeriodFlag.Name)), developer.Address, xdomainAddress, l1ETHGatewayAddress, addrManagerOwnerAddress, gpoOwnerAddress, l1FeeWalletAddress, stateDumpPath, chainID, gasLimit) + cfg.Genesis = core.DeveloperGenesisBlock(uint64(ctx.GlobalInt(DeveloperPeriodFlag.Name)), developer.Address, xdomainAddress, l1StandardBridgeAddress, addrManagerOwnerAddress, gpoOwnerAddress, l1FeeWalletAddress, stateDumpPath, chainID, gasLimit) if !ctx.GlobalIsSet(MinerGasPriceFlag.Name) && !ctx.GlobalIsSet(MinerLegacyGasPriceFlag.Name) { cfg.Miner.GasPrice = big.NewInt(1) } diff --git a/l2geth/core/genesis.go b/l2geth/core/genesis.go index 6fd5a812cbe5..380d9dd1eccd 100644 --- a/l2geth/core/genesis.go +++ b/l2geth/core/genesis.go @@ -72,8 +72,8 @@ type Genesis struct { L1FeeWalletAddress common.Address `json:"-"` L1CrossDomainMessengerAddress common.Address `json:"-"` AddressManagerOwnerAddress common.Address `json:"-"` - L1ETHGatewayAddress common.Address `json:"-"` GasPriceOracleOwnerAddress common.Address `json:"-"` + L1StandardBridgeAddress common.Address `json:"-"` ChainID *big.Int `json:"-"` } @@ -268,7 +268,7 @@ func (g *Genesis) configOrDefault(ghash common.Hash) *params.ChainConfig { } // ApplyOvmStateToState applies the initial OVM state to a state object. -func ApplyOvmStateToState(statedb *state.StateDB, stateDump *dump.OvmDump, l1XDomainMessengerAddress, l1ETHGatewayAddress, addrManagerOwnerAddress, gpoOwnerAddress, l1FeeWalletAddress common.Address, chainID *big.Int, gasLimit uint64) { +func ApplyOvmStateToState(statedb *state.StateDB, stateDump *dump.OvmDump, l1XDomainMessengerAddress, l1StandardBridgeAddress, addrManagerOwnerAddress, gpoOwnerAddress, l1FeeWalletAddress common.Address, chainID *big.Int, gasLimit uint64) { if len(stateDump.Accounts) == 0 { return } @@ -301,22 +301,13 @@ func ApplyOvmStateToState(statedb *state.StateDB, stateDump *dump.OvmDump, l1XDo l1MessengerValue := common.BytesToHash(l1XDomainMessengerAddress.Bytes()) statedb.SetState(AddressManager.Address, l1MessengerSlot, l1MessengerValue) } - OVM_ETH, ok := stateDump.Accounts["OVM_ETH"] + OVM_L2StandardBridge, ok := stateDump.Accounts["OVM_L2StandardBridge"] if ok { - log.Info("Setting OVM_L1ETHGateway in OVM_ETH", "address", l1ETHGatewayAddress.Hex()) - if strings.Contains(OVM_ETH.Code, "a84ce98") { - // Set the gateway of OVM_ETH at new dump - log.Info("Detected current OVM_ETH dump, setting slot 0x1") - l1GatewaySlot := common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000001") - l1GatewayValue := common.BytesToHash(l1ETHGatewayAddress.Bytes()) - statedb.SetState(OVM_ETH.Address, l1GatewaySlot, l1GatewayValue) - } else { - // Set the gateway of OVM_ETH at legacy slot - log.Info("Detected legacy OVM_ETH dump, setting slot 0x8") - l1GatewaySlot := common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000008") - l1GatewayValue := common.BytesToHash(l1ETHGatewayAddress.Bytes()) - statedb.SetState(OVM_ETH.Address, l1GatewaySlot, l1GatewayValue) - } + log.Info("Setting OVM_L1StandardBridge in OVM_L2StandardBridge", "address", l1StandardBridgeAddress.Hex()) + // Set the gateway of OVM_L2StandardBridge at new dump + l1BridgeSlot := common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000001") + l1BridgeValue := common.BytesToHash(l1StandardBridgeAddress.Bytes()) + statedb.SetState(OVM_L2StandardBridge.Address, l1BridgeSlot, l1BridgeValue) } ExecutionManager, ok := stateDump.Accounts["OVM_ExecutionManager"] if ok { @@ -358,7 +349,7 @@ func (g *Genesis) ToBlock(db ethdb.Database) *types.Block { if vm.UsingOVM { // OVM_ENABLED - ApplyOvmStateToState(statedb, g.Config.StateDump, g.L1CrossDomainMessengerAddress, g.L1ETHGatewayAddress, g.AddressManagerOwnerAddress, g.GasPriceOracleOwnerAddress, g.L1FeeWalletAddress, g.ChainID, g.GasLimit) + ApplyOvmStateToState(statedb, g.Config.StateDump, g.L1CrossDomainMessengerAddress, g.L1StandardBridgeAddress, g.AddressManagerOwnerAddress, g.GasPriceOracleOwnerAddress, g.L1FeeWalletAddress, g.ChainID, g.GasLimit) } for addr, account := range g.Alloc { @@ -485,7 +476,7 @@ func DefaultGoerliGenesisBlock() *Genesis { } // DeveloperGenesisBlock returns the 'geth --dev' genesis block. -func DeveloperGenesisBlock(period uint64, faucet, l1XDomainMessengerAddress common.Address, l1ETHGatewayAddress common.Address, addrManagerOwnerAddress, gpoOwnerAddress, l1FeeWalletAddress common.Address, stateDumpPath string, chainID *big.Int, gasLimit uint64) *Genesis { +func DeveloperGenesisBlock(period uint64, faucet, l1XDomainMessengerAddress common.Address, l1StandardBridgeAddress common.Address, addrManagerOwnerAddress, gpoOwnerAddress, l1FeeWalletAddress common.Address, stateDumpPath string, chainID *big.Int, gasLimit uint64) *Genesis { // Override the default period to the user requested one config := *params.AllCliqueProtocolChanges config.Clique.Period = period @@ -543,8 +534,8 @@ func DeveloperGenesisBlock(period uint64, faucet, l1XDomainMessengerAddress comm L1CrossDomainMessengerAddress: l1XDomainMessengerAddress, L1FeeWalletAddress: l1FeeWalletAddress, AddressManagerOwnerAddress: addrManagerOwnerAddress, - L1ETHGatewayAddress: l1ETHGatewayAddress, GasPriceOracleOwnerAddress: gpoOwnerAddress, + L1StandardBridgeAddress: l1StandardBridgeAddress, ChainID: config.ChainID, } } diff --git a/l2geth/core/state/statedb.go b/l2geth/core/state/statedb.go index e5be7ab75358..7f0597537fc7 100644 --- a/l2geth/core/state/statedb.go +++ b/l2geth/core/state/statedb.go @@ -269,7 +269,7 @@ func (s *StateDB) GetBalance(addr common.Address) *big.Int { func (s *StateDB) GetOVMBalance(addr common.Address) *big.Int { eth := common.HexToAddress("0x4200000000000000000000000000000000000006") - position := big.NewInt(5) + position := big.NewInt(0) hasher := sha3.NewLegacyKeccak256() hasher.Write(common.LeftPadBytes(addr.Bytes(), 32)) hasher.Write(common.LeftPadBytes(position.Bytes(), 32)) diff --git a/l2geth/core/vm/evm.go b/l2geth/core/vm/evm.go index b54b9bd5d777..196157f97b8b 100644 --- a/l2geth/core/vm/evm.go +++ b/l2geth/core/vm/evm.go @@ -200,6 +200,7 @@ type Context struct { OvmSafetyChecker dump.OvmDumpAccount OvmL2CrossDomainMessenger dump.OvmDumpAccount OvmETH dump.OvmDumpAccount + OvmL2StandardBridge dump.OvmDumpAccount } // EVM is the Ethereum Virtual Machine base object and provides @@ -252,6 +253,7 @@ func NewEVM(ctx Context, statedb StateDB, chainConfig *params.ChainConfig, vmCon ctx.OvmSafetyChecker = chainConfig.StateDump.Accounts["OVM_SafetyChecker"] ctx.OvmL2CrossDomainMessenger = chainConfig.StateDump.Accounts["OVM_L2CrossDomainMessenger"] ctx.OvmETH = chainConfig.StateDump.Accounts["OVM_ETH"] + ctx.OvmL2StandardBridge = chainConfig.StateDump.Accounts["OVM_L2StandardBridge"] } id := make([]byte, 4) @@ -404,7 +406,7 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas if evm.Context.IsL1ToL2Message && evm.depth == 3 { var isValidMessageTarget = true // 0x420... addresses are not valid targets except for the ETH predeploy. - if bytes.HasPrefix(addr.Bytes(), fortyTwoPrefix) && addr != evm.Context.OvmETH.Address { + if bytes.HasPrefix(addr.Bytes(), fortyTwoPrefix) && addr != evm.Context.OvmL2StandardBridge.Address { isValidMessageTarget = false } // 0xdead... addresses are not valid targets. diff --git a/l2geth/rollup/config.go b/l2geth/rollup/config.go index 3965bd5c83da..29f0ab65b816 100644 --- a/l2geth/rollup/config.go +++ b/l2geth/rollup/config.go @@ -23,8 +23,8 @@ type Config struct { L1CrossDomainMessengerAddress common.Address L1FeeWalletAddress common.Address AddressManagerOwnerAddress common.Address - L1ETHGatewayAddress common.Address GasPriceOracleOwnerAddress common.Address + L1StandardBridgeAddress common.Address // Turns on checking of state for L2 gas price EnableL2GasPolling bool // Deployment Height of the canonical transaction chain diff --git a/l2geth/scripts/start.sh b/l2geth/scripts/start.sh index bcfd3aa71231..a38f6771651d 100755 --- a/l2geth/scripts/start.sh +++ b/l2geth/scripts/start.sh @@ -9,7 +9,7 @@ DATADIR=$HOME/.ethereum TARGET_GAS_LIMIT=11000000 CHAIN_ID=10 ETH1_CTC_DEPLOYMENT_HEIGHT=12410807 -ETH1_L1_GATEWAY_ADDRESS=0xe681F80966a8b1fFadECf8068bD6F99034791c95 +ETH1_L1_STANDARD_BRIDGE_ADDRESS=0xe681F80966a8b1fFadECf8068bD6F99034791c95 ETH1_L1_CROSS_DOMAIN_MESSENGER_ADDRESS=0x902e5fF5A99C4eC1C21bbab089fdabE32EF0A5DF ADDRESS_MANAGER_OWNER_ADDRESS=0x9BA6e03D8B90dE867373Db8cF1A58d2F7F006b3A ROLLUP_STATE_DUMP_PATH=https://storage.googleapis.com/optimism/mainnet/4.json @@ -110,15 +110,6 @@ while (( "$#" )); do exit 1 fi ;; - --eth1.l1gatewayaddress) - if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then - ETH1_L1_GATEWAY_ADDRESS="$2" - shift 2 - else - echo "Error: Argument for $1 is missing" >&2 - exit 1 - fi - ;; --eth1.l1crossdomainmessengeraddress) if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then ETH1_L1_CROSS_DOMAIN_MESSENGER_ADDRESS="$2" @@ -137,9 +128,9 @@ while (( "$#" )); do exit 1 fi ;; - --eth1.l1ethgatewayaddress) + --eth1.l1standardbridgeaddress) if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then - ETH1_L1_ETH_GATEWAY_ADDRESS="$2" + ETH1_L1_STANDARD_BRIDGE_ADDRESS="$2" shift 2 else echo "Error: Argument for $1 is missing" >&2 @@ -244,7 +235,7 @@ cmd="$cmd --eth1.l1feewalletaddress $ETH1_L1_FEE_WALLET_ADDRESS" cmd="$cmd --rollup.addressmanagerowneraddress $ADDRESS_MANAGER_OWNER_ADDRESS" cmd="$cmd --rollup.statedumppath $ROLLUP_STATE_DUMP_PATH" cmd="$cmd --eth1.ctcdeploymentheight $ETH1_CTC_DEPLOYMENT_HEIGHT" -cmd="$cmd --eth1.l1ethgatewayaddress $ETH1_L1_GATEWAY_ADDRESS" +cmd="$cmd --eth1.l1standardbridgeaddress $ETH1_L1_STANDARD_BRIDGE_ADDRESS" cmd="$cmd --rollup.clienthttp $ROLLUP_CLIENT_HTTP" cmd="$cmd --rollup.pollinterval $ROLLUP_POLL_INTERVAL" cmd="$cmd --rollup.timestamprefresh $ROLLUP_TIMESTAMP_REFRESH" diff --git a/ops/scripts/geth.sh b/ops/scripts/geth.sh index b9aa06d4a170..3ade8c9ec081 100755 --- a/ops/scripts/geth.sh +++ b/ops/scripts/geth.sh @@ -21,9 +21,9 @@ if [[ ! -z "$URL" ]]; then envSet ROLLUP_ADDRESS_MANAGER_OWNER_ADDRESS Deployer # set the address to the proxy gateway if possible - envSet ETH1_L1_ETH_GATEWAY_ADDRESS Proxy__OVM_L1ETHGateway - if [ $ETH1_L1_ETH_GATEWAY_ADDRESS == null ]; then - envSet ETH1_L1_ETH_GATEWAY_ADDRESS OVM_L1ETHGateway + envSet ETH1_L1_STANDARD_BRIDGE_ADDRESS Proxy__OVM_L1StandardBridge + if [ $ETH1_L1_STANDARD_BRIDGE_ADDRESS == null ]; then + envSet ETH1_L1_STANDARD_BRIDGE_ADDRESS OVM_L1StandardBridge fi fi diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/Abs_L1TokenGateway.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/Abs_L1TokenGateway.sol deleted file mode 100644 index a5e147bf833a..000000000000 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/Abs_L1TokenGateway.sol +++ /dev/null @@ -1,217 +0,0 @@ -// SPDX-License-Identifier: MIT -// @unsupported: ovm -pragma solidity >0.5.0 <0.8.0; -pragma experimental ABIEncoderV2; - -/* Interface Imports */ -import { iOVM_L1TokenGateway } from "../../../iOVM/bridge/tokens/iOVM_L1TokenGateway.sol"; -import { iOVM_L2DepositedToken } from "../../../iOVM/bridge/tokens/iOVM_L2DepositedToken.sol"; - -/* Library Imports */ -import { OVM_CrossDomainEnabled } from "../../../libraries/bridge/OVM_CrossDomainEnabled.sol"; - -/** - * @title Abs_L1TokenGateway - * @dev An L1 Token Gateway is a contract which stores deposited L1 funds that are in use on L2. - * It synchronizes a corresponding L2 representation of the "deposited token", informing it - * of new deposits and releasing L1 funds when there are newly finalized withdrawals. - * - * NOTE: This abstract contract gives all the core functionality of an L1 token gateway, - * but provides easy hooks in case developers need extensions in child contracts. - * In many cases, the default OVM_L1ERC20Gateway will suffice. - * - * Compiler used: solc - * Runtime target: EVM - */ -abstract contract Abs_L1TokenGateway is iOVM_L1TokenGateway, OVM_CrossDomainEnabled { - - /******************************** - * External Contract References * - ********************************/ - - address public l2DepositedToken; - - /*************** - * Constructor * - ***************/ - - /** - * @param _l2DepositedToken iOVM_L2DepositedToken-compatible address on the chain being deposited into. - * @param _l1messenger L1 Messenger address being used for cross-chain communications. - */ - constructor( - address _l2DepositedToken, - address _l1messenger - ) - OVM_CrossDomainEnabled(_l1messenger) - { - l2DepositedToken = _l2DepositedToken; - } - - /******************************** - * Overridable Accounting logic * - ********************************/ - - /** - * @dev Core logic to be performed when a withdrawal is finalized on L1. - * In most cases, this will simply send locked funds to the withdrawer. - * param _to Address being withdrawn to. - * param _amount Amount being withdrawn. - */ - function _handleFinalizeWithdrawal( - address, // _to, - uint256 // _amount - ) - internal - virtual - { - revert("Implement me in child contracts"); - } - - /** - * @dev Core logic to be performed when a deposit is initiated on L1. - * In most cases, this will simply send locked funds to the withdrawer. - * param _from Address being deposited from on L1. - * param _to Address being deposited into on L2. - * param _amount Amount being deposited. - */ - function _handleInitiateDeposit( - address, // _from, - address, // _to, - uint256 // _amount - ) - internal - virtual - { - revert("Implement me in child contracts"); - } - - /************** - * Depositing * - **************/ - - /** - * @dev deposit an amount of the ERC20 to the caller's balance on L2. - * @param _amount Amount of the ERC20 to deposit - * @param _l2Gas Gas limit required to complete the deposit on L2. - * @param _data Optional data to forward to L2. This data is provided - * solely as a convenience for external contracts. Aside from enforcing a maximum - * length, these contracts provide no guarantees about its content. - */ - function deposit( - uint256 _amount, - uint32 _l2Gas, - bytes calldata _data - ) - external - override - virtual - { - _initiateDeposit(msg.sender, msg.sender, _amount, _l2Gas, _data); - } - - /** - * @dev deposit an amount of ERC20 to a recipient's balance on L2. - * @param _to L2 address to credit the withdrawal to. - * @param _amount Amount of the ERC20 to deposit. - * @param _l2Gas Gas limit required to complete the deposit on L2. - * @param _data Optional data to forward to L2. This data is provided - * solely as a convenience for external contracts. Aside from enforcing a maximum - * length, these contracts provide no guarantees about its content. - */ - function depositTo( - address _to, - uint256 _amount, - uint32 _l2Gas, - bytes calldata _data - ) - external - override - virtual - { - _initiateDeposit(msg.sender, _to, _amount, _l2Gas, _data); - } - - /** - * @dev Performs the logic for deposits by informing the L2 Deposited Token - * contract of the deposit and calling a handler to lock the L1 funds. (e.g. transferFrom) - * - * @param _from Account to pull the deposit from on L1 - * @param _to Account to give the deposit to on L2 - * @param _amount Amount of the ERC20 to deposit. - * @param _l2Gas Gas limit required to complete the deposit on L2. - * @param _data Optional data to forward to L2. This data is provided - * solely as a convenience for external contracts. Aside from enforcing a maximum - * length, these contracts provide no guarantees about its content. - */ - function _initiateDeposit( - address _from, - address _to, - uint256 _amount, - uint32 _l2Gas, - bytes calldata _data - ) - internal - { - // Call our deposit accounting handler implemented by child contracts. - _handleInitiateDeposit( - _from, - _to, - _amount - ); - - // Construct calldata for l2DepositedToken.finalizeDeposit(_to, _amount) - bytes memory message = abi.encodeWithSelector( - iOVM_L2DepositedToken.finalizeDeposit.selector, - _from, - _to, - _amount, - _data - ); - - // Send calldata into L2 - sendCrossDomainMessage( - l2DepositedToken, - _l2Gas, - message - ); - - // We omit _data here because events only support bytes32 types. - emit DepositInitiated(_from, _to, _amount, _data); - } - - /************************* - * Cross-chain Functions * - *************************/ - - /** - * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the - * L1 ERC20 token. - * This call will fail if the initialized withdrawal from L2 has not been finalized. - * - * @param _from L2 address initiating the transfer. - * @param _to L1 address to credit the withdrawal to. - * @param _amount Amount of the ERC20 to deposit. - * @param _data Data provided by the sender on L2. This data is provided - * solely as a convenience for external contracts. Aside from enforcing a maximum - * length, these contracts provide no guarantees about its content. - */ - function finalizeWithdrawal( - address _from, - address _to, - uint256 _amount, - bytes calldata _data - ) - external - override - virtual - onlyFromCrossDomainAccount(l2DepositedToken) - { - // Call our withdrawal accounting handler implemented by child contracts. - _handleFinalizeWithdrawal( - _to, - _amount - ); - emit WithdrawalFinalized(_from, _to, _amount, _data); - } -} diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/Abs_L2DepositedToken.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/Abs_L2DepositedToken.sol deleted file mode 100644 index f71dc6667a29..000000000000 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/Abs_L2DepositedToken.sol +++ /dev/null @@ -1,247 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >0.5.0 <0.8.0; -pragma experimental ABIEncoderV2; - -/* Interface Imports */ -import { iOVM_L2DepositedToken } from "../../../iOVM/bridge/tokens/iOVM_L2DepositedToken.sol"; -import { iOVM_L1TokenGateway } from "../../../iOVM/bridge/tokens/iOVM_L1TokenGateway.sol"; - -/* Library Imports */ -import { OVM_CrossDomainEnabled } from "../../../libraries/bridge/OVM_CrossDomainEnabled.sol"; - -/** - * @title Abs_L2DepositedToken - * @dev An L2 Deposited Token is an L2 representation of funds which were deposited from L1. - * Usually contract mints new tokens when it hears about deposits into the L1 ERC20 gateway. - * This contract also burns the tokens intended for withdrawal, informing the L1 gateway to release L1 funds. - * - * NOTE: This abstract contract gives all the core functionality of a deposited token implementation except for the - * token's internal accounting itself. This gives developers an easy way to implement children with their own token code. - * - * Compiler used: optimistic-solc - * Runtime target: OVM - */ -abstract contract Abs_L2DepositedToken is iOVM_L2DepositedToken, OVM_CrossDomainEnabled { - - /******************* - * Contract Events * - *******************/ - - event Initialized(iOVM_L1TokenGateway _l1TokenGateway); - - /******************************** - * External Contract References * - ********************************/ - - iOVM_L1TokenGateway public l1TokenGateway; - - /******************************** - * Constructor & Initialization * - ********************************/ - - /** - * @param _l2CrossDomainMessenger L2 Messenger address being used for cross-chain communications. - */ - constructor( - address _l2CrossDomainMessenger - ) - OVM_CrossDomainEnabled(_l2CrossDomainMessenger) - {} - - /** - * @dev Initialize this contract with the L1 token gateway address. - * The flow: - * 1) this contract is deployed on L2, - * 2) the L1 gateway is deployed with addr from (1), - * 3) L1 gateway address passed here. - * @param _l1TokenGateway Address of the corresponding L1 gateway deployed to the main chain - */ - function init( - iOVM_L1TokenGateway _l1TokenGateway - ) - public - { - require(address(l1TokenGateway) == address(0), "Contract has already been initialized"); - - l1TokenGateway = _l1TokenGateway; - - emit Initialized(l1TokenGateway); - } - - /********************** - * Function Modifiers * - **********************/ - - modifier onlyInitialized() { - require(address(l1TokenGateway) != address(0), "Contract has not yet been initialized"); - _; - } - - /******************************** - * Overridable Accounting logic * - ********************************/ - - /** - * @dev Core logic to be performed when a withdrawal from L2 is initialized. - * In most cases, this will simply burn the withdrawn L2 funds. - * param _to Address being withdrawn to. - * param _amount Amount being withdrawn. - */ - function _handleInitiateWithdrawal( - address, // _to, - uint256 // _amount - ) - internal - virtual - { - revert("Accounting must be implemented by child contract."); - } - - /** - * @dev Core logic to be performed when a deposit from L2 is finalized on L2. - * In most cases, this will simply _mint() to credit L2 funds to the recipient. - * param _to Address being deposited to on L2. - * param _amount Amount which was deposited on L1. - */ - function _handleFinalizeDeposit( - address, // _to - uint256 // _amount - ) - internal - virtual - { - revert("Accounting must be implemented by child contract."); - } - - /*************** - * Withdrawing * - ***************/ - - /** - * @dev initiate a withdraw of some tokens to the caller's account on L1 - * @param _amount Amount of the token to withdraw. - * param _l1Gas Unused, but included for potential forward compatibility considerations. - * @param _data Optional data to forward to L1. This data is provided - * solely as a convenience for external contracts. Aside from enforcing a maximum - * length, these contracts provide no guarantees about its content. - */ - function withdraw( - uint256 _amount, - uint32, // _l1Gas, - bytes calldata _data - ) - external - override - virtual - onlyInitialized() - { - _initiateWithdrawal( - msg.sender, - msg.sender, - _amount, - 0, - _data - ); - } - - /** - * @dev initiate a withdraw of some token to a recipient's account on L1. - * @param _to L1 adress to credit the withdrawal to. - * @param _amount Amount of the token to withdraw. - * param _l1Gas Unused, but included for potential forward compatibility considerations. - * @param _data Optional data to forward to L1. This data is provided - * solely as a convenience for external contracts. Aside from enforcing a maximum - * length, these contracts provide no guarantees about its content. - */ - function withdrawTo( - address _to, - uint256 _amount, - uint32, // _l1Gas, - bytes calldata _data - ) - external - override - virtual - onlyInitialized() - { - _initiateWithdrawal( - msg.sender, - _to, - _amount, - 0, - _data - ); - } - - /** - * @dev Performs the logic for deposits by storing the token and informing the L2 token Gateway of the deposit. - * @param _from Account to pull the deposit from on L2. - * @param _to Account to give the withdrawal to on L1. - * @param _amount Amount of the token to withdraw. - * param _l1Gas Unused, but included for potential forward compatibility considerations. - * @param _data Optional data to forward to L1. This data is provided - * solely as a convenience for external contracts. Aside from enforcing a maximum - * length, these contracts provide no guarantees about its content. - */ - function _initiateWithdrawal( - address _from, - address _to, - uint256 _amount, - uint32, // _l1Gas, - bytes calldata _data - ) - internal - { - // Call our withdrawal accounting handler implemented by child contracts (usually a _burn) - _handleInitiateWithdrawal(_to, _amount); - - // Construct calldata for l1TokenGateway.finalizeWithdrawal(_to, _amount) - bytes memory message = abi.encodeWithSelector( - iOVM_L1TokenGateway.finalizeWithdrawal.selector, - _from, - _to, - _amount, - _data - ); - - // Send message up to L1 gateway - sendCrossDomainMessage( - address(l1TokenGateway), - 0, - message - ); - - emit WithdrawalInitiated(msg.sender, _to, _amount, _data); - } - - /************************************ - * Cross-chain Function: Depositing * - ************************************/ - - /** - * @dev Complete a deposit from L1 to L2, and credits funds to the recipient's balance of this - * L2 token. - * This call will fail if it did not originate from a corresponding deposit in OVM_l1TokenGateway. - * @param _from Account to pull the deposit from on L2. - * @param _to Address to receive the withdrawal at - * @param _amount Amount of the token to withdraw - * @param _data Data provider by the sender on L1. This data is provided - * solely as a convenience for external contracts. Aside from enforcing a maximum - * length, these contracts provide no guarantees about its content. - */ - function finalizeDeposit( - address _from, - address _to, - uint256 _amount, - bytes calldata _data - ) - external - override - virtual - onlyInitialized() - onlyFromCrossDomainAccount(address(l1TokenGateway)) - { - _handleFinalizeDeposit(_to, _amount); - emit DepositFinalized(_from, _to, _amount, _data); - } -} diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ERC20Gateway.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ERC20Gateway.sol deleted file mode 100644 index 23834445b8b3..000000000000 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ERC20Gateway.sol +++ /dev/null @@ -1,100 +0,0 @@ -// SPDX-License-Identifier: MIT -// @unsupported: ovm -pragma solidity >0.5.0 <0.8.0; -pragma experimental ABIEncoderV2; - -/* Interface Imports */ -import { iOVM_L1TokenGateway } from "../../../iOVM/bridge/tokens/iOVM_L1TokenGateway.sol"; -import { Abs_L1TokenGateway } from "./Abs_L1TokenGateway.sol"; -import { iOVM_ERC20 } from "../../../iOVM/predeploys/iOVM_ERC20.sol"; - -/** - * @title OVM_L1ERC20Gateway - * @dev The L1 ERC20 Gateway is a contract which stores deposited L1 funds that are in use on L2. - * It synchronizes a corresponding L2 ERC20 Gateway, informing it of deposits, and listening to it - * for newly finalized withdrawals. - * - * NOTE: This contract extends Abs_L1TokenGateway, which is where we - * takes care of most of the initialization and the cross-chain logic. - * If you are looking to implement your own deposit/withdrawal contracts, you - * may also want to extend the abstract contract in a similar manner. - * - * Compiler used: solc - * Runtime target: EVM - */ -contract OVM_L1ERC20Gateway is Abs_L1TokenGateway { - - /******************************** - * External Contract References * - ********************************/ - - iOVM_ERC20 public l1ERC20; - - /*************** - * Constructor * - ***************/ - - /** - * @param _l1ERC20 L1 ERC20 address this contract stores deposits for. - * @param _l2DepositedERC20 L2 Gateway address on the chain being deposited into. - */ - constructor( - iOVM_ERC20 _l1ERC20, - address _l2DepositedERC20, - address _l1messenger - ) - Abs_L1TokenGateway( - _l2DepositedERC20, - _l1messenger - ) - { - l1ERC20 = _l1ERC20; - } - - - /************** - * Accounting * - **************/ - - /** - * @dev When a deposit is initiated on L1, the L1 Gateway - * transfers the funds to itself for future withdrawals. - * - * @param _from L1 address ETH is being deposited from. - * param _to L2 address that the ETH is being deposited to. - * @param _amount Amount of ERC20 to send. - */ - function _handleInitiateDeposit( - address _from, - address, // _to, - uint256 _amount - ) - internal - override - { - // Hold on to the newly deposited funds - l1ERC20.transferFrom( - _from, - address(this), - _amount - ); - } - - /** - * @dev When a withdrawal is finalized on L1, the L1 Gateway - * transfers the funds to the withdrawer. - * - * @param _to L1 address that the ERC20 is being withdrawn to. - * @param _amount Amount of ERC20 to send. - */ - function _handleFinalizeWithdrawal( - address _to, - uint256 _amount - ) - internal - override - { - // Transfer withdrawn funds out to withdrawer - l1ERC20.transfer(_to, _amount); - } -} diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ETHGateway.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ETHGateway.sol deleted file mode 100644 index d3e475e43ceb..000000000000 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ETHGateway.sol +++ /dev/null @@ -1,232 +0,0 @@ -// SPDX-License-Identifier: MIT -// @unsupported: ovm -pragma solidity >0.5.0 <0.8.0; -pragma experimental ABIEncoderV2; - -/* Interface Imports */ -import { iOVM_L1ETHGateway } from "../../../iOVM/bridge/tokens/iOVM_L1ETHGateway.sol"; -import { iOVM_L2DepositedToken } from "../../../iOVM/bridge/tokens/iOVM_L2DepositedToken.sol"; - -/* Library Imports */ -import { OVM_CrossDomainEnabled } from "../../../libraries/bridge/OVM_CrossDomainEnabled.sol"; -import { Lib_AddressResolver } from "../../../libraries/resolver/Lib_AddressResolver.sol"; -import { Lib_AddressManager } from "../../../libraries/resolver/Lib_AddressManager.sol"; - -/** - * @title OVM_L1ETHGateway - * @dev The L1 ETH Gateway is a contract which stores deposited ETH that is in use on L2. - * - * Compiler used: solc - * Runtime target: EVM - */ -contract OVM_L1ETHGateway is iOVM_L1ETHGateway, OVM_CrossDomainEnabled, Lib_AddressResolver { - - /******************************** - * External Contract References * - ********************************/ - - address public ovmEth; - - /*************** - * Constructor * - ***************/ - - // This contract lives behind a proxy, so the constructor parameters will go unused. - constructor() - OVM_CrossDomainEnabled(address(0)) - Lib_AddressResolver(address(0)) - {} - - /****************** - * Initialization * - ******************/ - - /** - * @param _libAddressManager Address manager for this OE deployment - * @param _ovmEth L2 OVM_ETH implementation of iOVM_DepositedToken - */ - function initialize( - address _libAddressManager, - address _ovmEth - ) - public - { - require(libAddressManager == Lib_AddressManager(0), "Contract has already been initialized."); - libAddressManager = Lib_AddressManager(_libAddressManager); - ovmEth = _ovmEth; - messenger = resolve("Proxy__OVM_L1CrossDomainMessenger"); - } - - /************** - * Depositing * - **************/ - - /** - * @dev This function can be called with no data - * to deposit an amount of ETH to the caller's balance on L2. - * Since the receive function doesn't take data, a conservative - * default of 1.2 Million gas is forwarded to L2. - */ - receive() - external - payable - { - _initiateDeposit(msg.sender, msg.sender, 1_200_000, bytes("")); - } - - /** - * @dev Deposit an amount of the ETH to the caller's balance on L2. - * @param _l2Gas Gas limit required to complete the deposit on L2. - * @param _data Optional data to forward to L2. This data is provided - * solely as a convenience for external contracts. Aside from enforcing a maximum - * length, these contracts provide no guarantees about its content. - */ - function deposit( - uint32 _l2Gas, - bytes calldata _data - ) - external - override - payable - { - _initiateDeposit( - msg.sender, - msg.sender, - _l2Gas, - _data - ); - } - - /** - * @dev Deposit an amount of ETH to a recipient's balance on L2. - * @param _to L2 address to credit the withdrawal to. - * @param _l2Gas Gas limit required to complete the deposit on L2. - * @param _data Optional data to forward to L2. This data is provided - * solely as a convenience for external contracts. Aside from enforcing a maximum - * length, these contracts provide no guarantees about its content. - */ - function depositTo( - address _to, - uint32 _l2Gas, - bytes calldata _data - ) - external - override - payable - { - _initiateDeposit( - msg.sender, - _to, - _l2Gas, - _data - ); - } - - /** - * @dev Performs the logic for deposits by storing the ETH and informing the L2 ETH Gateway of the deposit. - * @param _from Account to pull the deposit from on L1. - * @param _to Account to give the deposit to on L2. - * @param _l2Gas Gas limit required to complete the deposit on L2. - * @param _data Optional data to forward to L2. This data is provided - * solely as a convenience for external contracts. Aside from enforcing a maximum - * length, these contracts provide no guarantees about its content. - */ - function _initiateDeposit( - address _from, - address _to, - uint32 _l2Gas, - bytes memory _data - ) - internal - { - // Construct calldata for l2ETHGateway.finalizeDeposit(_to, _amount) - bytes memory message = - abi.encodeWithSelector( - iOVM_L2DepositedToken.finalizeDeposit.selector, - _from, - _to, - msg.value, - _data - ); - - // Send calldata into L2 - sendCrossDomainMessage( - ovmEth, - _l2Gas, - message - ); - - emit DepositInitiated(_from, _to, msg.value, _data); - } - - /************************* - * Cross-chain Functions * - *************************/ - - /** - * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the - * L1 ETH token. - * Since only the xDomainMessenger can call this function, it will never be called before the withdrawal is finalized. - * @param _from L2 address initiating the transfer. - * @param _to L1 address to credit the withdrawal to. - * @param _amount Amount of the ERC20 to deposit. - * @param _data Optional data to forward to L2. This data is provided - * solely as a convenience for external contracts. Aside from enforcing a maximum - * length, these contracts provide no guarantees about its content. - */ - function finalizeWithdrawal( - address _from, - address _to, - uint256 _amount, - bytes calldata _data - ) - external - override - onlyFromCrossDomainAccount(ovmEth) - { - _safeTransferETH(_to, _amount); - - emit WithdrawalFinalized(_from, _to, _amount, _data); - } - - /********************************** - * Internal Functions: Accounting * - **********************************/ - - /** - * @dev Internal accounting function for moving around L1 ETH. - * - * @param _to L1 address to transfer ETH to. - * @param _value Amount of ETH to transfer. - */ - function _safeTransferETH( - address _to, - uint256 _value - ) - internal - { - (bool success, ) = _to.call{value: _value}(new bytes(0)); - require(success, 'TransferHelper::safeTransferETH: ETH transfer failed'); - } - - /***************************** - * Temporary - Migrating ETH * - *****************************/ - - /** - * @dev Migrates entire ETH balance to another gateway. - * @param _to Gateway Proxy address to migrate ETH to. - */ - function migrateEth(address payable _to) external { - address owner = Lib_AddressManager(libAddressManager).owner(); - require(msg.sender == owner, "Only the owner can migrate ETH"); - uint256 balance = address(this).balance; - OVM_L1ETHGateway(_to).donateETH{value:balance}(); - } - - /** - * @dev Adds ETH balance to the account. This is meant to allow for ETH - * to be migrated from an old gateway to a new gateway. - */ - function donateETH() external payable {} -} diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1StandardBridge.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1StandardBridge.sol new file mode 100644 index 000000000000..96f3f3de0212 --- /dev/null +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1StandardBridge.sol @@ -0,0 +1,325 @@ +// SPDX-License-Identifier: MIT +// @unsupported: ovm +pragma solidity >0.5.0 <0.8.0; +pragma experimental ABIEncoderV2; + +/* Interface Imports */ +import { iOVM_L1StandardBridge } from "../../../iOVM/bridge/tokens/iOVM_L1StandardBridge.sol"; +import { iOVM_L1ERC20Bridge } from "../../../iOVM/bridge/tokens/iOVM_L1ERC20Bridge.sol"; +import { iOVM_L2ERC20Bridge } from "../../../iOVM/bridge/tokens/iOVM_L2ERC20Bridge.sol"; +import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; + +/* Library Imports */ +import { OVM_CrossDomainEnabled } from "../../../libraries/bridge/OVM_CrossDomainEnabled.sol"; +import { Lib_PredeployAddresses } from "../../../libraries/constants/Lib_PredeployAddresses.sol"; +import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol"; +import { Address } from "@openzeppelin/contracts/utils/Address.sol"; +import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; + +/** + * @title OVM_L1StandardBridge + * @dev The L1 ETH and ERC20 Bridge is a contract which stores deposited L1 funds and standard tokens that are in use on L2. + * It synchronizes a corresponding L2 Bridge, informing it of deposits, and listening to it for newly finalized withdrawals. + * + * Compiler used: solc + * Runtime target: EVM + */ +contract OVM_L1StandardBridge is iOVM_L1StandardBridge, OVM_CrossDomainEnabled { + using SafeMath for uint; + using SafeERC20 for IERC20; + + /******************************** + * External Contract References * + ********************************/ + + address public l2TokenBridge; + + // Maps L1 token to L2 token to balance of the L1 token deposited + mapping(address => mapping (address => uint256)) public deposits; + + /*************** + * Constructor * + ***************/ + + // This contract lives behind a proxy, so the constructor parameters will go unused. + constructor() + OVM_CrossDomainEnabled(address(0)) + {} + + /****************** + * Initialization * + ******************/ + + /** + * @param _l1messenger L1 Messenger address being used for cross-chain communications. + * @param _l2TokenBridge L2 standard bridge address. + */ + function initialize( + address _l1messenger, + address _l2TokenBridge + ) + public + { + require(messenger == address(0), "Contract has already been initialized."); + messenger = _l1messenger; + l2TokenBridge = _l2TokenBridge; + } + + /************** + * Depositing * + **************/ + + /// @dev Modifier requiring sender to be EOA. This check could be bypassed by a malicious contract via initcode, but it takes care of the user error we want to avoid. + modifier onlyEOA() { + // Used to stop deposits from contracts (avoid accidentally lost tokens) + require(!Address.isContract(msg.sender), "Account not EOA"); + _; + } + + /** + * @dev This function can be called with no data + * to deposit an amount of ETH to the caller's balance on L2. + * Since the receive function doesn't take data, a conservative + * default amount is forwarded to L2. + */ + receive() + external + payable + onlyEOA() + { + _initiateETHDeposit( + msg.sender, + msg.sender, + 1_300_000, + bytes("") + ); + } + + /** + * @inheritdoc iOVM_L1StandardBridge + */ + function depositETH( + uint32 _l2Gas, + bytes calldata _data + ) + external + override + payable + onlyEOA() + { + _initiateETHDeposit( + msg.sender, + msg.sender, + _l2Gas, + _data + ); + } + + /** + * @inheritdoc iOVM_L1StandardBridge + */ + function depositETHTo( + address _to, + uint32 _l2Gas, + bytes calldata _data + ) + external + override + payable + { + _initiateETHDeposit( + msg.sender, + _to, + _l2Gas, + _data + ); + } + + /** + * @dev Performs the logic for deposits by storing the ETH and informing the L2 ETH Gateway of the deposit. + * @param _from Account to pull the deposit from on L1. + * @param _to Account to give the deposit to on L2. + * @param _l2Gas Gas limit required to complete the deposit on L2. + * @param _data Optional data to forward to L2. This data is provided + * solely as a convenience for external contracts. Aside from enforcing a maximum + * length, these contracts provide no guarantees about its content. + */ + function _initiateETHDeposit( + address _from, + address _to, + uint32 _l2Gas, + bytes memory _data + ) + internal + { + // Construct calldata for finalizeDeposit call + bytes memory message = + abi.encodeWithSelector( + iOVM_L2ERC20Bridge.finalizeDeposit.selector, + address(0), + Lib_PredeployAddresses.OVM_ETH, + _from, + _to, + msg.value, + _data + ); + + // Send calldata into L2 + sendCrossDomainMessage( + l2TokenBridge, + _l2Gas, + message + ); + + emit ETHDepositInitiated(_from, _to, msg.value, _data); + } + + /** + * @inheritdoc iOVM_L1ERC20Bridge + */ + function depositERC20( + address _l1Token, + address _l2Token, + uint256 _amount, + uint32 _l2Gas, + bytes calldata _data + ) + external + override + virtual + onlyEOA() + { + _initiateERC20Deposit(_l1Token, _l2Token, msg.sender, msg.sender, _amount, _l2Gas, _data); + } + + /** + * @inheritdoc iOVM_L1ERC20Bridge + */ + function depositERC20To( + address _l1Token, + address _l2Token, + address _to, + uint256 _amount, + uint32 _l2Gas, + bytes calldata _data + ) + external + override + virtual + { + _initiateERC20Deposit(_l1Token, _l2Token, msg.sender, _to, _amount, _l2Gas, _data); + } + + /** + * @dev Performs the logic for deposits by informing the L2 Deposited Token + * contract of the deposit and calling a handler to lock the L1 funds. (e.g. transferFrom) + * + * @param _l1Token Address of the L1 ERC20 we are depositing + * @param _l2Token Address of the L1 respective L2 ERC20 + * @param _from Account to pull the deposit from on L1 + * @param _to Account to give the deposit to on L2 + * @param _amount Amount of the ERC20 to deposit. + * @param _l2Gas Gas limit required to complete the deposit on L2. + * @param _data Optional data to forward to L2. This data is provided + * solely as a convenience for external contracts. Aside from enforcing a maximum + * length, these contracts provide no guarantees about its content. + */ + function _initiateERC20Deposit( + address _l1Token, + address _l2Token, + address _from, + address _to, + uint256 _amount, + uint32 _l2Gas, + bytes calldata _data + ) + internal + { + // When a deposit is initiated on L1, the L1 Bridge transfers the funds to itself for future withdrawals. + // safeTransferFrom also checks if the contract has code, so this will fail if _from is an EOA or address(0). + IERC20(_l1Token).safeTransferFrom( + _from, + address(this), + _amount + ); + + // Construct calldata for _l2Token.finalizeDeposit(_to, _amount) + bytes memory message = abi.encodeWithSelector( + iOVM_L2ERC20Bridge.finalizeDeposit.selector, + _l1Token, + _l2Token, + _from, + _to, + _amount, + _data + ); + + // Send calldata into L2 + sendCrossDomainMessage( + l2TokenBridge, + _l2Gas, + message + ); + + deposits[_l1Token][_l2Token] = deposits[_l1Token][_l2Token].add(_amount); + + emit ERC20DepositInitiated(_l1Token, _l2Token, _from, _to, _amount, _data); + } + + /************************* + * Cross-chain Functions * + *************************/ + + /** + * @inheritdoc iOVM_L1StandardBridge + */ + function finalizeETHWithdrawal( + address _from, + address _to, + uint256 _amount, + bytes calldata _data + ) + external + override + onlyFromCrossDomainAccount(l2TokenBridge) + { + (bool success, ) = _to.call{value: _amount}(new bytes(0)); + require(success, 'TransferHelper::safeTransferETH: ETH transfer failed'); + + emit ETHWithdrawalFinalized(_from, _to, _amount, _data); + } + + /** + * @inheritdoc iOVM_L1ERC20Bridge + */ + function finalizeERC20Withdrawal( + address _l1Token, + address _l2Token, + address _from, + address _to, + uint256 _amount, + bytes calldata _data + ) + external + override + onlyFromCrossDomainAccount(l2TokenBridge) + { + deposits[_l1Token][_l2Token] = deposits[_l1Token][_l2Token].sub(_amount); + + // When a withdrawal is finalized on L1, the L1 Bridge transfers the funds to the withdrawer. + IERC20(_l1Token).safeTransfer(_to, _amount); + + emit ERC20WithdrawalFinalized(_l1Token, _l2Token, _from, _to, _amount, _data); + } + + /***************************** + * Temporary - Migrating ETH * + *****************************/ + + /** + * @dev Adds ETH balance to the account. This is meant to allow for ETH + * to be migrated from an old gateway to a new gateway. + * NOTE: This is left for one upgrade only so we are able to receive the migrated ETH from the old contract + */ + function donateETH() external payable {} +} diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L2DepositedERC20.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L2DepositedERC20.sol deleted file mode 100644 index b7e741636caf..000000000000 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L2DepositedERC20.sol +++ /dev/null @@ -1,67 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >0.5.0 <0.8.0; -pragma experimental ABIEncoderV2; - -/* Interface Imports */ -import { iOVM_L1TokenGateway } from "../../../iOVM/bridge/tokens/iOVM_L1TokenGateway.sol"; - -/* Contract Imports */ -import { UniswapV2ERC20 } from "../../../libraries/standards/UniswapV2ERC20.sol"; - -/* Library Imports */ -import { Abs_L2DepositedToken } from "./Abs_L2DepositedToken.sol"; - -/** - * @title OVM_L2DepositedERC20 - * @dev The L2 Deposited ERC20 is an ERC20 implementation which represents L1 assets deposited into L2. - * This contract mints new tokens when it hears about deposits into the L1 ERC20 gateway. - * This contract also burns the tokens intended for withdrawal, informing the L1 gateway to release L1 funds. - * - * NOTE: This contract implements the Abs_L2DepositedToken contract using Uniswap's ERC20 as the implementation. - * Alternative implementations can be used in this similar manner. - * - * Compiler used: optimistic-solc - * Runtime target: OVM - */ -contract OVM_L2DepositedERC20 is Abs_L2DepositedToken, UniswapV2ERC20 { - - /*************** - * Constructor * - ***************/ - - /** - * @param _l2CrossDomainMessenger Cross-domain messenger used by this contract. - * @param _name ERC20 name. - * @param _symbol ERC20 symbol. - */ - constructor( - address _l2CrossDomainMessenger, - string memory _name, - string memory _symbol - ) - Abs_L2DepositedToken(_l2CrossDomainMessenger) - UniswapV2ERC20(_name, _symbol) - {} - - // When a withdrawal is initiated, we burn the withdrawer's funds to prevent subsequent L2 usage. - function _handleInitiateWithdrawal( - address, // _to, - uint256 _amount - ) - internal - override - { - _burn(msg.sender, _amount); - } - - // When a deposit is finalized, we credit the account on L2 with the same amount of tokens. - function _handleFinalizeDeposit( - address _to, - uint256 _amount - ) - internal - override - { - _mint(_to, _amount); - } -} diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L2StandardBridge.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L2StandardBridge.sol new file mode 100644 index 000000000000..278686c9fa92 --- /dev/null +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L2StandardBridge.sol @@ -0,0 +1,219 @@ +// SPDX-License-Identifier: MIT +pragma solidity >0.5.0 <0.8.0; +pragma experimental ABIEncoderV2; + +/* Interface Imports */ +import { iOVM_L1StandardBridge } from "../../../iOVM/bridge/tokens/iOVM_L1StandardBridge.sol"; +import { iOVM_L1ERC20Bridge } from "../../../iOVM/bridge/tokens/iOVM_L1ERC20Bridge.sol"; +import { iOVM_L2ERC20Bridge } from "../../../iOVM/bridge/tokens/iOVM_L2ERC20Bridge.sol"; + +/* Library Imports */ +import { ERC165Checker } from "@openzeppelin/contracts/introspection/ERC165Checker.sol"; +import { OVM_CrossDomainEnabled } from "../../../libraries/bridge/OVM_CrossDomainEnabled.sol"; +import { Lib_PredeployAddresses } from "../../../libraries/constants/Lib_PredeployAddresses.sol"; + +/* Contract Imports */ +import { IL2StandardERC20 } from "../../../libraries/standards/IL2StandardERC20.sol"; + +/** + * @title OVM_L2StandardBridge + * @dev The L2 Standard bridge is a contract which works together with the L1 Standard bridge to enable + * ETH and ERC20 transitions between L1 and L2. + * This contract acts as a minter for new tokens when it hears about deposits into the L1 Standard bridge. + * This contract also acts as a burner of the tokens intended for withdrawal, informing the L1 bridge to release L1 funds. + * + * Compiler used: optimistic-solc + * Runtime target: OVM + */ +contract OVM_L2StandardBridge is iOVM_L2ERC20Bridge, OVM_CrossDomainEnabled { + + /******************************** + * External Contract References * + ********************************/ + + address public l1TokenBridge; + + /*************** + * Constructor * + ***************/ + + /** + * @param _l2CrossDomainMessenger Cross-domain messenger used by this contract. + * @param _l1TokenBridge Address of the L1 bridge deployed to the main chain. + */ + constructor( + address _l2CrossDomainMessenger, + address _l1TokenBridge + ) + OVM_CrossDomainEnabled(_l2CrossDomainMessenger) + { + l1TokenBridge = _l1TokenBridge; + } + + /*************** + * Withdrawing * + ***************/ + + /** + * @inheritdoc iOVM_L2ERC20Bridge + */ + function withdraw( + address _l2Token, + uint256 _amount, + uint32 _l1Gas, + bytes calldata _data + ) + external + override + virtual + { + _initiateWithdrawal( + _l2Token, + msg.sender, + msg.sender, + _amount, + _l1Gas, + _data + ); + } + + /** + * @inheritdoc iOVM_L2ERC20Bridge + */ + function withdrawTo( + address _l2Token, + address _to, + uint256 _amount, + uint32 _l1Gas, + bytes calldata _data + ) + external + override + virtual + { + _initiateWithdrawal( + _l2Token, + msg.sender, + _to, + _amount, + _l1Gas, + _data + ); + } + + /** + * @dev Performs the logic for deposits by storing the token and informing the L2 token Gateway of the deposit. + * @param _l2Token Address of L2 token where withdrawal was initiated. + * @param _from Account to pull the deposit from on L2. + * @param _to Account to give the withdrawal to on L1. + * @param _amount Amount of the token to withdraw. + * param _l1Gas Unused, but included for potential forward compatibility considerations. + * @param _data Optional data to forward to L1. This data is provided + * solely as a convenience for external contracts. Aside from enforcing a maximum + * length, these contracts provide no guarantees about its content. + */ + function _initiateWithdrawal( + address _l2Token, + address _from, + address _to, + uint256 _amount, + uint32 _l1Gas, + bytes calldata _data + ) + internal + { + // When a withdrawal is initiated, we burn the withdrawer's funds to prevent subsequent L2 usage + IL2StandardERC20(_l2Token).burn(msg.sender, _amount); + + // Construct calldata for l1TokenBridge.finalizeERC20Withdrawal(_to, _amount) + address l1Token = IL2StandardERC20(_l2Token).l1Token(); + bytes memory message; + + if (_l2Token == Lib_PredeployAddresses.OVM_ETH) { + message = abi.encodeWithSelector( + iOVM_L1StandardBridge.finalizeETHWithdrawal.selector, + _from, + _to, + _amount, + _data + ); + } else { + message = abi.encodeWithSelector( + iOVM_L1ERC20Bridge.finalizeERC20Withdrawal.selector, + l1Token, + _l2Token, + _from, + _to, + _amount, + _data + ); + } + + // Send message up to L1 bridge + sendCrossDomainMessage( + l1TokenBridge, + _l1Gas, + message + ); + + emit WithdrawalInitiated(l1Token, _l2Token, msg.sender, _to, _amount, _data); + } + + /************************************ + * Cross-chain Function: Depositing * + ************************************/ + + /** + * @inheritdoc iOVM_L2ERC20Bridge + */ + function finalizeDeposit( + address _l1Token, + address _l2Token, + address _from, + address _to, + uint256 _amount, + bytes calldata _data + ) + external + override + virtual + onlyFromCrossDomainAccount(l1TokenBridge) + { + // Check the target token is compliant and + // verify the deposited token on L1 matches the L2 deposited token representation here + if ( + ERC165Checker.supportsInterface(_l2Token, 0x1d1d8b63) && + _l1Token == IL2StandardERC20(_l2Token).l1Token() + ) { + // When a deposit is finalized, we credit the account on L2 with the same amount of tokens. + IL2StandardERC20(_l2Token).mint(_to, _amount); + emit DepositFinalized(_l1Token, _l2Token, _from, _to, _amount, _data); + } else { + // Either the L2 token which is being deposited-into disagrees about the correct address + // of its L1 token, or does not support the correct interface. + // This should only happen if there is a malicious L2 token, or if a user somehow + // specified the wrong L2 token address to deposit into. + // In either case, we stop the process here and construct a withdrawal + // message so that users can get their funds out in some cases. + // There is no way to prevent malicious token contracts altogether, but this does limit + // user error and mitigate some forms of malicious contract behavior. + bytes memory message = abi.encodeWithSelector( + iOVM_L1ERC20Bridge.finalizeERC20Withdrawal.selector, + _l1Token, + _l2Token, + _to, // switched the _to and _from here to bounce back the deposit to the sender + _from, + _amount, + _data + ); + + // Send message up to L1 bridge + sendCrossDomainMessage( + l1TokenBridge, + 0, + message + ); + emit DepositFailed(_l1Token, _l2Token, _from, _to, _amount, _data); + } + } +} diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol index 700348d9640d..c5a1aa2612a4 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol @@ -15,7 +15,6 @@ import { Lib_PredeployAddresses } from "../../libraries/constants/Lib_PredeployA import { iOVM_ExecutionManager } from "../../iOVM/execution/iOVM_ExecutionManager.sol"; import { iOVM_StateManager } from "../../iOVM/execution/iOVM_StateManager.sol"; import { iOVM_SafetyChecker } from "../../iOVM/execution/iOVM_SafetyChecker.sol"; -import { IUniswapV2ERC20 } from "../../libraries/standards/IUniswapV2ERC20.sol"; /* Contract Imports */ import { OVM_DeployerWhitelist } from "../predeploys/OVM_DeployerWhitelist.sol"; @@ -898,8 +897,8 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { ) { // Easiest way to get the balance is query OVM_ETH as normal. - bytes memory balanceOfCalldata = abi.encodeWithSelector( - IUniswapV2ERC20.balanceOf.selector, + bytes memory balanceOfCalldata = abi.encodeWithSignature( + "balanceOf(address)", _contract ); @@ -1108,7 +1107,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { ) { // Handle out-of-intrinsic gas consistent with EVM behavior -- the subcall "appears to revert" if we don't have enough gas to transfer the ETH. // Similar to dynamic gas cost of value exceeding gas here: - // https://github.com/ethereum/go-ethereum/blob/c503f98f6d5e80e079c1d8a3601d188af2a899da/core/vm/interpreter.go#L268-L273 + // https://github.com/ethereum/go-ethereum/blob/c503f98f6d5e80e079c1d8a3601d188af2a899da/core/vm/interpreter.go#L268-L273 if (gasleft() < CALL_WITH_VALUE_INTRINSIC_GAS) { return (false, hex""); } @@ -1357,10 +1356,10 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { bool _success ) { - bytes memory transferCalldata = abi.encodeWithSelector( - IUniswapV2ERC20.transfer.selector, - _to, - _value + bytes memory transferCalldata = abi.encodeWithSignature( + "transfer(address,uint256)", + _to, + _value ); // OVM_ETH inherits from the UniswapV2ERC20 standard. In this implementation, its return type diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_ETH.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_ETH.sol index 5ed565f99691..731286d17f56 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_ETH.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_ETH.sol @@ -2,13 +2,10 @@ pragma solidity >0.5.0 <0.8.0; /* Library Imports */ -import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; - -/* Interface Imports */ -import { iOVM_L1TokenGateway } from "../../iOVM/bridge/tokens/iOVM_L1TokenGateway.sol"; +import { Lib_PredeployAddresses } from "../../libraries/constants/Lib_PredeployAddresses.sol"; /* Contract Imports */ -import { OVM_L2DepositedERC20 } from "../bridge/tokens/OVM_L2DepositedERC20.sol"; +import { L2StandardERC20 } from "../../libraries/standards/L2StandardERC20.sol"; /** * @title OVM_ETH @@ -18,17 +15,18 @@ import { OVM_L2DepositedERC20 } from "../bridge/tokens/OVM_L2DepositedERC20.sol" * Compiler used: optimistic-solc * Runtime target: OVM */ -contract OVM_ETH is OVM_L2DepositedERC20 { - constructor( - address _l2CrossDomainMessenger, - address _l1ETHGateway - ) - OVM_L2DepositedERC20( - _l2CrossDomainMessenger, +contract OVM_ETH is L2StandardERC20 { + + /*************** + * Constructor * + ***************/ + + constructor() + L2StandardERC20( + Lib_PredeployAddresses.L2_STANDARD_BRIDGE, + address(0), "Ether", "ETH" ) - { - init(iOVM_L1TokenGateway(_l1ETHGateway)); - } + {} } diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerFeeVault.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerFeeVault.sol index 4212d6c71a28..7a5b4470deef 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerFeeVault.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerFeeVault.sol @@ -6,6 +6,7 @@ import { Lib_PredeployAddresses } from "../../libraries/constants/Lib_PredeployA /* Contract Imports */ import { OVM_ETH } from "../predeploys/OVM_ETH.sol"; +import { OVM_L2StandardBridge } from "../bridge/tokens/OVM_L2StandardBridge.sol"; /** * @title OVM_SequencerFeeVault @@ -36,7 +37,7 @@ contract OVM_SequencerFeeVault { /*************** * Constructor * ***************/ - + /** * @param _l1FeeWallet Initial address for the L1 wallet that will hold fees once withdrawn. * Currently HAS NO EFFECT in production because l2geth will mutate this storage slot during @@ -63,7 +64,8 @@ contract OVM_SequencerFeeVault { "OVM_SequencerFeeVault: withdrawal amount must be greater than minimum withdrawal amount" ); - OVM_ETH(Lib_PredeployAddresses.OVM_ETH).withdrawTo( + OVM_L2StandardBridge(Lib_PredeployAddresses.L2_STANDARD_BRIDGE).withdrawTo( + Lib_PredeployAddresses.OVM_ETH, l1FeeWallet, balance, 0, diff --git a/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/messaging/iAbs_BaseCrossDomainMessenger.sol b/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_CrossDomainMessenger.sol similarity index 91% rename from packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/messaging/iAbs_BaseCrossDomainMessenger.sol rename to packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_CrossDomainMessenger.sol index 3bd8e9cd6845..457d9d34f9d0 100644 --- a/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/messaging/iAbs_BaseCrossDomainMessenger.sol +++ b/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_CrossDomainMessenger.sol @@ -3,9 +3,9 @@ pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /** - * @title iAbs_BaseCrossDomainMessenger + * @title iOVM_CrossDomainMessenger */ -interface iAbs_BaseCrossDomainMessenger { +interface iOVM_CrossDomainMessenger { /********** * Events * diff --git a/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol b/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol index c560a623e115..67add2a591e4 100644 --- a/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol +++ b/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol @@ -6,12 +6,12 @@ pragma experimental ABIEncoderV2; import { Lib_OVMCodec } from "../../../libraries/codec/Lib_OVMCodec.sol"; /* Interface Imports */ -import { iAbs_BaseCrossDomainMessenger } from "./iAbs_BaseCrossDomainMessenger.sol"; +import { iOVM_CrossDomainMessenger } from "./iOVM_CrossDomainMessenger.sol"; /** * @title iOVM_L1CrossDomainMessenger */ -interface iOVM_L1CrossDomainMessenger is iAbs_BaseCrossDomainMessenger { +interface iOVM_L1CrossDomainMessenger is iOVM_CrossDomainMessenger { /******************* * Data Structures * diff --git a/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_L2CrossDomainMessenger.sol b/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_L2CrossDomainMessenger.sol index 900d59d09727..bf03718e7a3a 100644 --- a/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_L2CrossDomainMessenger.sol +++ b/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_L2CrossDomainMessenger.sol @@ -3,12 +3,12 @@ pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Interface Imports */ -import { iAbs_BaseCrossDomainMessenger } from "./iAbs_BaseCrossDomainMessenger.sol"; +import { iOVM_CrossDomainMessenger } from "./iOVM_CrossDomainMessenger.sol"; /** * @title iOVM_L2CrossDomainMessenger */ -interface iOVM_L2CrossDomainMessenger is iAbs_BaseCrossDomainMessenger { +interface iOVM_L2CrossDomainMessenger is iOVM_CrossDomainMessenger { /******************** * Public Functions * diff --git a/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1ERC20Bridge.sol b/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1ERC20Bridge.sol new file mode 100644 index 000000000000..636ddb61ce76 --- /dev/null +++ b/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1ERC20Bridge.sol @@ -0,0 +1,104 @@ +// SPDX-License-Identifier: MIT +pragma solidity >0.5.0; +pragma experimental ABIEncoderV2; + +/** + * @title iOVM_L1ERC20Bridge + */ +interface iOVM_L1ERC20Bridge { + + /********** + * Events * + **********/ + + event ERC20DepositInitiated ( + address indexed _l1Token, + address indexed _l2Token, + address indexed _from, + address _to, + uint256 _amount, + bytes _data + ); + + event ERC20WithdrawalFinalized ( + address indexed _l1Token, + address indexed _l2Token, + address indexed _from, + address _to, + uint256 _amount, + bytes _data + ); + + /******************** + * Public Functions * + ********************/ + + /** + * @dev deposit an amount of the ERC20 to the caller's balance on L2. + * @param _l1Token Address of the L1 ERC20 we are depositing + * @param _l2Token Address of the L1 respective L2 ERC20 + * @param _amount Amount of the ERC20 to deposit + * @param _l2Gas Gas limit required to complete the deposit on L2. + * @param _data Optional data to forward to L2. This data is provided + * solely as a convenience for external contracts. Aside from enforcing a maximum + * length, these contracts provide no guarantees about its content. + */ + function depositERC20 ( + address _l1Token, + address _l2Token, + uint _amount, + uint32 _l2Gas, + bytes calldata _data + ) + external; + + /** + * @dev deposit an amount of ERC20 to a recipient's balance on L2. + * @param _l1Token Address of the L1 ERC20 we are depositing + * @param _l2Token Address of the L1 respective L2 ERC20 + * @param _to L2 address to credit the withdrawal to. + * @param _amount Amount of the ERC20 to deposit. + * @param _l2Gas Gas limit required to complete the deposit on L2. + * @param _data Optional data to forward to L2. This data is provided + * solely as a convenience for external contracts. Aside from enforcing a maximum + * length, these contracts provide no guarantees about its content. + */ + function depositERC20To ( + address _l1Token, + address _l2Token, + address _to, + uint _amount, + uint32 _l2Gas, + bytes calldata _data + ) + external; + + + /************************* + * Cross-chain Functions * + *************************/ + + /** + * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the + * L1 ERC20 token. + * This call will fail if the initialized withdrawal from L2 has not been finalized. + * + * @param _l1Token Address of L1 token to finalizeWithdrawal for. + * @param _l2Token Address of L2 token where withdrawal was initiated. + * @param _from L2 address initiating the transfer. + * @param _to L1 address to credit the withdrawal to. + * @param _amount Amount of the ERC20 to deposit. + * @param _data Data provided by the sender on L2. This data is provided + * solely as a convenience for external contracts. Aside from enforcing a maximum + * length, these contracts provide no guarantees about its content. + */ + function finalizeERC20Withdrawal ( + address _l1Token, + address _l2Token, + address _from, + address _to, + uint _amount, + bytes calldata _data + ) + external; +} diff --git a/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1ETHGateway.sol b/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1ETHGateway.sol deleted file mode 100644 index 44c834b89da5..000000000000 --- a/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1ETHGateway.sol +++ /dev/null @@ -1,59 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >0.5.0; -pragma experimental ABIEncoderV2; - -/** - * @title iOVM_L1ETHGateway - */ -interface iOVM_L1ETHGateway { - - /********** - * Events * - **********/ - - event DepositInitiated( - address indexed _from, - address indexed _to, - uint256 _amount, - bytes _data - ); - - event WithdrawalFinalized( - address indexed _from, - address indexed _to, - uint256 _amount, - bytes _data - ); - - /******************** - * Public Functions * - ********************/ - - function deposit( - uint32 _l2Gas, - bytes calldata _data - ) - external - payable; - - function depositTo( - address _to, - uint32 _l2Gas, - bytes calldata _data - ) - external - payable; - - /************************* - * Cross-chain Functions * - *************************/ - - function finalizeWithdrawal( - address _from, - address _to, - uint _amount, - bytes calldata _data - ) - external; - -} diff --git a/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1StandardBridge.sol b/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1StandardBridge.sol new file mode 100644 index 000000000000..fe63dd8e88fc --- /dev/null +++ b/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1StandardBridge.sol @@ -0,0 +1,85 @@ +// SPDX-License-Identifier: MIT +pragma solidity >0.5.0; +pragma experimental ABIEncoderV2; + +import './iOVM_L1ERC20Bridge.sol'; + +/** + * @title iOVM_L1StandardBridge + */ +interface iOVM_L1StandardBridge is iOVM_L1ERC20Bridge { + + /********** + * Events * + **********/ + event ETHDepositInitiated ( + address indexed _from, + address indexed _to, + uint256 _amount, + bytes _data + ); + + event ETHWithdrawalFinalized ( + address indexed _from, + address indexed _to, + uint256 _amount, + bytes _data + ); + + /******************** + * Public Functions * + ********************/ + + /** + * @dev Deposit an amount of the ETH to the caller's balance on L2. + * @param _l2Gas Gas limit required to complete the deposit on L2. + * @param _data Optional data to forward to L2. This data is provided + * solely as a convenience for external contracts. Aside from enforcing a maximum + * length, these contracts provide no guarantees about its content. + */ + function depositETH ( + uint32 _l2Gas, + bytes calldata _data + ) + external + payable; + + /** + * @dev Deposit an amount of ETH to a recipient's balance on L2. + * @param _to L2 address to credit the withdrawal to. + * @param _l2Gas Gas limit required to complete the deposit on L2. + * @param _data Optional data to forward to L2. This data is provided + * solely as a convenience for external contracts. Aside from enforcing a maximum + * length, these contracts provide no guarantees about its content. + */ + function depositETHTo ( + address _to, + uint32 _l2Gas, + bytes calldata _data + ) + external + payable; + + /************************* + * Cross-chain Functions * + *************************/ + + /** + * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the + * L1 ETH token. + * Since only the xDomainMessenger can call this function, it will never be called before the withdrawal is finalized. + * @param _from L2 address initiating the transfer. + * @param _to L1 address to credit the withdrawal to. + * @param _amount Amount of the ERC20 to deposit. + * @param _data Optional data to forward to L2. This data is provided + * solely as a convenience for external contracts. Aside from enforcing a maximum + * length, these contracts provide no guarantees about its content. + */ + function finalizeETHWithdrawal ( + address _from, + address _to, + uint _amount, + bytes calldata _data + ) + external; +} diff --git a/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1TokenGateway.sol b/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1TokenGateway.sol deleted file mode 100644 index 402aefbcc669..000000000000 --- a/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1TokenGateway.sol +++ /dev/null @@ -1,61 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >0.5.0; -pragma experimental ABIEncoderV2; - -/** - * @title iOVM_L1TokenGateway - */ -interface iOVM_L1TokenGateway { - - /********** - * Events * - **********/ - - event DepositInitiated( - address indexed _from, - address indexed _to, - uint256 _amount, - bytes _data - ); - - event WithdrawalFinalized( - address indexed _from, - address indexed _to, - uint256 _amount, - bytes _data - ); - - - /******************** - * Public Functions * - ********************/ - - function deposit( - uint _amount, - uint32 _l2Gas, - bytes calldata _data - ) - external; - - function depositTo( - address _to, - uint _amount, - uint32 _l2Gas, - bytes calldata _data - ) - external; - - - /************************* - * Cross-chain Functions * - *************************/ - - function finalizeWithdrawal( - address _from, - address _to, - uint _amount, - bytes calldata _data - ) - external; - -} diff --git a/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L2DepositedToken.sol b/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L2DepositedToken.sol deleted file mode 100644 index 14d12db81a9a..000000000000 --- a/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L2DepositedToken.sol +++ /dev/null @@ -1,61 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >0.5.0; -pragma experimental ABIEncoderV2; - -/** - * @title iOVM_L2DepositedToken - */ -interface iOVM_L2DepositedToken { - - /********** - * Events * - **********/ - - event WithdrawalInitiated( - address indexed _from, - address indexed _to, - uint256 _amount, - bytes _data - ); - - event DepositFinalized( - address indexed _from, - address indexed _to, - uint256 _amount, - bytes _data - ); - - - /******************** - * Public Functions * - ********************/ - - function withdraw( - uint _amount, - uint32 _l1Gas, - bytes calldata _data - ) - external; - - function withdrawTo( - address _to, - uint _amount, - uint32 _l1Gas, - bytes calldata _data - ) - external; - - - /************************* - * Cross-chain Functions * - *************************/ - - function finalizeDeposit( - address _from, - address _to, - uint _amount, - bytes calldata _data - ) - external; - -} diff --git a/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L2ERC20Bridge.sol b/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L2ERC20Bridge.sol new file mode 100644 index 000000000000..75ea2f7c139e --- /dev/null +++ b/packages/contracts/contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L2ERC20Bridge.sol @@ -0,0 +1,109 @@ +// SPDX-License-Identifier: MIT +pragma solidity >0.5.0; +pragma experimental ABIEncoderV2; + +/** + * @title iOVM_L2ERC20Bridge + */ +interface iOVM_L2ERC20Bridge { + + /********** + * Events * + **********/ + + event WithdrawalInitiated ( + address indexed _l1Token, + address indexed _l2Token, + address indexed _from, + address _to, + uint256 _amount, + bytes _data + ); + + event DepositFinalized ( + address indexed _l1Token, + address indexed _l2Token, + address indexed _from, + address _to, + uint256 _amount, + bytes _data + ); + + event DepositFailed ( + address indexed _l1Token, + address indexed _l2Token, + address indexed _from, + address _to, + uint256 _amount, + bytes _data + ); + + + /******************** + * Public Functions * + ********************/ + + /** + * @dev initiate a withdraw of some tokens to the caller's account on L1 + * @param _l2Token Address of L2 token where withdrawal was initiated. + * @param _amount Amount of the token to withdraw. + * param _l1Gas Unused, but included for potential forward compatibility considerations. + * @param _data Optional data to forward to L1. This data is provided + * solely as a convenience for external contracts. Aside from enforcing a maximum + * length, these contracts provide no guarantees about its content. + */ + function withdraw ( + address _l2Token, + uint _amount, + uint32 _l1Gas, + bytes calldata _data + ) + external; + + /** + * @dev initiate a withdraw of some token to a recipient's account on L1. + * @param _l2Token Address of L2 token where withdrawal is initiated. + * @param _to L1 adress to credit the withdrawal to. + * @param _amount Amount of the token to withdraw. + * param _l1Gas Unused, but included for potential forward compatibility considerations. + * @param _data Optional data to forward to L1. This data is provided + * solely as a convenience for external contracts. Aside from enforcing a maximum + * length, these contracts provide no guarantees about its content. + */ + function withdrawTo ( + address _l2Token, + address _to, + uint _amount, + uint32 _l1Gas, + bytes calldata _data + ) + external; + + /************************* + * Cross-chain Functions * + *************************/ + + /** + * @dev Complete a deposit from L1 to L2, and credits funds to the recipient's balance of this + * L2 token. + * This call will fail if it did not originate from a corresponding deposit in OVM_l1TokenGateway. + * @param _l1Token Address for the l1 token this is called with + * @param _l2Token Address for the l2 token this is called with + * @param _from Account to pull the deposit from on L2. + * @param _to Address to receive the withdrawal at + * @param _amount Amount of the token to withdraw + * @param _data Data provider by the sender on L1. This data is provided + * solely as a convenience for external contracts. Aside from enforcing a maximum + * length, these contracts provide no guarantees about its content. + */ + function finalizeDeposit ( + address _l1Token, + address _l2Token, + address _from, + address _to, + uint _amount, + bytes calldata _data + ) + external; + +} diff --git a/packages/contracts/contracts/optimistic-ethereum/iOVM/predeploys/iOVM_ERC20.sol b/packages/contracts/contracts/optimistic-ethereum/iOVM/predeploys/iOVM_ERC20.sol deleted file mode 100644 index 1c765799cd10..000000000000 --- a/packages/contracts/contracts/optimistic-ethereum/iOVM/predeploys/iOVM_ERC20.sol +++ /dev/null @@ -1,53 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >0.5.0 <0.8.0; - -/** - * @title iOVM_ERC20 - */ -interface iOVM_ERC20 { - /* This is a slight change to the ERC20 base standard. - function totalSupply() constant returns (uint256 supply); - is replaced with: - uint256 public totalSupply; - This automatically creates a getter function for the totalSupply. - This is moved to the base contract since public getter functions are not - currently recognised as an implementation of the matching abstract - function by the compiler. - */ - /// total amount of tokens - function totalSupply() external view returns (uint256); - - /// @param _owner The address from which the balance will be retrieved - /// @return balance The balance - function balanceOf(address _owner) external view returns (uint256 balance); - - /// @notice send `_value` token to `_to` from `msg.sender` - /// @param _to The address of the recipient - /// @param _value The amount of token to be transferred - /// @return success Whether the transfer was successful or not - function transfer(address _to, uint256 _value) external returns (bool success); - - /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` - /// @param _from The address of the sender - /// @param _to The address of the recipient - /// @param _value The amount of token to be transferred - /// @return success Whether the transfer was successful or not - function transferFrom(address _from, address _to, uint256 _value) external returns (bool success); - - /// @notice `msg.sender` approves `_spender` to spend `_value` tokens - /// @param _spender The address of the account able to transfer the tokens - /// @param _value The amount of tokens to be approved for transfer - /// @return success Whether the approval was successful or not - function approve(address _spender, uint256 _value) external returns (bool success); - - /// @param _owner The address of the account owning tokens - /// @param _spender The address of the account able to transfer the tokens - /// @return remaining Amount of remaining tokens allowed to spent - function allowance(address _owner, address _spender) external view returns (uint256 remaining); - - // solhint-disable-next-line no-simple-event-func-name - event Transfer(address indexed _from, address indexed _to, uint256 _value); - event Approval(address indexed _owner, address indexed _spender, uint256 _value); - event Mint(address indexed _account, uint256 _amount); - event Burn(address indexed _account, uint256 _amount); -} diff --git a/packages/contracts/contracts/optimistic-ethereum/libraries/bridge/OVM_CrossDomainEnabled.sol b/packages/contracts/contracts/optimistic-ethereum/libraries/bridge/OVM_CrossDomainEnabled.sol index 784ecfb71094..7968433c3c3d 100644 --- a/packages/contracts/contracts/optimistic-ethereum/libraries/bridge/OVM_CrossDomainEnabled.sol +++ b/packages/contracts/contracts/optimistic-ethereum/libraries/bridge/OVM_CrossDomainEnabled.sol @@ -2,7 +2,7 @@ pragma solidity >0.5.0 <0.8.0; /* Interface Imports */ -import { iAbs_BaseCrossDomainMessenger } from "../../iOVM/bridge/messaging/iAbs_BaseCrossDomainMessenger.sol"; +import { iOVM_CrossDomainMessenger } from "../../iOVM/bridge/messaging/iOVM_CrossDomainMessenger.sol"; /** * @title OVM_CrossDomainEnabled @@ -74,10 +74,10 @@ contract OVM_CrossDomainEnabled { internal virtual returns ( - iAbs_BaseCrossDomainMessenger + iOVM_CrossDomainMessenger ) { - return iAbs_BaseCrossDomainMessenger(messenger); + return iOVM_CrossDomainMessenger(messenger); } /** diff --git a/packages/contracts/contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol b/packages/contracts/contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol index ab68135f36a5..1c1aa9ef9a45 100644 --- a/packages/contracts/contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol +++ b/packages/contracts/contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol @@ -16,4 +16,5 @@ library Lib_PredeployAddresses { address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009; address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011; address internal constant ERC1820_REGISTRY = 0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24; + address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010; } diff --git a/packages/contracts/contracts/optimistic-ethereum/libraries/standards/IL2StandardERC20.sol b/packages/contracts/contracts/optimistic-ethereum/libraries/standards/IL2StandardERC20.sol new file mode 100644 index 000000000000..34f7c2375155 --- /dev/null +++ b/packages/contracts/contracts/optimistic-ethereum/libraries/standards/IL2StandardERC20.sol @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.16 <0.8.0; + +import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import { IERC165 } from "@openzeppelin/contracts/introspection/IERC165.sol"; + +interface IL2StandardERC20 is IERC20, IERC165 { + function l1Token() external returns (address); + + function mint(address _to, uint256 _amount) external; + + function burn(address _from, uint256 _amount) external; + + event Mint(address indexed _account, uint256 _amount); + event Burn(address indexed _account, uint256 _amount); +} diff --git a/packages/contracts/contracts/optimistic-ethereum/libraries/standards/IUniswapV2ERC20.sol b/packages/contracts/contracts/optimistic-ethereum/libraries/standards/IUniswapV2ERC20.sol deleted file mode 100644 index f83dae349771..000000000000 --- a/packages/contracts/contracts/optimistic-ethereum/libraries/standards/IUniswapV2ERC20.sol +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >=0.5.16 <0.8.0; - -interface IUniswapV2ERC20 { - event Approval(address indexed owner, address indexed spender, uint value); - event Transfer(address indexed from, address indexed to, uint value); - - function name() external view returns (string memory); - function symbol() external view returns (string memory); - function decimals() external view returns (uint8); - function totalSupply() external view returns (uint); - function balanceOf(address owner) external view returns (uint); - function allowance(address owner, address spender) external view returns (uint); - - function approve(address spender, uint value) external returns (bool); - function transfer(address to, uint value) external returns (bool); - function transferFrom(address from, address to, uint value) external returns (bool); - - function DOMAIN_SEPARATOR() external view returns (bytes32); - function PERMIT_TYPEHASH() external pure returns (bytes32); - function nonces(address owner) external view returns (uint); - - function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; -} diff --git a/packages/contracts/contracts/optimistic-ethereum/libraries/standards/L2StandardERC20.sol b/packages/contracts/contracts/optimistic-ethereum/libraries/standards/L2StandardERC20.sol new file mode 100644 index 000000000000..4a85eff0f60e --- /dev/null +++ b/packages/contracts/contracts/optimistic-ethereum/libraries/standards/L2StandardERC20.sol @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.16 <0.8.0; + +import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; + +import './IL2StandardERC20.sol'; + +contract L2StandardERC20 is IL2StandardERC20, ERC20 { + address public override l1Token; + address public l2Bridge; + + /** + * @param _l1Token Address of the corresponding L1 token. + * @param _name ERC20 name. + * @param _symbol ERC20 symbol. + */ + constructor( + address _l2Bridge, + address _l1Token, + string memory _name, + string memory _symbol + ) + ERC20(_name, _symbol) { + l1Token = _l1Token; + l2Bridge = _l2Bridge; + } + + modifier onlyL2Bridge { + require(msg.sender == l2Bridge, "Only L2 Bridge can mint and burn"); + _; + } + + function supportsInterface(bytes4 _interfaceId) public override pure returns (bool) { + bytes4 firstSupportedInterface = bytes4(keccak256("supportsInterface(bytes4)")); // ERC165 + bytes4 secondSupportedInterface = IL2StandardERC20.l1Token.selector + ^ IL2StandardERC20.mint.selector + ^ IL2StandardERC20.burn.selector; + return _interfaceId == firstSupportedInterface || _interfaceId == secondSupportedInterface; + } + + function mint(address _to, uint256 _amount) public override onlyL2Bridge { + _mint(_to, _amount); + + emit Mint(_to, _amount); + } + + function burn(address _from, uint256 _amount) public override onlyL2Bridge { + _burn(_from, _amount); + + emit Burn(_from, _amount); + } +} diff --git a/packages/contracts/contracts/optimistic-ethereum/libraries/standards/UniSafeMath.sol b/packages/contracts/contracts/optimistic-ethereum/libraries/standards/UniSafeMath.sol deleted file mode 100644 index de87bab5d72d..000000000000 --- a/packages/contracts/contracts/optimistic-ethereum/libraries/standards/UniSafeMath.sol +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >=0.5.16 <0.8.0; - -// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) - -library UniSafeMath { - function add(uint x, uint y) internal pure returns (uint z) { - require((z = x + y) >= x, 'ds-math-add-overflow'); - } - - function sub(uint x, uint y) internal pure returns (uint z) { - require((z = x - y) <= x, 'ds-math-sub-underflow'); - } - - function mul(uint x, uint y) internal pure returns (uint z) { - require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow'); - } -} diff --git a/packages/contracts/contracts/optimistic-ethereum/libraries/standards/UniswapV2ERC20.sol b/packages/contracts/contracts/optimistic-ethereum/libraries/standards/UniswapV2ERC20.sol deleted file mode 100644 index 303d53484bd5..000000000000 --- a/packages/contracts/contracts/optimistic-ethereum/libraries/standards/UniswapV2ERC20.sol +++ /dev/null @@ -1,98 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >=0.5.16 <0.8.0; - -import './IUniswapV2ERC20.sol'; -import './UniSafeMath.sol'; - -contract UniswapV2ERC20 is IUniswapV2ERC20 { - using UniSafeMath for uint; - - string public override name; - string public override symbol; - uint8 public constant override decimals = 18; - uint public override totalSupply; - mapping(address => uint) public override balanceOf; - mapping(address => mapping(address => uint)) public override allowance; - - bytes32 public override DOMAIN_SEPARATOR; - // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); - bytes32 public constant override PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; - mapping(address => uint) public override nonces; - - constructor( - string memory _name, - string memory _symbol - ) { - name = _name; - symbol = _symbol; - - uint chainId; - assembly { - chainId := chainid() - } - DOMAIN_SEPARATOR = keccak256( - abi.encode( - keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'), - keccak256(bytes(name)), - keccak256(bytes('1')), - chainId, - address(this) - ) - ); - } - - function _mint(address to, uint value) internal { - totalSupply = totalSupply.add(value); - balanceOf[to] = balanceOf[to].add(value); - emit Transfer(address(0), to, value); - } - - function _burn(address from, uint value) internal { - balanceOf[from] = balanceOf[from].sub(value); - totalSupply = totalSupply.sub(value); - emit Transfer(from, address(0), value); - } - - function _approve(address owner, address spender, uint value) private { - allowance[owner][spender] = value; - emit Approval(owner, spender, value); - } - - function _transfer(address from, address to, uint value) private { - balanceOf[from] = balanceOf[from].sub(value); - balanceOf[to] = balanceOf[to].add(value); - emit Transfer(from, to, value); - } - - function approve(address spender, uint value) external override returns (bool) { - _approve(msg.sender, spender, value); - return true; - } - - function transfer(address to, uint value) external override returns (bool) { - _transfer(msg.sender, to, value); - return true; - } - - function transferFrom(address from, address to, uint value) external override returns (bool) { - if (allowance[from][msg.sender] != uint(-1)) { - allowance[from][msg.sender] = allowance[from][msg.sender].sub(value); - } - _transfer(from, to, value); - return true; - } - - function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external override { - require(deadline >= block.timestamp, 'UniswapV2: EXPIRED'); - bytes32 digest = keccak256( - abi.encodePacked( - '\x19\x01', - DOMAIN_SEPARATOR, - keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline)) - ) - ); - address recoveredAddress = ecrecover(digest, v, r, s); - require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE'); - _approve(owner, spender, value); - } -} diff --git a/packages/contracts/deploy/015-OVM_L1ETHGateway.deploy.ts b/packages/contracts/deploy/015-OVM_L1ETHGateway.deploy.ts deleted file mode 100644 index 85aa3cc151e0..000000000000 --- a/packages/contracts/deploy/015-OVM_L1ETHGateway.deploy.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* 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, - }) - - // 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 - ) - - 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/packages/contracts/deploy/015-Proxy__OVM_L1StandardBridge.deploy.ts b/packages/contracts/deploy/015-Proxy__OVM_L1StandardBridge.deploy.ts new file mode 100644 index 000000000000..2b352b488256 --- /dev/null +++ b/packages/contracts/deploy/015-Proxy__OVM_L1StandardBridge.deploy.ts @@ -0,0 +1,104 @@ +/* Imports: External */ +import { DeployFunction } from 'hardhat-deploy/dist/types' + +/* Imports: Internal */ +import { getDeployedContract } from '../src/hardhat-deploy-ethers' +import { predeploys } from '../src/predeploys' +import { NON_ZERO_ADDRESS } from '../test/helpers/constants' +import { getContractFactory } from '../src/contract-defs' + +import l1StandardBridgeJson from '../artifacts/contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1StandardBridge.sol/OVM_L1StandardBridge.json' + +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_L1StandardBridge', { + contract: 'L1ChugSplashProxy', + from: deployer, + args: [deployer], + log: true, + }) + + if (!result.newlyDeployed) { + return + } + + // Create a contract object at the Proxy address with the proxy interface. + const Proxy__WithChugSplashInterface = await getDeployedContract( + hre, + 'Proxy__OVM_L1StandardBridge', + { + signerOrProvider: deployer, + iface: 'L1ChugSplashProxy', + } + ) + + // Create a contract object at the Proxy address with the brige implementation interface. + const Proxy__WithBridgeInterface = await getDeployedContract( + hre, + 'Proxy__OVM_L1StandardBridge', + { + signerOrProvider: deployer, + iface: 'OVM_L1StandardBridge', + } + ) + + // Set the implementation code + const bridgeCode = l1StandardBridgeJson.deployedBytecode + await Proxy__WithChugSplashInterface.setCode(bridgeCode) + + // Set slot 0 to the L1 Messenger Address + const l1MessengerAddress = await Lib_AddressManager.getAddress( + 'Proxy__OVM_L1CrossDomainMessenger' + ) + await Proxy__WithChugSplashInterface.setStorage( + hre.ethers.constants.HashZero, + hre.ethers.utils.hexZeroPad(l1MessengerAddress, 32) + ) + // Verify that the slot was set correctly + const l1MessengerStored = await Proxy__WithBridgeInterface.callStatic.messenger() + console.log('l1MessengerStored:', l1MessengerStored) + if (l1MessengerStored !== l1MessengerAddress) { + throw new Error( + 'L1 messenger address was not correctly set, check the key value used in setStorage' + ) + } + + // Set Slot 1 to the L2 Standard Bridge Address + await Proxy__WithChugSplashInterface.setStorage( + hre.ethers.utils.hexZeroPad('0x01', 32), + hre.ethers.utils.hexZeroPad(predeploys.OVM_L2StandardBridge, 32) + ) + // Verify that the slot was set correctly + const l2TokenBridgeStored = await Proxy__WithBridgeInterface.callStatic.l2TokenBridge() + console.log('l2TokenBridgeStored:', l2TokenBridgeStored) + if (l2TokenBridgeStored !== predeploys.OVM_L2StandardBridge) { + throw new Error( + 'L2 bridge address was not correctly set, check the key value used in setStorage' + ) + } + + // transfer ownership to Address Manager owner + const addressManagerOwner = Lib_AddressManager.callStatic.owner() + await Proxy__WithChugSplashInterface.setOwner(addressManagerOwner) + + // Todo: remove this after adding chugsplash proxy + await Lib_AddressManager.setAddress( + 'Proxy__OVM_L1StandardBridge', + result.address + ) +} + +deployFn.dependencies = ['Lib_AddressManager', 'OVM_L1StandardBridge'] +deployFn.tags = ['Proxy__OVM_L1StandardBridge'] + +export default deployFn diff --git a/packages/contracts/deploy/016-Proxy__OVM_L1ETHGateway.deploy.ts b/packages/contracts/deploy/016-Proxy__OVM_L1ETHGateway.deploy.ts deleted file mode 100644 index 2c57e94b43a3..000000000000 --- a/packages/contracts/deploy/016-Proxy__OVM_L1ETHGateway.deploy.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* 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 diff --git a/packages/contracts/deploy/017-finalize.ts b/packages/contracts/deploy/016-finalize.ts similarity index 100% rename from packages/contracts/deploy/017-finalize.ts rename to packages/contracts/deploy/016-finalize.ts diff --git a/packages/contracts/deploy/018-fund-accounts.ts b/packages/contracts/deploy/018-fund-accounts.ts index 3dc7c9b0a4fe..fe68da8039c3 100644 --- a/packages/contracts/deploy/018-fund-accounts.ts +++ b/packages/contracts/deploy/018-fund-accounts.ts @@ -17,11 +17,11 @@ const deployFn: DeployFunction = async (hre) => { // Only execute this step if we're on the hardhat chain ID. const { chainId } = await hre.ethers.provider.getNetwork() if (chainId === defaultHardhatNetworkParams.chainId) { - const Proxy__OVM_L1ETHGateway = await getDeployedContract( + const OVM_L1StandardBridge = await getDeployedContract( hre, - 'Proxy__OVM_L1ETHGateway', + 'Proxy__OVM_L1StandardBridge', { - iface: 'OVM_L1ETHGateway', + iface: 'OVM_L1StandardBridge', } ) @@ -44,7 +44,7 @@ const deployFn: DeployFunction = async (hre) => { ) const balance = await wallet.getBalance() const depositAmount = balance.div(2) // Deposit half of the wallet's balance into L2. - await Proxy__OVM_L1ETHGateway.connect(wallet).deposit(8_000_000, '0x', { + await OVM_L1StandardBridge.connect(wallet).depositETH(8_000_000, '0x', { value: depositAmount, gasLimit: 2_000_000, // Idk, gas estimation was broken and this fixes it. }) diff --git a/packages/contracts/src/contract-deployment/config.ts b/packages/contracts/src/contract-deployment/config.ts index 124b680fbfcd..b1e94747707f 100644 --- a/packages/contracts/src/contract-deployment/config.ts +++ b/packages/contracts/src/contract-deployment/config.ts @@ -1,5 +1,5 @@ /* External Imports */ -import { Signer, ContractFactory, Contract } from 'ethers' +import { Signer, ContractFactory, Contract, constants } from 'ethers' import { TransactionResponse } from '@ethersproject/abstract-provider' import { Overrides } from '@ethersproject/contracts' @@ -112,25 +112,20 @@ export const makeContractDeployConfig = async ( ) }, }, - OVM_L1ETHGateway: { - factory: getContractFactory('OVM_L1ETHGateway'), + OVM_L1StandardBridge: { + factory: getContractFactory('OVM_L1StandardBridge'), params: [], }, - Proxy__OVM_L1ETHGateway: { + Proxy__OVM_L1StandardBridge: { factory: getContractFactory('Lib_ResolvedDelegateProxy'), - params: [AddressManager.address, 'OVM_L1ETHGateway'], - afterDeploy: async (contracts): Promise => { - const l1EthGateway = getContractFactory('OVM_L1ETHGateway') - .connect(config.deploymentSigner) - .attach(contracts.Proxy__OVM_L1ETHGateway.address) - await _sendTx( - l1EthGateway.initialize( - AddressManager.address, - predeploys.OVM_ETH, - config.deployOverrides - ) - ) - }, + params: [AddressManager.address, 'OVM_L1StandardBridge'], + }, + OVM_L2StandardBridge: { + factory: getContractFactory('OVM_L2StandardBridge'), + params: [ + predeploys.OVM_L2CrossDomainMessenger, + constants.AddressZero, // we'll set this to the L1 Bridge address in genesis.go + ], }, OVM_L1MultiMessageRelayer: { factory: getContractFactory('OVM_L1MultiMessageRelayer'), @@ -233,10 +228,7 @@ export const makeContractDeployConfig = async ( }, OVM_ETH: { factory: getContractFactory('OVM_ETH'), - params: [ - predeploys.OVM_L2CrossDomainMessenger, - '0x0000000000000000000000000000000000000000', // will be overridden by geth when state dump is ingested. Storage key: 0x0000000000000000000000000000000000000000000000000000000000000008 - ], + params: [], }, 'OVM_ChainStorageContainer-CTC-batches': { factory: getContractFactory('OVM_ChainStorageContainer'), diff --git a/packages/contracts/src/predeploys.ts b/packages/contracts/src/predeploys.ts index edc316f04fac..57829dbf2632 100644 --- a/packages/contracts/src/predeploys.ts +++ b/packages/contracts/src/predeploys.ts @@ -20,5 +20,6 @@ export const predeploys = { OVM_ExecutionManagerWrapper: '0x420000000000000000000000000000000000000B', OVM_GasPriceOracle: '0x420000000000000000000000000000000000000F', OVM_SequencerFeeVault: '0x4200000000000000000000000000000000000011', + OVM_L2StandardBridge: '0x4200000000000000000000000000000000000010', ERC1820Registry: '0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24', } diff --git a/packages/contracts/src/state-dump/make-dump.ts b/packages/contracts/src/state-dump/make-dump.ts index 1828feceebde..1f7a1e1010e1 100644 --- a/packages/contracts/src/state-dump/make-dump.ts +++ b/packages/contracts/src/state-dump/make-dump.ts @@ -138,6 +138,7 @@ export const makeStateDump = async (cfg: RollupDeployConfig): Promise => { 'OVM_ExecutionManagerWrapper', 'OVM_GasPriceOracle', 'OVM_SequencerFeeVault', + 'OVM_L2StandardBridge', ], deployOverrides: {}, waitForReceipts: false, @@ -161,6 +162,7 @@ export const makeStateDump = async (cfg: RollupDeployConfig): Promise => { 'OVM_ExecutionManagerWrapper', 'OVM_GasPriceOracle', 'OVM_SequencerFeeVault', + 'OVM_L2StandardBridge', ] const deploymentResult = await deploy(config) diff --git a/packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts b/packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts index d15a65c8c6b2..565e585d3845 100644 --- a/packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts +++ b/packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts @@ -117,7 +117,7 @@ describe('OVM_ECDSAContractAccount', () => { ).to.be.revertedWith('Transaction signed with wrong chain ID') }) - // TEMPORARY: Skip gas checks for minnet. + // TEMPORARY: Skip gas checks for mainnet. it.skip(`should revert on insufficient gas`, async () => { const transaction = { ...DEFAULT_EIP155_TX, gasLimit: 200000000 } const encodedTransaction = await wallet.signTransaction(transaction) diff --git a/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L1ERC20Gateway.spec.ts b/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L1ERC20Gateway.spec.ts deleted file mode 100644 index a7fb4394a311..000000000000 --- a/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L1ERC20Gateway.spec.ts +++ /dev/null @@ -1,255 +0,0 @@ -import { expect } from '../../../../setup' - -/* External Imports */ -import { ethers } from 'hardhat' -import { Signer, ContractFactory, Contract, constants } from 'ethers' -import { smockit, MockContract, smoddit } from '@eth-optimism/smock' - -/* Internal Imports */ -import { NON_NULL_BYTES32, NON_ZERO_ADDRESS } from '../../../../helpers' - -const INITIAL_TOTAL_L1_SUPPLY = 3000 -const FINALIZATION_GAS = 1_200_000 - -const ERR_INVALID_MESSENGER = 'OVM_XCHAIN: messenger contract unauthenticated' -const ERR_INVALID_X_DOMAIN_MSG_SENDER = - 'OVM_XCHAIN: wrong sender of cross-domain message' - -describe('OVM_L1ERC20Gateway', () => { - // init signers - let alice: Signer - let bob: Signer - - // we can just make up this string since it's on the "other" Layer - let Mock__OVM_L2DepositedERC20: MockContract - let Factory__L1ERC20: ContractFactory - let L1ERC20: Contract - before(async () => { - ;[alice, bob] = await ethers.getSigners() - - Mock__OVM_L2DepositedERC20 = await smockit( - await ethers.getContractFactory('OVM_L2DepositedERC20') - ) - - // deploy an ERC20 contract on L1 - Factory__L1ERC20 = await smoddit('UniswapV2ERC20') - - L1ERC20 = await Factory__L1ERC20.deploy('L1ERC20', 'ERC') - - const aliceAddress = await alice.getAddress() - await L1ERC20.smodify.put({ - totalSupply: INITIAL_TOTAL_L1_SUPPLY, - balanceOf: { - [aliceAddress]: INITIAL_TOTAL_L1_SUPPLY, - }, - }) - }) - - let OVM_L1ERC20Gateway: Contract - let Mock__OVM_L1CrossDomainMessenger: MockContract - beforeEach(async () => { - // Create a special signer which will enable us to send messages from the L1Messenger contract - let l1MessengerImpersonator: Signer - ;[l1MessengerImpersonator, alice, bob] = await ethers.getSigners() - // Get a new mock L1 messenger - Mock__OVM_L1CrossDomainMessenger = await smockit( - await ethers.getContractFactory('OVM_L1CrossDomainMessenger'), - { address: await l1MessengerImpersonator.getAddress() } // This allows us to use an ethers override {from: Mock__OVM_L2CrossDomainMessenger.address} to mock calls - ) - - // Deploy the contract under test - OVM_L1ERC20Gateway = await ( - await ethers.getContractFactory('OVM_L1ERC20Gateway') - ).deploy( - L1ERC20.address, - Mock__OVM_L2DepositedERC20.address, - Mock__OVM_L1CrossDomainMessenger.address - ) - }) - - describe('finalizeWithdrawal', () => { - it('onlyFromCrossDomainAccount: should revert on calls from a non-crossDomainMessenger L1 account', async () => { - // Deploy new gateway, initialize with random messenger - OVM_L1ERC20Gateway = await ( - await ethers.getContractFactory('OVM_L1ERC20Gateway') - ).deploy( - L1ERC20.address, - Mock__OVM_L2DepositedERC20.address, - NON_ZERO_ADDRESS - ) - - await expect( - OVM_L1ERC20Gateway.finalizeWithdrawal( - constants.AddressZero, - constants.AddressZero, - 1, - NON_NULL_BYTES32 - ) - ).to.be.revertedWith(ERR_INVALID_MESSENGER) - }) - - it('onlyFromCrossDomainAccount: should revert on calls from the right crossDomainMessenger, but wrong xDomainMessageSender (ie. not the L2ERC20Gateway)', async () => { - Mock__OVM_L1CrossDomainMessenger.smocked.xDomainMessageSender.will.return.with( - () => NON_ZERO_ADDRESS - ) - - await expect( - OVM_L1ERC20Gateway.finalizeWithdrawal( - constants.AddressZero, - constants.AddressZero, - 1, - NON_NULL_BYTES32, - { - from: Mock__OVM_L1CrossDomainMessenger.address, - } - ) - ).to.be.revertedWith(ERR_INVALID_X_DOMAIN_MSG_SENDER) - }) - - it('should credit funds to the withdrawer and not use too much gas', async () => { - // make sure no balance at start of test - await expect(await L1ERC20.balanceOf(NON_ZERO_ADDRESS)).to.be.equal(0) - - const withdrawalAmount = 100 - Mock__OVM_L1CrossDomainMessenger.smocked.xDomainMessageSender.will.return.with( - () => Mock__OVM_L2DepositedERC20.address - ) - - await L1ERC20.transfer(OVM_L1ERC20Gateway.address, withdrawalAmount) - - const res = await OVM_L1ERC20Gateway.finalizeWithdrawal( - NON_ZERO_ADDRESS, - NON_ZERO_ADDRESS, - withdrawalAmount, - NON_NULL_BYTES32, - { from: Mock__OVM_L1CrossDomainMessenger.address } - ) - - await expect(await L1ERC20.balanceOf(NON_ZERO_ADDRESS)).to.be.equal( - withdrawalAmount - ) - - const gasUsed = ( - await OVM_L1ERC20Gateway.provider.getTransactionReceipt(res.hash) - ).gasUsed - - const OVM_L2DepositedERC20 = await ( - await ethers.getContractFactory('OVM_L2DepositedERC20') - ).deploy(constants.AddressZero, '', '') - }) - - it.skip('finalizeWithdrawalAndCall(): should should credit funds to the withdrawer, and forward from and data', async () => { - // TODO: implement this functionality in a future update - expect.fail() - }) - }) - - describe('deposits', () => { - const INITIAL_DEPOSITER_BALANCE = 100_000 - let depositer: string - const depositAmount = 1_000 - - beforeEach(async () => { - // Deploy the L1 ERC20 token, Alice will receive the full initialSupply - L1ERC20 = await Factory__L1ERC20.deploy('L1ERC20', 'ERC') - - // get a new mock L1 messenger - Mock__OVM_L1CrossDomainMessenger = await smockit( - await ethers.getContractFactory('OVM_L1CrossDomainMessenger') - ) - - // Deploy the contract under test: - OVM_L1ERC20Gateway = await ( - await ethers.getContractFactory('OVM_L1ERC20Gateway') - ).deploy( - L1ERC20.address, - Mock__OVM_L2DepositedERC20.address, - Mock__OVM_L1CrossDomainMessenger.address - ) - - // the Signer sets approve for the L1 Gateway - await L1ERC20.approve(OVM_L1ERC20Gateway.address, depositAmount) - depositer = await L1ERC20.signer.getAddress() - - await L1ERC20.smodify.put({ - balanceOf: { - [depositer]: INITIAL_DEPOSITER_BALANCE, - }, - }) - }) - - it('deposit() escrows the deposit amount and sends the correct deposit message', async () => { - // alice calls deposit on the gateway and the L1 gateway calls transferFrom on the token - await OVM_L1ERC20Gateway.deposit( - depositAmount, - FINALIZATION_GAS, - NON_NULL_BYTES32 - ) - const depositCallToMessenger = - Mock__OVM_L1CrossDomainMessenger.smocked.sendMessage.calls[0] - - const depositerBalance = await L1ERC20.balanceOf(depositer) - expect(depositerBalance).to.equal( - INITIAL_DEPOSITER_BALANCE - depositAmount - ) - - // gateway's balance is increased - const gatewayBalance = await L1ERC20.balanceOf(OVM_L1ERC20Gateway.address) - expect(gatewayBalance).to.equal(depositAmount) - - // Check the correct cross-chain call was sent: - // Message should be sent to the L2ERC20Gateway on L2 - expect(depositCallToMessenger._target).to.equal( - Mock__OVM_L2DepositedERC20.address - ) - // Message data should be a call telling the L2ERC20Gateway to finalize the deposit - - // the L1 gateway sends the correct message to the L1 messenger - expect(depositCallToMessenger._message).to.equal( - await Mock__OVM_L2DepositedERC20.interface.encodeFunctionData( - 'finalizeDeposit', - [depositer, depositer, depositAmount, NON_NULL_BYTES32] - ) - ) - expect(depositCallToMessenger._gasLimit).to.equal(FINALIZATION_GAS) - }) - - it('depositTo() escrows the deposit amount and sends the correct deposit message', async () => { - // depositor calls deposit on the gateway and the L1 gateway calls transferFrom on the token - const bobsAddress = await bob.getAddress() - await OVM_L1ERC20Gateway.depositTo( - bobsAddress, - depositAmount, - FINALIZATION_GAS, - NON_NULL_BYTES32 - ) - const depositCallToMessenger = - Mock__OVM_L1CrossDomainMessenger.smocked.sendMessage.calls[0] - - const depositerBalance = await L1ERC20.balanceOf(depositer) - expect(depositerBalance).to.equal( - INITIAL_DEPOSITER_BALANCE - depositAmount - ) - - // gateway's balance is increased - const gatewayBalance = await L1ERC20.balanceOf(OVM_L1ERC20Gateway.address) - expect(gatewayBalance).to.equal(depositAmount) - - // Check the correct cross-chain call was sent: - // Message should be sent to the L2ERC20Gateway on L2 - expect(depositCallToMessenger._target).to.equal( - Mock__OVM_L2DepositedERC20.address - ) - // Message data should be a call telling the L2ERC20Gateway to finalize the deposit - - // the L1 gateway sends the correct message to the L1 messenger - expect(depositCallToMessenger._message).to.equal( - await Mock__OVM_L2DepositedERC20.interface.encodeFunctionData( - 'finalizeDeposit', - [depositer, bobsAddress, depositAmount, NON_NULL_BYTES32] - ) - ) - expect(depositCallToMessenger._gasLimit).to.equal(FINALIZATION_GAS) - }) - }) -}) diff --git a/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L1ETHGateway.spec.ts b/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L1ETHGateway.spec.ts deleted file mode 100644 index 731cf073f432..000000000000 --- a/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L1ETHGateway.spec.ts +++ /dev/null @@ -1,315 +0,0 @@ -import { expect } from '../../../../setup' - -/* External Imports */ -import { ethers } from 'hardhat' -import { Signer, Contract, constants } from 'ethers' -import { smockit, MockContract } from '@eth-optimism/smock' - -/* Internal Imports */ -import { - NON_ZERO_ADDRESS, - makeAddressManager, - NON_NULL_BYTES32, -} from '../../../../helpers' - -const L1_MESSENGER_NAME = 'Proxy__OVM_L1CrossDomainMessenger' - -const ERR_INVALID_MESSENGER = 'OVM_XCHAIN: messenger contract unauthenticated' -const ERR_INVALID_X_DOMAIN_MSG_SENDER = - 'OVM_XCHAIN: wrong sender of cross-domain message' -const ERR_ALREADY_INITIALIZED = 'Contract has already been initialized.' -const FINALIZATION_GAS = 1_200_000 - -describe('OVM_L1ETHGateway', () => { - // init signers - let l1MessengerImpersonator: Signer - let alice: Signer - let bob: Signer - - let AddressManager: Contract - before(async () => { - AddressManager = await makeAddressManager() - }) - - // we can just make up this string since it's on the "other" Layer - let Mock__OVM_L2DepositedERC20: MockContract - before(async () => { - ;[l1MessengerImpersonator, alice, bob] = await ethers.getSigners() - - Mock__OVM_L2DepositedERC20 = await smockit( - await ethers.getContractFactory('OVM_L2DepositedERC20') - ) - }) - - let OVM_L1ETHGateway: Contract - let Mock__OVM_L1CrossDomainMessenger: MockContract - beforeEach(async () => { - // Get a new mock L1 messenger - Mock__OVM_L1CrossDomainMessenger = await smockit( - await ethers.getContractFactory('OVM_L1CrossDomainMessenger'), - { address: await l1MessengerImpersonator.getAddress() } // This allows us to use an ethers override {from: Mock__OVM_L2CrossDomainMessenger.address} to mock calls - ) - - // Deploy the contract under test and initialize - OVM_L1ETHGateway = await ( - await ethers.getContractFactory('OVM_L1ETHGateway') - ).deploy() - await OVM_L1ETHGateway.initialize( - AddressManager.address, - Mock__OVM_L2DepositedERC20.address - ) - }) - - describe('initialize', () => { - it('Should only be callable once', async () => { - await expect( - OVM_L1ETHGateway.initialize( - ethers.constants.AddressZero, - ethers.constants.AddressZero - ) - ).to.be.revertedWith(ERR_ALREADY_INITIALIZED) - }) - }) - - describe('finalizeWithdrawal', () => { - it('onlyFromCrossDomainAccount: should revert on calls from a non-crossDomainMessenger L1 account', async () => { - // Deploy new gateway, initialize with random messenger - await expect( - OVM_L1ETHGateway.connect(alice).finalizeWithdrawal( - constants.AddressZero, - constants.AddressZero, - 1, - NON_NULL_BYTES32 - ) - ).to.be.revertedWith(ERR_INVALID_MESSENGER) - }) - - it('onlyFromCrossDomainAccount: should revert on calls from the right crossDomainMessenger, but wrong xDomainMessageSender (ie. not the L2ETHGateway)', async () => { - await AddressManager.setAddress( - L1_MESSENGER_NAME, - Mock__OVM_L1CrossDomainMessenger.address - ) - - OVM_L1ETHGateway = await ( - await ethers.getContractFactory('OVM_L1ETHGateway') - ).deploy() - await OVM_L1ETHGateway.initialize( - AddressManager.address, - Mock__OVM_L2DepositedERC20.address - ) - - Mock__OVM_L1CrossDomainMessenger.smocked.xDomainMessageSender.will.return.with( - NON_ZERO_ADDRESS - ) - - await expect( - OVM_L1ETHGateway.finalizeWithdrawal( - constants.AddressZero, - constants.AddressZero, - 1, - NON_NULL_BYTES32 - ) - ).to.be.revertedWith(ERR_INVALID_X_DOMAIN_MSG_SENDER) - }) - - it('should credit funds to the withdrawer and not use too much gas', async () => { - // make sure no balance at start of test - await expect( - await ethers.provider.getBalance(NON_ZERO_ADDRESS) - ).to.be.equal(0) - - const withdrawalAmount = 100 - Mock__OVM_L1CrossDomainMessenger.smocked.xDomainMessageSender.will.return.with( - () => Mock__OVM_L2DepositedERC20.address - ) - - // thanks Alice - await OVM_L1ETHGateway.connect(alice).deposit( - FINALIZATION_GAS, - NON_NULL_BYTES32, - { - value: ethers.utils.parseEther('1.0'), - gasPrice: 0, - } - ) - - const res = await OVM_L1ETHGateway.finalizeWithdrawal( - NON_ZERO_ADDRESS, - NON_ZERO_ADDRESS, - withdrawalAmount, - NON_NULL_BYTES32, - { from: Mock__OVM_L1CrossDomainMessenger.address } - ) - - await expect( - await ethers.provider.getBalance(NON_ZERO_ADDRESS) - ).to.be.equal(withdrawalAmount) - - const gasUsed = ( - await OVM_L1ETHGateway.provider.getTransactionReceipt(res.hash) - ).gasUsed - - // Deploy this just for the getter - const OVM_L2DepositedERC20 = await ( - await ethers.getContractFactory('OVM_L2DepositedERC20') - ).deploy(constants.AddressZero, '', '') - }) - - it.skip('finalizeWithdrawalAndCall(): should should credit funds to the withdrawer, and forward from and data', async () => { - // TODO: implement this functionality in a future update - expect.fail() - }) - }) - - describe('deposits', () => { - const depositAmount = 1_000 - - beforeEach(async () => { - // Deploy the L1 ETH token, Alice will receive the full initialSupply - - // get a new mock L1 messenger and set in AM - Mock__OVM_L1CrossDomainMessenger = await smockit( - await ethers.getContractFactory('OVM_L1CrossDomainMessenger') - ) - await AddressManager.setAddress( - L1_MESSENGER_NAME, - Mock__OVM_L1CrossDomainMessenger.address - ) - - // Deploy the contract under test and initialize - OVM_L1ETHGateway = await ( - await ethers.getContractFactory('OVM_L1ETHGateway') - ).deploy() - await OVM_L1ETHGateway.initialize( - AddressManager.address, - Mock__OVM_L2DepositedERC20.address - ) - }) - - it('deposit() escrows the deposit amount and sends the correct deposit message', async () => { - const depositer = await alice.getAddress() - const initialBalance = await ethers.provider.getBalance(depositer) - - // alice calls deposit on the gateway and the L1 gateway calls transferFrom on the token - await OVM_L1ETHGateway.connect(alice).deposit( - FINALIZATION_GAS, - NON_NULL_BYTES32, - { - value: depositAmount, - gasPrice: 0, - } - ) - - const depositCallToMessenger = - Mock__OVM_L1CrossDomainMessenger.smocked.sendMessage.calls[0] - - const depositerBalance = await ethers.provider.getBalance(depositer) - - expect(depositerBalance).to.equal(initialBalance.sub(depositAmount)) - - // gateway's balance is increased - const gatewayBalance = await ethers.provider.getBalance( - OVM_L1ETHGateway.address - ) - expect(gatewayBalance).to.equal(depositAmount) - - // Check the correct cross-chain call was sent: - // Message should be sent to the L2ETHGateway on L2 - expect(depositCallToMessenger._target).to.equal( - Mock__OVM_L2DepositedERC20.address - ) - // Message data should be a call telling the L2ETHGateway to finalize the deposit - - // the L1 gateway sends the correct message to the L1 messenger - expect(depositCallToMessenger._message).to.equal( - await Mock__OVM_L2DepositedERC20.interface.encodeFunctionData( - 'finalizeDeposit', - [depositer, depositer, depositAmount, NON_NULL_BYTES32] - ) - ) - expect(depositCallToMessenger._gasLimit).to.equal(FINALIZATION_GAS) - }) - - it('depositTo() escrows the deposit amount and sends the correct deposit message', async () => { - // depositor calls deposit on the gateway and the L1 gateway calls transferFrom on the token - const bobsAddress = await bob.getAddress() - const aliceAddress = await alice.getAddress() - const initialBalance = await ethers.provider.getBalance(aliceAddress) - - await OVM_L1ETHGateway.connect(alice).depositTo( - bobsAddress, - FINALIZATION_GAS, - NON_NULL_BYTES32, - { - value: depositAmount, - gasPrice: 0, - } - ) - const depositCallToMessenger = - Mock__OVM_L1CrossDomainMessenger.smocked.sendMessage.calls[0] - - const depositerBalance = await ethers.provider.getBalance(aliceAddress) - expect(depositerBalance).to.equal(initialBalance.sub(depositAmount)) - - // gateway's balance is increased - const gatewayBalance = await ethers.provider.getBalance( - OVM_L1ETHGateway.address - ) - expect(gatewayBalance).to.equal(depositAmount) - - // Check the correct cross-chain call was sent: - // Message should be sent to the L2ETHGateway on L2 - expect(depositCallToMessenger._target).to.equal( - Mock__OVM_L2DepositedERC20.address - ) - // Message data should be a call telling the L2ETHGateway to finalize the deposit - - // the L1 gateway sends the correct message to the L1 messenger - expect(depositCallToMessenger._message).to.equal( - await Mock__OVM_L2DepositedERC20.interface.encodeFunctionData( - 'finalizeDeposit', - [aliceAddress, bobsAddress, depositAmount, NON_NULL_BYTES32] - ) - ) - expect(depositCallToMessenger._gasLimit).to.equal(FINALIZATION_GAS) - }) - }) - - describe('migrating ETH', () => { - const migrateAmount = 1_000 - - beforeEach(async () => { - await OVM_L1ETHGateway.donateETH({ value: migrateAmount }) - const gatewayBalance = await ethers.provider.getBalance( - OVM_L1ETHGateway.address - ) - expect(gatewayBalance).to.equal(migrateAmount) - }) - it('should successfully migrate ETH to new gateway', async () => { - const New_OVM_L1ETHGateway = await ( - await ethers.getContractFactory('OVM_L1ETHGateway') - ).deploy() - await New_OVM_L1ETHGateway.initialize( - AddressManager.address, - Mock__OVM_L2DepositedERC20.address - ) - await OVM_L1ETHGateway.migrateEth(New_OVM_L1ETHGateway.address) - const newGatewayBalance = await ethers.provider.getBalance( - New_OVM_L1ETHGateway.address - ) - expect(newGatewayBalance).to.equal(migrateAmount) - }) - it('should not allow migrating ETH from non-owner', async () => { - const New_OVM_L1ETHGateway = await ( - await ethers.getContractFactory('OVM_L1ETHGateway') - ).deploy() - await New_OVM_L1ETHGateway.initialize( - AddressManager.address, - Mock__OVM_L2DepositedERC20.address - ) - await expect( - OVM_L1ETHGateway.connect(bob).migrateEth(New_OVM_L1ETHGateway.address) - ).to.be.revertedWith('Only the owner can migrate ETH') - }) - }) -}) diff --git a/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L1StandardBridge.spec.ts b/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L1StandardBridge.spec.ts new file mode 100644 index 000000000000..5170186ac00e --- /dev/null +++ b/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L1StandardBridge.spec.ts @@ -0,0 +1,540 @@ +import { expect } from '../../../../setup' + +/* External Imports */ +import { ethers } from 'hardhat' +import { Signer, ContractFactory, Contract, constants } from 'ethers' +import { Interface } from 'ethers/lib/utils' +import { smockit, MockContract, smoddit } from '@eth-optimism/smock' + +/* Internal Imports */ +import { NON_NULL_BYTES32, NON_ZERO_ADDRESS } from '../../../../helpers' +import { getContractInterface, predeploys } from '../../../../../src' + +const ERR_INVALID_MESSENGER = 'OVM_XCHAIN: messenger contract unauthenticated' +const ERR_INVALID_X_DOMAIN_MSG_SENDER = + 'OVM_XCHAIN: wrong sender of cross-domain message' +const ERR_ALREADY_INITIALIZED = 'Contract has already been initialized.' +const DUMMY_L2_ERC20_ADDRESS = ethers.utils.getAddress('0x' + 'abba'.repeat(10)) +const DUMMY_L2_BRIDGE_ADDRESS = ethers.utils.getAddress( + '0x' + 'acdc'.repeat(10) +) + +const INITIAL_TOTAL_L1_SUPPLY = 5000 +const FINALIZATION_GAS = 1_200_000 + +describe('OVM_L1StandardBridge', () => { + // init signers + let l1MessengerImpersonator: Signer + let alice: Signer + let bob: Signer + let bobsAddress + let aliceAddress + + // we can just make up this string since it's on the "other" Layer + let Mock__OVM_ETH: MockContract + let Factory__L1ERC20: ContractFactory + let IL2ERC20Bridge: Interface + before(async () => { + ;[l1MessengerImpersonator, alice, bob] = await ethers.getSigners() + + Mock__OVM_ETH = await smockit(await ethers.getContractFactory('OVM_ETH')) + + // deploy an ERC20 contract on L1 + Factory__L1ERC20 = await smoddit( + '@openzeppelin/contracts/token/ERC20/ERC20.sol:ERC20' + ) + + // get an L2ER20Bridge Interface + IL2ERC20Bridge = getContractInterface('iOVM_L2ERC20Bridge') + + aliceAddress = await alice.getAddress() + bobsAddress = await bob.getAddress() + }) + + let L1ERC20: Contract + let OVM_L1StandardBridge: Contract + let Mock__OVM_L1CrossDomainMessenger: MockContract + beforeEach(async () => { + // Get a new mock L1 messenger + Mock__OVM_L1CrossDomainMessenger = await smockit( + await ethers.getContractFactory('OVM_L1CrossDomainMessenger'), + { address: await l1MessengerImpersonator.getAddress() } // This allows us to use an ethers override {from: Mock__OVM_L2CrossDomainMessenger.address} to mock calls + ) + + // Deploy the contract under test + OVM_L1StandardBridge = await ( + await ethers.getContractFactory('OVM_L1StandardBridge') + ).deploy() + await OVM_L1StandardBridge.initialize( + Mock__OVM_L1CrossDomainMessenger.address, + DUMMY_L2_BRIDGE_ADDRESS + ) + + L1ERC20 = await Factory__L1ERC20.deploy('L1ERC20', 'ERC') + await L1ERC20.smodify.put({ + _totalSupply: INITIAL_TOTAL_L1_SUPPLY, + _balances: { + [aliceAddress]: INITIAL_TOTAL_L1_SUPPLY, + }, + }) + }) + + describe('initialize', () => { + it('Should only be callable once', async () => { + await expect( + OVM_L1StandardBridge.initialize( + ethers.constants.AddressZero, + DUMMY_L2_BRIDGE_ADDRESS + ) + ).to.be.revertedWith(ERR_ALREADY_INITIALIZED) + }) + }) + + describe('ETH deposits', () => { + const depositAmount = 1_000 + + it('depositETH() escrows the deposit amount and sends the correct deposit message', async () => { + const depositer = await alice.getAddress() + const initialBalance = await ethers.provider.getBalance(depositer) + + // alice calls deposit on the bridge and the L1 bridge calls transferFrom on the token + await OVM_L1StandardBridge.connect(alice).depositETH( + FINALIZATION_GAS, + NON_NULL_BYTES32, + { + value: depositAmount, + gasPrice: 0, + } + ) + + const depositCallToMessenger = + Mock__OVM_L1CrossDomainMessenger.smocked.sendMessage.calls[0] + + const depositerBalance = await ethers.provider.getBalance(depositer) + + expect(depositerBalance).to.equal(initialBalance.sub(depositAmount)) + + // bridge's balance is increased + const bridgeBalance = await ethers.provider.getBalance( + OVM_L1StandardBridge.address + ) + expect(bridgeBalance).to.equal(depositAmount) + + // Check the correct cross-chain call was sent: + // Message should be sent to the L2 bridge + expect(depositCallToMessenger._target).to.equal(DUMMY_L2_BRIDGE_ADDRESS) + // Message data should be a call telling the L2ETHToken to finalize the deposit + + // the L1 bridge sends the correct message to the L1 messenger + expect(depositCallToMessenger._message).to.equal( + IL2ERC20Bridge.encodeFunctionData('finalizeDeposit', [ + constants.AddressZero, + predeploys.OVM_ETH, + depositer, + depositer, + depositAmount, + NON_NULL_BYTES32, + ]) + ) + expect(depositCallToMessenger._gasLimit).to.equal(FINALIZATION_GAS) + }) + + it('depositETHTo() escrows the deposit amount and sends the correct deposit message', async () => { + // depositor calls deposit on the bridge and the L1 bridge calls transferFrom on the token + const initialBalance = await ethers.provider.getBalance(aliceAddress) + + await OVM_L1StandardBridge.connect(alice).depositETHTo( + bobsAddress, + FINALIZATION_GAS, + NON_NULL_BYTES32, + { + value: depositAmount, + gasPrice: 0, + } + ) + const depositCallToMessenger = + Mock__OVM_L1CrossDomainMessenger.smocked.sendMessage.calls[0] + + const depositerBalance = await ethers.provider.getBalance(aliceAddress) + expect(depositerBalance).to.equal(initialBalance.sub(depositAmount)) + + // bridge's balance is increased + const bridgeBalance = await ethers.provider.getBalance( + OVM_L1StandardBridge.address + ) + expect(bridgeBalance).to.equal(depositAmount) + + // Check the correct cross-chain call was sent: + // Message should be sent to the L2 bridge + expect(depositCallToMessenger._target).to.equal(DUMMY_L2_BRIDGE_ADDRESS) + // Message data should be a call telling the L2ETHToken to finalize the deposit + + // the L1 bridge sends the correct message to the L1 messenger + expect(depositCallToMessenger._message).to.equal( + IL2ERC20Bridge.encodeFunctionData('finalizeDeposit', [ + constants.AddressZero, + predeploys.OVM_ETH, + aliceAddress, + bobsAddress, + depositAmount, + NON_NULL_BYTES32, + ]) + ) + expect(depositCallToMessenger._gasLimit).to.equal(FINALIZATION_GAS) + }) + + it('cannot depositETH from a contract account', async () => { + expect( + OVM_L1StandardBridge.depositETH(FINALIZATION_GAS, NON_NULL_BYTES32, { + value: depositAmount, + gasPrice: 0, + }) + ).to.be.revertedWith('Account not EOA') + }) + }) + + describe('ETH withdrawals', () => { + it('onlyFromCrossDomainAccount: should revert on calls from a non-crossDomainMessenger L1 account', async () => { + // Deploy new bridge, initialize with random messenger + await expect( + OVM_L1StandardBridge.connect(alice).finalizeETHWithdrawal( + constants.AddressZero, + constants.AddressZero, + 1, + NON_NULL_BYTES32, + { + from: aliceAddress, + } + ) + ).to.be.revertedWith(ERR_INVALID_MESSENGER) + }) + + it('onlyFromCrossDomainAccount: should revert on calls from the right crossDomainMessenger, but wrong xDomainMessageSender (ie. not the L2ETHToken)', async () => { + OVM_L1StandardBridge = await ( + await ethers.getContractFactory('OVM_L1StandardBridge') + ).deploy() + await OVM_L1StandardBridge.initialize( + Mock__OVM_L1CrossDomainMessenger.address, + DUMMY_L2_BRIDGE_ADDRESS + ) + + Mock__OVM_L1CrossDomainMessenger.smocked.xDomainMessageSender.will.return.with( + '0x' + '22'.repeat(20) + ) + + await expect( + OVM_L1StandardBridge.finalizeETHWithdrawal( + constants.AddressZero, + constants.AddressZero, + 1, + NON_NULL_BYTES32, + { + from: Mock__OVM_L1CrossDomainMessenger.address, + } + ) + ).to.be.revertedWith(ERR_INVALID_X_DOMAIN_MSG_SENDER) + }) + + it('should credit funds to the withdrawer and not use too much gas', async () => { + // make sure no balance at start of test + expect(await ethers.provider.getBalance(NON_ZERO_ADDRESS)).to.be.equal(0) + + const withdrawalAmount = 100 + Mock__OVM_L1CrossDomainMessenger.smocked.xDomainMessageSender.will.return.with( + () => DUMMY_L2_BRIDGE_ADDRESS + ) + + // thanks Alice + await OVM_L1StandardBridge.connect(alice).depositETH( + FINALIZATION_GAS, + NON_NULL_BYTES32, + { + value: ethers.utils.parseEther('1.0'), + gasPrice: 0, + } + ) + + await OVM_L1StandardBridge.finalizeETHWithdrawal( + NON_ZERO_ADDRESS, + NON_ZERO_ADDRESS, + withdrawalAmount, + NON_NULL_BYTES32, + { + from: Mock__OVM_L1CrossDomainMessenger.address, + } + ) + + expect(await ethers.provider.getBalance(NON_ZERO_ADDRESS)).to.be.equal( + withdrawalAmount + ) + }) + }) + + describe('ERC20 deposits', () => { + const depositAmount = 1_000 + + beforeEach(async () => { + await L1ERC20.connect(alice).approve( + OVM_L1StandardBridge.address, + depositAmount + ) + }) + + it('depositERC20() escrows the deposit amount and sends the correct deposit message', async () => { + // alice calls deposit on the bridge and the L1 bridge calls transferFrom on the token + await OVM_L1StandardBridge.connect(alice).depositERC20( + L1ERC20.address, + DUMMY_L2_ERC20_ADDRESS, + depositAmount, + FINALIZATION_GAS, + NON_NULL_BYTES32 + ) + + const depositCallToMessenger = + Mock__OVM_L1CrossDomainMessenger.smocked.sendMessage.calls[0] + + const depositerBalance = await L1ERC20.balanceOf(aliceAddress) + + expect(depositerBalance).to.equal(INITIAL_TOTAL_L1_SUPPLY - depositAmount) + + // bridge's balance is increased + const bridgeBalance = await L1ERC20.balanceOf( + OVM_L1StandardBridge.address + ) + expect(bridgeBalance).to.equal(depositAmount) + + // Check the correct cross-chain call was sent: + // Message should be sent to the L2 bridge + expect(depositCallToMessenger._target).to.equal(DUMMY_L2_BRIDGE_ADDRESS) + // Message data should be a call telling the L2DepositedERC20 to finalize the deposit + + // the L1 bridge sends the correct message to the L1 messenger + expect(depositCallToMessenger._message).to.equal( + IL2ERC20Bridge.encodeFunctionData('finalizeDeposit', [ + L1ERC20.address, + DUMMY_L2_ERC20_ADDRESS, + aliceAddress, + aliceAddress, + depositAmount, + NON_NULL_BYTES32, + ]) + ) + expect(depositCallToMessenger._gasLimit).to.equal(FINALIZATION_GAS) + }) + + it('depositERC20To() escrows the deposit amount and sends the correct deposit message', async () => { + // depositor calls deposit on the bridge and the L1 bridge calls transferFrom on the token + await OVM_L1StandardBridge.connect(alice).depositERC20To( + L1ERC20.address, + DUMMY_L2_ERC20_ADDRESS, + bobsAddress, + depositAmount, + FINALIZATION_GAS, + NON_NULL_BYTES32 + ) + const depositCallToMessenger = + Mock__OVM_L1CrossDomainMessenger.smocked.sendMessage.calls[0] + + const depositerBalance = await L1ERC20.balanceOf(aliceAddress) + expect(depositerBalance).to.equal(INITIAL_TOTAL_L1_SUPPLY - depositAmount) + + // bridge's balance is increased + const bridgeBalance = await L1ERC20.balanceOf( + OVM_L1StandardBridge.address + ) + expect(bridgeBalance).to.equal(depositAmount) + + // Check the correct cross-chain call was sent: + // Message should be sent to the L2DepositedERC20 on L2 + expect(depositCallToMessenger._target).to.equal(DUMMY_L2_BRIDGE_ADDRESS) + // Message data should be a call telling the L2DepositedERC20 to finalize the deposit + + // the L1 bridge sends the correct message to the L1 messenger + expect(depositCallToMessenger._message).to.equal( + IL2ERC20Bridge.encodeFunctionData('finalizeDeposit', [ + L1ERC20.address, + DUMMY_L2_ERC20_ADDRESS, + aliceAddress, + bobsAddress, + depositAmount, + NON_NULL_BYTES32, + ]) + ) + expect(depositCallToMessenger._gasLimit).to.equal(FINALIZATION_GAS) + }) + + it('cannot depositERC20 from a contract account', async () => { + expect( + OVM_L1StandardBridge.depositERC20( + L1ERC20.address, + DUMMY_L2_ERC20_ADDRESS, + depositAmount, + FINALIZATION_GAS, + NON_NULL_BYTES32 + ) + ).to.be.revertedWith('Account not EOA') + }) + + describe('Handling ERC20.transferFrom() failures that revert ', () => { + let MOCK__L1ERC20: MockContract + + before(async () => { + // Deploy the L1 ERC20 token, Alice will receive the full initialSupply + MOCK__L1ERC20 = await smockit( + await Factory__L1ERC20.deploy('L1ERC20', 'ERC') + ) + MOCK__L1ERC20.smocked.transferFrom.will.revert() + }) + + it('depositERC20(): will revert if ERC20.transferFrom() reverts', async () => { + await expect( + OVM_L1StandardBridge.connect(alice).depositERC20( + MOCK__L1ERC20.address, + DUMMY_L2_ERC20_ADDRESS, + depositAmount, + FINALIZATION_GAS, + NON_NULL_BYTES32 + ) + ).to.be.revertedWith('SafeERC20: low-level call failed') + }) + + it('depositERC20To(): will revert if ERC20.transferFrom() reverts', async () => { + await expect( + OVM_L1StandardBridge.connect(alice).depositERC20To( + MOCK__L1ERC20.address, + DUMMY_L2_ERC20_ADDRESS, + bobsAddress, + depositAmount, + FINALIZATION_GAS, + NON_NULL_BYTES32 + ) + ).to.be.revertedWith('SafeERC20: low-level call failed') + }) + + it('depositERC20To(): will revert if the L1 ERC20 has no code or is zero address', async () => { + await expect( + OVM_L1StandardBridge.connect(alice).depositERC20To( + ethers.constants.AddressZero, + DUMMY_L2_ERC20_ADDRESS, + bobsAddress, + depositAmount, + FINALIZATION_GAS, + NON_NULL_BYTES32 + ) + ).to.be.revertedWith('Address: call to non-contract') + }) + }) + + describe('Handling ERC20.transferFrom failures that return false', () => { + let MOCK__L1ERC20: MockContract + before(async () => { + MOCK__L1ERC20 = await smockit( + await Factory__L1ERC20.deploy('L1ERC20', 'ERC') + ) + MOCK__L1ERC20.smocked.transferFrom.will.return.with(false) + }) + + it('deposit(): will revert if ERC20.transferFrom() returns false', async () => { + await expect( + OVM_L1StandardBridge.connect(alice).depositERC20( + MOCK__L1ERC20.address, + DUMMY_L2_ERC20_ADDRESS, + depositAmount, + FINALIZATION_GAS, + NON_NULL_BYTES32 + ) + ).to.be.revertedWith('SafeERC20: ERC20 operation did not succeed') + }) + + it('depositTo(): will revert if ERC20.transferFrom() returns false', async () => { + await expect( + OVM_L1StandardBridge.depositERC20To( + MOCK__L1ERC20.address, + DUMMY_L2_ERC20_ADDRESS, + bobsAddress, + depositAmount, + FINALIZATION_GAS, + NON_NULL_BYTES32 + ) + ).to.be.revertedWith('SafeERC20: ERC20 operation did not succeed') + }) + }) + }) + + describe('ERC20 withdrawals', () => { + it('onlyFromCrossDomainAccount: should revert on calls from a non-crossDomainMessenger L1 account', async () => { + await expect( + OVM_L1StandardBridge.connect(alice).finalizeERC20Withdrawal( + L1ERC20.address, + DUMMY_L2_ERC20_ADDRESS, + constants.AddressZero, + constants.AddressZero, + 1, + NON_NULL_BYTES32 + ) + ).to.be.revertedWith(ERR_INVALID_MESSENGER) + }) + + it('onlyFromCrossDomainAccount: should revert on calls from the right crossDomainMessenger, but wrong xDomainMessageSender (ie. not the L2DepositedERC20)', async () => { + Mock__OVM_L1CrossDomainMessenger.smocked.xDomainMessageSender.will.return.with( + '0x' + '22'.repeat(20) + ) + + await expect( + OVM_L1StandardBridge.finalizeERC20Withdrawal( + L1ERC20.address, + DUMMY_L2_ERC20_ADDRESS, + constants.AddressZero, + constants.AddressZero, + 1, + NON_NULL_BYTES32, + { + from: Mock__OVM_L1CrossDomainMessenger.address, + } + ) + ).to.be.revertedWith(ERR_INVALID_X_DOMAIN_MSG_SENDER) + }) + + it('should credit funds to the withdrawer and not use too much gas', async () => { + // First Alice will 'donate' some tokens so that there's a balance to be withdrawn + const withdrawalAmount = 10 + await L1ERC20.connect(alice).approve( + OVM_L1StandardBridge.address, + withdrawalAmount + ) + + await OVM_L1StandardBridge.connect(alice).depositERC20( + L1ERC20.address, + DUMMY_L2_ERC20_ADDRESS, + withdrawalAmount, + FINALIZATION_GAS, + NON_NULL_BYTES32 + ) + + expect(await L1ERC20.balanceOf(OVM_L1StandardBridge.address)).to.be.equal( + withdrawalAmount + ) + + // make sure no balance at start of test + expect(await L1ERC20.balanceOf(NON_ZERO_ADDRESS)).to.be.equal(0) + + Mock__OVM_L1CrossDomainMessenger.smocked.xDomainMessageSender.will.return.with( + () => DUMMY_L2_BRIDGE_ADDRESS + ) + + await OVM_L1StandardBridge.finalizeERC20Withdrawal( + L1ERC20.address, + DUMMY_L2_ERC20_ADDRESS, + NON_ZERO_ADDRESS, + NON_ZERO_ADDRESS, + withdrawalAmount, + NON_NULL_BYTES32, + { from: Mock__OVM_L1CrossDomainMessenger.address } + ) + + expect(await L1ERC20.balanceOf(NON_ZERO_ADDRESS)).to.be.equal( + withdrawalAmount + ) + }) + }) +}) diff --git a/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L2DepositedERC20.spec.ts b/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L2DepositedERC20.spec.ts deleted file mode 100644 index e404a951a2bb..000000000000 --- a/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L2DepositedERC20.spec.ts +++ /dev/null @@ -1,260 +0,0 @@ -import { expect } from '../../../../setup' - -/* External Imports */ -import { ethers } from 'hardhat' -import { Signer, ContractFactory, Contract, constants } from 'ethers' -import { - smockit, - MockContract, - smoddit, - ModifiableContract, -} from '@eth-optimism/smock' - -/* Internal Imports */ -import { NON_NULL_BYTES32, NON_ZERO_ADDRESS } from '../../../../helpers' - -const FINALIZATION_GAS = 1_200_000 - -const ERR_INVALID_MESSENGER = 'OVM_XCHAIN: messenger contract unauthenticated' -const ERR_INVALID_X_DOMAIN_MSG_SENDER = - 'OVM_XCHAIN: wrong sender of cross-domain message' -const MOCK_L1GATEWAY_ADDRESS: string = - '0x1234123412341234123412341234123412341234' - -describe('OVM_L2DepositedERC20', () => { - let alice: Signer - let bob: Signer - let Factory__OVM_L1ERC20Gateway: ContractFactory - before(async () => { - ;[alice, bob] = await ethers.getSigners() - Factory__OVM_L1ERC20Gateway = await ethers.getContractFactory( - 'OVM_L1ERC20Gateway' - ) - }) - - let OVM_L2DepositedERC20: Contract - let Mock__OVM_L2CrossDomainMessenger: MockContract - beforeEach(async () => { - // Create a special signer which will enable us to send messages from the L2Messenger contract - let l2MessengerImpersonator: Signer - ;[l2MessengerImpersonator] = await ethers.getSigners() - - // Get a new mock L2 messenger - Mock__OVM_L2CrossDomainMessenger = await smockit( - await ethers.getContractFactory('OVM_L2CrossDomainMessenger'), - // This allows us to use an ethers override {from: Mock__OVM_L2CrossDomainMessenger.address} to mock calls - { address: await l2MessengerImpersonator.getAddress() } - ) - - // Deploy the contract under test - OVM_L2DepositedERC20 = await ( - await ethers.getContractFactory('OVM_L2DepositedERC20') - ).deploy(Mock__OVM_L2CrossDomainMessenger.address, 'ovmWETH', 'oWETH') - - // initialize the L2 Gateway with the L1G ateway addrss - await OVM_L2DepositedERC20.init(MOCK_L1GATEWAY_ADDRESS) - }) - - // test the transfer flow of moving a token from L2 to L1 - describe('finalizeDeposit', () => { - it('onlyFromCrossDomainAccount: should revert on calls from a non-crossDomainMessenger L2 account', async () => { - // Deploy new gateway, initialize with random messenger - OVM_L2DepositedERC20 = await ( - await ethers.getContractFactory('OVM_L2DepositedERC20') - ).deploy(NON_ZERO_ADDRESS, 'ovmWETH', 'oWETH') - await OVM_L2DepositedERC20.init(NON_ZERO_ADDRESS) - - await expect( - OVM_L2DepositedERC20.finalizeDeposit( - constants.AddressZero, - constants.AddressZero, - 0, - NON_NULL_BYTES32 - ) - ).to.be.revertedWith(ERR_INVALID_MESSENGER) - }) - - it('onlyFromCrossDomainAccount: should revert on calls from the right crossDomainMessenger, but wrong xDomainMessageSender (ie. not the L1ERC20Gateway)', async () => { - Mock__OVM_L2CrossDomainMessenger.smocked.xDomainMessageSender.will.return.with( - NON_ZERO_ADDRESS - ) - - await expect( - OVM_L2DepositedERC20.finalizeDeposit( - constants.AddressZero, - constants.AddressZero, - 0, - NON_NULL_BYTES32, - { - from: Mock__OVM_L2CrossDomainMessenger.address, - } - ) - ).to.be.revertedWith(ERR_INVALID_X_DOMAIN_MSG_SENDER) - }) - - it('should credit funds to the depositor', async () => { - const depositAmount = 100 - Mock__OVM_L2CrossDomainMessenger.smocked.xDomainMessageSender.will.return.with( - () => MOCK_L1GATEWAY_ADDRESS - ) - - await OVM_L2DepositedERC20.finalizeDeposit( - NON_ZERO_ADDRESS, - await alice.getAddress(), - depositAmount, - NON_NULL_BYTES32, - { from: Mock__OVM_L2CrossDomainMessenger.address } - ) - - const aliceBalance = await OVM_L2DepositedERC20.balanceOf( - await alice.getAddress() - ) - aliceBalance.should.equal(depositAmount) - }) - }) - - describe('withdrawals', () => { - const INITIAL_TOTAL_SUPPLY = 100_000 - const ALICE_INITIAL_BALANCE = 50_000 - const withdrawAmount = 1_000 - let SmoddedL2Gateway: ModifiableContract - beforeEach(async () => { - // Deploy a smodded gateway so we can give some balances to withdraw - SmoddedL2Gateway = await ( - await smoddit('OVM_L2DepositedERC20', alice) - ).deploy(Mock__OVM_L2CrossDomainMessenger.address, 'ovmWETH', 'oWETH') - await SmoddedL2Gateway.init(MOCK_L1GATEWAY_ADDRESS) - - // Populate the initial state with a total supply and some money in alice's balance - const aliceAddress = await alice.getAddress() - SmoddedL2Gateway.smodify.put({ - totalSupply: INITIAL_TOTAL_SUPPLY, - balanceOf: { - [aliceAddress]: ALICE_INITIAL_BALANCE, - }, - }) - }) - - it('withdraw() burns and sends the correct withdrawal message', async () => { - await SmoddedL2Gateway.withdraw( - withdrawAmount, - FINALIZATION_GAS, - NON_NULL_BYTES32 - ) - const withdrawalCallToMessenger = - Mock__OVM_L2CrossDomainMessenger.smocked.sendMessage.calls[0] - - // Assert Alice's balance went down - const aliceBalance = await SmoddedL2Gateway.balanceOf( - await alice.getAddress() - ) - expect(aliceBalance).to.deep.equal( - ethers.BigNumber.from(ALICE_INITIAL_BALANCE - withdrawAmount) - ) - - // Assert totalSupply went down - const newTotalSupply = await SmoddedL2Gateway.totalSupply() - expect(newTotalSupply).to.deep.equal( - ethers.BigNumber.from(INITIAL_TOTAL_SUPPLY - withdrawAmount) - ) - - // Assert the correct cross-chain call was sent: - // Message should be sent to the L1ERC20Gateway on L1 - expect(withdrawalCallToMessenger._target).to.equal(MOCK_L1GATEWAY_ADDRESS) - // Message data should be a call telling the L1ERC20Gateway to finalize the withdrawal - expect(withdrawalCallToMessenger._message).to.equal( - await Factory__OVM_L1ERC20Gateway.interface.encodeFunctionData( - 'finalizeWithdrawal', - [ - await alice.getAddress(), - await alice.getAddress(), - withdrawAmount, - NON_NULL_BYTES32, - ] - ) - ) - // gaslimit should be correct - expect(withdrawalCallToMessenger._gasLimit).to.equal(0) - }) - - it('withdraw() uses the user provided gas limit if it is larger than the default value ', async () => { - await SmoddedL2Gateway.withdraw( - withdrawAmount, - FINALIZATION_GAS, - NON_NULL_BYTES32 - ) - const withdrawalCallToMessenger = - Mock__OVM_L2CrossDomainMessenger.smocked.sendMessage.calls[0] - // gas value is ignored and set to 0. - expect(withdrawalCallToMessenger._gasLimit).to.equal(0) - }) - - it('withdrawTo() burns and sends the correct withdrawal message', async () => { - await SmoddedL2Gateway.withdrawTo( - await bob.getAddress(), - withdrawAmount, - FINALIZATION_GAS, - NON_NULL_BYTES32 - ) - const withdrawalCallToMessenger = - Mock__OVM_L2CrossDomainMessenger.smocked.sendMessage.calls[0] - - // Assert Alice's balance went down - const aliceBalance = await SmoddedL2Gateway.balanceOf( - await alice.getAddress() - ) - expect(aliceBalance).to.deep.equal( - ethers.BigNumber.from(ALICE_INITIAL_BALANCE - withdrawAmount) - ) - - // Assert totalSupply went down - const newTotalSupply = await SmoddedL2Gateway.totalSupply() - expect(newTotalSupply).to.deep.equal( - ethers.BigNumber.from(INITIAL_TOTAL_SUPPLY - withdrawAmount) - ) - - // Assert the correct cross-chain call was sent. - // Message should be sent to the L1ERC20Gateway on L1 - expect(withdrawalCallToMessenger._target).to.equal(MOCK_L1GATEWAY_ADDRESS) - // The message data should be a call telling the L1ERC20Gateway to finalize the withdrawal - expect(withdrawalCallToMessenger._message).to.equal( - await Factory__OVM_L1ERC20Gateway.interface.encodeFunctionData( - 'finalizeWithdrawal', - [ - await alice.getAddress(), - await bob.getAddress(), - withdrawAmount, - NON_NULL_BYTES32, - ] - ) - ) - // gas value is ignored and set to 0. - expect(withdrawalCallToMessenger._gasLimit).to.equal(0) - }) - - it('withdrawTo() uses the user provided gas limit if it is larger than the default value ', async () => { - await SmoddedL2Gateway.withdrawTo( - await bob.getAddress(), - withdrawAmount, - FINALIZATION_GAS, - NON_NULL_BYTES32 - ) - const withdrawalCallToMessenger = - Mock__OVM_L2CrossDomainMessenger.smocked.sendMessage.calls[0] - - // gas value is ignored and set to 0. - expect(withdrawalCallToMessenger._gasLimit).to.equal(0) - }) - }) - - // low priority todos: see question in contract - describe.skip('Initialization logic', () => { - it('should not allow calls to onlyInitialized functions', async () => { - // TODO - }) - - it('should only allow initialization once and emits initialized event', async () => { - // TODO - }) - }) -}) diff --git a/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L2StandardBridge.spec.ts b/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L2StandardBridge.spec.ts new file mode 100644 index 000000000000..4b1000b53f5a --- /dev/null +++ b/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L2StandardBridge.spec.ts @@ -0,0 +1,332 @@ +import { expect } from '../../../../setup' + +/* External Imports */ +import { ethers } from 'hardhat' +import { Signer, ContractFactory, Contract } from 'ethers' +import { Interface } from 'ethers/lib/utils' +import { + smockit, + MockContract, + smoddit, + ModifiableContract, +} from '@eth-optimism/smock' + +/* Internal Imports */ +import { NON_NULL_BYTES32, NON_ZERO_ADDRESS } from '../../../../helpers' + +import { getContractInterface } from '../../../../../src' + +const ERR_INVALID_MESSENGER = 'OVM_XCHAIN: messenger contract unauthenticated' +const ERR_INVALID_X_DOMAIN_MSG_SENDER = + 'OVM_XCHAIN: wrong sender of cross-domain message' +const DUMMY_L1BRIDGE_ADDRESS: string = + '0x1234123412341234123412341234123412341234' +const DUMMY_L1TOKEN_ADDRESS: string = + '0x2234223412342234223422342234223422342234' + +describe('OVM_L2StandardBridge', () => { + let alice: Signer + let aliceAddress: string + let bob: Signer + let bobsAddress: string + let l2MessengerImpersonator: Signer + let Factory__OVM_L1StandardBridge: ContractFactory + let IL2ERC20Bridge: Interface + const INITIAL_TOTAL_SUPPLY = 100_000 + const ALICE_INITIAL_BALANCE = 50_000 + before(async () => { + // Create a special signer which will enable us to send messages from the L2Messenger contract + ;[alice, bob, l2MessengerImpersonator] = await ethers.getSigners() + aliceAddress = await alice.getAddress() + bobsAddress = await bob.getAddress() + Factory__OVM_L1StandardBridge = await ethers.getContractFactory( + 'OVM_L1StandardBridge' + ) + + // get an L2ER20Bridge Interface + IL2ERC20Bridge = getContractInterface('iOVM_L2ERC20Bridge') + }) + + let OVM_L2StandardBridge: Contract + let L2ERC20: Contract + let Mock__OVM_L2CrossDomainMessenger: MockContract + beforeEach(async () => { + // Get a new mock L2 messenger + Mock__OVM_L2CrossDomainMessenger = await smockit( + await ethers.getContractFactory('OVM_L2CrossDomainMessenger'), + // This allows us to use an ethers override {from: Mock__OVM_L2CrossDomainMessenger.address} to mock calls + { address: await l2MessengerImpersonator.getAddress() } + ) + + // Deploy the contract under test + OVM_L2StandardBridge = await ( + await ethers.getContractFactory('OVM_L2StandardBridge') + ).deploy(Mock__OVM_L2CrossDomainMessenger.address, DUMMY_L1BRIDGE_ADDRESS) + + // Deploy an L2 ERC20 + L2ERC20 = await ( + await ethers.getContractFactory('L2StandardERC20', alice) + ).deploy( + OVM_L2StandardBridge.address, + DUMMY_L1TOKEN_ADDRESS, + 'L2Token', + 'L2T' + ) + }) + + // test the transfer flow of moving a token from L2 to L1 + describe('finalizeDeposit', () => { + it('onlyFromCrossDomainAccount: should revert on calls from a non-crossDomainMessenger L2 account', async () => { + await expect( + OVM_L2StandardBridge.finalizeDeposit( + DUMMY_L1TOKEN_ADDRESS, + NON_ZERO_ADDRESS, + NON_ZERO_ADDRESS, + NON_ZERO_ADDRESS, + 0, + NON_NULL_BYTES32 + ) + ).to.be.revertedWith(ERR_INVALID_MESSENGER) + }) + + it('onlyFromCrossDomainAccount: should revert on calls from the right crossDomainMessenger, but wrong xDomainMessageSender (ie. not the L1L1StandardBridge)', async () => { + Mock__OVM_L2CrossDomainMessenger.smocked.xDomainMessageSender.will.return.with( + NON_ZERO_ADDRESS + ) + + await expect( + OVM_L2StandardBridge.connect(l2MessengerImpersonator).finalizeDeposit( + DUMMY_L1TOKEN_ADDRESS, + NON_ZERO_ADDRESS, + NON_ZERO_ADDRESS, + NON_ZERO_ADDRESS, + 0, + NON_NULL_BYTES32, + { + from: Mock__OVM_L2CrossDomainMessenger.address, + } + ) + ).to.be.revertedWith(ERR_INVALID_X_DOMAIN_MSG_SENDER) + }) + + it('should initialize a withdrawal if the L2 token is not compliant', async () => { + // Deploy a non compliant ERC20 + const NonCompliantERC20 = await ( + await ethers.getContractFactory( + '@openzeppelin/contracts/token/ERC20/ERC20.sol:ERC20' + ) + ).deploy('L2Token', 'L2T') + + OVM_L2StandardBridge.connect(l2MessengerImpersonator).finalizeDeposit( + DUMMY_L1TOKEN_ADDRESS, + NON_ZERO_ADDRESS, + NON_ZERO_ADDRESS, + NON_ZERO_ADDRESS, + 0, + NON_NULL_BYTES32, + { + from: Mock__OVM_L2CrossDomainMessenger.address, + } + ) + + Mock__OVM_L2CrossDomainMessenger.smocked.xDomainMessageSender.will.return.with( + () => DUMMY_L1BRIDGE_ADDRESS + ) + + await OVM_L2StandardBridge.connect( + l2MessengerImpersonator + ).finalizeDeposit( + DUMMY_L1TOKEN_ADDRESS, + NonCompliantERC20.address, + aliceAddress, + bobsAddress, + 100, + NON_NULL_BYTES32, + { + from: Mock__OVM_L2CrossDomainMessenger.address, + } + ) + + const withdrawalCallToMessenger = + Mock__OVM_L2CrossDomainMessenger.smocked.sendMessage.calls[0] + + expect(withdrawalCallToMessenger._target).to.equal(DUMMY_L1BRIDGE_ADDRESS) + expect(withdrawalCallToMessenger._message).to.equal( + Factory__OVM_L1StandardBridge.interface.encodeFunctionData( + 'finalizeERC20Withdrawal', + [ + DUMMY_L1TOKEN_ADDRESS, + NonCompliantERC20.address, + bobsAddress, + aliceAddress, + 100, + NON_NULL_BYTES32, + ] + ) + ) + }) + + it('should credit funds to the depositor', async () => { + const depositAmount = 100 + + Mock__OVM_L2CrossDomainMessenger.smocked.xDomainMessageSender.will.return.with( + () => DUMMY_L1BRIDGE_ADDRESS + ) + + await OVM_L2StandardBridge.connect( + l2MessengerImpersonator + ).finalizeDeposit( + DUMMY_L1TOKEN_ADDRESS, + L2ERC20.address, + aliceAddress, + bobsAddress, + depositAmount, + NON_NULL_BYTES32, + { + from: Mock__OVM_L2CrossDomainMessenger.address, + } + ) + + const bobsBalance = await L2ERC20.balanceOf(bobsAddress) + bobsBalance.should.equal(depositAmount) + }) + }) + + describe('withdrawals', () => { + const withdrawAmount = 1_000 + let SmoddedL2Token: ModifiableContract + beforeEach(async () => { + // Deploy a smodded gateway so we can give some balances to withdraw + SmoddedL2Token = await (await smoddit('L2StandardERC20', alice)).deploy( + OVM_L2StandardBridge.address, + DUMMY_L1TOKEN_ADDRESS, + 'L2Token', + 'L2T' + ) + + // Populate the initial state with a total supply and some money in alice's balance + SmoddedL2Token.smodify.put({ + _totalSupply: INITIAL_TOTAL_SUPPLY, + _balances: { + [aliceAddress]: ALICE_INITIAL_BALANCE, + }, + l2Bridge: OVM_L2StandardBridge.address, + }) + }) + + it('withdraw() burns and sends the correct withdrawal message', async () => { + await OVM_L2StandardBridge.withdraw( + SmoddedL2Token.address, + withdrawAmount, + 0, + NON_NULL_BYTES32 + ) + const withdrawalCallToMessenger = + Mock__OVM_L2CrossDomainMessenger.smocked.sendMessage.calls[0] + + // Assert Alice's balance went down + const aliceBalance = await SmoddedL2Token.balanceOf( + await alice.getAddress() + ) + expect(aliceBalance).to.deep.equal( + ethers.BigNumber.from(ALICE_INITIAL_BALANCE - withdrawAmount) + ) + + // Assert totalSupply went down + const newTotalSupply = await SmoddedL2Token.totalSupply() + expect(newTotalSupply).to.deep.equal( + ethers.BigNumber.from(INITIAL_TOTAL_SUPPLY - withdrawAmount) + ) + + // Assert the correct cross-chain call was sent: + // Message should be sent to the L1L1StandardBridge on L1 + expect(withdrawalCallToMessenger._target).to.equal(DUMMY_L1BRIDGE_ADDRESS) + // Message data should be a call telling the L1L1StandardBridge to finalize the withdrawal + expect(withdrawalCallToMessenger._message).to.equal( + Factory__OVM_L1StandardBridge.interface.encodeFunctionData( + 'finalizeERC20Withdrawal', + [ + DUMMY_L1TOKEN_ADDRESS, + SmoddedL2Token.address, + await alice.getAddress(), + await alice.getAddress(), + withdrawAmount, + NON_NULL_BYTES32, + ] + ) + ) + // gaslimit should be correct + expect(withdrawalCallToMessenger._gasLimit).to.equal(0) + }) + + it('withdrawTo() burns and sends the correct withdrawal message', async () => { + await OVM_L2StandardBridge.withdrawTo( + SmoddedL2Token.address, + await bob.getAddress(), + withdrawAmount, + 0, + NON_NULL_BYTES32 + ) + const withdrawalCallToMessenger = + Mock__OVM_L2CrossDomainMessenger.smocked.sendMessage.calls[0] + + // Assert Alice's balance went down + const aliceBalance = await SmoddedL2Token.balanceOf( + await alice.getAddress() + ) + expect(aliceBalance).to.deep.equal( + ethers.BigNumber.from(ALICE_INITIAL_BALANCE - withdrawAmount) + ) + + // Assert totalSupply went down + const newTotalSupply = await SmoddedL2Token.totalSupply() + expect(newTotalSupply).to.deep.equal( + ethers.BigNumber.from(INITIAL_TOTAL_SUPPLY - withdrawAmount) + ) + + // Assert the correct cross-chain call was sent. + // Message should be sent to the L1L1StandardBridge on L1 + expect(withdrawalCallToMessenger._target).to.equal(DUMMY_L1BRIDGE_ADDRESS) + // The message data should be a call telling the L1L1StandardBridge to finalize the withdrawal + expect(withdrawalCallToMessenger._message).to.equal( + Factory__OVM_L1StandardBridge.interface.encodeFunctionData( + 'finalizeERC20Withdrawal', + [ + DUMMY_L1TOKEN_ADDRESS, + SmoddedL2Token.address, + await alice.getAddress(), + await bob.getAddress(), + withdrawAmount, + NON_NULL_BYTES32, + ] + ) + ) + // gas value is ignored and set to 0. + expect(withdrawalCallToMessenger._gasLimit).to.equal(0) + }) + }) + + describe('standard erc20', () => { + it('should not allow anyone but the L2 bridge to mint and burn', async () => { + expect(L2ERC20.connect(alice).mint(aliceAddress, 100)).to.be.revertedWith( + 'Only L2 Bridge can mint and burn' + ) + expect(L2ERC20.connect(alice).burn(aliceAddress, 100)).to.be.revertedWith( + 'Only L2 Bridge can mint and burn' + ) + }) + + it('should return the correct interface support', async () => { + const supportsERC165 = await L2ERC20.supportsInterface(0x01ffc9a7) + expect(supportsERC165).to.be.true + + const supportsL2TokenInterface = await L2ERC20.supportsInterface( + 0x1d1d8b63 + ) + expect(supportsL2TokenInterface).to.be.true + + const badSupports = await L2ERC20.supportsInterface(0xffffffff) + expect(badSupports).to.be.false + }) + }) +}) diff --git a/packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/native-eth.spec.ts b/packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/native-eth.spec.ts index 9c3b53fd2ea3..52801006f98d 100644 --- a/packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/native-eth.spec.ts +++ b/packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/native-eth.spec.ts @@ -11,8 +11,8 @@ import { VERIFIED_EMPTY_CONTRACT_HASH, } from '../../../../helpers' -const uniswapERC20BalanceOfStorageLayoutKey = - '0000000000000000000000000000000000000000000000000000000000000005' +const ovmEthBalanceOfStorageLayoutKey = + '0000000000000000000000000000000000000000000000000000000000000000' // TODO: use fancy chugsplash storage getter once possible const getOvmEthBalanceSlot = (addressOrPlaceholder: string): string => { let address: string @@ -22,7 +22,7 @@ const getOvmEthBalanceSlot = (addressOrPlaceholder: string): string => { address = addressOrPlaceholder } const balanceOfSlotPreimage = - ethers.utils.hexZeroPad(address, 32) + uniswapERC20BalanceOfStorageLayoutKey + ethers.utils.hexZeroPad(address, 32) + ovmEthBalanceOfStorageLayoutKey const balanceOfSlot = ethers.utils.keccak256(balanceOfSlotPreimage) return balanceOfSlot } diff --git a/packages/contracts/test/contracts/OVM/precompiles/OVM_SequencerFeeVault.spec.ts b/packages/contracts/test/contracts/OVM/precompiles/OVM_SequencerFeeVault.spec.ts index 66be51e08a13..287cbf4bbf70 100644 --- a/packages/contracts/test/contracts/OVM/precompiles/OVM_SequencerFeeVault.spec.ts +++ b/packages/contracts/test/contracts/OVM/precompiles/OVM_SequencerFeeVault.spec.ts @@ -3,10 +3,11 @@ import { expect } from '../../../setup' /* Imports: External */ import hre from 'hardhat' import { MockContract, smockit } from '@eth-optimism/smock' -import { Contract, Signer } from 'ethers' +import { Contract, Signer, constants } from 'ethers' /* Imports: Internal */ import { predeploys } from '../../../../src' +import { getContractFactory } from '@nomiclabs/hardhat-ethers/types' describe('OVM_SequencerFeeVault', () => { let signer1: Signer @@ -15,10 +16,15 @@ describe('OVM_SequencerFeeVault', () => { }) let Mock__OVM_ETH: MockContract + let Mock__OVM_L2StandardBridge: MockContract before(async () => { Mock__OVM_ETH = await smockit('OVM_ETH', { address: predeploys.OVM_ETH, }) + Mock__OVM_L2StandardBridge = await smockit('OVM_L2StandardBridge', { + address: predeploys.OVM_L2StandardBridge, + }) + console.log(await Mock__OVM_L2StandardBridge.getAddress) }) let OVM_SequencerFeeVault: Contract @@ -40,7 +46,10 @@ describe('OVM_SequencerFeeVault', () => { await expect(OVM_SequencerFeeVault.withdraw()).to.not.be.reverted - expect(Mock__OVM_ETH.smocked.withdrawTo.calls[0]).to.deep.equal([ + expect( + Mock__OVM_L2StandardBridge.smocked.withdrawTo.calls[0] + ).to.deep.equal([ + predeploys.OVM_ETH, await signer1.getAddress(), amount, 0, @@ -54,7 +63,10 @@ describe('OVM_SequencerFeeVault', () => { await expect(OVM_SequencerFeeVault.withdraw()).to.not.be.reverted - expect(Mock__OVM_ETH.smocked.withdrawTo.calls[0]).to.deep.equal([ + expect( + Mock__OVM_L2StandardBridge.smocked.withdrawTo.calls[0] + ).to.deep.equal([ + predeploys.OVM_ETH, await signer1.getAddress(), amount, 0, diff --git a/packages/contracts/test/helpers/gas/gas.ts b/packages/contracts/test/helpers/gas/gas.ts index 9e2be331179f..2be82359fe53 100644 --- a/packages/contracts/test/helpers/gas/gas.ts +++ b/packages/contracts/test/helpers/gas/gas.ts @@ -1,5 +1,6 @@ import { ethers } from 'hardhat' -import { Contract, Signer } from 'ethers' +import { Contract, Signer, BigNumber } from 'ethers' +import { expect } from 'chai' export class GasMeasurement { GasMeasurementContract: Contract diff --git a/packages/contracts/test/helpers/test-runner/test-runner.ts b/packages/contracts/test/helpers/test-runner/test-runner.ts index 5e68a54229c5..52262eaa2745 100644 --- a/packages/contracts/test/helpers/test-runner/test-runner.ts +++ b/packages/contracts/test/helpers/test-runner/test-runner.ts @@ -239,7 +239,7 @@ export class ExecutionManagerTestRunner { 'OVM_ETH', AddressManager.signer, true - ).deploy(ethers.constants.AddressZero, ethers.constants.AddressZero) + ).deploy() this.contracts.OVM_ETH = OvmEth diff --git a/packages/data-transport-layer/package.json b/packages/data-transport-layer/package.json index 47e0a8158f2e..3d66cf8262c5 100644 --- a/packages/data-transport-layer/package.json +++ b/packages/data-transport-layer/package.json @@ -52,6 +52,7 @@ "@types/mocha": "^8.2.2", "@types/node-fetch": "^2.5.8", "@types/workerpool": "^6.0.0", + "bfj": "^7.0.2", "chai": "^4.3.4", "chai-as-promised": "^7.1.1", "hardhat": "^2.2.1", From 6d7b12b8693117c379be76223448ef36707304d2 Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Sun, 13 Jun 2021 10:03:09 -0400 Subject: [PATCH 077/125] fix: comment out codeowners (#1073) --- .github/CODEOWNERS | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index feb1c407fe80..924c601c1677 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,14 +1,18 @@ -l2geth/ @smartcontracts @tynes @karlfloersch -packages/specs/l2geth/ @smartcontracts @tynes @karlfloersch -packages/contracts/ @smartcontracts @ben-chain @maurelian @elenadimitrova -packages/specs/protocol/ @smartcontracts @ben-chain @maurelian -ops/ @tynes @karlfloersch -packages/hardhat-ovm/ @smartcontracts -packages/smock/ @smartcontracts @maurelian -packages/core-utils/ @smartcontracts @annieke @ben-chain -packages/common-ts/ @annieke -packages/core-utils/src/watcher.ts @K-Ho -packages/message-relayer/ @K-Ho -packages/batch-submitter/ @annieke @karlfloersch -packages/data-transport-layer/ @annieke -integration-tests/ @tynes +# CODEOWNERS can be disruptive because it automatically requests review from individuals across the +# board. We still like to use this file to track who's working on what, but all lines are commented +# out so that GitHub won't trigger review requests. + +# l2geth/ @smartcontracts @tynes @karlfloersch +# packages/specs/l2geth/ @smartcontracts @tynes @karlfloersch +# packages/contracts/ @smartcontracts @ben-chain @maurelian @elenadimitrova +# packages/specs/protocol/ @smartcontracts @ben-chain @maurelian +# ops/ @tynes @karlfloersch +# packages/hardhat-ovm/ @smartcontracts +# packages/smock/ @smartcontracts @maurelian +# packages/core-utils/ @smartcontracts @annieke @ben-chain +# packages/common-ts/ @annieke +# packages/core-utils/src/watcher.ts @K-Ho +# packages/message-relayer/ @K-Ho +# packages/batch-submitter/ @annieke @karlfloersch +# packages/data-transport-layer/ @annieke +# integration-tests/ @tynes From 3c2c32e11285314d75af598e7f508b0d42862d49 Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Mon, 14 Jun 2021 10:15:28 -0400 Subject: [PATCH 078/125] fix: use predeploy constant lib for em wrapper (#1075) * fix: use predeploy constant lib for em wrapper * chore: add changeset --- .changeset/lovely-suns-learn.md | 5 +++++ .../libraries/constants/Lib_PredeployAddresses.sol | 1 + .../libraries/wrappers/Lib_ExecutionManagerWrapper.sol | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/lovely-suns-learn.md diff --git a/.changeset/lovely-suns-learn.md b/.changeset/lovely-suns-learn.md new file mode 100644 index 000000000000..c76d61cdf684 --- /dev/null +++ b/.changeset/lovely-suns-learn.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/contracts': patch +--- + +Use predeploy constants lib for EM wrapper diff --git a/packages/contracts/contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol b/packages/contracts/contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol index 1c1aa9ef9a45..15e0d529e033 100644 --- a/packages/contracts/contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol +++ b/packages/contracts/contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol @@ -14,6 +14,7 @@ library Lib_PredeployAddresses { address internal constant L2_CROSS_DOMAIN_MESSENGER = 0x4200000000000000000000000000000000000007; address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008; address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009; + address internal constant EXECUTION_MANAGER_WRAPPER = 0x420000000000000000000000000000000000000B; address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011; address internal constant ERC1820_REGISTRY = 0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24; address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010; diff --git a/packages/contracts/contracts/optimistic-ethereum/libraries/wrappers/Lib_ExecutionManagerWrapper.sol b/packages/contracts/contracts/optimistic-ethereum/libraries/wrappers/Lib_ExecutionManagerWrapper.sol index 7a2dc61c53a0..7912be21767b 100644 --- a/packages/contracts/contracts/optimistic-ethereum/libraries/wrappers/Lib_ExecutionManagerWrapper.sol +++ b/packages/contracts/contracts/optimistic-ethereum/libraries/wrappers/Lib_ExecutionManagerWrapper.sol @@ -3,6 +3,7 @@ pragma solidity >0.5.0 <0.8.0; /* Library Imports */ import { Lib_ErrorUtils } from "../utils/Lib_ErrorUtils.sol"; +import { Lib_PredeployAddresses } from "../constants/Lib_PredeployAddresses.sol"; /** * @title Lib_ExecutionManagerWrapper @@ -252,7 +253,7 @@ library Lib_ExecutionManagerWrapper { bytes memory ) { - (bool success, bytes memory returndata) = 0x420000000000000000000000000000000000000B.delegatecall(_calldata); + (bool success, bytes memory returndata) = Lib_PredeployAddresses.EXECUTION_MANAGER_WRAPPER.delegatecall(_calldata); if (success == true) { return returndata; From f409ce75eed76639bf5fd90060570cf0af0bef51 Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Mon, 14 Jun 2021 17:09:35 -0400 Subject: [PATCH 079/125] fix[l2geth]: off-by-one sometimes breaking replica sync (#1082) * fix[l2geth]: off-by-one sometimes breaking replica sync * chore: add changeset --- .changeset/lazy-toes-teach.md | 5 +++++ l2geth/miner/worker.go | 2 +- l2geth/rollup/sync_service.go | 19 ++++++++++--------- 3 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 .changeset/lazy-toes-teach.md diff --git a/.changeset/lazy-toes-teach.md b/.changeset/lazy-toes-teach.md new file mode 100644 index 000000000000..3c482f92504d --- /dev/null +++ b/.changeset/lazy-toes-teach.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/l2geth': patch +--- + +Fixes an off-by-one error that would sometimes break replica syncing when stopping and restarting geth. diff --git a/l2geth/miner/worker.go b/l2geth/miner/worker.go index 2c9a0a177997..e8da4757e148 100644 --- a/l2geth/miner/worker.go +++ b/l2geth/miner/worker.go @@ -196,7 +196,7 @@ func newWorker(config *Config, chainConfig *params.ChainConfig, engine consensus unconfirmed: newUnconfirmedBlocks(eth.BlockChain(), miningLogAtDepth), pendingTasks: make(map[common.Hash]*task), txsCh: make(chan core.NewTxsEvent, txChanSize), - rollupCh: make(chan core.NewTxsEvent, txChanSize), + rollupCh: make(chan core.NewTxsEvent, 1), chainHeadCh: make(chan core.ChainHeadEvent, chainHeadChanSize), chainSideCh: make(chan core.ChainSideEvent, chainSideChanSize), newWorkCh: make(chan *newWorkReq), diff --git a/l2geth/rollup/sync_service.go b/l2geth/rollup/sync_service.go index b3bcfa952853..0b71d20193ee 100644 --- a/l2geth/rollup/sync_service.go +++ b/l2geth/rollup/sync_service.go @@ -243,21 +243,22 @@ func (s *SyncService) initializeLatestL1(ctcDeployHeight *big.Int) error { s.SetLatestL1Timestamp(context.Timestamp) s.SetLatestL1BlockNumber(context.BlockNumber) } else { - // Prevent underflows - if *index != 0 { - *index = *index - 1 - } log.Info("Found latest index", "index", *index) - block := s.bc.GetBlockByNumber(*index) + block := s.bc.GetBlockByNumber(*index + 1) if block == nil { block = s.bc.CurrentBlock() - idx := block.Number().Uint64() - if idx > *index { + blockNum := block.Number().Uint64() + if blockNum > *index { // This is recoverable with a reorg but should never happen return fmt.Errorf("Current block height greater than index") } - s.SetLatestIndex(&idx) - log.Info("Block not found, resetting index", "new", idx, "old", *index) + var idx *uint64 + if blockNum > 0 { + num := blockNum - 1 + idx = &num + } + s.SetLatestIndex(idx) + log.Info("Block not found, resetting index", "new", stringify(idx), "old", *index) } txs := block.Transactions() if len(txs) != 1 { From d9fd67d2502a590e116ffdb6c1c53003a045e318 Mon Sep 17 00:00:00 2001 From: Maurelian Date: Mon, 14 Jun 2021 17:54:31 -0400 Subject: [PATCH 080/125] fix(l2geth): Log 'end of OVM execution' correctly (#1080) --- .changeset/ten-pumas-perform.md | 5 +++++ l2geth/core/vm/evm.go | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 .changeset/ten-pumas-perform.md diff --git a/.changeset/ten-pumas-perform.md b/.changeset/ten-pumas-perform.md new file mode 100644 index 000000000000..e40a6484c396 --- /dev/null +++ b/.changeset/ten-pumas-perform.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/l2geth': patch +--- + +Correctly log 'end of OVM execution' message. diff --git a/l2geth/core/vm/evm.go b/l2geth/core/vm/evm.go index b54b9bd5d777..20fdc2dfcb60 100644 --- a/l2geth/core/vm/evm.go +++ b/l2geth/core/vm/evm.go @@ -464,10 +464,9 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas ret = []byte{} } } - } - - if evm.Context.EthCallSender == nil { - log.Debug("Reached the end of an OVM execution", "ID", evm.Id, "Return Data", hexutil.Encode(ret), "Error", err) + if evm.Context.EthCallSender == nil { + log.Debug("Reached the end of an OVM execution", "ID", evm.Id, "Return Data", hexutil.Encode(ret), "Error", err) + } } } From 38355a3bae5ebcc48677bc2c6427d601e3d140fa Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Mon, 14 Jun 2021 21:05:33 -0400 Subject: [PATCH 081/125] refactor[contracts]: move account contracts to predeploy folder (#1085) * refactor[contracts]: move account contracts to predeploy folder * chore: add changeset --- .changeset/khaki-ads-kiss.md | 5 +++++ .../{accounts => predeploys}/OVM_ECDSAContractAccount.sol | 0 .../OVM/{accounts => predeploys}/OVM_ProxyEOA.sol | 0 3 files changed, 5 insertions(+) create mode 100644 .changeset/khaki-ads-kiss.md rename packages/contracts/contracts/optimistic-ethereum/OVM/{accounts => predeploys}/OVM_ECDSAContractAccount.sol (100%) rename packages/contracts/contracts/optimistic-ethereum/OVM/{accounts => predeploys}/OVM_ProxyEOA.sol (100%) diff --git a/.changeset/khaki-ads-kiss.md b/.changeset/khaki-ads-kiss.md new file mode 100644 index 000000000000..8d0e9e41a90f --- /dev/null +++ b/.changeset/khaki-ads-kiss.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/contracts': patch +--- + +Moved contracts in the "accounts" folder into the "predeploys" folder diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_ECDSAContractAccount.sol similarity index 100% rename from packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol rename to packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_ECDSAContractAccount.sol diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_ProxyEOA.sol similarity index 100% rename from packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol rename to packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_ProxyEOA.sol From ef0df819617c018d4c2a62ed1c9b54e6b04892d1 Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Mon, 14 Jun 2021 21:47:13 -0400 Subject: [PATCH 082/125] maintenance[contracts]: rename precompiles test folder to predeploys (#1086) --- .../OVM/{precompiles => predeploys}/OVM_GasPriceOracle.spec.ts | 0 .../OVM/{precompiles => predeploys}/OVM_L1MessageSender.spec.ts | 0 .../{precompiles => predeploys}/OVM_L2ToL1MessagePasser.spec.ts | 0 .../{precompiles => predeploys}/OVM_SequencerEntrypoint.spec.ts | 0 .../OVM/{precompiles => predeploys}/OVM_SequencerFeeVault.spec.ts | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename packages/contracts/test/contracts/OVM/{precompiles => predeploys}/OVM_GasPriceOracle.spec.ts (100%) rename packages/contracts/test/contracts/OVM/{precompiles => predeploys}/OVM_L1MessageSender.spec.ts (100%) rename packages/contracts/test/contracts/OVM/{precompiles => predeploys}/OVM_L2ToL1MessagePasser.spec.ts (100%) rename packages/contracts/test/contracts/OVM/{precompiles => predeploys}/OVM_SequencerEntrypoint.spec.ts (100%) rename packages/contracts/test/contracts/OVM/{precompiles => predeploys}/OVM_SequencerFeeVault.spec.ts (100%) diff --git a/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts b/packages/contracts/test/contracts/OVM/predeploys/OVM_GasPriceOracle.spec.ts similarity index 100% rename from packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts rename to packages/contracts/test/contracts/OVM/predeploys/OVM_GasPriceOracle.spec.ts diff --git a/packages/contracts/test/contracts/OVM/precompiles/OVM_L1MessageSender.spec.ts b/packages/contracts/test/contracts/OVM/predeploys/OVM_L1MessageSender.spec.ts similarity index 100% rename from packages/contracts/test/contracts/OVM/precompiles/OVM_L1MessageSender.spec.ts rename to packages/contracts/test/contracts/OVM/predeploys/OVM_L1MessageSender.spec.ts diff --git a/packages/contracts/test/contracts/OVM/precompiles/OVM_L2ToL1MessagePasser.spec.ts b/packages/contracts/test/contracts/OVM/predeploys/OVM_L2ToL1MessagePasser.spec.ts similarity index 100% rename from packages/contracts/test/contracts/OVM/precompiles/OVM_L2ToL1MessagePasser.spec.ts rename to packages/contracts/test/contracts/OVM/predeploys/OVM_L2ToL1MessagePasser.spec.ts diff --git a/packages/contracts/test/contracts/OVM/precompiles/OVM_SequencerEntrypoint.spec.ts b/packages/contracts/test/contracts/OVM/predeploys/OVM_SequencerEntrypoint.spec.ts similarity index 100% rename from packages/contracts/test/contracts/OVM/precompiles/OVM_SequencerEntrypoint.spec.ts rename to packages/contracts/test/contracts/OVM/predeploys/OVM_SequencerEntrypoint.spec.ts diff --git a/packages/contracts/test/contracts/OVM/precompiles/OVM_SequencerFeeVault.spec.ts b/packages/contracts/test/contracts/OVM/predeploys/OVM_SequencerFeeVault.spec.ts similarity index 100% rename from packages/contracts/test/contracts/OVM/precompiles/OVM_SequencerFeeVault.spec.ts rename to packages/contracts/test/contracts/OVM/predeploys/OVM_SequencerFeeVault.spec.ts From 7cce55a97dfa40e8dc2aefdc9df9c35e68a70ff8 Mon Sep 17 00:00:00 2001 From: Annie Ke Date: Tue, 15 Jun 2021 05:32:11 -0700 Subject: [PATCH 083/125] fix[bs]: disambiguate generic submission errors (#1051) * fix[bs]: disambiguate generic submission errors * add cases for errors * separate out errors from transaction reverts with reasons * remove extraneous errors --- .changeset/selfish-dryers-teach.md | 5 ++++ .../src/batch-submitter/batch-submitter.ts | 29 +++++++++++++++---- .../src/batch-submitter/tx-batch-submitter.ts | 3 +- .../src/exec/run-batch-submitter.ts | 28 ++++++++++++++---- 4 files changed, 53 insertions(+), 12 deletions(-) create mode 100644 .changeset/selfish-dryers-teach.md diff --git a/.changeset/selfish-dryers-teach.md b/.changeset/selfish-dryers-teach.md new file mode 100644 index 000000000000..13ce78fb5784 --- /dev/null +++ b/.changeset/selfish-dryers-teach.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/batch-submitter': patch +--- + +Add status to generic error log to disambiguate errors diff --git a/packages/batch-submitter/src/batch-submitter/batch-submitter.ts b/packages/batch-submitter/src/batch-submitter/batch-submitter.ts index c2e2fb64f861..ffe2674e2c7b 100644 --- a/packages/batch-submitter/src/batch-submitter/batch-submitter.ts +++ b/packages/batch-submitter/src/batch-submitter/batch-submitter.ts @@ -232,11 +232,30 @@ export abstract class BatchSubmitter { gasRetryIncrement: this.gasRetryIncrement, } - const receipt = await BatchSubmitter.getReceiptWithResubmission( - txFunc, - resubmissionConfig, - this.logger - ) + let receipt: TransactionReceipt + try { + receipt = await BatchSubmitter.getReceiptWithResubmission( + txFunc, + resubmissionConfig, + this.logger + ) + } catch (err) { + if (err.reason) { + this.logger.error(`Transaction invalid: ${err.reason}, aborting`, { + message: err.toString(), + stack: err.stack, + code: err.code, + }) + return + } + + this.logger.error('Encountered error at submission, aborting', { + message: err.toString(), + stack: err.stack, + code: err.code, + }) + return + } this.logger.info('Received transaction receipt', { receipt }) this.logger.info(successMessage) diff --git a/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts b/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts index 713c2a560aa8..8a8a041337fe 100644 --- a/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts +++ b/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts @@ -301,8 +301,7 @@ export class TransactionBatchSubmitter extends BatchSubmitter { // Fix our batches if we are configured to. TODO: Remove this. batch = await this._fixBatch(batch) if (!(await this._validateBatch(batch))) { - this.logger.error('Batch is malformed! Cannot submit next batch!') - throw new Error('Batch is malformed! Cannot submit next batch!') + return } let sequencerBatchParams = await this._getSequencerBatchParams( startBlock, diff --git a/packages/batch-submitter/src/exec/run-batch-submitter.ts b/packages/batch-submitter/src/exec/run-batch-submitter.ts index e3f21a3139cd..627b63e9647c 100644 --- a/packages/batch-submitter/src/exec/run-batch-submitter.ts +++ b/packages/batch-submitter/src/exec/run-batch-submitter.ts @@ -441,11 +441,29 @@ export const run = async () => { try { await func() } catch (err) { - logger.error('Error submitting batch', { - message: err.toString(), - stack: err.stack, - code: err.code, - }) + switch (err.code) { + case 'SERVER_ERROR': + logger.error(`Encountered server error with status ${err.status}`, { + message: err.toString(), + stack: err.stack, + code: err.code, + }) + break + case 'NETWORK_ERROR': + logger.error('Could not detect network', { + message: err.toString(), + stack: err.stack, + code: err.code, + }) + break + default: + logger.error('Unhandled exception during batch submission', { + message: err.toString(), + stack: err.stack, + code: err.code, + }) + break + } logger.info('Retrying...') } // Sleep From c43b33ecfe367b4f0b2006ab55073c7138bfa3c1 Mon Sep 17 00:00:00 2001 From: Kevin Ho Date: Tue, 15 Jun 2021 10:50:34 -0400 Subject: [PATCH 084/125] WETH deposit and withdraw on OVM_ETH (#1083) * feat(contracts): add no-op WETH9 functionality to OVM_ETH * working WETH deposit and withdraw + tests * add changeset * address PR feedback * update WETH9 contract implementation * add fallback to WETH9 * add fallback and revert withdraw test * update nit comment Co-authored-by: ben --- .changeset/fluffy-jobs-kiss.md | 6 ++ integration-tests/test/native-eth.spec.ts | 78 +++++++++++++++++++ .../OVM/predeploys/OVM_ETH.sol | 49 +++++++++++- .../constants/Lib_PredeployAddresses.sol | 2 +- .../libraries/standards/IWETH9.sol | 15 ++++ 5 files changed, 148 insertions(+), 2 deletions(-) create mode 100644 .changeset/fluffy-jobs-kiss.md create mode 100644 packages/contracts/contracts/optimistic-ethereum/libraries/standards/IWETH9.sol diff --git a/.changeset/fluffy-jobs-kiss.md b/.changeset/fluffy-jobs-kiss.md new file mode 100644 index 000000000000..6e2c814bb810 --- /dev/null +++ b/.changeset/fluffy-jobs-kiss.md @@ -0,0 +1,6 @@ +--- +'@eth-optimism/integration-tests': patch +'@eth-optimism/contracts': patch +--- + +Add WETH9 compatible deposit and withdraw functions to OVM_ETH diff --git a/integration-tests/test/native-eth.spec.ts b/integration-tests/test/native-eth.spec.ts index 1b873eda147e..81bf6dc809b0 100644 --- a/integration-tests/test/native-eth.spec.ts +++ b/integration-tests/test/native-eth.spec.ts @@ -6,6 +6,7 @@ import { Direction } from './shared/watcher-utils' import { expectApprox, + fundUser, PROXY_SEQUENCER_ENTRYPOINT_ADDRESS, } from './shared/utils' import { OptimismEnv } from './shared/env' @@ -302,4 +303,81 @@ describe('Native ETH Integration Tests', async () => { expect(l1BalanceAfter).to.deep.eq(l1BalanceBefore.add(withdrawnAmount)) expect(l2BalanceAfter).to.deep.eq(amount.sub(withdrawnAmount).sub(fee)) }) + + describe('WETH9 functionality', async () => { + let initialBalance: BigNumber + const value = 10 + + beforeEach(async () => { + await fundUser(env.watcher, env.l1Bridge, value, env.l2Wallet.address) + initialBalance = await env.l2Wallet.provider.getBalance( + env.l2Wallet.address + ) + }) + + it('successfully deposits', async () => { + const depositTx = await env.ovmEth.deposit({ value, gasPrice: 0 }) + const receipt = await depositTx.wait() + + expect( + await env.l2Wallet.provider.getBalance(env.l2Wallet.address) + ).to.equal(initialBalance) + expect(receipt.events.length).to.equal(4) + + // The first transfer event is fee payment + const [ + , + firstTransferEvent, + secondTransferEvent, + depositEvent, + ] = receipt.events + + expect(firstTransferEvent.event).to.equal('Transfer') + expect(firstTransferEvent.args.from).to.equal(env.l2Wallet.address) + expect(firstTransferEvent.args.to).to.equal(env.ovmEth.address) + expect(firstTransferEvent.args.value).to.equal(value) + + expect(secondTransferEvent.event).to.equal('Transfer') + expect(secondTransferEvent.args.from).to.equal(env.ovmEth.address) + expect(secondTransferEvent.args.to).to.equal(env.l2Wallet.address) + expect(secondTransferEvent.args.value).to.equal(value) + + expect(depositEvent.event).to.equal('Deposit') + expect(depositEvent.args.dst).to.equal(env.l2Wallet.address) + expect(depositEvent.args.wad).to.equal(value) + }) + + it('successfully deposits on fallback', async () => { + const fallbackTx = await env.l2Wallet.sendTransaction({ + to: env.ovmEth.address, + value, + gasPrice: 0, + }) + const receipt = await fallbackTx.wait() + expect(receipt.status).to.equal(1) + expect( + await env.l2Wallet.provider.getBalance(env.l2Wallet.address) + ).to.equal(initialBalance) + }) + + it('successfully withdraws', async () => { + const withdrawTx = await env.ovmEth.withdraw(value, { gasPrice: 0 }) + const receipt = await withdrawTx.wait() + expect( + await env.l2Wallet.provider.getBalance(env.l2Wallet.address) + ).to.equal(initialBalance) + expect(receipt.events.length).to.equal(2) + + // The first transfer event is fee payment + const depositEvent = receipt.events[1] + expect(depositEvent.event).to.equal('Withdrawal') + expect(depositEvent.args.src).to.equal(env.l2Wallet.address) + expect(depositEvent.args.wad).to.equal(value) + }) + + it('reverts on invalid withdraw', async () => { + await expect(env.ovmEth.withdraw(initialBalance.add(1), { gasPrice: 0 })) + .to.be.reverted + }) + }) }) diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_ETH.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_ETH.sol index 731286d17f56..3ebb6ec0d79b 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_ETH.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_ETH.sol @@ -6,6 +6,7 @@ import { Lib_PredeployAddresses } from "../../libraries/constants/Lib_PredeployA /* Contract Imports */ import { L2StandardERC20 } from "../../libraries/standards/L2StandardERC20.sol"; +import { IWETH9 } from "../../libraries/standards/IWETH9.sol"; /** * @title OVM_ETH @@ -15,7 +16,7 @@ import { L2StandardERC20 } from "../../libraries/standards/L2StandardERC20.sol"; * Compiler used: optimistic-solc * Runtime target: OVM */ -contract OVM_ETH is L2StandardERC20 { +contract OVM_ETH is L2StandardERC20, IWETH9 { /*************** * Constructor * @@ -29,4 +30,50 @@ contract OVM_ETH is L2StandardERC20 { "ETH" ) {} + + + /****************************** + * Custom WETH9 Functionality * + ******************************/ + fallback() external payable { + deposit(); + } + + /** + * Implements the WETH9 deposit() function as a no-op. + * WARNING: this function does NOT have to do with cross-chain asset bridging. The + * relevant deposit and withdraw functions for that use case can be found at L2StandardBridge.sol. + * This function allows developers to treat OVM_ETH as WETH without any modifications to their code. + */ + function deposit() + public + payable + override + { + // Calling deposit() with nonzero value will send the ETH to this contract address. Once recieved here, + // We transfer it back by sending to the msg.sender. + _transfer(address(this), msg.sender, msg.value); + + emit Deposit(msg.sender, msg.value); + } + + /** + * Implements the WETH9 withdraw() function as a no-op. + * WARNING: this function does NOT have to do with cross-chain asset bridging. The + * relevant deposit and withdraw functions for that use case can be found at L2StandardBridge.sol. + * This function allows developers to treat OVM_ETH as WETH without any modifications to their code. + * @param _wad Amount being withdrawn + */ + function withdraw( + uint256 _wad + ) + external + override + { + // Calling withdraw() with value exceeding the withdrawer's ovmBALANCE should revert, as in WETH9. + require(balanceOf(msg.sender) >= _wad); + + // Other than emitting an event, OVM_ETH already is native ETH, so we don't need to do anything else. + emit Withdrawal(msg.sender, _wad); + } } diff --git a/packages/contracts/contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol b/packages/contracts/contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol index 15e0d529e033..b597e00ec0da 100644 --- a/packages/contracts/contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol +++ b/packages/contracts/contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol @@ -10,7 +10,7 @@ library Lib_PredeployAddresses { address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002; address internal constant ECDSA_CONTRACT_ACCOUNT = 0x4200000000000000000000000000000000000003; address internal constant SEQUENCER_ENTRYPOINT = 0x4200000000000000000000000000000000000005; - address internal constant OVM_ETH = 0x4200000000000000000000000000000000000006; + address payable internal constant OVM_ETH = 0x4200000000000000000000000000000000000006; address internal constant L2_CROSS_DOMAIN_MESSENGER = 0x4200000000000000000000000000000000000007; address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008; address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009; diff --git a/packages/contracts/contracts/optimistic-ethereum/libraries/standards/IWETH9.sol b/packages/contracts/contracts/optimistic-ethereum/libraries/standards/IWETH9.sol new file mode 100644 index 000000000000..ad7e88f616ff --- /dev/null +++ b/packages/contracts/contracts/optimistic-ethereum/libraries/standards/IWETH9.sol @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +pragma solidity =0.7.6; +import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; + +/// @title Interface for WETH9. Also contains the non-ERC20 events normally present in the WETH9 implementation. +interface IWETH9 is IERC20 { + event Deposit(address indexed dst, uint256 wad); + event Withdrawal(address indexed src, uint256 wad); + + /// @notice Deposit ether to get wrapped ether + function deposit() external payable; + + /// @notice Withdraw wrapped ether to get ether + function withdraw(uint256) external; +} From a0d9e565e008b4255e743b16cfd1f0a6b907611a Mon Sep 17 00:00:00 2001 From: Maurelian Date: Tue, 15 Jun 2021 11:21:30 -0400 Subject: [PATCH 085/125] Also move the accounts interface to iOVM/predeploys (#1087) * refactor[contracts]: move account interface to predeploy folder * chore: add changeset --- .changeset/hungry-pears-vanish.md | 5 +++++ .../OVM/predeploys/OVM_ECDSAContractAccount.sol | 2 +- .../OVM/predeploys/OVM_SequencerEntrypoint.sol | 2 +- .../{accounts => predeploys}/iOVM_ECDSAContractAccount.sol | 0 4 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/hungry-pears-vanish.md rename packages/contracts/contracts/optimistic-ethereum/iOVM/{accounts => predeploys}/iOVM_ECDSAContractAccount.sol (100%) diff --git a/.changeset/hungry-pears-vanish.md b/.changeset/hungry-pears-vanish.md new file mode 100644 index 000000000000..2ce7119b88cc --- /dev/null +++ b/.changeset/hungry-pears-vanish.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/contracts': patch +--- + +ECDSA account interface contract moved to predeploys dir diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_ECDSAContractAccount.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_ECDSAContractAccount.sol index f6a41466f530..8c93f9a4c92f 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_ECDSAContractAccount.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_ECDSAContractAccount.sol @@ -3,7 +3,7 @@ pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Interface Imports */ -import { iOVM_ECDSAContractAccount } from "../../iOVM/accounts/iOVM_ECDSAContractAccount.sol"; +import { iOVM_ECDSAContractAccount } from "../../iOVM/predeploys/iOVM_ECDSAContractAccount.sol"; /* Library Imports */ import { Lib_EIP155Tx } from "../../libraries/codec/Lib_EIP155Tx.sol"; diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerEntrypoint.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerEntrypoint.sol index 8581624d75c9..ebbacff35218 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerEntrypoint.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerEntrypoint.sol @@ -5,7 +5,7 @@ pragma experimental ABIEncoderV2; /* Library Imports */ import { Lib_EIP155Tx } from "../../libraries/codec/Lib_EIP155Tx.sol"; import { Lib_ExecutionManagerWrapper } from "../../libraries/wrappers/Lib_ExecutionManagerWrapper.sol"; -import { iOVM_ECDSAContractAccount } from "../../iOVM/accounts/iOVM_ECDSAContractAccount.sol"; +import { iOVM_ECDSAContractAccount } from "../../iOVM/predeploys/iOVM_ECDSAContractAccount.sol"; /** * @title OVM_SequencerEntrypoint diff --git a/packages/contracts/contracts/optimistic-ethereum/iOVM/accounts/iOVM_ECDSAContractAccount.sol b/packages/contracts/contracts/optimistic-ethereum/iOVM/predeploys/iOVM_ECDSAContractAccount.sol similarity index 100% rename from packages/contracts/contracts/optimistic-ethereum/iOVM/accounts/iOVM_ECDSAContractAccount.sol rename to packages/contracts/contracts/optimistic-ethereum/iOVM/predeploys/iOVM_ECDSAContractAccount.sol From 2378711bb025022426870c737c4dcee9652e81d5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 15 Jun 2021 11:23:44 -0400 Subject: [PATCH 086/125] Version Packages (#1089) Co-authored-by: github-actions[bot] --- .changeset/lazy-toes-teach.md | 5 ----- .changeset/selfish-dryers-teach.md | 5 ----- .changeset/ten-pumas-perform.md | 5 ----- l2geth/CHANGELOG.md | 7 +++++++ l2geth/package.json | 2 +- packages/batch-submitter/CHANGELOG.md | 6 ++++++ packages/batch-submitter/package.json | 2 +- 7 files changed, 15 insertions(+), 17 deletions(-) delete mode 100644 .changeset/lazy-toes-teach.md delete mode 100644 .changeset/selfish-dryers-teach.md delete mode 100644 .changeset/ten-pumas-perform.md diff --git a/.changeset/lazy-toes-teach.md b/.changeset/lazy-toes-teach.md deleted file mode 100644 index 3c482f92504d..000000000000 --- a/.changeset/lazy-toes-teach.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/l2geth': patch ---- - -Fixes an off-by-one error that would sometimes break replica syncing when stopping and restarting geth. diff --git a/.changeset/selfish-dryers-teach.md b/.changeset/selfish-dryers-teach.md deleted file mode 100644 index 13ce78fb5784..000000000000 --- a/.changeset/selfish-dryers-teach.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/batch-submitter': patch ---- - -Add status to generic error log to disambiguate errors diff --git a/.changeset/ten-pumas-perform.md b/.changeset/ten-pumas-perform.md deleted file mode 100644 index e40a6484c396..000000000000 --- a/.changeset/ten-pumas-perform.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/l2geth': patch ---- - -Correctly log 'end of OVM execution' message. diff --git a/l2geth/CHANGELOG.md b/l2geth/CHANGELOG.md index d0a0f3a73c23..95f2630fce25 100644 --- a/l2geth/CHANGELOG.md +++ b/l2geth/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 0.3.9 + +### Patch Changes + +- f409ce75: Fixes an off-by-one error that would sometimes break replica syncing when stopping and restarting geth. +- d9fd67d2: Correctly log 'end of OVM execution' message. + ## 0.3.8 ### Patch Changes diff --git a/l2geth/package.json b/l2geth/package.json index 56a9a6a93700..424e231e21df 100644 --- a/l2geth/package.json +++ b/l2geth/package.json @@ -1,6 +1,6 @@ { "name": "@eth-optimism/l2geth", - "version": "0.3.8", + "version": "0.3.9", "private": true, "devDependencies": {} } diff --git a/packages/batch-submitter/CHANGELOG.md b/packages/batch-submitter/CHANGELOG.md index 6b0e1457b7fb..74311a997ba9 100644 --- a/packages/batch-submitter/CHANGELOG.md +++ b/packages/batch-submitter/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 0.3.5 + +### Patch Changes + +- 7cce55a9: Add status to generic error log to disambiguate errors + ## 0.3.4 ### Patch Changes diff --git a/packages/batch-submitter/package.json b/packages/batch-submitter/package.json index 102b8c8f6773..835646c19097 100644 --- a/packages/batch-submitter/package.json +++ b/packages/batch-submitter/package.json @@ -1,6 +1,6 @@ { "name": "@eth-optimism/batch-submitter", - "version": "0.3.4", + "version": "0.3.5", "private": true, "description": "[Optimism] Batch submission for sequencer & aggregators", "main": "dist/index", From 14243701923f521bfd16ea0ce94f60a84e72900f Mon Sep 17 00:00:00 2001 From: Liam Horne Date: Tue, 15 Jun 2021 11:57:22 -0400 Subject: [PATCH 087/125] fix: use -z flag for var unset in canary --- .github/workflows/publish-canary.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-canary.yml b/.github/workflows/publish-canary.yml index d5cb35ddb93f..82585ff8dc8e 100644 --- a/.github/workflows/publish-canary.yml +++ b/.github/workflows/publish-canary.yml @@ -74,11 +74,11 @@ jobs: - name: Docker Image Name id: docker_image_name run: | - if [ $CUSTOM_IMAGE_NAME == '' ] + if [ -z "${CUSTOM_IMAGE_NAME}" ] then echo "::set-output name=canary-docker-tag::${GITHUB_SHA::8}" else - echo "::set-output name=canary-docker-tag::prerelease-$CUSTOM_IMAGE_NAME" + echo "::set-output name=canary-docker-tag::prerelease-${CUSTOM_IMAGE_NAME}" fi env: CUSTOM_IMAGE_NAME: ${{ github.event.inputs.customImageName }} @@ -112,7 +112,7 @@ jobs: context: . file: ./ops/docker/Dockerfile.geth push: true - tags: ethereumoptimism/l2geth:${{ needs.canary-publish.outputs.l2geth }} + tags: ethereumoptimism/l2geth:${{ steps.docker_image_name.outputs.canary-docker-tag }} # pushes the base builder image to dockerhub builder: From c87e4c74e6165ca890d8dc138f5bdc1e4cba8d20 Mon Sep 17 00:00:00 2001 From: Rajiv Patel-O'Connor Date: Tue, 15 Jun 2021 13:07:37 -0500 Subject: [PATCH 088/125] Use Eslint instead of Tslint (#1005) * removed tslint * forgot to commit files * made .eslintrc.js consistent for all subdirs and other cleanup * [removed] includes and files keys from tsconfig.json * removed file level linting exceptions and added details to line level * added changeset * fixed newly introduced linting errors from rebase * enable json import for batch submitter * removed ecdsa-coder * maybe a tsconfig issue? * Update deploy.ts Co-authored-by: smartcontracts Co-authored-by: platocrat <37757724+platocrat@users.noreply.github.com> --- .changeset/calm-fans-travel.md | 5 + .eslintrc.js | 186 +++ examples/truffle/test/erc20.spec.js | 3 +- integration-tests/.eslintrc.js | 3 + integration-tests/package.json | 14 +- integration-tests/tsconfig.json | 2 +- integration-tests/tslint.json | 7 - packages/batch-submitter/.eslintrc.js | 3 + packages/batch-submitter/package.json | 16 +- packages/batch-submitter/tsconfig.json | 9 +- packages/batch-submitter/tslint.json | 3 - packages/common-ts/.eslintrc.js | 3 + packages/common-ts/package.json | 16 +- packages/common-ts/src/base-service.ts | 6 +- packages/common-ts/tslint.json | 3 - packages/contracts/.eslintrc.js | 7 + packages/contracts/bin/deploy.ts | 56 +- packages/contracts/package.json | 16 +- packages/contracts/src/predeploys.ts | 6 +- .../contracts/src/state-dump/make-dump.ts | 2 + .../assets/OVM_L2DepositedERC20.spec.ts | 3 +- .../OVM_StateTransitioner.spec.ts | 1 - .../libraries/codec/Lib_EIP155Tx.spec.ts | 1 - .../libraries/codec/Lib_OVMCodec.spec.ts | 1 - .../libraries/rlp/Lib_RLPWriter.spec.ts | 1 - .../libraries/utils/Lib_EthUtils.spec.ts | 3 +- packages/contracts/test/helpers/constants.ts | 2 +- .../test/helpers/test-runner/test-runner.ts | 2 +- packages/contracts/tsconfig.json | 4 +- packages/contracts/tslint.json | 8 - packages/core-utils/.eslintrc.js | 3 + packages/core-utils/package.json | 16 +- packages/core-utils/src/common/hex-strings.ts | 5 + packages/core-utils/src/common/misc.ts | 1 + packages/core-utils/src/fees.ts | 10 +- .../test/coders/batch-encoder.spec.ts | 1 + packages/core-utils/tslint.json | 3 - packages/data-transport-layer/.eslintrc.js | 3 + packages/data-transport-layer/package.json | 16 +- .../data-transport-layer/src/client/client.ts | 2 +- .../src/db/transport-db.ts | 2 +- .../src/services/l1-ingestion/service.ts | 1 + .../src/services/l2-ingestion/service.ts | 1 + .../src/services/server/service.ts | 1 + .../data-transport-layer/src/utils/common.ts | 1 + packages/data-transport-layer/tslint.json | 3 - packages/hardhat-ovm/.eslintrc.js | 3 + packages/hardhat-ovm/package.json | 18 +- packages/hardhat-ovm/src/index.ts | 3 +- packages/hardhat-ovm/tslint.json | 3 - packages/message-relayer/.eslintrc.js | 3 + packages/message-relayer/package.json | 18 +- packages/message-relayer/src/relay-tx.ts | 7 + packages/message-relayer/src/service.ts | 1 + packages/message-relayer/tslint.json | 3 - packages/smock/.eslintrc.js | 7 + packages/smock/package.json | 18 +- packages/smock/src/common/hardhat-common.ts | 3 + packages/smock/src/smockit/binding.ts | 7 +- packages/smock/src/smockit/smockit.ts | 3 + packages/smock/src/smoddit/smoddit.ts | 1 + packages/smock/src/smoddit/storage.ts | 4 + packages/smock/tsconfig.json | 5 +- packages/smock/tslint.json | 3 - tslint.base.json | 38 - yarn.lock | 1141 +++++++++++++++-- 66 files changed, 1472 insertions(+), 278 deletions(-) create mode 100644 .changeset/calm-fans-travel.md create mode 100644 .eslintrc.js create mode 100644 integration-tests/.eslintrc.js delete mode 100644 integration-tests/tslint.json create mode 100644 packages/batch-submitter/.eslintrc.js delete mode 100644 packages/batch-submitter/tslint.json create mode 100644 packages/common-ts/.eslintrc.js delete mode 100644 packages/common-ts/tslint.json create mode 100644 packages/contracts/.eslintrc.js delete mode 100644 packages/contracts/tslint.json create mode 100644 packages/core-utils/.eslintrc.js delete mode 100644 packages/core-utils/tslint.json create mode 100644 packages/data-transport-layer/.eslintrc.js delete mode 100644 packages/data-transport-layer/tslint.json create mode 100644 packages/hardhat-ovm/.eslintrc.js delete mode 100644 packages/hardhat-ovm/tslint.json create mode 100644 packages/message-relayer/.eslintrc.js delete mode 100644 packages/message-relayer/tslint.json create mode 100644 packages/smock/.eslintrc.js delete mode 100644 packages/smock/tslint.json delete mode 100644 tslint.base.json diff --git a/.changeset/calm-fans-travel.md b/.changeset/calm-fans-travel.md new file mode 100644 index 000000000000..b579a850af27 --- /dev/null +++ b/.changeset/calm-fans-travel.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/contracts': patch +--- + +Migrated from tslint to eslint. The preference for lint exceptions is as follows: line level, block level, file level, package level. diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 000000000000..d3f6ef0b358a --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,186 @@ +module.exports = { + "env": { + "browser": true, + "es6": true + }, + "extends": [ + "prettier", + ], + "ignorePatterns": ["dist/**/*.ts"], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "project": "tsconfig.json", + "sourceType": "module" + }, + "plugins": [ + "eslint-plugin-import", + "eslint-plugin-unicorn", + "eslint-plugin-jsdoc", + "eslint-plugin-prefer-arrow", + "eslint-plugin-react", + "@typescript-eslint", + ], + "rules": { + "@typescript-eslint/adjacent-overload-signatures": "error", + "@typescript-eslint/array-type": "off", + "@typescript-eslint/ban-types": "off", + "@typescript-eslint/consistent-type-assertions": "error", + "@typescript-eslint/dot-notation": "off", + "@typescript-eslint/indent": "off", + "@typescript-eslint/member-delimiter-style": [ + "off", + { + "multiline": { + "delimiter": "none", + "requireLast": true + }, + "singleline": { + "delimiter": "semi", + "requireLast": false + } + } + ], + "@typescript-eslint/member-ordering": "off", + "@typescript-eslint/naming-convention": "off", + "@typescript-eslint/no-empty-function": "error", + "@typescript-eslint/no-empty-interface": "off", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-misused-new": "error", + "@typescript-eslint/no-namespace": "error", + "@typescript-eslint/no-parameter-properties": "off", + "@typescript-eslint/no-shadow": [ + "error", + { + "hoist": "all" + } + ], + "@typescript-eslint/no-this-alias": "error", + "@typescript-eslint/no-unused-expressions": "off", + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/no-var-requires": "error", + "@typescript-eslint/prefer-for-of": "error", + "@typescript-eslint/prefer-function-type": "error", + "@typescript-eslint/prefer-namespace-keyword": "error", + "@typescript-eslint/quotes": "off", + "@typescript-eslint/semi": [ + "off", + null + ], + "@typescript-eslint/triple-slash-reference": [ + "error", + { + "path": "always", + "types": "prefer-import", + "lib": "always" + } + ], + "@typescript-eslint/type-annotation-spacing": "off", + "@typescript-eslint/unified-signatures": "error", + "arrow-parens": [ + "off", + "always" + ], + "brace-style": [ + "off", + "off" + ], + "comma-dangle": "off", + "complexity": "off", + "constructor-super": "error", + "curly": "error", + "dot-notation": "off", + "eol-last": "off", + "eqeqeq": [ + "error", + "smart" + ], + "guard-for-in": "error", + "id-blacklist": "off", + "id-match": "off", + "import/no-extraneous-dependencies": [ + "error" + ], + "import/no-internal-modules": "off", + "import/order": "off", + "indent": "off", + "jsdoc/check-alignment": "error", + "jsdoc/check-indentation": "error", + "jsdoc/newline-after-description": "error", + "linebreak-style": "off", + "max-classes-per-file": "off", + "max-len": "off", + "new-parens": "off", + "newline-per-chained-call": "off", + "no-bitwise": "off", + "no-caller": "error", + "no-cond-assign": "error", + "no-console": "off", + "no-debugger": "error", + "no-duplicate-case": "error", + "no-duplicate-imports": "error", + "no-empty": "error", + "no-eval": "error", + "no-extra-bind": "error", + "no-extra-semi": "off", + "no-fallthrough": "off", + "no-invalid-this": "off", + "no-irregular-whitespace": "off", + "no-multiple-empty-lines": "off", + "no-new-func": "error", + "no-new-wrappers": "error", + "no-redeclare": "error", + "no-return-await": "error", + "no-sequences": "error", + "no-sparse-arrays": "error", + "no-template-curly-in-string": "error", + "no-throw-literal": "error", + "no-trailing-spaces": "off", + "no-undef-init": "error", + "no-underscore-dangle": "off", + "no-unsafe-finally": "error", + "no-unused-expressions": "off", + "no-unused-labels": "error", + "no-use-before-define": "off", + "no-var": "error", + "object-shorthand": "error", + "one-var": [ + "error", + "never" + ], + "padded-blocks": [ + "off", + { + "blocks": "never" + }, + { + "allowSingleLineBlocks": true + } + ], + "prefer-arrow/prefer-arrow-functions": "error", + "prefer-const": "error", + "prefer-object-spread": "error", + "quote-props": "off", + "quotes": "off", + "radix": "error", + "react/jsx-curly-spacing": "off", + "react/jsx-equals-spacing": "off", + "react/jsx-tag-spacing": [ + "off", + { + "afterOpening": "allow", + "closingSlash": "allow" + } + ], + "react/jsx-wrap-multilines": "off", + "semi": "off", + "space-before-blocks": "error", + "space-before-function-paren": "off", + "space-in-parens": [ + "off", + "never" + ], + "unicorn/prefer-ternary": "off", + "use-isnan": "error", + "valid-typeof": "off" + } +}; diff --git a/examples/truffle/test/erc20.spec.js b/examples/truffle/test/erc20.spec.js index 4a8e284881b9..1258d0be7d4e 100644 --- a/examples/truffle/test/erc20.spec.js +++ b/examples/truffle/test/erc20.spec.js @@ -211,8 +211,7 @@ contract('ERC20', (accounts) => { const balance02 = await token.balanceOf.call(accounts[ 0 ]) assert.strictEqual(balance02.toNumber(), 9980) }) - - /* eslint-disable no-underscore-dangle */ + it('events: should fire Transfer event properly', async () => { const res = await token.transfer(accounts[ 1 ], '2666', { from: accounts[ 0 ], gasPrice: 0 }) const transferLog = res.logs.find( diff --git a/integration-tests/.eslintrc.js b/integration-tests/.eslintrc.js new file mode 100644 index 000000000000..004cfa55aac8 --- /dev/null +++ b/integration-tests/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + "extends": "../.eslintrc.js" +} diff --git a/integration-tests/package.json b/integration-tests/package.json index ca67edcc4fcf..12061c3b9d4a 100644 --- a/integration-tests/package.json +++ b/integration-tests/package.json @@ -8,7 +8,7 @@ "scripts": { "lint": "yarn lint:fix && yarn lint:check", "lint:fix": "prettier --config ./.prettierrc.json --write 'test/**/*.ts'", - "lint:check": "tslint --format stylish --project .", + "lint:check": "eslint -c .eslintrc.js --ext .ts --format stylish .", "build:integration": "./scripts/build.sh", "build:contracts": "hardhat compile", "build:contracts:ovm": "hardhat compile --network optimism", @@ -23,15 +23,25 @@ "@ethersproject/providers": "^5.0.24", "@nomiclabs/hardhat-ethers": "^2.0.2", "@nomiclabs/hardhat-waffle": "^2.0.1", - "@types/chai-as-promised": "^7.1.3", "@types/chai": "^4.2.17", + "@types/chai-as-promised": "^7.1.3", "@types/mocha": "^8.2.2", "@types/rimraf": "^3.0.0", "@types/shelljs": "^0.8.8", + "@typescript-eslint/eslint-plugin": "^4.26.0", + "@typescript-eslint/parser": "^4.26.0", "chai": "^4.3.3", "chai-as-promised": "^7.1.1", "docker-compose": "^0.23.8", "envalid": "^7.1.0", + "eslint": "^7.27.0", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-ban": "^1.5.2", + "eslint-plugin-import": "^2.23.4", + "eslint-plugin-jsdoc": "^35.1.2", + "eslint-plugin-prefer-arrow": "^1.2.3", + "eslint-plugin-react": "^7.24.0", + "eslint-plugin-unicorn": "^32.0.1", "ethereum-waffle": "^3.3.0", "ethers": "^5.0.32", "hardhat": "^2.2.1", diff --git a/integration-tests/tsconfig.json b/integration-tests/tsconfig.json index 758c942d51a9..fb827e9e7179 100644 --- a/integration-tests/tsconfig.json +++ b/integration-tests/tsconfig.json @@ -3,6 +3,6 @@ "compilerOptions": { "resolveJsonModule": true }, - "include": ["./test", "sync-tests/*.ts"], + "include": ["./test", "sync-tests/*.ts", "./artifacts/**/*.json", "./artifacts-ovm/**/*.json"], "files": ["./hardhat.config.ts"] } diff --git a/integration-tests/tslint.json b/integration-tests/tslint.json deleted file mode 100644 index d6d9b0e0ca6b..000000000000 --- a/integration-tests/tslint.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "../tslint.base.json", - "rules": { - "array-type": false, - "class-name": false - } -} diff --git a/packages/batch-submitter/.eslintrc.js b/packages/batch-submitter/.eslintrc.js new file mode 100644 index 000000000000..9e57fbfb8492 --- /dev/null +++ b/packages/batch-submitter/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + "extends": "../../.eslintrc.js" +} diff --git a/packages/batch-submitter/package.json b/packages/batch-submitter/package.json index 835646c19097..7c365149e514 100644 --- a/packages/batch-submitter/package.json +++ b/packages/batch-submitter/package.json @@ -14,7 +14,7 @@ "clean": "rimraf cache/ dist/ ./tsconfig.build.tsbuildinfo", "lint": "yarn lint:fix && yarn lint:check", "lint:fix": "prettier --config .prettierrc.json --write \"hardhat.config.ts\" \"{src,exec,test}/**/*.ts\"", - "lint:check": "tslint --format stylish --project .", + "lint:check": "eslint -c .eslintrc.js --ext .ts --format stylish .", "test": "hardhat test --show-stack-traces" }, "keywords": [ @@ -57,7 +57,17 @@ "@types/rimraf": "^3.0.0", "@types/sinon": "^9.0.10", "@types/sinon-chai": "^3.2.5", + "@typescript-eslint/eslint-plugin": "^4.26.0", + "@typescript-eslint/parser": "^4.26.0", "chai": "^4.2.0", + "eslint": "^7.27.0", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-ban": "^1.5.2", + "eslint-plugin-import": "^2.23.4", + "eslint-plugin-jsdoc": "^35.1.2", + "eslint-plugin-prefer-arrow": "^1.2.3", + "eslint-plugin-react": "^7.24.0", + "eslint-plugin-unicorn": "^32.0.1", "ethereum-waffle": "3.0.0", "ganache-core": "^2.13.2", "hardhat": "^2.2.1", @@ -66,10 +76,6 @@ "rimraf": "^2.6.3", "sinon": "^9.2.4", "sinon-chai": "^3.5.0", - "tslint": "^6.1.3", - "tslint-config-prettier": "^1.18.0", - "tslint-no-focused-test": "^0.5.0", - "tslint-plugin-prettier": "^2.3.0", "typescript": "^4.2.3" }, "resolutions": { diff --git a/packages/batch-submitter/tsconfig.json b/packages/batch-submitter/tsconfig.json index 17100a25bcda..f2bd005dfc51 100644 --- a/packages/batch-submitter/tsconfig.json +++ b/packages/batch-submitter/tsconfig.json @@ -1,6 +1,7 @@ { - "extends": "../../tsconfig.json", - "compilerOptions": { - "resolveJsonModule": true - } + "extends": "../../tsconfig.json", + "compilerOptions": { + "resolveJsonModule": true + } } + \ No newline at end of file diff --git a/packages/batch-submitter/tslint.json b/packages/batch-submitter/tslint.json deleted file mode 100644 index 6587c444f045..000000000000 --- a/packages/batch-submitter/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tslint.base.json" -} diff --git a/packages/common-ts/.eslintrc.js b/packages/common-ts/.eslintrc.js new file mode 100644 index 000000000000..9e57fbfb8492 --- /dev/null +++ b/packages/common-ts/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + "extends": "../../.eslintrc.js" +} diff --git a/packages/common-ts/package.json b/packages/common-ts/package.json index ac3f92b2d573..9388e2d30e36 100644 --- a/packages/common-ts/package.json +++ b/packages/common-ts/package.json @@ -14,7 +14,7 @@ "clean": "rimraf dist/ ./tsconfig.build.tsbuildinfo", "lint": "yarn lint:fix && yarn lint:check", "lint:fix": "prettier --config .prettierrc.json --write '{src,test}/**/*.ts'", - "lint:check": "tslint --format stylish --project .", + "lint:check": "eslint -c .eslintrc.js --ext .ts --format stylish .", "test": "ts-mocha test/*.spec.ts" }, "devDependencies": { @@ -24,15 +24,21 @@ "@types/pino": "^6.3.6", "@types/pino-multi-stream": "^5.1.1", "@types/prettier": "^2.2.3", + "@typescript-eslint/eslint-plugin": "^4.26.0", + "@typescript-eslint/parser": "^4.26.0", "chai": "^4.3.4", + "eslint": "^7.27.0", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-ban": "^1.5.2", + "eslint-plugin-import": "^2.23.4", + "eslint-plugin-jsdoc": "^35.1.2", + "eslint-plugin-prefer-arrow": "^1.2.3", + "eslint-plugin-react": "^7.24.0", + "eslint-plugin-unicorn": "^32.0.1", "mocha": "^8.4.0", "prettier": "^2.2.1", "supertest": "^6.1.3", "ts-mocha": "^8.0.0", - "tslint": "^6.1.3", - "tslint-config-prettier": "^1.18.0", - "tslint-no-focused-test": "^0.5.0", - "tslint-plugin-prettier": "^2.3.0", "typescript": "^4.2.3" }, "dependencies": { diff --git a/packages/common-ts/src/base-service.ts b/packages/common-ts/src/base-service.ts index 1f1fee6bfd7b..5e8d74fd5859 100644 --- a/packages/common-ts/src/base-service.ts +++ b/packages/common-ts/src/base-service.ts @@ -109,10 +109,10 @@ export class BaseService { /** * Combines user provided and default options. */ -function mergeDefaultOptions( +const mergeDefaultOptions = ( options: T, optionSettings: OptionSettings -): T { +): T => { for (const optionName of Object.keys(optionSettings)) { const optionDefault = optionSettings[optionName].default if (optionDefault === undefined) { @@ -132,7 +132,7 @@ function mergeDefaultOptions( /** * Performs option validation against the option settings */ -function validateOptions(options: T, optionSettings: OptionSettings) { +const validateOptions = (options: T, optionSettings: OptionSettings) => { for (const optionName of Object.keys(optionSettings)) { const optionValidationFunction = optionSettings[optionName].validate if (optionValidationFunction === undefined) { diff --git a/packages/common-ts/tslint.json b/packages/common-ts/tslint.json deleted file mode 100644 index 6587c444f045..000000000000 --- a/packages/common-ts/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tslint.base.json" -} diff --git a/packages/contracts/.eslintrc.js b/packages/contracts/.eslintrc.js new file mode 100644 index 000000000000..566e53edb505 --- /dev/null +++ b/packages/contracts/.eslintrc.js @@ -0,0 +1,7 @@ +module.exports = { + "extends": "../../.eslintrc.js", + "parserOptions": { + "project": "tsconfig.json", + "sourceType": "module" + } +} diff --git a/packages/contracts/bin/deploy.ts b/packages/contracts/bin/deploy.ts index 7ac14d6615e1..28cd4680d134 100755 --- a/packages/contracts/bin/deploy.ts +++ b/packages/contracts/bin/deploy.ts @@ -18,8 +18,32 @@ import hre from 'hardhat' const sequencer = new Wallet(process.env.SEQUENCER_PRIVATE_KEY) const deployer = new Wallet(process.env.DEPLOYER_PRIVATE_KEY) -const main = async () => { +const parseEnv = () => { + const ensure = (env, type) => { + if (typeof process.env[env] === 'undefined') { + return undefined + } + if (type === 'number') { + return parseInt(process.env[env], 10) + } + return process.env[env] + } + + return { + l1BlockTimeSeconds: ensure('BLOCK_TIME_SECONDS', 'number'), + ctcForceInclusionPeriodSeconds: ensure('FORCE_INCLUSION_PERIOD_SECONDS', 'number'), + ctcMaxTransactionGasLimit: ensure('MAX_TRANSACTION_GAS_LIMIT', 'number'), + emMinTransactionGasLimit: ensure('MIN_TRANSACTION_GAS_LIMIT', 'number'), + emMaxtransactionGasLimit: ensure('MAX_TRANSACTION_GAS_LIMIT', 'number'), + emMaxGasPerQueuePerEpoch: ensure('MAX_GAS_PER_QUEUE_PER_EPOCH', 'number'), + emSecondsPerEpoch: ensure('ECONDS_PER_EPOCH', 'number'), + emOvmChainId: ensure('CHAIN_ID', 'number'), + sccFraudProofWindow: ensure('FRAUD_PROOF_WINDOW_SECONDS', 'number'), + sccSequencerPublishWindow: ensure('SEQUENCER_PUBLISH_WINDOW_SECONDS', 'number'), + } +} +const main = async () => { const config = parseEnv() await hre.run('deploy', { @@ -52,11 +76,12 @@ const main = async () => { path.resolve(__dirname, `../deployments/custom`) ).children.filter((child) => { return child.extension === '.json' - }).reduce((contracts, child) => { + }).reduce((contractsAccumulator, child) => { const contractName = child.name.replace('.json', '') + // eslint-disable-next-line @typescript-eslint/no-var-requires const artifact = require(path.resolve(__dirname, `../deployments/custom/${child.name}`)) - contracts[nicknames[contractName] || contractName] = artifact.address - return contracts + contractsAccumulator[nicknames[contractName] || contractName] = artifact.address + return contractsAccumulator }, {}) contracts.OVM_Sequencer = await sequencer.getAddress() @@ -79,26 +104,3 @@ main() ) process.exit(1) }) - -function parseEnv() { - function ensure(env, type) { - if (typeof process.env[env] === 'undefined') - return undefined - if (type === 'number') - return parseInt(process.env[env], 10) - return process.env[env] - } - - return { - l1BlockTimeSeconds: ensure('BLOCK_TIME_SECONDS', 'number'), - ctcForceInclusionPeriodSeconds: ensure('FORCE_INCLUSION_PERIOD_SECONDS', 'number'), - ctcMaxTransactionGasLimit: ensure('MAX_TRANSACTION_GAS_LIMIT', 'number'), - emMinTransactionGasLimit: ensure('MIN_TRANSACTION_GAS_LIMIT', 'number'), - emMaxtransactionGasLimit: ensure('MAX_TRANSACTION_GAS_LIMIT', 'number'), - emMaxGasPerQueuePerEpoch: ensure('MAX_GAS_PER_QUEUE_PER_EPOCH', 'number'), - emSecondsPerEpoch: ensure('ECONDS_PER_EPOCH', 'number'), - emOvmChainId: ensure('CHAIN_ID', 'number'), - sccFraudProofWindow: ensure('FRAUD_PROOF_WINDOW_SECONDS', 'number'), - sccSequencerPublishWindow: ensure('SEQUENCER_PUBLISH_WINDOW_SECONDS', 'number'), - } -} diff --git a/packages/contracts/package.json b/packages/contracts/package.json index eb4e94dddf50..ee109fe460d7 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -39,7 +39,7 @@ "lint:fix": "yarn run lint:fix:typescript", "lint:fix:typescript": "prettier --config .prettierrc.json --write \"hardhat.config.ts\" \"{src,test}/**/*.ts\"", "lint:check": "yarn run lint:typescript", - "lint:typescript": "tslint --format stylish --project .", + "lint:typescript": "eslint -c .eslintrc.js --ext .ts --format stylish .", "clean": "rm -rf ./dist ./artifacts ./artifacts-ovm ./cache ./cache-ovm ./tsconfig.build.tsbuildinfo", "deploy": "ts-node \"./bin/deploy.ts\" && yarn generate-markdown", "serve": "./bin/serve_dump.sh", @@ -74,11 +74,21 @@ "@types/mkdirp": "^1.0.1", "@types/mocha": "^8.2.2", "@types/yargs": "^16.0.1", + "@typescript-eslint/eslint-plugin": "^4.26.0", + "@typescript-eslint/parser": "^4.26.0", "buffer-xor": "^2.0.2", "chai": "^4.3.1", "copyfiles": "^2.3.0", "directory-tree": "^2.2.7", "dotenv": "^8.2.0", + "eslint": "^7.27.0", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-ban": "^1.5.2", + "eslint-plugin-import": "^2.23.4", + "eslint-plugin-jsdoc": "^35.1.2", + "eslint-plugin-prefer-arrow": "^1.2.3", + "eslint-plugin-react": "^7.24.0", + "eslint-plugin-unicorn": "^32.0.1", "ethereum-waffle": "^3.3.0", "ethers": "^5.0.31", "ganache-core": "^2.13.2", @@ -96,10 +106,6 @@ "solidity-coverage": "^0.7.16", "ts-generator": "0.0.8", "ts-node": "^9.1.1", - "tslint": "^6.1.3", - "tslint-config-prettier": "^1.18.0", - "tslint-no-focused-test": "^0.5.0", - "tslint-plugin-prettier": "^2.3.0", "typechain": "2.0.0", "yargs": "^16.2.0" }, diff --git a/packages/contracts/src/predeploys.ts b/packages/contracts/src/predeploys.ts index 05bc306ea752..3fbe691bd14a 100644 --- a/packages/contracts/src/predeploys.ts +++ b/packages/contracts/src/predeploys.ts @@ -3,9 +3,9 @@ * various useful functions. * * Notes: - * - 0x42...04 was the address of the OVM_ProxySequencerEntrypoint. This contract is no longer in - * use and has therefore been removed. We may place a new predeployed contract at this address - * in the future. See https://github.com/ethereum-optimism/optimism/pull/549 for more info. + * 0x42...04 was the address of the OVM_ProxySequencerEntrypoint. This contract is no longer in + * use and has therefore been removed. We may place a new predeployed contract at this address + * in the future. See https://github.com/ethereum-optimism/optimism/pull/549 for more info. */ export const predeploys = { OVM_L2ToL1MessagePasser: '0x4200000000000000000000000000000000000000', diff --git a/packages/contracts/src/state-dump/make-dump.ts b/packages/contracts/src/state-dump/make-dump.ts index 42179e516bc2..0038697a149c 100644 --- a/packages/contracts/src/state-dump/make-dump.ts +++ b/packages/contracts/src/state-dump/make-dump.ts @@ -12,6 +12,7 @@ import { predeploys } from '../predeploys' /** * Generates a storage dump for a given address. + * * @param cStateManager Instance of the callback-based internal vm StateManager. * @param address Address to generate a state dump for. */ @@ -44,6 +45,7 @@ const getStorageDump = async ( /** * Replaces old addresses found in a storage dump with new ones. + * * @param storageDump Storage dump to sanitize. * @param accounts Set of accounts to sanitize with. * @returns Sanitized storage dump. diff --git a/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L2DepositedERC20.spec.ts b/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L2DepositedERC20.spec.ts index 94e22562931e..74bf015a10ad 100644 --- a/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L2DepositedERC20.spec.ts +++ b/packages/contracts/test/contracts/OVM/bridge/assets/OVM_L2DepositedERC20.spec.ts @@ -35,8 +35,7 @@ describe('OVM_L2DepositedERC20', () => { let finalizeWithdrawalGasLimit: number beforeEach(async () => { // Create a special signer which will enable us to send messages from the L2Messenger contract - let l2MessengerImpersonator: Signer - ;[l2MessengerImpersonator] = await ethers.getSigners() + const [l2MessengerImpersonator] = await ethers.getSigners() // Get a new mock L2 messenger Mock__OVM_L2CrossDomainMessenger = await smockit( diff --git a/packages/contracts/test/contracts/OVM/verification/OVM_StateTransitioner.spec.ts b/packages/contracts/test/contracts/OVM/verification/OVM_StateTransitioner.spec.ts index 880343452b9e..633f6918500c 100644 --- a/packages/contracts/test/contracts/OVM/verification/OVM_StateTransitioner.spec.ts +++ b/packages/contracts/test/contracts/OVM/verification/OVM_StateTransitioner.spec.ts @@ -1,4 +1,3 @@ -/* tslint:disable:no-empty */ import { expect } from '../../../setup' /* External Imports */ diff --git a/packages/contracts/test/contracts/libraries/codec/Lib_EIP155Tx.spec.ts b/packages/contracts/test/contracts/libraries/codec/Lib_EIP155Tx.spec.ts index 021f14edcb19..844b92ab7df2 100644 --- a/packages/contracts/test/contracts/libraries/codec/Lib_EIP155Tx.spec.ts +++ b/packages/contracts/test/contracts/libraries/codec/Lib_EIP155Tx.spec.ts @@ -1,4 +1,3 @@ -/* tslint:disable:no-empty */ import '../../../setup' /* Internal Imports */ diff --git a/packages/contracts/test/contracts/libraries/codec/Lib_OVMCodec.spec.ts b/packages/contracts/test/contracts/libraries/codec/Lib_OVMCodec.spec.ts index 39310cdc31ba..f381372e1c15 100644 --- a/packages/contracts/test/contracts/libraries/codec/Lib_OVMCodec.spec.ts +++ b/packages/contracts/test/contracts/libraries/codec/Lib_OVMCodec.spec.ts @@ -1,4 +1,3 @@ -/* tslint:disable:no-empty */ import '../../../setup' /* Internal Imports */ diff --git a/packages/contracts/test/contracts/libraries/rlp/Lib_RLPWriter.spec.ts b/packages/contracts/test/contracts/libraries/rlp/Lib_RLPWriter.spec.ts index 70fab544901b..0398fcb5aa69 100644 --- a/packages/contracts/test/contracts/libraries/rlp/Lib_RLPWriter.spec.ts +++ b/packages/contracts/test/contracts/libraries/rlp/Lib_RLPWriter.spec.ts @@ -1,4 +1,3 @@ -/* tslint:disable:no-empty */ import { expect } from '../../../setup' /* External Imports */ diff --git a/packages/contracts/test/contracts/libraries/utils/Lib_EthUtils.spec.ts b/packages/contracts/test/contracts/libraries/utils/Lib_EthUtils.spec.ts index ab6d3aca62b1..10e620b61c9c 100644 --- a/packages/contracts/test/contracts/libraries/utils/Lib_EthUtils.spec.ts +++ b/packages/contracts/test/contracts/libraries/utils/Lib_EthUtils.spec.ts @@ -1,4 +1,3 @@ -/* tslint:disable:no-empty */ import { expect } from '../../../setup' /* External Imports */ @@ -300,6 +299,7 @@ describe('Lib_EthUtils', () => { }) }) + /* eslint-disable @typescript-eslint/no-empty-function */ describe('getCode(address)', () => { describe('when the contract does not exist', () => {}) @@ -359,4 +359,5 @@ describe('Lib_EthUtils', () => { }) }) }) + /* eslint-enable @typescript-eslint/no-empty-function */ }) diff --git a/packages/contracts/test/helpers/constants.ts b/packages/contracts/test/helpers/constants.ts index a2573a90ae00..1464b17b9ca2 100644 --- a/packages/contracts/test/helpers/constants.ts +++ b/packages/contracts/test/helpers/constants.ts @@ -45,7 +45,7 @@ try { len = fromHexString( getContractDefinition('Helper_TestRunner').deployedBytecode ).byteLength - /* tslint:disable:no-empty */ + // eslint-disable-next-line no-empty } catch {} export const Helper_TestRunner_BYTELEN = len diff --git a/packages/contracts/test/helpers/test-runner/test-runner.ts b/packages/contracts/test/helpers/test-runner/test-runner.ts index 0e80f525d9ca..c6ae9c200991 100644 --- a/packages/contracts/test/helpers/test-runner/test-runner.ts +++ b/packages/contracts/test/helpers/test-runner/test-runner.ts @@ -95,10 +95,10 @@ export class ExecutionManagerTestRunner { } public run(test: TestDefinition) { - // tslint:disable-next-line:ban-comma-operator ;(test.preState = merge( cloneDeep(this.defaultPreState), cloneDeep(test.preState) + // eslint-disable-next-line no-sequences )), (test.postState = test.postState || {}) diff --git a/packages/contracts/tsconfig.json b/packages/contracts/tsconfig.json index 9622d152c5da..aa33388023ee 100644 --- a/packages/contracts/tsconfig.json +++ b/packages/contracts/tsconfig.json @@ -2,7 +2,5 @@ "extends": "../../tsconfig.json", "compilerOptions": { "resolveJsonModule": true - }, - "include": ["./test", "src/**/*", "deployments"], - "files": ["./hardhat.config.ts"] + } } diff --git a/packages/contracts/tslint.json b/packages/contracts/tslint.json deleted file mode 100644 index 08c0a483cadc..000000000000 --- a/packages/contracts/tslint.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tslint.base.json", - "rules": { - "array-type": false, - "class-name": false, - "no-var-requires": false - } -} diff --git a/packages/core-utils/.eslintrc.js b/packages/core-utils/.eslintrc.js new file mode 100644 index 000000000000..9e57fbfb8492 --- /dev/null +++ b/packages/core-utils/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + "extends": "../../.eslintrc.js" +} diff --git a/packages/core-utils/package.json b/packages/core-utils/package.json index 74166fb352bd..90407cc36c81 100644 --- a/packages/core-utils/package.json +++ b/packages/core-utils/package.json @@ -15,7 +15,7 @@ "clean": "rimraf dist/ ./tsconfig.build.tsbuildinfo", "lint": "yarn lint:fix && yarn lint:check", "lint:fix": "prettier --config .prettierrc.json --write '{src,test}/**/*.ts'", - "lint:check": "tslint --format stylish --project .", + "lint:check": "eslint -c .eslintrc.js --ext .ts --format stylish .", "test": "ts-mocha test/**/*.spec.ts" }, "devDependencies": { @@ -23,14 +23,20 @@ "@types/lodash": "^4.14.168", "@types/mocha": "^8.2.2", "@types/prettier": "^2.2.3", + "@typescript-eslint/eslint-plugin": "^4.26.0", + "@typescript-eslint/parser": "^4.26.0", "chai": "^4.3.0", + "eslint": "^7.27.0", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-ban": "^1.5.2", + "eslint-plugin-import": "^2.23.4", + "eslint-plugin-jsdoc": "^35.1.2", + "eslint-plugin-prefer-arrow": "^1.2.3", + "eslint-plugin-react": "^7.24.0", + "eslint-plugin-unicorn": "^32.0.1", "mocha": "^8.3.0", "prettier": "^2.2.1", "ts-mocha": "^8.0.0", - "tslint": "^6.1.3", - "tslint-config-prettier": "^1.18.0", - "tslint-no-focused-test": "^0.5.0", - "tslint-plugin-prettier": "^2.3.0", "typescript": "^4.2.3" }, "dependencies": { diff --git a/packages/core-utils/src/common/hex-strings.ts b/packages/core-utils/src/common/hex-strings.ts index 71b412c76b56..aab9e9ebca80 100644 --- a/packages/core-utils/src/common/hex-strings.ts +++ b/packages/core-utils/src/common/hex-strings.ts @@ -3,6 +3,7 @@ import { BigNumber } from 'ethers' /** * Removes "0x" from start of a string if it exists. + * * @param str String to modify. * @returns the string without "0x". */ @@ -15,6 +16,7 @@ export const remove0x = (str: string): string => { /** * Adds "0x" to the start of a string if necessary. + * * @param str String to modify. * @returns the string with "0x". */ @@ -27,6 +29,7 @@ export const add0x = (str: string): string => { /** * Returns whether or not the provided string is a hex string. + * * @param str The string to test. * @returns True if the provided string is a hex string, false otherwise. */ @@ -36,6 +39,7 @@ export const isHexString = (inp: any): boolean => { /** * Casts a hex string to a buffer. + * * @param inp Input to cast to a buffer. * @return Input cast as a buffer. */ @@ -49,6 +53,7 @@ export const fromHexString = (inp: Buffer | string): Buffer => { /** * Casts an input to a hex string. + * * @param inp Input to cast to a hex string. * @return Input cast as a hex string. */ diff --git a/packages/core-utils/src/common/misc.ts b/packages/core-utils/src/common/misc.ts index 1a5fada81643..13d6a479adbb 100644 --- a/packages/core-utils/src/common/misc.ts +++ b/packages/core-utils/src/common/misc.ts @@ -1,5 +1,6 @@ /** * Basic timeout-based async sleep function. + * * @param ms Number of milliseconds to sleep. */ export const sleep = async (ms: number): Promise => { diff --git a/packages/core-utils/src/fees.ts b/packages/core-utils/src/fees.ts index 5a1008b1aa5a..ec489e77e97f 100644 --- a/packages/core-utils/src/fees.ts +++ b/packages/core-utils/src/fees.ts @@ -20,7 +20,7 @@ export interface EncodableL2GasLimit { l2GasPrice: BigNumber | number } -function encode(input: EncodableL2GasLimit): BigNumber { +const encode = (input: EncodableL2GasLimit): BigNumber => { const { data } = input let { l1GasPrice, l2GasLimit, l2GasPrice } = input if (typeof l1GasPrice === 'number') { @@ -43,7 +43,7 @@ function encode(input: EncodableL2GasLimit): BigNumber { return rounded.add(roundedScaledL2GasLimit) } -function decode(fee: BigNumber | number): BigNumber { +const decode = (fee: BigNumber | number): BigNumber => { if (typeof fee === 'number') { fee = BigNumber.from(fee) } @@ -56,7 +56,7 @@ export const TxGasLimit = { decode, } -export function ceilmod(a: BigNumber | number, b: BigNumber | number) { +export const ceilmod = (a: BigNumber | number, b: BigNumber | number) => { if (typeof a === 'number') { a = BigNumber.from(a) } @@ -72,7 +72,7 @@ export function ceilmod(a: BigNumber | number, b: BigNumber | number) { return rounded } -export function calculateL1GasLimit(data: string | Buffer): BigNumber { +export const calculateL1GasLimit = (data: string | Buffer): BigNumber => { const [zeroes, ones] = zeroesAndOnes(data) const zeroesCost = zeroes * txDataZeroGas const onesCost = ones * txDataNonZeroGasEIP2028 @@ -80,7 +80,7 @@ export function calculateL1GasLimit(data: string | Buffer): BigNumber { return BigNumber.from(gasLimit) } -export function zeroesAndOnes(data: Buffer | string): Array { +export const zeroesAndOnes = (data: Buffer | string): Array => { if (typeof data === 'string') { data = Buffer.from(remove0x(data), 'hex') } diff --git a/packages/core-utils/test/coders/batch-encoder.spec.ts b/packages/core-utils/test/coders/batch-encoder.spec.ts index ce277a72d051..473443e2a97c 100644 --- a/packages/core-utils/test/coders/batch-encoder.spec.ts +++ b/packages/core-utils/test/coders/batch-encoder.spec.ts @@ -42,6 +42,7 @@ describe('BatchEncoder', () => { }) it('should work with mainnet calldata', () => { + // eslint-disable-next-line @typescript-eslint/no-var-requires const data = require('../fixtures/appendSequencerBatch.json') for (const calldata of data.calldata) { const decoded = sequencerBatch.decode(calldata) diff --git a/packages/core-utils/tslint.json b/packages/core-utils/tslint.json deleted file mode 100644 index 6587c444f045..000000000000 --- a/packages/core-utils/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tslint.base.json" -} diff --git a/packages/data-transport-layer/.eslintrc.js b/packages/data-transport-layer/.eslintrc.js new file mode 100644 index 000000000000..9e57fbfb8492 --- /dev/null +++ b/packages/data-transport-layer/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + "extends": "../../.eslintrc.js" +} diff --git a/packages/data-transport-layer/package.json b/packages/data-transport-layer/package.json index 940bb46393f8..7982c69b08f1 100644 --- a/packages/data-transport-layer/package.json +++ b/packages/data-transport-layer/package.json @@ -14,7 +14,7 @@ "clean:db": "rimraf ./db", "lint": "yarn run lint:fix && yarn run lint:check", "lint:fix": "prettier --config .prettierrc.json --write \"{src,exec,test}/**/*.ts\"", - "lint:check": "tslint --format stylish --project .", + "lint:check": "eslint -c .eslintrc.js --ext .ts --format stylish .", "start": "ts-node ./src/services/run.ts", "start:local": "ts-node ./src/services/run.ts | pino-pretty", "test": "hardhat --config test/config/hardhat.config.ts test", @@ -52,18 +52,24 @@ "@types/mocha": "^8.2.2", "@types/node-fetch": "^2.5.8", "@types/workerpool": "^6.0.0", + "@typescript-eslint/eslint-plugin": "^4.26.0", + "@typescript-eslint/parser": "^4.26.0", "chai": "^4.3.4", "chai-as-promised": "^7.1.1", + "eslint": "^7.27.0", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-ban": "^1.5.2", + "eslint-plugin-import": "^2.23.4", + "eslint-plugin-jsdoc": "^35.1.2", + "eslint-plugin-prefer-arrow": "^1.2.3", + "eslint-plugin-react": "^7.24.0", + "eslint-plugin-unicorn": "^32.0.1", "hardhat": "^2.2.1", "mocha": "^8.3.2", "pino-pretty": "^4.7.1", "prettier": "^2.2.1", "rimraf": "^3.0.2", "ts-node": "^9.1.1", - "tslint": "^6.1.3", - "tslint-config-prettier": "^1.18.0", - "tslint-no-focused-test": "^0.5.0", - "tslint-plugin-prettier": "^2.3.0", "typescript": "^4.2.3" } } diff --git a/packages/data-transport-layer/src/client/client.ts b/packages/data-transport-layer/src/client/client.ts index 63dc3277c43e..724c72c30295 100644 --- a/packages/data-transport-layer/src/client/client.ts +++ b/packages/data-transport-layer/src/client/client.ts @@ -1,9 +1,9 @@ // Only load if not in browser. import { isNode } from 'browser-or-node' +// eslint-disable-next-line no-var declare var window: any -/* tslint:disable-next-line:no-var-requires */ const fetch = isNode ? require('node-fetch') : window.fetch import { diff --git a/packages/data-transport-layer/src/db/transport-db.ts b/packages/data-transport-layer/src/db/transport-db.ts index 777ba4423dde..ab98254bb06e 100644 --- a/packages/data-transport-layer/src/db/transport-db.ts +++ b/packages/data-transport-layer/src/db/transport-db.ts @@ -402,7 +402,7 @@ export class TransportDB { } } -function stringify(entry) { +const stringify = (entry) => { if (entry === null || entry === undefined) { return entry } diff --git a/packages/data-transport-layer/src/services/l1-ingestion/service.ts b/packages/data-transport-layer/src/services/l1-ingestion/service.ts index d682fa5436b8..27548303d950 100644 --- a/packages/data-transport-layer/src/services/l1-ingestion/service.ts +++ b/packages/data-transport-layer/src/services/l1-ingestion/service.ts @@ -321,6 +321,7 @@ export class L1IngestionService extends BaseService { /** * Gets the address of a contract at a particular block in the past. + * * @param contractName Name of the contract to get an address for. * @param blockNumber Block at which to get an address. * @return Contract address. diff --git a/packages/data-transport-layer/src/services/l2-ingestion/service.ts b/packages/data-transport-layer/src/services/l2-ingestion/service.ts index a9f59f7cb261..9b3eead27be5 100644 --- a/packages/data-transport-layer/src/services/l2-ingestion/service.ts +++ b/packages/data-transport-layer/src/services/l2-ingestion/service.ts @@ -132,6 +132,7 @@ export class L2IngestionService extends BaseService { /** * Synchronizes unconfirmed transactions from a range of sequencer blocks. + * * @param startBlockNumber Block to start querying from. * @param endBlockNumber Block to query to. */ diff --git a/packages/data-transport-layer/src/services/server/service.ts b/packages/data-transport-layer/src/services/server/service.ts index 7accc0bd8dec..202c3e2454d9 100644 --- a/packages/data-transport-layer/src/services/server/service.ts +++ b/packages/data-transport-layer/src/services/server/service.ts @@ -169,6 +169,7 @@ export class L1TransportServer extends BaseService { /** * Registers a route on the server. + * * @param method Http method type. * @param route Route to register. * @param handler Handler called and is expected to return a JSON response. diff --git a/packages/data-transport-layer/src/utils/common.ts b/packages/data-transport-layer/src/utils/common.ts index f659b4f6ef27..30838461b861 100644 --- a/packages/data-transport-layer/src/utils/common.ts +++ b/packages/data-transport-layer/src/utils/common.ts @@ -2,6 +2,7 @@ import { toHexString } from '@eth-optimism/core-utils' /** * Basic timeout-based async sleep function. + * * @param ms Number of milliseconds to sleep. */ export const sleep = async (ms: number): Promise => { diff --git a/packages/data-transport-layer/tslint.json b/packages/data-transport-layer/tslint.json deleted file mode 100644 index a6e3c32c8f70..000000000000 --- a/packages/data-transport-layer/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tslint.base.json" -} diff --git a/packages/hardhat-ovm/.eslintrc.js b/packages/hardhat-ovm/.eslintrc.js new file mode 100644 index 000000000000..9e57fbfb8492 --- /dev/null +++ b/packages/hardhat-ovm/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + "extends": "../../.eslintrc.js" +} diff --git a/packages/hardhat-ovm/package.json b/packages/hardhat-ovm/package.json index b6fbeb975873..ac896191a73a 100644 --- a/packages/hardhat-ovm/package.json +++ b/packages/hardhat-ovm/package.json @@ -13,7 +13,7 @@ "build": "tsc -p tsconfig.build.json", "lint": "yarn run lint:fix && yarn run lint:check", "lint:fix": "prettier --config .prettierrc.json --write \"{src,test}/**/*.ts\"", - "lint:check": "tslint --format stylish --project ." + "lint:check": "eslint -c .eslintrc.js --ext .ts --format stylish ." }, "dependencies": { "node-fetch": "^2.6.1" @@ -25,10 +25,16 @@ "devDependencies": { "@types/mocha": "^8.2.2", "@types/node-fetch": "^2.5.10", - "prettier": "^2.2.1", - "tslint": "^6.1.3", - "tslint-config-prettier": "^1.18.0", - "tslint-no-focused-test": "^0.5.0", - "tslint-plugin-prettier": "^2.3.0" + "@typescript-eslint/eslint-plugin": "^4.26.0", + "@typescript-eslint/parser": "^4.26.0", + "eslint": "^7.27.0", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-ban": "^1.5.2", + "eslint-plugin-import": "^2.23.4", + "eslint-plugin-jsdoc": "^35.1.2", + "eslint-plugin-prefer-arrow": "^1.2.3", + "eslint-plugin-react": "^7.24.0", + "eslint-plugin-unicorn": "^32.0.1", + "prettier": "^2.2.1" } } diff --git a/packages/hardhat-ovm/src/index.ts b/packages/hardhat-ovm/src/index.ts index 1284016a2455..1e13fec51d4c 100644 --- a/packages/hardhat-ovm/src/index.ts +++ b/packages/hardhat-ovm/src/index.ts @@ -35,6 +35,7 @@ const OVM_POLLING_INTERVAL = 50 /** * Find or generate an OVM soljson.js compiler file and return the path of this file. * We pass the path to this file into hardhat. + * * @param version Solidity compiler version to get a path for in the format `X.Y.Z`. * @return Path to the downloaded soljson.js file. */ @@ -289,7 +290,7 @@ extendEnvironment(async (hre) => { } ;(hre as any).ethers.getSigners = () => signers - /* tslint:disable:no-empty */ + // eslint-disable-next-line no-empty } catch (e) {} // Update the provider at the very end to avoid any weird issues. diff --git a/packages/hardhat-ovm/tslint.json b/packages/hardhat-ovm/tslint.json deleted file mode 100644 index 6587c444f045..000000000000 --- a/packages/hardhat-ovm/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tslint.base.json" -} diff --git a/packages/message-relayer/.eslintrc.js b/packages/message-relayer/.eslintrc.js new file mode 100644 index 000000000000..9e57fbfb8492 --- /dev/null +++ b/packages/message-relayer/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + "extends": "../../.eslintrc.js" +} diff --git a/packages/message-relayer/package.json b/packages/message-relayer/package.json index 2847bc3af931..9d6f1ffd4c32 100644 --- a/packages/message-relayer/package.json +++ b/packages/message-relayer/package.json @@ -13,7 +13,7 @@ "clean": "rimraf dist/ ./tsconfig.build.tsbuildinfo", "lint": "yarn lint:fix && yarn lint:check", "lint:fix": "prettier --config .prettierrc.json --write \"{src,exec,test}/**/*.ts\"", - "lint:check": "tslint --format stylish --project .", + "lint:check": "eslint -c .eslintrc.js --ext .ts --format stylish .", "test": "hardhat test --show-stack-traces" }, "keywords": [ @@ -46,16 +46,22 @@ "@types/chai": "^4.2.18", "@types/chai-as-promised": "^7.1.4", "@types/mocha": "^8.2.2", + "@typescript-eslint/eslint-plugin": "^4.26.0", + "@typescript-eslint/parser": "^4.26.0", "chai": "^4.3.4", "chai-as-promised": "^7.1.1", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-ban": "^1.5.2", + "eslint-plugin-import": "^2.23.4", + "eslint-plugin-jsdoc": "^35.1.2", + "eslint-plugin-prefer-arrow": "^1.2.3", + "eslint-plugin-react": "^7.24.0", + "eslint-plugin-unicorn": "^32.0.1", "ethereum-waffle": "^3.3.0", "hardhat": "^2.3.0", "lodash": "^4.17.21", "mocha": "^8.4.0", - "prettier": "^2.2.1", - "tslint": "^6.1.3", - "tslint-config-prettier": "^1.18.0", - "tslint-no-focused-test": "^0.5.0", - "tslint-plugin-prettier": "^2.3.0" + "eslint": "^7.27.0", + "prettier": "^2.2.1" } } diff --git a/packages/message-relayer/src/relay-tx.ts b/packages/message-relayer/src/relay-tx.ts index 92c83e189add..1a093da90971 100644 --- a/packages/message-relayer/src/relay-tx.ts +++ b/packages/message-relayer/src/relay-tx.ts @@ -59,6 +59,7 @@ interface StateTrieProof { /** * Finds all L2 => L1 messages triggered by a given L2 transaction, if the message exists. + * * @param l2RpcProvider L2 RPC provider. * @param l2CrossDomainMessengerAddress Address of the L2CrossDomainMessenger. * @param l2TransactionHash Hash of the L2 transaction to find a message for. @@ -110,6 +111,7 @@ export const getMessagesByTransactionHash = async ( /** * Encodes a cross domain message. + * * @param message Message to encode. * @returns Encoded message. */ @@ -126,6 +128,7 @@ const encodeCrossDomainMessage = (message: CrossDomainMessage): string => { /** * Finds the StateBatchAppended event associated with a given L2 transaction. + * * @param l1RpcProvider L1 RPC provider. * @param l1StateCommitmentChainAddress Address of the L1StateCommitmentChain. * @param l2TransactionIndex Index of the L2 transaction to find a StateBatchAppended event for. @@ -206,6 +209,7 @@ export const getStateBatchAppendedEventByTransactionIndex = async ( /** * Finds the full state root batch associated with a given transaction index. + * * @param l1RpcProvider L1 RPC provider. * @param l1StateCommitmentChainAddress Address of the L1StateCommitmentChain. * @param l2TransactionIndex Index of the L2 transaction to find a state root batch for. @@ -252,6 +256,7 @@ export const getStateRootBatchByTransactionIndex = async ( /** * Generates a Merkle proof (using the particular scheme we use within Lib_MerkleTree). + * * @param leaves Leaves of the merkle tree. * @param index Index to generate a proof for. * @returns Merkle proof sibling leaves, as hex strings. @@ -288,6 +293,7 @@ const getMerkleTreeProof = (leaves: string[], index: number): string[] => { /** * Generates a Merkle-Patricia trie proof for a given account and storage slot. + * * @param l2RpcProvider L2 RPC provider. * @param blockNumber Block number to generate the proof at. * @param address Address to generate the proof for. @@ -315,6 +321,7 @@ const getStateTrieProof = async ( /** * Finds all L2 => L1 messages sent in a given L2 transaction and generates proofs for each of * those messages. + * * @param l1RpcProvider L1 RPC provider. * @param l2RpcProvider L2 RPC provider. * @param l1StateCommitmentChainAddress Address of the StateCommitmentChain. diff --git a/packages/message-relayer/src/service.ts b/packages/message-relayer/src/service.ts index c69305fd262c..9052e946f6b3 100644 --- a/packages/message-relayer/src/service.ts +++ b/packages/message-relayer/src/service.ts @@ -367,6 +367,7 @@ export class MessageRelayerService extends BaseService { /** * Returns all sent message events between some start height (inclusive) and an end height * (exclusive). + * * @param startHeight Start height to start finding messages from. * @param endHeight End height to finish finding messages at. * @returns All sent messages between start and end height, sorted by transaction index in diff --git a/packages/message-relayer/tslint.json b/packages/message-relayer/tslint.json deleted file mode 100644 index 6587c444f045..000000000000 --- a/packages/message-relayer/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tslint.base.json" -} diff --git a/packages/smock/.eslintrc.js b/packages/smock/.eslintrc.js new file mode 100644 index 000000000000..5f329b2b72e5 --- /dev/null +++ b/packages/smock/.eslintrc.js @@ -0,0 +1,7 @@ +module.exports = { + "extends": "../../.eslintrc.js", + "parserOptions": { + "project": "./tsconfig.json", + "sourceType": "module" + } +} diff --git a/packages/smock/package.json b/packages/smock/package.json index 4a41c1d58444..3564296c9fd3 100644 --- a/packages/smock/package.json +++ b/packages/smock/package.json @@ -13,7 +13,7 @@ "test": "hardhat test --show-stack-traces", "lint": "yarn lint:fix && yarn lint:check", "lint:fix": "prettier --config ./.prettierrc.json --write \"hardhat.config.ts\" \"{src,test}/**/*.ts\"", - "lint:check": "tslint --format stylish --project .", + "lint:check": "eslint -c .eslintrc.js --ext .ts --format stylish .", "clean": "rimraf ./artifacts ./cache ./dist ./tsconfig.build.tsbuildinfo" }, "peerDependencies": { @@ -41,15 +41,21 @@ "@types/glob": "^7.1.3", "@types/lodash": "^4.14.161", "@types/prettier": "^2.2.3", + "@typescript-eslint/eslint-plugin": "^4.26.0", + "@typescript-eslint/parser": "^4.26.0", "chai": "^4.3.0", + "eslint": "^7.27.0", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-ban": "^1.5.2", + "eslint-plugin-import": "^2.23.4", + "eslint-plugin-jsdoc": "^35.1.2", + "eslint-plugin-prefer-arrow": "^1.2.3", + "eslint-plugin-react": "^7.24.0", + "eslint-plugin-unicorn": "^32.0.1", "ethereum-waffle": "^3.3.0", "ethers": "^5.0.31", "hardhat": "^2.2.1", "lodash": "^4.17.20", - "prettier": "^2.2.1", - "tslint": "^6.1.3", - "tslint-config-prettier": "^1.18.0", - "tslint-no-focused-test": "^0.5.0", - "tslint-plugin-prettier": "^2.3.0" + "prettier": "^2.2.1" } } diff --git a/packages/smock/src/common/hardhat-common.ts b/packages/smock/src/common/hardhat-common.ts index dd692caf1350..cf4f96f0c8db 100644 --- a/packages/smock/src/common/hardhat-common.ts +++ b/packages/smock/src/common/hardhat-common.ts @@ -13,6 +13,7 @@ import { fromHexString, toHexString } from '@eth-optimism/core-utils' * This object has direct access to the node (provider._node), which in turn has direct access to * the ethereumjs-vm instance (provider._node._vm). So it's quite useful to be able to find this * object reliably! + * * @param hre hardhat runtime environment to pull the base provider from. * @return base hardhat network provider */ @@ -49,6 +50,7 @@ export const findBaseHardhatProvider = ( /** * Converts a string into the fancy new address thing that ethereumjs-vm v5 expects while also * maintaining backwards compatibility with ethereumjs-vm v4. + * * @param address String address to convert into the fancy new address type. * @returns Fancified address. */ @@ -67,6 +69,7 @@ export const toFancyAddress = (address: string): any => { /** * Same as toFancyAddress but in the opposite direction. + * * @param fancyAddress Fancy address to turn into a string. * @returns Way more boring address. */ diff --git a/packages/smock/src/smockit/binding.ts b/packages/smock/src/smockit/binding.ts index 3436d6390cff..349b471aa6b0 100644 --- a/packages/smock/src/smockit/binding.ts +++ b/packages/smock/src/smockit/binding.ts @@ -7,11 +7,11 @@ import BN from 'bn.js' // Handle hardhat ^2.2.0 let TransactionExecutionError: any try { - // tslint:disable-next-line + // eslint-disable-next-line @typescript-eslint/no-var-requires TransactionExecutionError = require('hardhat/internal/hardhat-network/provider/errors') .TransactionExecutionError } catch (err) { - // tslint:disable-next-line + // eslint-disable-next-line @typescript-eslint/no-var-requires TransactionExecutionError = require('hardhat/internal/core/providers/errors') .TransactionExecutionError } @@ -23,6 +23,7 @@ import { fromFancyAddress, toFancyAddress } from '../common' /** * Checks to see if smock has been initialized already. Basically just checking to see if we've * attached smock state to the VM already. + * * @param provider Base hardhat network provider to check. * @return Whether or not the provider has already been modified to support smock. */ @@ -32,6 +33,7 @@ const isSmockInitialized = (provider: HardhatNetworkProvider): boolean => { /** * Modifies a hardhat provider to be compatible with smock. + * * @param provider Base hardhat network provider to modify. */ const initializeSmock = (provider: HardhatNetworkProvider): void => { @@ -156,6 +158,7 @@ const initializeSmock = (provider: HardhatNetworkProvider): void => { /** * Attaches a smocked contract to a hardhat network provider. Will also modify the provider to be * compatible with smock if not done already. + * * @param mock Smocked contract to attach to a provider. * @param provider Hardhat network provider to attach the contract to. */ diff --git a/packages/smock/src/smockit/smockit.ts b/packages/smock/src/smockit/smockit.ts index 1673064518aa..e206baad1d28 100644 --- a/packages/smock/src/smockit/smockit.ts +++ b/packages/smock/src/smockit/smockit.ts @@ -23,6 +23,7 @@ import { findBaseHardhatProvider } from '../common' /** * Generates an ethers Interface instance when given a smock spec. Meant for standardizing the * various input types we might reasonably want to support. + * * @param spec Smock specification object. Thing you want to base the interface on. * @param hre Hardhat runtime environment. Used so we can * @return Interface generated from the spec. @@ -57,6 +58,7 @@ const makeContractInterfaceFromSpec = async ( /** * Creates a mock contract function from a real contract function. + * * @param contract Contract object to make a mock function for. * @param functionName Name of the function to mock. * @param vm Virtual machine reference, necessary for call assertions to work. @@ -137,6 +139,7 @@ const smockifyFunction = ( /** * Turns a specification into a mock contract. + * * @param spec Smock contract specification. * @param opts Optional additional settings. */ diff --git a/packages/smock/src/smoddit/smoddit.ts b/packages/smock/src/smoddit/smoddit.ts index 19410e98fda5..8afc33e8d33d 100644 --- a/packages/smock/src/smoddit/smoddit.ts +++ b/packages/smock/src/smoddit/smoddit.ts @@ -10,6 +10,7 @@ import { findBaseHardhatProvider, toFancyAddress } from '../common' /** * Creates a modifiable contract factory. + * * @param name Name of the contract to smoddify. * @param signer Optional signer to attach to the factory. * @returns Smoddified contract factory. diff --git a/packages/smock/src/smoddit/storage.ts b/packages/smock/src/smoddit/storage.ts index e97bd3239a0c..24c7eecc6439 100644 --- a/packages/smock/src/smoddit/storage.ts +++ b/packages/smock/src/smoddit/storage.ts @@ -21,6 +21,7 @@ interface StorageSlot { /** * Reads the storage layout of a contract. + * * @param name Name of the contract to get a storage layout for. * @return Storage layout for the given contract name. */ @@ -43,6 +44,7 @@ export const getStorageLayout = async (name: string): Promise => { /** * Converts storage into a list of storage slots. + * * @param storageLayout Contract storage layout. * @param obj Storage object to convert. * @returns List of storage slots. @@ -108,6 +110,7 @@ export const getStorageSlots = ( /** * Flattens an object. + * * @param obj Object to flatten. * @param prefix Current object prefix (used recursively). * @param res Current result (used recursively). @@ -143,6 +146,7 @@ const flattenObject = ( /** * Gets the slot positions for a provided variable type. + * * @param storageLayout Contract's storage layout. * @param inputTypeName Variable type name. * @returns Slot positions. diff --git a/packages/smock/tsconfig.json b/packages/smock/tsconfig.json index 8a032ca1110a..4082f16a5d91 100644 --- a/packages/smock/tsconfig.json +++ b/packages/smock/tsconfig.json @@ -1,6 +1,3 @@ { - "extends": "../../tsconfig.json", - "files": [ - "./hardhat.config.ts" - ] + "extends": "../../tsconfig.json" } diff --git a/packages/smock/tslint.json b/packages/smock/tslint.json deleted file mode 100644 index 6587c444f045..000000000000 --- a/packages/smock/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tslint.base.json" -} diff --git a/tslint.base.json b/tslint.base.json deleted file mode 100644 index 28bab7f8245b..000000000000 --- a/tslint.base.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "extends": [ - "tslint:latest", - "tslint-config-prettier", - "tslint-plugin-prettier" - ], - "rulesDirectory": [ - "tslint-no-focused-test" - ], - "rules": { - "ban-types": false, - "comment-format": false, - "interface-name": false, - "max-classes-per-file": false, - "member-ordering": false, - "no-console": false, - "no-bitwise": false, - "no-empty-interface": false, - "no-implicit-dependencies": [true, "dev"], - "no-string-literal": false, - "no-submodule-imports": false, - "no-unused-expression": false, - "object-literal-sort-keys": false, - "prefer-conditional-expression": false, - "ordered-imports": false, - "semicolon": false, - "variable-name": false, - "no-focused-test": true, - "array-type": false, - "prettier": [true, "./.prettierrc.json"], - "curly": true - }, - "linterOptions": { - "exclude": [ - "**/node_modules/**/*" - ] - } -} diff --git a/yarn.lock b/yarn.lock index cc075769cbea..5ade0edd675a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,18 +2,182 @@ # yarn lockfile v1 -"@babel/code-frame@^7.0.0": +"@babel/code-frame@7.12.11": + version "7.12.11" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f" + integrity sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw== + dependencies: + "@babel/highlight" "^7.10.4" + +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13": version "7.12.13" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.13.tgz#dcfc826beef65e75c50e21d3837d7d95798dd658" integrity sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g== dependencies: "@babel/highlight" "^7.12.13" +"@babel/compat-data@^7.14.4": + version "7.14.4" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.14.4.tgz#45720fe0cecf3fd42019e1d12cc3d27fadc98d58" + integrity sha512-i2wXrWQNkH6JplJQGn3Rd2I4Pij8GdHkXwHMxm+zV5YG/Jci+bCNrWZEWC4o+umiDkRrRs4dVzH3X4GP7vyjQQ== + +"@babel/core@^7.12.16": + version "7.14.3" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.14.3.tgz#5395e30405f0776067fbd9cf0884f15bfb770a38" + integrity sha512-jB5AmTKOCSJIZ72sd78ECEhuPiDMKlQdDI/4QRI6lzYATx5SSogS1oQA2AoPecRCknm30gHi2l+QVvNUu3wZAg== + dependencies: + "@babel/code-frame" "^7.12.13" + "@babel/generator" "^7.14.3" + "@babel/helper-compilation-targets" "^7.13.16" + "@babel/helper-module-transforms" "^7.14.2" + "@babel/helpers" "^7.14.0" + "@babel/parser" "^7.14.3" + "@babel/template" "^7.12.13" + "@babel/traverse" "^7.14.2" + "@babel/types" "^7.14.2" + convert-source-map "^1.7.0" + debug "^4.1.0" + gensync "^1.0.0-beta.2" + json5 "^2.1.2" + semver "^6.3.0" + source-map "^0.5.0" + +"@babel/eslint-parser@^7.12.16": + version "7.14.4" + resolved "https://registry.yarnpkg.com/@babel/eslint-parser/-/eslint-parser-7.14.4.tgz#73e6996163a2ad48f315a8466b55f57c330cd15c" + integrity sha512-7CTckFLPBGEfCKqlrnJq2PIId3UmJ5hW+D4dsv/VvuA5DapgqyZFCttq+8oeRIJMZQizFIe5gel3xm2SbrqlYA== + dependencies: + eslint-scope "^5.1.0" + eslint-visitor-keys "^2.1.0" + semver "^6.3.0" + +"@babel/generator@^7.14.2", "@babel/generator@^7.14.3": + version "7.14.3" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.14.3.tgz#0c2652d91f7bddab7cccc6ba8157e4f40dcedb91" + integrity sha512-bn0S6flG/j0xtQdz3hsjJ624h3W0r3llttBMfyHX3YrZ/KtLYr15bjA0FXkgW7FpvrDuTuElXeVjiKlYRpnOFA== + dependencies: + "@babel/types" "^7.14.2" + jsesc "^2.5.1" + source-map "^0.5.0" + +"@babel/helper-compilation-targets@^7.13.16": + version "7.14.4" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.14.4.tgz#33ebd0ffc34248051ee2089350a929ab02f2a516" + integrity sha512-JgdzOYZ/qGaKTVkn5qEDV/SXAh8KcyUVkCoSWGN8T3bwrgd6m+/dJa2kVGi6RJYJgEYPBdZ84BZp9dUjNWkBaA== + dependencies: + "@babel/compat-data" "^7.14.4" + "@babel/helper-validator-option" "^7.12.17" + browserslist "^4.16.6" + semver "^6.3.0" + +"@babel/helper-function-name@^7.14.2": + version "7.14.2" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.14.2.tgz#397688b590760b6ef7725b5f0860c82427ebaac2" + integrity sha512-NYZlkZRydxw+YT56IlhIcS8PAhb+FEUiOzuhFTfqDyPmzAhRge6ua0dQYT/Uh0t/EDHq05/i+e5M2d4XvjgarQ== + dependencies: + "@babel/helper-get-function-arity" "^7.12.13" + "@babel/template" "^7.12.13" + "@babel/types" "^7.14.2" + +"@babel/helper-get-function-arity@^7.12.13": + version "7.12.13" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.12.13.tgz#bc63451d403a3b3082b97e1d8b3fe5bd4091e583" + integrity sha512-DjEVzQNz5LICkzN0REdpD5prGoidvbdYk1BVgRUOINaWJP2t6avB27X1guXK1kXNrX0WMfsrm1A/ZBthYuIMQg== + dependencies: + "@babel/types" "^7.12.13" + +"@babel/helper-member-expression-to-functions@^7.13.12": + version "7.13.12" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.13.12.tgz#dfe368f26d426a07299d8d6513821768216e6d72" + integrity sha512-48ql1CLL59aKbU94Y88Xgb2VFy7a95ykGRbJJaaVv+LX5U8wFpLfiGXJJGUozsmA1oEh/o5Bp60Voq7ACyA/Sw== + dependencies: + "@babel/types" "^7.13.12" + +"@babel/helper-module-imports@^7.13.12": + version "7.13.12" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.13.12.tgz#c6a369a6f3621cb25da014078684da9196b61977" + integrity sha512-4cVvR2/1B693IuOvSI20xqqa/+bl7lqAMR59R4iu39R9aOX8/JoYY1sFaNvUMyMBGnHdwvJgUrzNLoUZxXypxA== + dependencies: + "@babel/types" "^7.13.12" + +"@babel/helper-module-transforms@^7.14.2": + version "7.14.2" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.14.2.tgz#ac1cc30ee47b945e3e0c4db12fa0c5389509dfe5" + integrity sha512-OznJUda/soKXv0XhpvzGWDnml4Qnwp16GN+D/kZIdLsWoHj05kyu8Rm5kXmMef+rVJZ0+4pSGLkeixdqNUATDA== + dependencies: + "@babel/helper-module-imports" "^7.13.12" + "@babel/helper-replace-supers" "^7.13.12" + "@babel/helper-simple-access" "^7.13.12" + "@babel/helper-split-export-declaration" "^7.12.13" + "@babel/helper-validator-identifier" "^7.14.0" + "@babel/template" "^7.12.13" + "@babel/traverse" "^7.14.2" + "@babel/types" "^7.14.2" + +"@babel/helper-optimise-call-expression@^7.12.13": + version "7.12.13" + resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.12.13.tgz#5c02d171b4c8615b1e7163f888c1c81c30a2aaea" + integrity sha512-BdWQhoVJkp6nVjB7nkFWcn43dkprYauqtk++Py2eaf/GRDFm5BxRqEIZCiHlZUGAVmtwKcsVL1dC68WmzeFmiA== + dependencies: + "@babel/types" "^7.12.13" + +"@babel/helper-replace-supers@^7.13.12": + version "7.14.4" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.14.4.tgz#b2ab16875deecfff3ddfcd539bc315f72998d836" + integrity sha512-zZ7uHCWlxfEAAOVDYQpEf/uyi1dmeC7fX4nCf2iz9drnCwi1zvwXL3HwWWNXUQEJ1k23yVn3VbddiI9iJEXaTQ== + dependencies: + "@babel/helper-member-expression-to-functions" "^7.13.12" + "@babel/helper-optimise-call-expression" "^7.12.13" + "@babel/traverse" "^7.14.2" + "@babel/types" "^7.14.4" + +"@babel/helper-simple-access@^7.13.12": + version "7.13.12" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.13.12.tgz#dd6c538afb61819d205a012c31792a39c7a5eaf6" + integrity sha512-7FEjbrx5SL9cWvXioDbnlYTppcZGuCY6ow3/D5vMggb2Ywgu4dMrpTJX0JdQAIcRRUElOIxF3yEooa9gUb9ZbA== + dependencies: + "@babel/types" "^7.13.12" + +"@babel/helper-split-export-declaration@^7.12.13": + version "7.12.13" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.12.13.tgz#e9430be00baf3e88b0e13e6f9d4eaf2136372b05" + integrity sha512-tCJDltF83htUtXx5NLcaDqRmknv652ZWCHyoTETf1CXYJdPC7nohZohjUgieXhv0hTJdRf2FjDueFehdNucpzg== + dependencies: + "@babel/types" "^7.12.13" + "@babel/helper-validator-identifier@^7.12.11": version "7.12.11" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz#c9a1f021917dcb5ccf0d4e453e399022981fc9ed" integrity sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw== +"@babel/helper-validator-identifier@^7.14.0": + version "7.14.0" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.0.tgz#d26cad8a47c65286b15df1547319a5d0bcf27288" + integrity sha512-V3ts7zMSu5lfiwWDVWzRDGIN+lnCEUdaXgtVHJgLb1rGaA6jMrtB9EmE7L18foXJIE8Un/A/h6NJfGQp/e1J4A== + +"@babel/helper-validator-option@^7.12.17": + version "7.12.17" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.12.17.tgz#d1fbf012e1a79b7eebbfdc6d270baaf8d9eb9831" + integrity sha512-TopkMDmLzq8ngChwRlyjR6raKD6gMSae4JdYDB8bByKreQgG0RBTuKe9LRxW3wFtUnjxOPRKBDwEH6Mg5KeDfw== + +"@babel/helpers@^7.14.0": + version "7.14.0" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.14.0.tgz#ea9b6be9478a13d6f961dbb5f36bf75e2f3b8f62" + integrity sha512-+ufuXprtQ1D1iZTO/K9+EBRn+qPWMJjZSw/S0KlFrxCw4tkrzv9grgpDHkY9MeQTjTY8i2sp7Jep8DfU6tN9Mg== + dependencies: + "@babel/template" "^7.12.13" + "@babel/traverse" "^7.14.0" + "@babel/types" "^7.14.0" + +"@babel/highlight@^7.10.4": + version "7.14.0" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.14.0.tgz#3197e375711ef6bf834e67d0daec88e4f46113cf" + integrity sha512-YSCOwxvTYEIMSGaBQb5kDDsCopDdiUGsqpatp3fOlI4+2HQSkTmEVWnVuySdAC5EWCqSWWTv0ib63RjR7dTBdg== + dependencies: + "@babel/helper-validator-identifier" "^7.14.0" + chalk "^2.0.0" + js-tokens "^4.0.0" + "@babel/highlight@^7.12.13": version "7.13.10" resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.13.10.tgz#a8b2a66148f5b27d666b15d81774347a731d52d1" @@ -23,6 +187,11 @@ chalk "^2.0.0" js-tokens "^4.0.0" +"@babel/parser@^7.12.13", "@babel/parser@^7.14.2", "@babel/parser@^7.14.3": + version "7.14.4" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.14.4.tgz#a5c560d6db6cd8e6ed342368dea8039232cbab18" + integrity sha512-ArliyUsWDUqEGfWcmzpGUzNfLxTdTp6WU4IuP6QFSp9gGfWS6boxFCkJSJ/L4+RG8z/FnIU3WxCk6hPL9SSWeA== + "@babel/runtime@^7.10.4", "@babel/runtime@^7.5.5": version "7.13.10" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.13.10.tgz#47d42a57b6095f4468da440388fdbad8bebf0d7d" @@ -30,6 +199,37 @@ dependencies: regenerator-runtime "^0.13.4" +"@babel/template@^7.12.13": + version "7.12.13" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.12.13.tgz#530265be8a2589dbb37523844c5bcb55947fb327" + integrity sha512-/7xxiGA57xMo/P2GVvdEumr8ONhFOhfgq2ihK3h1e6THqzTAkHbkXgB0xI9yeTfIUoH3+oAeHhqm/I43OTbbjA== + dependencies: + "@babel/code-frame" "^7.12.13" + "@babel/parser" "^7.12.13" + "@babel/types" "^7.12.13" + +"@babel/traverse@^7.14.0", "@babel/traverse@^7.14.2": + version "7.14.2" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.14.2.tgz#9201a8d912723a831c2679c7ebbf2fe1416d765b" + integrity sha512-TsdRgvBFHMyHOOzcP9S6QU0QQtjxlRpEYOy3mcCO5RgmC305ki42aSAmfZEMSSYBla2oZ9BMqYlncBaKmD/7iA== + dependencies: + "@babel/code-frame" "^7.12.13" + "@babel/generator" "^7.14.2" + "@babel/helper-function-name" "^7.14.2" + "@babel/helper-split-export-declaration" "^7.12.13" + "@babel/parser" "^7.14.2" + "@babel/types" "^7.14.2" + debug "^4.1.0" + globals "^11.1.0" + +"@babel/types@^7.12.13", "@babel/types@^7.13.12", "@babel/types@^7.14.0", "@babel/types@^7.14.2", "@babel/types@^7.14.4": + version "7.14.4" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.14.4.tgz#bfd6980108168593b38b3eb48a24aa026b919bc0" + integrity sha512-lCj4aIs0xUefJFQnwwQv2Bxg7Omd6bgquZ6LGC+gGMh6/s5qDVfjuCMlDmYQ15SLsWHd9n+X3E75lKIhl5Lkiw== + dependencies: + "@babel/helper-validator-identifier" "^7.14.0" + to-fast-properties "^2.0.0" + "@changesets/apply-release-plan@^5.0.0": version "5.0.0" resolved "https://registry.yarnpkg.com/@changesets/apply-release-plan/-/apply-release-plan-5.0.0.tgz#11bf168acecbf4cfa2b0e6425160bac5ceeec1c3" @@ -256,6 +456,30 @@ resolved "https://registry.yarnpkg.com/@ensdomains/resolver/-/resolver-0.2.4.tgz#c10fe28bf5efbf49bff4666d909aed0265efbc89" integrity sha512-bvaTH34PMCbv6anRa9I/0zjLJgY4EuznbEMgbV77JBCQ9KNC46rzi0avuxpOfu+xDjPEtSFGqVEOr5GlUSGudA== +"@es-joy/jsdoccomment@^0.8.0-alpha.2": + version "0.8.0-alpha.2" + resolved "https://registry.yarnpkg.com/@es-joy/jsdoccomment/-/jsdoccomment-0.8.0-alpha.2.tgz#78585147d8e6231270374dae528fe5b7b5587b5a" + integrity sha512-fjRY13Bh8sxDZkzO27U2R9L6xFqkh5fAbHuMGvGLXLfrTes8nTTMyOi6wIPt+CG0XPAxEUge8cDjhG+0aag6ew== + dependencies: + comment-parser "^1.1.5" + esquery "^1.4.0" + jsdoc-type-pratt-parser "1.0.0-alpha.23" + +"@eslint/eslintrc@^0.4.1": + version "0.4.1" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.1.tgz#442763b88cecbe3ee0ec7ca6d6dd6168550cbf14" + integrity sha512-5v7TDE9plVhvxQeWLXDTvFvJBdH6pEsdnl2g/dAptmuFEPedQ4Erq5rsDsX+mvAM610IhNaO2W5V1dOOnDKxkQ== + dependencies: + ajv "^6.12.4" + debug "^4.1.1" + espree "^7.3.0" + globals "^12.1.0" + ignore "^4.0.6" + import-fresh "^3.2.1" + js-yaml "^3.13.1" + minimatch "^3.0.4" + strip-json-comments "^3.1.1" + "@eth-optimism/solc@^0.6.12-alpha.1": version "0.6.12-alpha.1" resolved "https://registry.yarnpkg.com/@eth-optimism/solc/-/solc-0.6.12-alpha.1.tgz#041876f83b34c6afe2f19dfe9626568df6ed8590" @@ -2328,6 +2552,11 @@ "@types/minimatch" "*" "@types/node" "*" +"@types/json-schema@^7.0.7": + version "7.0.7" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.7.tgz#98a993516c859eb0d5c4c8f098317a9ea68db9ad" + integrity sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA== + "@types/json5@^0.0.29": version "0.0.29" resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" @@ -2620,6 +2849,76 @@ dependencies: "@types/yargs-parser" "*" +"@typescript-eslint/eslint-plugin@^4.26.0": + version "4.26.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.26.0.tgz#12bbd6ebd5e7fabd32e48e1e60efa1f3554a3242" + integrity sha512-yA7IWp+5Qqf+TLbd8b35ySFOFzUfL7i+4If50EqvjT6w35X8Lv0eBHb6rATeWmucks37w+zV+tWnOXI9JlG6Eg== + dependencies: + "@typescript-eslint/experimental-utils" "4.26.0" + "@typescript-eslint/scope-manager" "4.26.0" + debug "^4.3.1" + functional-red-black-tree "^1.0.1" + lodash "^4.17.21" + regexpp "^3.1.0" + semver "^7.3.5" + tsutils "^3.21.0" + +"@typescript-eslint/experimental-utils@4.26.0": + version "4.26.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.26.0.tgz#ba7848b3f088659cdf71bce22454795fc55be99a" + integrity sha512-TH2FO2rdDm7AWfAVRB5RSlbUhWxGVuxPNzGT7W65zVfl8H/WeXTk1e69IrcEVsBslrQSTDKQSaJD89hwKrhdkw== + dependencies: + "@types/json-schema" "^7.0.7" + "@typescript-eslint/scope-manager" "4.26.0" + "@typescript-eslint/types" "4.26.0" + "@typescript-eslint/typescript-estree" "4.26.0" + eslint-scope "^5.1.1" + eslint-utils "^3.0.0" + +"@typescript-eslint/parser@^4.26.0": + version "4.26.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.26.0.tgz#31b6b732c9454f757b020dab9b6754112aa5eeaf" + integrity sha512-b4jekVJG9FfmjUfmM4VoOItQhPlnt6MPOBUL0AQbiTmm+SSpSdhHYlwayOm4IW9KLI/4/cRKtQCmDl1oE2OlPg== + dependencies: + "@typescript-eslint/scope-manager" "4.26.0" + "@typescript-eslint/types" "4.26.0" + "@typescript-eslint/typescript-estree" "4.26.0" + debug "^4.3.1" + +"@typescript-eslint/scope-manager@4.26.0": + version "4.26.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.26.0.tgz#60d1a71df162404e954b9d1c6343ff3bee496194" + integrity sha512-G6xB6mMo4xVxwMt5lEsNTz3x4qGDt0NSGmTBNBPJxNsrTXJSm21c6raeYroS2OwQsOyIXqKZv266L/Gln1BWqg== + dependencies: + "@typescript-eslint/types" "4.26.0" + "@typescript-eslint/visitor-keys" "4.26.0" + +"@typescript-eslint/types@4.26.0": + version "4.26.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.26.0.tgz#7c6732c0414f0a69595f4f846ebe12616243d546" + integrity sha512-rADNgXl1kS/EKnDr3G+m7fB9yeJNnR9kF7xMiXL6mSIWpr3Wg5MhxyfEXy/IlYthsqwBqHOr22boFbf/u6O88A== + +"@typescript-eslint/typescript-estree@4.26.0": + version "4.26.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.26.0.tgz#aea17a40e62dc31c63d5b1bbe9a75783f2ce7109" + integrity sha512-GHUgahPcm9GfBuy3TzdsizCcPjKOAauG9xkz9TR8kOdssz2Iz9jRCSQm6+aVFa23d5NcSpo1GdHGSQKe0tlcbg== + dependencies: + "@typescript-eslint/types" "4.26.0" + "@typescript-eslint/visitor-keys" "4.26.0" + debug "^4.3.1" + globby "^11.0.3" + is-glob "^4.0.1" + semver "^7.3.5" + tsutils "^3.21.0" + +"@typescript-eslint/visitor-keys@4.26.0": + version "4.26.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.26.0.tgz#26d2583169222815be4dcd1da4fe5459bc3bcc23" + integrity sha512-cw4j8lH38V1ycGBbF+aFiLUls9Z0Bw8QschP3mkth50BbWzgFS33ISIgBzUMuQ2IdahoEv/rXstr8Zhlz4B1Zg== + dependencies: + "@typescript-eslint/types" "4.26.0" + eslint-visitor-keys "^2.0.0" + "@ungap/promise-all-settled@1.1.2": version "1.1.2" resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44" @@ -2713,6 +3012,16 @@ accepts@~1.3.7: mime-types "~2.1.24" negotiator "0.6.2" +acorn-jsx@^5.3.1: + version "5.3.1" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.1.tgz#fc8661e11b7ac1539c47dbfea2e72b3af34d267b" + integrity sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng== + +acorn@^7.4.0: + version "7.4.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" + integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== + add-stream@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/add-stream/-/add-stream-1.0.0.tgz#6a7990437ca736d5e1288db92bd3266d5f5cb2aa" @@ -2762,7 +3071,7 @@ aggregate-error@^3.0.0: clean-stack "^2.0.0" indent-string "^4.0.0" -ajv@^6.12.3: +ajv@^6.10.0, ajv@^6.12.3, ajv@^6.12.4: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -2772,6 +3081,16 @@ ajv@^6.12.3: json-schema-traverse "^0.4.1" uri-js "^4.2.2" +ajv@^8.0.1: + version "8.5.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.5.0.tgz#695528274bcb5afc865446aa275484049a18ae4b" + integrity sha512-Y2l399Tt1AguU3BPRP9Fn4eN+Or+StUGWCUpbnFyXSo8NZ9S4uj+AG2pjs5apK+ZMOwYOz1+a+VKvKH7CudXgQ== + dependencies: + fast-deep-equal "^3.1.1" + json-schema-traverse "^1.0.0" + require-from-string "^2.0.2" + uri-js "^4.2.2" + amdefine@>=0.0.4: version "1.0.1" resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" @@ -2952,6 +3271,17 @@ array-ify@^1.0.0: resolved "https://registry.yarnpkg.com/array-ify/-/array-ify-1.0.0.tgz#9e528762b4a9066ad163a6962a364418e9626ece" integrity sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4= +array-includes@^3.1.2, array-includes@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.3.tgz#c7f619b382ad2afaf5326cddfdc0afc61af7690a" + integrity sha512-gcem1KlBU7c9rB+Rq8/3PPKsK2kjqeEBa3bD5kkQo4nYlOHQCJqIJFqBXDEfwaRuYTT4E+FxA9xez7Gf/e3Q7A== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.18.0-next.2" + get-intrinsic "^1.1.1" + is-string "^1.0.5" + array-union@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" @@ -2962,6 +3292,25 @@ array-unique@^0.3.2: resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= +array.prototype.flat@^1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.2.4.tgz#6ef638b43312bd401b4c6199fdec7e2dc9e9a123" + integrity sha512-4470Xi3GAPAjZqFcljX2xzckv1qeKPizoNkiS0+O4IoPR2ZNpcjE0pkhdihlDouK+x6QOast26B4Q/O9DJnwSg== + dependencies: + call-bind "^1.0.0" + define-properties "^1.1.3" + es-abstract "^1.18.0-next.1" + +array.prototype.flatmap@^1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/array.prototype.flatmap/-/array.prototype.flatmap-1.2.4.tgz#94cfd47cc1556ec0747d97f7c7738c58122004c9" + integrity sha512-r9Z0zYoxqHz60vvQbWEdXIEtCwHF0yxaWfno9qzXeNHvfyl3BZqygmGzb84dsubyaXLH4husF+NFgMSdpZhk2Q== + dependencies: + call-bind "^1.0.0" + define-properties "^1.1.3" + es-abstract "^1.18.0-next.1" + function-bind "^1.1.1" + arrify@^1.0.0, arrify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" @@ -3009,6 +3358,11 @@ assign-symbols@^1.0.0: resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= +astral-regex@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" + integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== + async-eventemitter@^0.2.2, async-eventemitter@^0.2.4: version "0.2.4" resolved "https://registry.yarnpkg.com/async-eventemitter/-/async-eventemitter-0.2.4.tgz#f5e7c8ca7d3e46aab9ec40a292baf686a0bafaca" @@ -3897,6 +4251,17 @@ browserslist@^3.2.6: caniuse-lite "^1.0.30000844" electron-to-chromium "^1.3.47" +browserslist@^4.16.6: + version "4.16.6" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.16.6.tgz#d7901277a5a88e554ed305b183ec9b0c08f66fa2" + integrity sha512-Wspk/PqO+4W9qp5iUTJsa1B/QrYn1keNCcEP5OvP7WBwT4KaDly0uONYmC6Xa3Z5IqnUgS0KcgLYu1l74x0ZXQ== + dependencies: + caniuse-lite "^1.0.30001219" + colorette "^1.2.2" + electron-to-chromium "^1.3.723" + escalade "^3.1.1" + node-releases "^1.1.71" + bs58@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a" @@ -3960,10 +4325,10 @@ bufferutil@^4.0.1: dependencies: node-gyp-build "^4.2.0" -builtin-modules@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" - integrity sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8= +builtin-modules@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.2.0.tgz#45d5db99e7ee5e6bc4f362e008bf917ab5049887" + integrity sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA== builtins@^1.0.3: version "1.0.3" @@ -4124,6 +4489,11 @@ caniuse-lite@^1.0.30000844: resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001207.tgz#364d47d35a3007e528f69adb6fecb07c2bb2cc50" integrity sha512-UPQZdmAsyp2qfCTiMU/zqGSWOYaY9F9LL61V8f+8MrubsaDGpaHD9HRV/EWZGULZn0Hxu48SKzI5DgFwTvHuYw== +caniuse-lite@^1.0.30001219: + version "1.0.30001232" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001232.tgz#2ebc8b6a77656fd772ab44a82a332a26a17e9527" + integrity sha512-e4Gyp7P8vqC2qV2iHA+cJNf/yqUKOShXQOJHQt81OHxlIZl/j/j3soEA0adAQi8CPUQgvOdDENyQ5kd6a6mNSg== + cardinal@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/cardinal/-/cardinal-2.1.1.tgz#7cc1055d822d212954d07b085dea251cc7bc5505" @@ -4156,7 +4526,7 @@ chai@^4.2.0, chai@^4.3.0, chai@^4.3.1, chai@^4.3.3, chai@^4.3.4: pathval "^1.1.1" type-detect "^4.0.5" -chalk@2.4.2, chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.4.1, chalk@^2.4.2: +chalk@2.4.2, chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.4.1, chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -4264,6 +4634,11 @@ ci-info@^2.0.0: resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== +ci-info@^3.1.1: + version "3.2.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.2.0.tgz#2876cb948a498797b5236f0095bc057d0dca38b6" + integrity sha512-dVqRX7fLUm8J6FgHJ418XuIgDLZDkYcDFTeL6TA2gt5WlIZUQrrH6EZrNClwT/H0FateUsZkGIOPRrLbP+PR9A== + cids@^0.7.1: version "0.7.5" resolved "https://registry.yarnpkg.com/cids/-/cids-0.7.5.tgz#60a08138a99bfb69b6be4ceb63bfef7a396b28b2" @@ -4298,6 +4673,13 @@ class-utils@^0.3.5: isobject "^3.0.0" static-extend "^0.1.1" +clean-regexp@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/clean-regexp/-/clean-regexp-1.0.0.tgz#8df7c7aae51fd36874e8f8d05b9180bc11a3fed7" + integrity sha1-jffHquUf02h06PjQW5GAvBGj/tc= + dependencies: + escape-string-regexp "^1.0.5" + clean-stack@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" @@ -4443,6 +4825,11 @@ color-name@~1.1.4: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== +colorette@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.2.2.tgz#cbcc79d5e99caea2dbf10eb3a26fd8b3e6acfa94" + integrity sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w== + colors@1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/colors/-/colors-1.0.3.tgz#0433f44d809680fdeb60ed260f1b0c262e82a40b" @@ -4487,11 +4874,16 @@ commander@3.0.2: resolved "https://registry.yarnpkg.com/commander/-/commander-3.0.2.tgz#6837c3fb677ad9933d1cfba42dd14d5117d6b39e" integrity sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow== -commander@^2.12.1, commander@^2.19.0, commander@^2.20.0: +commander@^2.19.0, commander@^2.20.0: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== +comment-parser@1.1.5, comment-parser@^1.1.5: + version "1.1.5" + resolved "https://registry.yarnpkg.com/comment-parser/-/comment-parser-1.1.5.tgz#453627ef8f67dbcec44e79a9bd5baa37f0bce9b2" + integrity sha512-RePCE4leIhBlmrqiYTvaqEeGYg7qpSl4etaIabKtdOQVi+mSTIBBklGUwIr79GXYnl3LpMwmDw4KeR2stNc6FA== + compare-func@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/compare-func/-/compare-func-2.0.0.tgz#fb65e75edbddfd2e568554e8b5b05fff7a51fcb3" @@ -4649,7 +5041,7 @@ conventional-recommended-bump@^6.1.0: meow "^8.0.0" q "^1.5.1" -convert-source-map@^1.5.1: +convert-source-map@^1.5.1, convert-source-map@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442" integrity sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA== @@ -4800,7 +5192,7 @@ cross-spawn@^6.0.0, cross-spawn@^6.0.5: shebang-command "^1.2.0" which "^1.2.9" -cross-spawn@^7.0.3: +cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== @@ -4917,14 +5309,14 @@ debug@3.2.6: dependencies: ms "^2.1.1" -debug@4, debug@4.3.1, debug@^4.1.0, debug@^4.1.1: +debug@4, debug@4.3.1, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: version "4.3.1" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ== dependencies: ms "2.1.2" -debug@^3.1.0: +debug@^3.1.0, debug@^3.2.7: version "3.2.7" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a" integrity sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ== @@ -5002,7 +5394,7 @@ deep-extend@^0.6.0: resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== -deep-is@~0.1.3: +deep-is@^0.1.3, deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= @@ -5190,6 +5582,20 @@ docker-compose@^0.23.8: dependencies: yaml "^1.10.2" +doctrine@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" + integrity sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw== + dependencies: + esutils "^2.0.2" + +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== + dependencies: + esutils "^2.0.2" + dom-walk@^0.1.0: version "0.1.2" resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.2.tgz#0c548bef048f4d1f2a97249002236060daa3fd84" @@ -5268,6 +5674,11 @@ electron-to-chromium@^1.3.47: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.709.tgz#d7be0b5686a2fdfe8bad898faa3a428d04d8f656" integrity sha512-LolItk2/ikSGQ7SN8UkuKVNMBZp3RG7Itgaxj1npsHRzQobj9JjMneZOZfLhtwlYBe5fCJ75k+cVCiDFUs23oA== +electron-to-chromium@^1.3.723: + version "1.3.743" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.743.tgz#fcec24d6d647cb84fd796b42caa1b4039a180894" + integrity sha512-K2wXfo9iZQzNJNx67+Pld0DRF+9bYinj62gXCdgPhcu1vidwVuLPHQPPFnCdO55njWigXXpfBiT90jGUPbw8Zg== + elliptic@6.5.3: version "6.5.3" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.3.tgz#cb59eb2efdaf73a0bd78ccd7015a62ad6e0f93d6" @@ -5349,7 +5760,7 @@ end-of-stream@^1.1.0, end-of-stream@^1.4.1: dependencies: once "^1.4.0" -enquirer@^2.3.0: +enquirer@^2.3.0, enquirer@^2.3.5: version "2.3.6" resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d" integrity sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg== @@ -5390,6 +5801,28 @@ error-ex@^1.2.0, error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" +es-abstract@^1.18.0-next.1, es-abstract@^1.18.2: + version "1.18.3" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.18.3.tgz#25c4c3380a27aa203c44b2b685bba94da31b63e0" + integrity sha512-nQIr12dxV7SSxE6r6f1l3DtAeEYdsGpps13dR0TwJg1S8gyp4ZPgy3FZcHBgbiQqnoqSTb+oC+kO4UQ0C/J8vw== + dependencies: + call-bind "^1.0.2" + es-to-primitive "^1.2.1" + function-bind "^1.1.1" + get-intrinsic "^1.1.1" + has "^1.0.3" + has-symbols "^1.0.2" + is-callable "^1.2.3" + is-negative-zero "^2.0.1" + is-regex "^1.1.3" + is-string "^1.0.6" + object-inspect "^1.10.3" + object-keys "^1.1.1" + object.assign "^4.1.2" + string.prototype.trimend "^1.0.4" + string.prototype.trimstart "^1.0.4" + unbox-primitive "^1.0.1" + es-abstract@^1.18.0-next.2: version "1.18.0" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.18.0.tgz#ab80b359eecb7ede4c298000390bc5ac3ec7b5a4" @@ -5462,7 +5895,7 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1 resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= -escape-string-regexp@4.0.0: +escape-string-regexp@4.0.0, escape-string-regexp@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== @@ -5479,13 +5912,208 @@ escodegen@1.8.x: optionalDependencies: source-map "~0.2.0" -eslint-plugin-prettier@^2.2.0: - version "2.7.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.7.0.tgz#b4312dcf2c1d965379d7f9d5b5f8aaadc6a45904" - integrity sha512-CStQYJgALoQBw3FsBzH0VOVDRnJ/ZimUlpLm226U8qgqYJfPOY/CPK6wyRInMxh73HSKg5wyRwdS4BVYYHwokA== +eslint-config-prettier@^8.3.0: + version "8.3.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz#f7471b20b6fe8a9a9254cc684454202886a2dd7a" + integrity sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew== + +eslint-import-resolver-node@^0.3.4: + version "0.3.4" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.4.tgz#85ffa81942c25012d8231096ddf679c03042c717" + integrity sha512-ogtf+5AB/O+nM6DIeBUNr2fuT7ot9Qg/1harBfBtaP13ekEWFQEEMP94BCB7zaNW3gyY+8SHYF00rnqYwXKWOA== + dependencies: + debug "^2.6.9" + resolve "^1.13.1" + +eslint-module-utils@^2.6.1: + version "2.6.1" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.6.1.tgz#b51be1e473dd0de1c5ea638e22429c2490ea8233" + integrity sha512-ZXI9B8cxAJIH4nfkhTwcRTEAnrVfobYqwjWy/QMCZ8rHkZHFjf9yO4BzpiF9kCSfNlMG54eKigISHpX0+AaT4A== + dependencies: + debug "^3.2.7" + pkg-dir "^2.0.0" + +eslint-plugin-ban@^1.5.2: + version "1.5.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-ban/-/eslint-plugin-ban-1.5.2.tgz#5ca01fa5acdecf79e7422e2876eb330c22b5de9a" + integrity sha512-i6yjMbep866kREX8HfCPM32QyTZG4gfhlEFjL7s04P+sJjsM+oa0pejwyLOz/6s/oiW7BQqc6u3Dcr9tKz+svg== + dependencies: + requireindex "~1.2.0" + +eslint-plugin-import@^2.23.4: + version "2.23.4" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.23.4.tgz#8dceb1ed6b73e46e50ec9a5bb2411b645e7d3d97" + integrity sha512-6/wP8zZRsnQFiR3iaPFgh5ImVRM1WN5NUWfTIRqwOdeiGJlBcSk82o1FEVq8yXmy4lkIzTo7YhHCIxlU/2HyEQ== + dependencies: + array-includes "^3.1.3" + array.prototype.flat "^1.2.4" + debug "^2.6.9" + doctrine "^2.1.0" + eslint-import-resolver-node "^0.3.4" + eslint-module-utils "^2.6.1" + find-up "^2.0.0" + has "^1.0.3" + is-core-module "^2.4.0" + minimatch "^3.0.4" + object.values "^1.1.3" + pkg-up "^2.0.0" + read-pkg-up "^3.0.0" + resolve "^1.20.0" + tsconfig-paths "^3.9.0" + +eslint-plugin-jsdoc@^35.1.2: + version "35.1.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-35.1.2.tgz#dbd447f61e9baa6c369eb85d6cd8c2df0e1f63c9" + integrity sha512-IPChTbaL9rWe6DCinKOpUdqsBV7r2dKEId1nweSKsjJqZp1VAQyzQJ5N6ogji2AWmrPU1jdjfHA5HIG2RaiRBA== + dependencies: + "@es-joy/jsdoccomment" "^0.8.0-alpha.2" + comment-parser "1.1.5" + debug "^4.3.1" + esquery "^1.4.0" + jsdoc-type-pratt-parser "^1.0.2" + lodash "^4.17.21" + regextras "^0.8.0" + semver "^7.3.5" + spdx-expression-parse "^3.0.1" + +eslint-plugin-prefer-arrow@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/eslint-plugin-prefer-arrow/-/eslint-plugin-prefer-arrow-1.2.3.tgz#e7fbb3fa4cd84ff1015b9c51ad86550e55041041" + integrity sha512-J9I5PKCOJretVuiZRGvPQxCbllxGAV/viI20JO3LYblAodofBxyMnZAJ+WGeClHgANnSJberTNoFWWjrWKBuXQ== + +eslint-plugin-react@^7.24.0: + version "7.24.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.24.0.tgz#eadedfa351a6f36b490aa17f4fa9b14e842b9eb4" + integrity sha512-KJJIx2SYx7PBx3ONe/mEeMz4YE0Lcr7feJTCMyyKb/341NcjuAgim3Acgan89GfPv7nxXK2+0slu0CWXYM4x+Q== + dependencies: + array-includes "^3.1.3" + array.prototype.flatmap "^1.2.4" + doctrine "^2.1.0" + has "^1.0.3" + jsx-ast-utils "^2.4.1 || ^3.0.0" + minimatch "^3.0.4" + object.entries "^1.1.4" + object.fromentries "^2.0.4" + object.values "^1.1.4" + prop-types "^15.7.2" + resolve "^2.0.0-next.3" + string.prototype.matchall "^4.0.5" + +eslint-plugin-unicorn@^32.0.1: + version "32.0.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-unicorn/-/eslint-plugin-unicorn-32.0.1.tgz#a7cb9f538441b78936a96261eea4392d76526d77" + integrity sha512-LaZ9utnXtOJjnoDkpm+nQsONUUmyRR0WD6PGROSdQRRW3LRmgK/ZP8wxjW+Ai+2uolKTtuJzLx2mvbIeIoLqpg== + dependencies: + ci-info "^3.1.1" + clean-regexp "^1.0.0" + eslint-template-visitor "^2.3.2" + eslint-utils "^2.1.0" + import-modules "^2.1.0" + is-builtin-module "^3.1.0" + lodash "^4.17.21" + pluralize "^8.0.0" + read-pkg-up "^7.0.1" + regexp-tree "^0.1.23" + reserved-words "^0.1.2" + safe-regex "^2.1.1" + semver "^7.3.5" + +eslint-scope@^5.1.0, eslint-scope@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" + integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== + dependencies: + esrecurse "^4.3.0" + estraverse "^4.1.1" + +eslint-template-visitor@^2.3.2: + version "2.3.2" + resolved "https://registry.yarnpkg.com/eslint-template-visitor/-/eslint-template-visitor-2.3.2.tgz#b52f96ff311e773a345d79053ccc78275bbc463d" + integrity sha512-3ydhqFpuV7x1M9EK52BPNj6V0Kwu0KKkcIAfpUhwHbR8ocRln/oUHgfxQupY8O1h4Qv/POHDumb/BwwNfxbtnA== + dependencies: + "@babel/core" "^7.12.16" + "@babel/eslint-parser" "^7.12.16" + eslint-visitor-keys "^2.0.0" + esquery "^1.3.1" + multimap "^1.1.0" + +eslint-utils@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-2.1.0.tgz#d2de5e03424e707dc10c74068ddedae708741b27" + integrity sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg== + dependencies: + eslint-visitor-keys "^1.1.0" + +eslint-utils@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-3.0.0.tgz#8aebaface7345bb33559db0a1f13a1d2d48c3672" + integrity sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA== + dependencies: + eslint-visitor-keys "^2.0.0" + +eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e" + integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== + +eslint-visitor-keys@^2.0.0, eslint-visitor-keys@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" + integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== + +eslint@^7.27.0: + version "7.27.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.27.0.tgz#665a1506d8f95655c9274d84bd78f7166b07e9c7" + integrity sha512-JZuR6La2ZF0UD384lcbnd0Cgg6QJjiCwhMD6eU4h/VGPcVGwawNNzKU41tgokGXnfjOOyI6QIffthhJTPzzuRA== + dependencies: + "@babel/code-frame" "7.12.11" + "@eslint/eslintrc" "^0.4.1" + ajv "^6.10.0" + chalk "^4.0.0" + cross-spawn "^7.0.2" + debug "^4.0.1" + doctrine "^3.0.0" + enquirer "^2.3.5" + escape-string-regexp "^4.0.0" + eslint-scope "^5.1.1" + eslint-utils "^2.1.0" + eslint-visitor-keys "^2.0.0" + espree "^7.3.1" + esquery "^1.4.0" + esutils "^2.0.2" + fast-deep-equal "^3.1.3" + file-entry-cache "^6.0.1" + functional-red-black-tree "^1.0.1" + glob-parent "^5.0.0" + globals "^13.6.0" + ignore "^4.0.6" + import-fresh "^3.0.0" + imurmurhash "^0.1.4" + is-glob "^4.0.0" + js-yaml "^3.13.1" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.4.1" + lodash.merge "^4.6.2" + minimatch "^3.0.4" + natural-compare "^1.4.0" + optionator "^0.9.1" + progress "^2.0.0" + regexpp "^3.1.0" + semver "^7.2.1" + strip-ansi "^6.0.0" + strip-json-comments "^3.1.0" + table "^6.0.9" + text-table "^0.2.0" + v8-compile-cache "^2.0.3" + +espree@^7.3.0, espree@^7.3.1: + version "7.3.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-7.3.1.tgz#f2df330b752c6f55019f8bd89b7660039c1bbbb6" + integrity sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g== dependencies: - fast-diff "^1.1.1" - jest-docblock "^21.0.0" + acorn "^7.4.0" + acorn-jsx "^5.3.1" + eslint-visitor-keys "^1.3.0" esprima@2.7.x, esprima@^2.7.1: version "2.7.3" @@ -5497,11 +6125,35 @@ esprima@^4.0.0, esprima@~4.0.0: resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== +esquery@^1.3.1, esquery@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.4.0.tgz#2148ffc38b82e8c7057dfed48425b3e61f0f24a5" + integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w== + dependencies: + estraverse "^5.1.0" + +esrecurse@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" + integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== + dependencies: + estraverse "^5.2.0" + estraverse@^1.9.1: version "1.9.3" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-1.9.3.tgz#af67f2dc922582415950926091a4005d29c9bb44" integrity sha1-r2fy3JIlgkFZUJJgkaQAXSnJu0Q= +estraverse@^4.1.1: + version "4.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" + integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== + +estraverse@^5.1.0, estraverse@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.2.0.tgz#307df42547e6cc7324d3cf03c155d5cdb8c53880" + integrity sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ== + esutils@^2.0.2: version "2.0.3" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" @@ -6273,16 +6925,11 @@ fake-merkle-patricia-tree@^1.0.1: dependencies: checkpoint-store "^1.1.0" -fast-deep-equal@^3.1.1: +fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== -fast-diff@^1.1.1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" - integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== - fast-glob@^3.0.3, fast-glob@^3.1.1: version "3.2.5" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.5.tgz#7939af2a656de79a4f1901903ee8adcaa7cb9661" @@ -6300,7 +6947,7 @@ fast-json-stable-stringify@^2.0.0: resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== -fast-levenshtein@~2.0.6: +fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= @@ -6336,6 +6983,13 @@ figures@^3.0.0: dependencies: escape-string-regexp "^1.0.5" +file-entry-cache@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" + integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== + dependencies: + flat-cache "^3.0.4" + file-uri-to-path@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd" @@ -6445,6 +7099,14 @@ find-yarn-workspace-root@^2.0.0: dependencies: micromatch "^4.0.2" +flat-cache@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" + integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== + dependencies: + flatted "^3.1.0" + rimraf "^3.0.2" + flat@^4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/flat/-/flat-4.1.1.tgz#a392059cc382881ff98642f5da4dde0a959f309b" @@ -6462,6 +7124,11 @@ flatstr@^1.0.12: resolved "https://registry.yarnpkg.com/flatstr/-/flatstr-1.0.12.tgz#c2ba6a08173edbb6c9640e3055b95e287ceb5931" integrity sha512-4zPxDyhCyiN2wIAtSLI6gc82/EjqZc1onI4Mz/l0pWrAlsSfYH/2ZIcU+e3oA2wDwbzIWNKwa23F8rh6+DRWkw== +flatted@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.1.1.tgz#c4b489e80096d9df1dfc97c79871aea7c617c469" + integrity sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA== + flow-stoplight@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/flow-stoplight/-/flow-stoplight-1.0.0.tgz#4a292c5bcff8b39fa6cc0cb1a853d86f27eeff7b" @@ -6712,6 +7379,11 @@ gauge@~2.7.3: strip-ansi "^3.0.1" wide-align "^1.1.0" +gensync@^1.0.0-beta.2: + version "1.0.0-beta.2" + resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" + integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== + get-caller-file@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" @@ -6727,7 +7399,7 @@ get-func-name@^2.0.0: resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41" integrity sha1-6td0q+5y4gQJQzoGY2YCPdaIekE= -get-intrinsic@^1.0.2, get-intrinsic@^1.1.1: +get-intrinsic@^1.0.2, get-intrinsic@^1.1.0, get-intrinsic@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.1.tgz#15f59f376f855c446963948f0d24cd3637b4abc6" integrity sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q== @@ -6926,6 +7598,25 @@ global@~4.4.0: min-document "^2.19.0" process "^0.11.10" +globals@^11.1.0: + version "11.12.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" + integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== + +globals@^12.1.0: + version "12.4.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-12.4.0.tgz#a18813576a41b00a24a97e7f815918c2e19925f8" + integrity sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg== + dependencies: + type-fest "^0.8.1" + +globals@^13.6.0: + version "13.9.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.9.0.tgz#4bf2bf635b334a173fb1daf7c5e6b218ecdc06cb" + integrity sha512-74/FduwI/JaIrr1H8e71UbDE+5x7pIPs1C2rrwC52SszOo043CsWOZEMW7o2Y58xwm9b+0RBKDxY5n2sUpEFxA== + dependencies: + type-fest "^0.20.2" + globals@^9.18.0: version "9.18.0" resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" @@ -6945,7 +7636,7 @@ globby@^10.0.1: merge2 "^1.2.3" slash "^3.0.0" -globby@^11.0.0, globby@^11.0.2: +globby@^11.0.0, globby@^11.0.2, globby@^11.0.3: version "11.0.3" resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.3.tgz#9b1f0cb523e171dd1ad8c7b2a9fb4b644b9593cb" integrity sha512-ffdmosjA807y7+lA1NM0jELARVmYul/715xiILEjo3hBLPTcirgQNnXECn5g3mtR8TOLCVbkfua1Hpen25/Xcg== @@ -7461,6 +8152,11 @@ ignore-walk@^3.0.3: dependencies: minimatch "^3.0.4" +ignore@^4.0.6: + version "4.0.6" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" + integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== + ignore@^5.1.1, ignore@^5.1.4: version "5.1.8" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57" @@ -7481,7 +8177,7 @@ 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== -import-fresh@^3.2.1: +import-fresh@^3.0.0, import-fresh@^3.2.1: version "3.3.0" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== @@ -7497,6 +8193,11 @@ import-local@^3.0.2: pkg-dir "^4.2.0" resolve-cwd "^3.0.0" +import-modules@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/import-modules/-/import-modules-2.1.0.tgz#abe7df297cb6c1f19b57246eb8b8bd9664b6d8c2" + integrity sha512-8HEWcnkbGpovH9yInoisxaSoIg9Brbul+Ju3Kqe2UsYDUBJD/iQjSgEj0zPcTDPKfPp2fs5xlv1i+JSye/m1/A== + imul@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/imul/-/imul-1.0.1.tgz#9d5867161e8b3de96c2c38d5dc7cb102f35e2ac9" @@ -7580,6 +8281,15 @@ inquirer@^7.3.3: strip-ansi "^6.0.0" through "^2.3.6" +internal-slot@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.3.tgz#7347e307deeea2faac2ac6205d4bc7d34967f59c" + integrity sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA== + dependencies: + get-intrinsic "^1.1.0" + has "^1.0.3" + side-channel "^1.0.4" + interpret@^1.0.0: version "1.4.0" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e" @@ -7674,6 +8384,13 @@ is-buffer@~2.0.3: resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.5.tgz#ebc252e400d22ff8d77fa09888821a24a658c191" integrity sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ== +is-builtin-module@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-3.1.0.tgz#6fdb24313b1c03b75f8b9711c0feb8c30b903b00" + integrity sha512-OV7JjAgOTfAFJmHZLvpSTb4qi0nIILDV1gWPYDnDJUTNFM5aGlRAhk4QcT8i7TuAleeEV5Fdkqn3t4mS+Q11fg== + dependencies: + builtin-modules "^3.0.0" + is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.3.tgz#8b1e0500b73a1d76c70487636f368e519de8db8e" @@ -7693,6 +8410,13 @@ is-core-module@^2.2.0: dependencies: has "^1.0.3" +is-core-module@^2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.4.0.tgz#8e9fc8e15027b011418026e98f0e6f4d86305cc1" + integrity sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A== + dependencies: + has "^1.0.3" + is-data-descriptor@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" @@ -7784,7 +8508,7 @@ is-function@^1.0.1: resolved "https://registry.yarnpkg.com/is-function/-/is-function-1.0.2.tgz#4f097f30abf6efadac9833b17ca5dc03f8144e08" integrity sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ== -is-glob@^4.0.1, is-glob@~4.0.1: +is-glob@^4.0.0, is-glob@^4.0.1, is-glob@~4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== @@ -7863,6 +8587,14 @@ is-regex@^1.0.4, is-regex@^1.1.2: call-bind "^1.0.2" has-symbols "^1.0.1" +is-regex@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.3.tgz#d029f9aff6448b93ebbe3f33dac71511fdcbef9f" + integrity sha512-qSVXFz28HM7y+IWX6vLCsexdlvzT1PJNFSBuaQLQ5o0IEw8UDYW6/2+eCMVyIsbM8CNLX2a/QWmSpyxYEHY7CQ== + dependencies: + call-bind "^1.0.2" + has-symbols "^1.0.2" + is-regex@~1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.5.tgz#39d589a358bf18967f726967120b8fc1aed74eae" @@ -7897,6 +8629,11 @@ is-string@^1.0.5: resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.5.tgz#40493ed198ef3ff477b8c7f92f644ec82a5cd3a6" integrity sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ== +is-string@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.6.tgz#3fe5d5992fb0d93404f32584d4b0179a71b54a5f" + integrity sha512-2gdzbKUuqtQ3lYNrUTQYoClPhm7oQu4UdpSZMp1/DGgkHBT8E2Z1l0yMdb6D4zNAxwDiMv8MdulKROJGNl0Q0w== + is-subdir@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/is-subdir/-/is-subdir-1.2.0.tgz#b791cd28fab5202e91a08280d51d9d7254fd20d4" @@ -7985,11 +8722,6 @@ isurl@^1.0.0-alpha5: has-to-string-tag-x "^1.2.0" is-object "^1.0.1" -jest-docblock@^21.0.0: - version "21.2.0" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-21.2.0.tgz#51529c3b30d5fd159da60c27ceedc195faf8d414" - integrity sha512-5IZ7sY9dBAYSV+YjQ0Ovb540Ku7AO9Z5o2Cg789xj167iQuZ2cG+z0f3Uct6WeYLbU6aQiM2pCs7sZ+4dotydw== - jmespath@^0.15.0: version "0.15.0" resolved "https://registry.yarnpkg.com/jmespath/-/jmespath-0.15.0.tgz#a3f222a9aae9f966f5d27c796510e28091764217" @@ -8048,11 +8780,26 @@ jsbn@~0.1.0: resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= +jsdoc-type-pratt-parser@1.0.0-alpha.23: + version "1.0.0-alpha.23" + resolved "https://registry.yarnpkg.com/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-1.0.0-alpha.23.tgz#01c232d92b99b7e7ef52235ab8c9115137426639" + integrity sha512-COtimMd97eo5W0h6R9ISFj9ufg/9EiAzVAeQpKBJ1xJs/x8znWE155HGBDR2rwOuZsCes1gBXGmFVfvRZxGrhg== + +jsdoc-type-pratt-parser@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-1.0.2.tgz#956b4723eef47c28b8c7f4a890bcdf73e0b5b629" + integrity sha512-yJSKO94/IsCWxdH3A1hpsfq/CU2NUJwpFhoB8+4GKq4TvBWVv2yf2OdwO+5zvgON391HdAb+2pz1xqwmkl7W9w== + jsesc@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b" integrity sha1-RsP+yMGJKxKwgz25vHYiF226s0s= +jsesc@^2.5.1: + version "2.5.2" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" + integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== + jsesc@~0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" @@ -8102,11 +8849,21 @@ json-schema-traverse@^0.4.1: resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== +json-schema-traverse@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" + integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== + json-schema@0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= + json-stable-stringify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" @@ -8131,7 +8888,7 @@ json5@^1.0.1: dependencies: minimist "^1.2.0" -json5@^2.1.0: +json5@^2.1.0, json5@^2.1.2: version "2.2.0" resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.0.tgz#2dfefe720c6ba525d9ebd909950f0515316c89a3" integrity sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA== @@ -8186,6 +8943,14 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.10.0" +"jsx-ast-utils@^2.4.1 || ^3.0.0": + version "3.2.0" + resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-3.2.0.tgz#41108d2cec408c3453c1bbe8a4aae9e1e2bd8f82" + integrity sha512-EIsmt3O3ljsU6sot/J4E1zDRxfBNrhjyf/OKjlydwgEimQuznlM4Wv7U+ueONJMyEn1WRE0K8dhi3dVAXYT24Q== + dependencies: + array-includes "^3.1.2" + object.assign "^4.1.2" + just-extend@^4.0.2: version "4.2.1" resolved "https://registry.yarnpkg.com/just-extend/-/just-extend-4.2.1.tgz#ef5e589afb61e5d66b24eca749409a8939a8c744" @@ -8522,6 +9287,14 @@ leven@2.1.0: resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" integrity sha1-wuep93IJTe6dNCAq6KzORoeHVYA= +levn@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" + integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== + dependencies: + prelude-ls "^1.2.1" + type-check "~0.4.0" + levn@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" @@ -8637,6 +9410,11 @@ lodash.assign@^4.0.3, lodash.assign@^4.0.6: resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-4.2.0.tgz#0d99f3ccd7a6d261d19bdaeb9245005d285808e7" integrity sha1-DZnzzNem0mHRm9rrkkUAXShYCOc= +lodash.clonedeep@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" + integrity sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8= + lodash.get@^4.4.2: version "4.4.2" resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" @@ -8647,6 +9425,11 @@ lodash.ismatch@^4.4.0: resolved "https://registry.yarnpkg.com/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz#756cb5150ca3ba6f11085a78849645f188f85f37" integrity sha1-dWy1FQyjum8RCFp4hJZF8Yj4Xzc= +lodash.merge@^4.6.2: + version "4.6.2" + resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" + integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== + lodash.startcase@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/lodash.startcase/-/lodash.startcase-4.4.0.tgz#9436e34ed26093ed7ffae1936144350915d9add8" @@ -8672,6 +9455,11 @@ lodash.toarray@^4.4.0: resolved "https://registry.yarnpkg.com/lodash.toarray/-/lodash.toarray-4.4.0.tgz#24c4bfcd6b2fba38bfd0594db1179d8e9b656561" integrity sha1-JMS/zWsvuji/0FlNsRedjptlZWE= +lodash.truncate@^4.4.2: + version "4.4.2" + resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193" + integrity sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM= + lodash@4.17.20: version "4.17.20" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" @@ -8713,7 +9501,7 @@ looper@^3.0.0: resolved "https://registry.yarnpkg.com/looper/-/looper-3.0.0.tgz#2efa54c3b1cbaba9b94aee2e5914b0be57fbb749" integrity sha1-LvpUw7HLq6m5Su4uWRSwvlf7t0k= -loose-envify@^1.0.0: +loose-envify@^1.0.0, loose-envify@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== @@ -9307,7 +10095,7 @@ mkdirp@0.5.4: dependencies: minimist "^1.2.5" -mkdirp@0.5.5, mkdirp@0.5.x, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@^0.5.3: +mkdirp@0.5.5, mkdirp@0.5.x, mkdirp@^0.5.0, mkdirp@^0.5.1: version "0.5.5" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== @@ -9517,6 +10305,11 @@ multihashes@^0.4.15, multihashes@~0.4.15: multibase "^0.7.0" varint "^5.0.0" +multimap@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/multimap/-/multimap-1.1.0.tgz#5263febc085a1791c33b59bb3afc6a76a2a10ca8" + integrity sha512-0ZIR9PasPxGXmRsEF8jsDzndzHDj7tIav+JUmvIFB/WHswliFnquxECT/De7GR4yg99ky/NlRKJT82G1y271bw== + multimatch@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/multimatch/-/multimatch-5.0.0.tgz#932b800963cea7a31a033328fa1e0c3a1874dbe6" @@ -9589,6 +10382,11 @@ napi-macros@~2.0.0: resolved "https://registry.yarnpkg.com/napi-macros/-/napi-macros-2.0.0.tgz#2b6bae421e7b96eb687aa6c77a7858640670001b" integrity sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg== +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= + negotiator@0.6.2: version "0.6.2" resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb" @@ -9740,6 +10538,11 @@ node-hid@2.1.1: node-addon-api "^3.0.2" prebuild-install "^6.0.0" +node-releases@^1.1.71: + version "1.1.72" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.72.tgz#14802ab6b1039a79a0c7d662b610a5bbd76eacbe" + integrity sha512-LLUo+PpH3dU6XizX3iVoubUNheF/owjXCZZ5yACDxNnPtgFuludV1ZL3ayK1kVep42Rmm0+R9/Y60NQbZ2bifw== + noms@0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/noms/-/noms-0.0.0.tgz#da8ebd9f3af9d6760919b27d9cdc8092a7332859" @@ -9942,6 +10745,11 @@ object-copy@^0.1.0: define-property "^0.2.5" kind-of "^3.0.3" +object-inspect@^1.10.3: + version "1.10.3" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.10.3.tgz#c2aa7d2d09f50c99375704f7a0adf24c5782d369" + integrity sha512-e5mCJlSH7poANfC8z8S9s9S2IN5/4Zb3aZ33f5s8YqoazCFzNLloLU8r5VCG+G7WoqLvAAZoVMcy3tp/3X0Plw== + object-inspect@^1.9.0: version "1.9.0" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.9.0.tgz#c90521d74e1127b67266ded3394ad6116986533a" @@ -9997,6 +10805,25 @@ object.assign@^4.1.2: has-symbols "^1.0.1" object-keys "^1.1.1" +object.entries@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.4.tgz#43ccf9a50bc5fd5b649d45ab1a579f24e088cafd" + integrity sha512-h4LWKWE+wKQGhtMjZEBud7uLGhqyLwj8fpHOarZhD2uY3C9cRtk57VQ89ke3moByLXMedqs3XCHzyb4AmA2DjA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.18.2" + +object.fromentries@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.4.tgz#26e1ba5c4571c5c6f0890cef4473066456a120b8" + integrity sha512-EsFBshs5RUUpQEY1D4q/m59kMfz4YJvxuNCJcv/jWwOJr34EaVnG11ZrZa0UHB3wnzV1wx8m58T4hQL8IuNXlQ== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.18.0-next.2" + has "^1.0.3" + object.getownpropertydescriptors@^2.0.3, object.getownpropertydescriptors@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.2.tgz#1bd63aeacf0d5d2d2f31b5e393b03a7c601a23f7" @@ -10013,6 +10840,15 @@ object.pick@^1.3.0: dependencies: isobject "^3.0.1" +object.values@^1.1.3, object.values@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.4.tgz#0d273762833e816b693a637d30073e7051535b30" + integrity sha512-TnGo7j4XSnKQoK3MfvkzqKCi0nVe/D9I9IjwTNYdb/fxYHpjrluHVOgw0AF6jrRFGMPHdfuidR09tIDiIvnaSg== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.18.2" + obliterator@^1.6.1: version "1.6.1" resolved "https://registry.yarnpkg.com/obliterator/-/obliterator-1.6.1.tgz#dea03e8ab821f6c4d96a299e17aef6a3af994ef3" @@ -10078,6 +10914,18 @@ optionator@^0.8.1: type-check "~0.3.2" word-wrap "~1.2.3" +optionator@^0.9.1: + version "0.9.1" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499" + integrity sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw== + dependencies: + deep-is "^0.1.3" + fast-levenshtein "^2.0.6" + levn "^0.4.1" + prelude-ls "^1.2.1" + type-check "^0.4.0" + word-wrap "^1.2.3" + os-homedir@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" @@ -10599,6 +11447,13 @@ pino@^6.0.0, pino@^6.11.3: quick-format-unescaped "^4.0.3" sonic-boom "^1.0.2" +pkg-dir@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-2.0.0.tgz#f6d5d1109e19d63edf428e0bd57e12777615334b" + integrity sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s= + dependencies: + find-up "^2.1.0" + pkg-dir@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" @@ -10606,6 +11461,18 @@ pkg-dir@^4.2.0: dependencies: find-up "^4.0.0" +pkg-up@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/pkg-up/-/pkg-up-2.0.0.tgz#c819ac728059a461cab1c3889a2be3c49a004d7f" + integrity sha1-yBmscoBZpGHKscOImivjxJoATX8= + dependencies: + find-up "^2.1.0" + +pluralize@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-8.0.0.tgz#1a6fa16a38d12a1901e0320fa017051c539ce3b1" + integrity sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA== + posix-character-classes@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" @@ -10672,6 +11539,11 @@ preferred-pm@^3.0.0: path-exists "^4.0.0" which-pm "2.0.0" +prelude-ls@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" + integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== + prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" @@ -10717,6 +11589,11 @@ process@^0.11.10: resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" integrity sha1-czIwDoQBYb2j5podHZGn1LwW8YI= +progress@^2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" + integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== + prom-client@^13.1.0: version "13.1.0" resolved "https://registry.yarnpkg.com/prom-client/-/prom-client-13.1.0.tgz#1185caffd8691e28d32e373972e662964e3dba45" @@ -10759,6 +11636,15 @@ promzard@^0.3.0: dependencies: read "1" +prop-types@^15.7.2: + version "15.7.2" + resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5" + integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ== + dependencies: + loose-envify "^1.4.0" + object-assign "^4.1.1" + react-is "^16.8.1" + proto-list@~1.2.1: version "1.2.4" resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849" @@ -11000,6 +11886,11 @@ rc@^1.2.7: minimist "^1.2.0" strip-json-comments "~2.0.1" +react-is@^16.8.1: + version "16.13.1" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" + integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== + read-cmd-shim@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/read-cmd-shim/-/read-cmd-shim-2.0.0.tgz#4a50a71d6f0965364938e9038476f7eede3928d9" @@ -11247,7 +12138,12 @@ regex-not@^1.0.0, regex-not@^1.0.2: extend-shallow "^3.0.2" safe-regex "^1.1.0" -regexp.prototype.flags@^1.2.0: +regexp-tree@^0.1.23, regexp-tree@~0.1.1: + version "0.1.23" + resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.23.tgz#8a8ce1cc5e971acef62213a7ecdb1f6e18a1f1b2" + integrity sha512-+7HWfb4Bvu8Rs2eQTUIpX9I/PlQkYOuTNbRpKLJlQpSgwSkzFYh+pUj0gtvglnOZLKB6YgnIgRuJ2/IlpL48qw== + +regexp.prototype.flags@^1.2.0, regexp.prototype.flags@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.3.1.tgz#7ef352ae8d159e758c0eadca6f8fcb4eef07be26" integrity sha512-JiBdRBq91WlY7uRJ0ds7R+dU02i6LKi8r3BuQhNXn+kmeLN+EfHhfjqMRis1zJxnlu88hq/4dx0P2OP3APRTOA== @@ -11255,6 +12151,11 @@ regexp.prototype.flags@^1.2.0: call-bind "^1.0.2" define-properties "^1.1.3" +regexpp@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.1.0.tgz#206d0ad0a5648cffbdb8ae46438f3dc51c9f78e2" + integrity sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q== + regexpu-core@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-2.0.0.tgz#49d038837b8dcf8bfa5b9a42139938e6ea2ae240" @@ -11264,6 +12165,11 @@ regexpu-core@^2.0.0: regjsgen "^0.2.0" regjsparser "^0.1.4" +regextras@^0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/regextras/-/regextras-0.8.0.tgz#ec0f99853d4912839321172f608b544814b02217" + integrity sha512-k519uI04Z3SaY0fLX843MRXnDeG2+vHOFsyhiPZvNLe7r8rD2YNRjq4BQLZZ0oAr2NrtvZlICsXysGNFPGa3CQ== + regjsgen@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.2.0.tgz#6c016adeac554f75823fe37ac05b92d5a4edb1f7" @@ -11369,7 +12275,7 @@ require-from-string@^1.1.0: resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-1.2.1.tgz#529c9ccef27380adfec9a2f965b649bbee636418" integrity sha1-UpyczvJzgK3+yaL5ZbZJu+5jZBg= -require-from-string@^2.0.0: +require-from-string@^2.0.0, require-from-string@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== @@ -11384,6 +12290,16 @@ require-main-filename@^2.0.0: resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== +requireindex@~1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/requireindex/-/requireindex-1.2.0.tgz#3463cdb22ee151902635aa6c9535d4de9c2ef1ef" + integrity sha512-L9jEkOi3ASd9PYit2cwRfyppc9NoABujTP8/5gFcbERmo5jUoAKovIC3fsF17pkTnGsrByysqX+Kxd2OTNI1ww== + +reserved-words@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/reserved-words/-/reserved-words-0.1.2.tgz#00a0940f98cd501aeaaac316411d9adc52b31ab1" + integrity sha1-AKCUD5jNUBrqqsMWQR2a3FKzGrE= + resolve-cwd@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" @@ -11423,7 +12339,7 @@ resolve@1.17.0, resolve@~1.17.0: dependencies: path-parse "^1.0.6" -resolve@^1.1.6, resolve@^1.10.0, resolve@^1.20.0, resolve@^1.3.2, resolve@^1.8.1: +resolve@^1.1.6, resolve@^1.10.0, resolve@^1.13.1, resolve@^1.20.0, resolve@^1.8.1: version "1.20.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975" integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A== @@ -11431,6 +12347,14 @@ resolve@^1.1.6, resolve@^1.10.0, resolve@^1.20.0, resolve@^1.3.2, resolve@^1.8.1 is-core-module "^2.2.0" path-parse "^1.0.6" +resolve@^2.0.0-next.3: + version "2.0.0-next.3" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-2.0.0-next.3.tgz#d41016293d4a8586a39ca5d9b5f15cbea1f55e46" + integrity sha512-W8LucSynKUIDu9ylraa7ueVZ7hc0uAgJBxVsQSKOXOyle8a93qXhcz+XAXZ8bIq2d6i4Ehddn6Evt+0/UwKk6Q== + dependencies: + is-core-module "^2.2.0" + path-parse "^1.0.6" + responselike@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/responselike/-/responselike-1.0.2.tgz#918720ef3b631c5642be068f15ade5a46f4ba1e7" @@ -11545,6 +12469,13 @@ safe-regex@^1.1.0: dependencies: ret "~0.1.10" +safe-regex@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-2.1.1.tgz#f7128f00d056e2fe5c11e81a1324dd974aadced2" + integrity sha512-rx+x8AMzKb5Q5lQ95Zoi6ZbJqwCLkqi3XuJXp5P3rT8OEc6sZCJG5AE5dU3lsgRr/F4Bs31jSlVN+j5KrsGu9A== + dependencies: + regexp-tree "~0.1.1" + "safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" @@ -11635,7 +12566,7 @@ semver@^6.0.0, semver@^6.3.0: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== -semver@^7.1.1, semver@^7.1.3, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5: +semver@^7.1.1, semver@^7.1.3, semver@^7.2.1, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5: version "7.3.5" resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== @@ -11854,6 +12785,15 @@ slash@^3.0.0: resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== +slice-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-4.0.0.tgz#500e8dd0fd55b05815086255b3195adf2a45fe6b" + integrity sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ== + dependencies: + ansi-styles "^4.0.0" + astral-regex "^2.0.0" + is-fullwidth-code-point "^3.0.0" + slide@^1.1.6: version "1.1.6" resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707" @@ -12048,7 +12988,7 @@ source-map-url@^0.4.0: resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.1.tgz#0af66605a745a5a2f91cf1bbf8a7afbc283dec56" integrity sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw== -source-map@^0.5.6, source-map@^0.5.7: +source-map@^0.5.0, source-map@^0.5.6, source-map@^0.5.7: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= @@ -12086,7 +13026,7 @@ spdx-exceptions@^2.1.0: resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz#3f28ce1a77a00372683eade4a433183527a2163d" integrity sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A== -spdx-expression-parse@^3.0.0: +spdx-expression-parse@^3.0.0, spdx-expression-parse@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz#cf70f50482eefdc98e3ce0a6833e4a53ceeba679" integrity sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q== @@ -12242,6 +13182,20 @@ string-width@^4.1.0, string-width@^4.2.0: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.0" +string.prototype.matchall@^4.0.5: + version "4.0.5" + resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.5.tgz#59370644e1db7e4c0c045277690cf7b01203c4da" + integrity sha512-Z5ZaXO0svs0M2xd/6By3qpeKpLKd9mO4v4q3oMEQrk8Ck4xOD5d5XeBOOjGrmVZZ/AHB1S0CgG4N5r1G9N3E2Q== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.18.2" + get-intrinsic "^1.1.1" + has-symbols "^1.0.2" + internal-slot "^1.0.3" + regexp.prototype.flags "^1.3.1" + side-channel "^1.0.4" + string.prototype.trim@~1.2.1: version "1.2.4" resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.4.tgz#6014689baf5efaf106ad031a5fa45157666ed1bd" @@ -12367,7 +13321,7 @@ strip-json-comments@2.0.1, strip-json-comments@~2.0.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= -strip-json-comments@3.1.1, strip-json-comments@^3.1.1: +strip-json-comments@3.1.1, strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== @@ -12487,6 +13441,18 @@ sync-rpc@^1.2.1: dependencies: get-port "^3.1.0" +table@^6.0.9: + version "6.7.1" + resolved "https://registry.yarnpkg.com/table/-/table-6.7.1.tgz#ee05592b7143831a8c94f3cee6aae4c1ccef33e2" + integrity sha512-ZGum47Yi6KOOFDE8m223td53ath2enHcYLgOCjGr5ngu8bdIARQk6mN/wRMv4yMRcHnCSnHbCEha4sobQx5yWg== + dependencies: + ajv "^8.0.1" + lodash.clonedeep "^4.5.0" + lodash.truncate "^4.4.2" + slice-ansi "^4.0.0" + string-width "^4.2.0" + strip-ansi "^6.0.0" + tape@^4.6.3: version "4.13.3" resolved "https://registry.yarnpkg.com/tape/-/tape-4.13.3.tgz#51b3d91c83668c7a45b1a594b607dee0a0b46278" @@ -12607,6 +13573,11 @@ text-extensions@^1.0.0: resolved "https://registry.yarnpkg.com/text-extensions/-/text-extensions-1.9.0.tgz#1853e45fee39c945ce6f6c36b2d659b5aabc2a26" integrity sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ== +text-table@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= + then-request@^6.0.0: version "6.0.2" resolved "https://registry.yarnpkg.com/then-request/-/then-request-6.0.2.tgz#ec18dd8b5ca43aaee5cb92f7e4c1630e950d4f0c" @@ -12676,6 +13647,11 @@ to-fast-properties@^1.0.3: resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" integrity sha1-uDVx+k2MJbguIxsG46MFXeTKGkc= +to-fast-properties@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4= + to-object-path@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" @@ -12854,7 +13830,7 @@ ts-node@^9.1.1: source-map-support "^0.5.17" yn "3.1.1" -tsconfig-paths@^3.5.0: +tsconfig-paths@^3.5.0, tsconfig-paths@^3.9.0: version "3.9.0" resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz#098547a6c4448807e8fcb8eae081064ee9a3c90b" integrity sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw== @@ -12864,58 +13840,20 @@ tsconfig-paths@^3.5.0: minimist "^1.2.0" strip-bom "^3.0.0" -tslib@^1.13.0, tslib@^1.7.1, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3: +tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tslint-config-prettier@^1.18.0: - version "1.18.0" - resolved "https://registry.yarnpkg.com/tslint-config-prettier/-/tslint-config-prettier-1.18.0.tgz#75f140bde947d35d8f0d238e0ebf809d64592c37" - integrity sha512-xPw9PgNPLG3iKRxmK7DWr+Ea/SzrvfHtjFt5LBl61gk2UBG/DB9kCXRjv+xyIU1rUtnayLeMUVJBcMX8Z17nDg== - -tslint-no-focused-test@^0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/tslint-no-focused-test/-/tslint-no-focused-test-0.5.0.tgz#e0a93ef3fa64bd91c7e7437d1f183204880a8ed5" - integrity sha512-YK0PSY5XAdJaTzVIXxnUGyvB5VAi+H9yTc3e40YVtu8Ix3+zLSz4ufvX6rXT3nWpim0DR6fxXoL/Zk8JI641Vg== - -tslint-plugin-prettier@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/tslint-plugin-prettier/-/tslint-plugin-prettier-2.3.0.tgz#73fe71bf9f03842ac48c104122ca9b1de012ecf4" - integrity sha512-F9e4K03yc9xuvv+A0v1EmjcnDwpz8SpCD8HzqSDe0eyg34cBinwn9JjmnnRrNAs4HdleRQj7qijp+P/JTxt4vA== - dependencies: - eslint-plugin-prettier "^2.2.0" - lines-and-columns "^1.1.6" - tslib "^1.7.1" - -tslint@^6.1.3: - version "6.1.3" - resolved "https://registry.yarnpkg.com/tslint/-/tslint-6.1.3.tgz#5c23b2eccc32487d5523bd3a470e9aa31789d904" - integrity sha512-IbR4nkT96EQOvKE2PW/djGz8iGNeJ4rF2mBfiYaR/nvUWYKJhLwimoJKgjIFEIDibBtOevj7BqCRL4oHeWWUCg== - dependencies: - "@babel/code-frame" "^7.0.0" - builtin-modules "^1.1.1" - chalk "^2.3.0" - commander "^2.12.1" - diff "^4.0.1" - glob "^7.1.1" - js-yaml "^3.13.1" - minimatch "^3.0.4" - mkdirp "^0.5.3" - resolve "^1.3.2" - semver "^5.3.0" - tslib "^1.13.0" - tsutils "^2.29.0" - tsort@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/tsort/-/tsort-0.0.1.tgz#e2280f5e817f8bf4275657fd0f9aebd44f5a2786" integrity sha1-4igPXoF/i/QnVlf9D5rr1E9aJ4Y= -tsutils@^2.29.0: - version "2.29.0" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.29.0.tgz#32b488501467acbedd4b85498673a0812aca0b99" - integrity sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA== +tsutils@^3.21.0: + version "3.21.0" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" + integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== dependencies: tslib "^1.8.1" @@ -12953,6 +13891,13 @@ tweetnacl@^1.0.0, tweetnacl@^1.0.3: resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.3.tgz#ac0af71680458d8a6378d0d0d050ab1407d35596" integrity sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw== +type-check@^0.4.0, type-check@~0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" + integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== + dependencies: + prelude-ls "^1.2.1" + type-check@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" @@ -12975,6 +13920,11 @@ type-fest@^0.18.0: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.18.1.tgz#db4bc151a4a2cf4eebf9add5db75508db6cc841f" integrity sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw== +type-fest@^0.20.2: + version "0.20.2" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" + integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== + type-fest@^0.21.3: version "0.21.3" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" @@ -13108,7 +14058,7 @@ umask@^1.1.0: resolved "https://registry.yarnpkg.com/umask/-/umask-1.1.0.tgz#f29cebf01df517912bb58ff9c4e50fde8e33320d" integrity sha1-8pzr8B31F5ErtY/5xOUP3o4zMg0= -unbox-primitive@^1.0.0: +unbox-primitive@^1.0.0, unbox-primitive@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.1.tgz#085e215625ec3162574dc8859abee78a59b14471" integrity sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw== @@ -13313,6 +14263,11 @@ uuid@^3.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== +v8-compile-cache@^2.0.3: + version "2.3.0" + resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee" + integrity sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA== + validate-npm-package-license@^3.0.1, validate-npm-package-license@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" @@ -13996,7 +14951,7 @@ window-size@^0.2.0: resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.2.0.tgz#b4315bb4214a3d7058ebeee892e13fa24d98b075" integrity sha1-tDFbtCFKPXBY6+7okuE/ok2YsHU= -word-wrap@~1.2.3: +word-wrap@^1.2.3, word-wrap@~1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== From 52d02b1480d4c1c98f61f65ed7757881d6c239de Mon Sep 17 00:00:00 2001 From: Annie Ke Date: Tue, 15 Jun 2021 12:38:29 -0700 Subject: [PATCH 089/125] metrics[batch-submitter]: add new batch submitter metrics (#1074) * metrics[batch-submitter]: add new batch submitter metrics * chore: changeset * account for failed submissions --- .changeset/olive-planets-clean.md | 5 +++++ .../src/batch-submitter/batch-submitter.ts | 22 ++++++++++++++++++- .../src/batch-submitter/tx-batch-submitter.ts | 1 + 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 .changeset/olive-planets-clean.md diff --git a/.changeset/olive-planets-clean.md b/.changeset/olive-planets-clean.md new file mode 100644 index 000000000000..27ddbce53227 --- /dev/null +++ b/.changeset/olive-planets-clean.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/batch-submitter': patch +--- + +Add failure metrics to batch submitter diff --git a/packages/batch-submitter/src/batch-submitter/batch-submitter.ts b/packages/batch-submitter/src/batch-submitter/batch-submitter.ts index ffe2674e2c7b..c487d86dfac9 100644 --- a/packages/batch-submitter/src/batch-submitter/batch-submitter.ts +++ b/packages/batch-submitter/src/batch-submitter/batch-submitter.ts @@ -1,7 +1,7 @@ /* External Imports */ import { Contract, Signer, utils, providers } from 'ethers' import { TransactionReceipt } from '@ethersproject/abstract-provider' -import { Gauge, Histogram } from 'prom-client' +import { Gauge, Histogram, Counter } from 'prom-client' import * as ynatm from '@eth-optimism/ynatm' import { RollupInfo } from '@eth-optimism/core-utils' import { Logger, Metrics } from '@eth-optimism/common-ts' @@ -24,6 +24,9 @@ interface BatchSubmitterMetrics { numTxPerBatch: Histogram submissionTimestamp: Histogram submissionGasUsed: Histogram + batchesSubmitted: Counter + failedSubmissions: Counter + malformedBatches: Counter } export abstract class BatchSubmitter { @@ -240,6 +243,7 @@ export abstract class BatchSubmitter { this.logger ) } catch (err) { + this.metrics.failedSubmissions.inc() if (err.reason) { this.logger.error(`Transaction invalid: ${err.reason}, aborting`, { message: err.toString(), @@ -259,6 +263,7 @@ export abstract class BatchSubmitter { this.logger.info('Received transaction receipt', { receipt }) this.logger.info(successMessage) + this.metrics.batchesSubmitted.inc() this.metrics.submissionGasUsed.observe(receipt.gasUsed.toNumber()) this.metrics.submissionTimestamp.observe(Date.now()) return receipt @@ -293,6 +298,21 @@ export abstract class BatchSubmitter { help: 'Gas used to submit each batch', registers: [metrics.registry], }), + batchesSubmitted: new metrics.client.Counter({ + name: 'batches_submitted', + help: 'Count of batches submitted', + registers: [metrics.registry], + }), + failedSubmissions: new metrics.client.Counter({ + name: 'failed_submissions', + help: 'Count of failed batch submissions', + registers: [metrics.registry], + }), + malformedBatches: new metrics.client.Counter({ + name: 'malformed_batches', + help: 'Count of malformed batches', + registers: [metrics.registry], + }), } } } diff --git a/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts b/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts index 8a8a041337fe..b6aae4c980d5 100644 --- a/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts +++ b/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts @@ -301,6 +301,7 @@ export class TransactionBatchSubmitter extends BatchSubmitter { // Fix our batches if we are configured to. TODO: Remove this. batch = await this._fixBatch(batch) if (!(await this._validateBatch(batch))) { + this.metrics.malformedBatches.inc() return } let sequencerBatchParams = await this._getSequencerBatchParams( From 6c1627f6109ab42c64e668d034a08e2734d82eca Mon Sep 17 00:00:00 2001 From: Liam Horne Date: Tue, 15 Jun 2021 15:42:06 -0400 Subject: [PATCH 090/125] Fix canary publishing (#1093) * ci: fix custom docker tag * ci: use new env file * ci: use outputs from previous job * ci: fix headers of jobs * ci: inherit canary tag from builder --- .github/workflows/publish-canary.yml | 29 +++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/.github/workflows/publish-canary.yml b/.github/workflows/publish-canary.yml index 82585ff8dc8e..20f8f351b051 100644 --- a/.github/workflows/publish-canary.yml +++ b/.github/workflows/publish-canary.yml @@ -21,6 +21,7 @@ jobs: message-relayer: ${{ steps.packages.outputs.message-relayer }} data-transport-layer: ${{ steps.packages.outputs.data-transport-layer }} contracts: ${{ steps.packages.outputs.contracts }} + canary-docker-tag: ${{ steps.docker-image-name.outputs.canary-docker-tag }} steps: - name: Check out source code @@ -72,9 +73,9 @@ jobs: node ops/scripts/ci-versions.js ${{ toJSON(steps.changesets.outputs.publishedPackages) }} - name: Docker Image Name - id: docker_image_name + id: docker-image-name run: | - if [ -z "${CUSTOM_IMAGE_NAME}" ] + if [ ${CUSTOM_IMAGE_NAME} == '' ] then echo "::set-output name=canary-docker-tag::${GITHUB_SHA::8}" else @@ -89,7 +90,7 @@ jobs: # while also allowing for parallelization (i.e. `l2geth` not depending on `builder`) # and all jobs executing in parallel once `builder` is built l2geth: - name: Publish L2Geth Version ${{ needs.canary-publish.outputs.l2geth }} + name: Publish L2Geth Version ${{ needs.canary-publish.outputs.canary-docker-tag }} needs: canary-publish if: needs.canary-publish.outputs.l2geth != '' runs-on: ubuntu-latest @@ -112,7 +113,7 @@ jobs: context: . file: ./ops/docker/Dockerfile.geth push: true - tags: ethereumoptimism/l2geth:${{ steps.docker_image_name.outputs.canary-docker-tag }} + tags: ethereumoptimism/l2geth:${{ needs.canary-publish.outputs.canary-docker-tag }} # pushes the base builder image to dockerhub builder: @@ -127,6 +128,8 @@ jobs: data-transport-layer: ${{ needs.canary-publish.outputs.data-transport-layer }} contracts: ${{ needs.canary-publish.outputs.contracts }} integration-tests: ${{ needs.canary-publish.outputs.integration-tests }} + canary-docker-tag: ${{ needs.canary-publish.outputs.canary-docker-tag }} + steps: - name: Checkout @@ -149,7 +152,7 @@ jobs: tags: ethereumoptimism/builder message-relayer: - name: Publish Message Relayer Version ${{ needs.builder.outputs.message-relayer }} + name: Publish Message Relayer Version ${{ needs.builder.outputs.canary-docker-tag }} needs: builder if: needs.builder.outputs.message-relayer != '' runs-on: ubuntu-latest @@ -172,10 +175,10 @@ jobs: context: . file: ./ops/docker/Dockerfile.message-relayer push: true - tags: ethereumoptimism/message-relayer:${{ steps.docker_image_name.outputs.canary-docker-tag }} + tags: ethereumoptimism/message-relayer:${{ needs.builder.outputs.canary-docker-tag }} batch-submitter: - name: Publish Batch Submitter Version ${{ needs.builder.outputs.batch-submitter }} + name: Publish Batch Submitter Version ${{ needs.builder.outputs.canary-docker-tag }} needs: builder if: needs.builder.outputs.batch-submitter != '' runs-on: ubuntu-latest @@ -198,10 +201,10 @@ jobs: context: . file: ./ops/docker/Dockerfile.batch-submitter push: true - tags: ethereumoptimism/batch-submitter:${{ steps.docker_image_name.outputs.canary-docker-tag }} + tags: ethereumoptimism/batch-submitter:${{ needs.builder.outputs.canary-docker-tag }} data-transport-layer: - name: Publish Data Transport Layer Version ${{ needs.builder.outputs.data-transport-layer }} + name: Publish Data Transport Layer Version ${{ needs.builder.outputs.canary-docker-tag }} needs: builder if: needs.builder.outputs.data-transport-layer != '' runs-on: ubuntu-latest @@ -224,10 +227,10 @@ jobs: context: . file: ./ops/docker/Dockerfile.data-transport-layer push: true - tags: ethereumoptimism/data-transport-layer:${{ steps.docker_image_name.outputs.canary-docker-tag }} + tags: ethereumoptimism/data-transport-layer:${{ needs.builder.outputs.canary-docker-tag }} contracts: - name: Publish Deployer Version ${{ needs.builder.outputs.contracts }} + name: Publish Deployer Version ${{ needs.builder.outputs.canary-docker-tag }} needs: builder if: needs.builder.outputs.contracts != '' runs-on: ubuntu-latest @@ -250,7 +253,7 @@ jobs: context: . file: ./ops/docker/Dockerfile.deployer push: true - tags: ethereumoptimism/deployer:${{ steps.docker_image_name.outputs.canary-docker-tag }} + tags: ethereumoptimism/deployer:${{ needs.builder.outputs.canary-docker-tag }} integration_tests: name: Publish Integration tests ${{ needs.builder.outputs.integration-tests }} @@ -276,4 +279,4 @@ jobs: context: . file: ./ops/docker/Dockerfile.integration-tests push: true - tags: ethereumoptimism/integration-tests:${{ steps.docker_image_name.outputs.canary-docker-tag }} + tags: ethereumoptimism/integration-tests:${{ needs.builder.outputs.canary-docker-tag }} From aba77c080d1bb951cab2084e6208c249e33aaef8 Mon Sep 17 00:00:00 2001 From: Annie Ke Date: Tue, 15 Jun 2021 12:42:38 -0700 Subject: [PATCH 091/125] feat[ci]: upload logs for sync tests if failure (#1098) --- .github/workflows/sync-tests.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/sync-tests.yml b/.github/workflows/sync-tests.yml index b70e12a9bdab..bd031837cde8 100644 --- a/.github/workflows/sync-tests.yml +++ b/.github/workflows/sync-tests.yml @@ -42,3 +42,21 @@ jobs: run: | yarn yarn test:sync + + - name: Collect docker logs on failure + if: failure() + uses: jwalton/gh-docker-logs@v1 + with: + images: 'ethereumoptimism/builder,ethereumoptimism/hardhat,ethereumoptimism/deployer,ethereumoptimism/data-transport-layer,ethereumoptimism/l2geth,ethereumoptimism/message-relayer,ethereumoptimism/batch-submitter,ethereumoptimism/l2geth' + dest: './logs' + + - name: Tar logs + if: failure() + run: tar cvzf ./logs.tgz ./logs + + - name: Upload logs to GitHub + if: failure() + uses: actions/upload-artifact@master + with: + name: logs.tgz + path: ./logs.tgz From 26bc63adff16147050be7437c6dba2a65d212ff9 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Tue, 15 Jun 2021 15:35:59 -0700 Subject: [PATCH 092/125] deploy: goerli 0.4.0 (#1099) * deployments: goerli 0.4.0 rc * readme: update * chore: add changeset --- .changeset/happy-cars-fix.md | 5 + packages/contracts/deployments/README.md | 53 +-- .../goerli/Lib_AddressManager.json | 56 +-- .../goerli/OVM_CanonicalTransactionChain.json | 42 +-- ...OVM_ChainStorageContainer-CTC-batches.json | 117 ++---- .../OVM_ChainStorageContainer-CTC-queue.json | 117 ++---- ...OVM_ChainStorageContainer-SCC-batches.json | 117 ++---- .../goerli/OVM_ExecutionManager.json | 314 ++++++++++++---- .../deployments/goerli/OVM_FraudVerifier.json | 40 +- .../goerli/OVM_L1CrossDomainMessenger.json | 354 +++++++++++++++--- .../goerli/OVM_L1MultiMessageRelayer.json | 36 +- .../goerli/OVM_StateCommitmentChain.json | 44 +-- .../goerli/OVM_StateManagerFactory.json | 24 +- .../goerli/OVM_StateTransitionerFactory.json | 36 +- .../Proxy__OVM_L1CrossDomainMessenger.json | 40 +- .../goerli/Proxy__OVM_L1StandardBridge.json | 177 +++++++++ .../goerli/mockOVM_BondManager.json | 34 +- .../7531d7762a77038a37e7490a7b4b176f.json | 38 ++ .../ef3f334bac4d7e77d91b457a0d89ab0a.json | 338 +++++++++++++++++ 19 files changed, 1373 insertions(+), 609 deletions(-) create mode 100644 .changeset/happy-cars-fix.md create mode 100644 packages/contracts/deployments/goerli/Proxy__OVM_L1StandardBridge.json create mode 100644 packages/contracts/deployments/goerli/solcInputs/7531d7762a77038a37e7490a7b4b176f.json create mode 100644 packages/contracts/deployments/goerli/solcInputs/ef3f334bac4d7e77d91b457a0d89ab0a.json diff --git a/.changeset/happy-cars-fix.md b/.changeset/happy-cars-fix.md new file mode 100644 index 000000000000..1c596a1f26b8 --- /dev/null +++ b/.changeset/happy-cars-fix.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/contracts': patch +--- + +Deploy new Goerli contracts at d3e743aa7a406c583f7d76f4fda607f592d03e47 diff --git a/packages/contracts/deployments/README.md b/packages/contracts/deployments/README.md index a6d5b7156e9b..8d7efdb7caf9 100644 --- a/packages/contracts/deployments/README.md +++ b/packages/contracts/deployments/README.md @@ -1,15 +1,6 @@ # Optimism Regenesis Deployments ## LAYER 2 -## OPTIMISTIC-KOVAN - -Network : __optimistic-kovan (chain id: 69)__ - -|Contract|Address| -|--|--| -|OVM_GasPriceOracle|[0x038a8825A3C3B0c08d52Cc76E5E361953Cf6Dc76](https://kovan-optimistic.etherscan.io/address/0x038a8825A3C3B0c08d52Cc76E5E361953Cf6Dc76)| ---- - ### Chain IDs: - Mainnet: 10 - Kovan: 69 @@ -34,6 +25,19 @@ Network : __optimistic-kovan (chain id: 69)__ ## LAYER 1 +## OPTIMISTIC-KOVAN + +Network : __undefined (chain id: 69)__ + +|Contract|Address| +|--|--| +|OVM_GasPriceOracle|[0x038a8825A3C3B0c08d52Cc76E5E361953Cf6Dc76](https://undefined.etherscan.io/address/0x038a8825A3C3B0c08d52Cc76E5E361953Cf6Dc76)| + +--- ## MAINNET Network : __mainnet (chain id: 1)__ @@ -106,28 +110,29 @@ Network : __goerli (chain id: 5)__ |Contract|Address| |--|--| -|Lib_AddressManager|[0xE3d08F0D900A2D53cB794cf82d7127764BcC3092](https://goerli.etherscan.io/address/0xE3d08F0D900A2D53cB794cf82d7127764BcC3092)| -|OVM_CanonicalTransactionChain|[0x266534680e632Ce9425d8E5a991C43B3531C7818](https://goerli.etherscan.io/address/0x266534680e632Ce9425d8E5a991C43B3531C7818)| -|OVM_ChainStorageContainer-CTC-batches|[0x7b439CD647b76F45252858C19093a53b4c5FD4B4](https://goerli.etherscan.io/address/0x7b439CD647b76F45252858C19093a53b4c5FD4B4)| -|OVM_ChainStorageContainer-CTC-queue|[0xeD5fF8cFFba09fa5fF3104a63bA321733c4553d9](https://goerli.etherscan.io/address/0xeD5fF8cFFba09fa5fF3104a63bA321733c4553d9)| -|OVM_ChainStorageContainer-SCC-batches|[0x2A622E327D7A204b39355202d41BD9B752C8df54](https://goerli.etherscan.io/address/0x2A622E327D7A204b39355202d41BD9B752C8df54)| -|OVM_ExecutionManager|[0x45B459295d6b08D7dA3B9daae541D5F75E1CF818](https://goerli.etherscan.io/address/0x45B459295d6b08D7dA3B9daae541D5F75E1CF818)| -|OVM_FraudVerifier|[0xfA590cE7fE1d80D4b286e23f3f6e9f9357D6A90b](https://goerli.etherscan.io/address/0xfA590cE7fE1d80D4b286e23f3f6e9f9357D6A90b)| -|OVM_L1MultiMessageRelayer|[0x737557d97f7f2ccb0263C4b55f0D735D52c2D385](https://goerli.etherscan.io/address/0x737557d97f7f2ccb0263C4b55f0D735D52c2D385)| +|Lib_AddressManager|[0xA4346c8c120DdCE2c5447e68790625F10Bb4d47A](https://goerli.etherscan.io/address/0xA4346c8c120DdCE2c5447e68790625F10Bb4d47A)| +|OVM_CanonicalTransactionChain|[0x4781674AAe242bbDf6C58b81Cf4F06F1534cd37d](https://goerli.etherscan.io/address/0x4781674AAe242bbDf6C58b81Cf4F06F1534cd37d)| +|OVM_ChainStorageContainer-CTC-batches|[0xd5F2B9f6Ee80065b2Ce18bF1e629c5aC1C98c7F6](https://goerli.etherscan.io/address/0xd5F2B9f6Ee80065b2Ce18bF1e629c5aC1C98c7F6)| +|OVM_ChainStorageContainer-CTC-queue|[0x3EA657c5aA0E4Bce1D8919dC7f248724d7B0987a](https://goerli.etherscan.io/address/0x3EA657c5aA0E4Bce1D8919dC7f248724d7B0987a)| +|OVM_ChainStorageContainer-SCC-batches|[0x777adA49d40DAC02AE5b4FdC292feDf9066435A3](https://goerli.etherscan.io/address/0x777adA49d40DAC02AE5b4FdC292feDf9066435A3)| +|OVM_ExecutionManager|[0x838a74bAdfD28Fd0e32E4A88BddDa502D56ae7F7](https://goerli.etherscan.io/address/0x838a74bAdfD28Fd0e32E4A88BddDa502D56ae7F7)| +|OVM_FraudVerifier|[0x916f75037b87Bf4Fe0Dc7719815bd972F0618669](https://goerli.etherscan.io/address/0x916f75037b87Bf4Fe0Dc7719815bd972F0618669)| +|OVM_L1MultiMessageRelayer|[0x2545fa928d5d278cA75Fd47306e4a89096ff6403](https://goerli.etherscan.io/address/0x2545fa928d5d278cA75Fd47306e4a89096ff6403)| |OVM_SafetyChecker|[0x71D4ea896C9a2D4a973CC5c7E347B6707691ECa0](https://goerli.etherscan.io/address/0x71D4ea896C9a2D4a973CC5c7E347B6707691ECa0)| -|OVM_StateCommitmentChain|[0x5c3e321947C99698027108351ee736823Bd157D8](https://goerli.etherscan.io/address/0x5c3e321947C99698027108351ee736823Bd157D8)| -|OVM_StateManagerFactory|[0x8E63CD1CfDBe5d34a7a91B97E0A2AeA23D0e585D](https://goerli.etherscan.io/address/0x8E63CD1CfDBe5d34a7a91B97E0A2AeA23D0e585D)| -|OVM_StateTransitionerFactory|[0x543021950Af9250443EEdc681755e0bdBd3Fc81d](https://goerli.etherscan.io/address/0x543021950Af9250443EEdc681755e0bdBd3Fc81d)| -|Proxy__OVM_L1CrossDomainMessenger|[0xFec83764acDeEc2ac338d4cc1f12bBE3cCDf551E](https://goerli.etherscan.io/address/0xFec83764acDeEc2ac338d4cc1f12bBE3cCDf551E)| +|OVM_StateCommitmentChain|[0x9bA5E286934F0A29fb2f8421f60d3eE8A853447C](https://goerli.etherscan.io/address/0x9bA5E286934F0A29fb2f8421f60d3eE8A853447C)| +|OVM_StateManagerFactory|[0x24C7F0a4a2B926613B31c4cDDA4c0f90c0772f2b](https://goerli.etherscan.io/address/0x24C7F0a4a2B926613B31c4cDDA4c0f90c0772f2b)| +|OVM_StateTransitionerFactory|[0x703303Ce2d92Ef95F17a622E3d538390251165E8](https://goerli.etherscan.io/address/0x703303Ce2d92Ef95F17a622E3d538390251165E8)| +|Proxy__OVM_L1CrossDomainMessenger|[0xa85716330ff84Ab312D5B43F3BfDcC7E650fd88A](https://goerli.etherscan.io/address/0xa85716330ff84Ab312D5B43F3BfDcC7E650fd88A)| |Proxy__OVM_L1ETHGateway|[0xA721CF3e39E5cB4CfEEc0e32EE05B3D05AA9aE39](https://goerli.etherscan.io/address/0xA721CF3e39E5cB4CfEEc0e32EE05B3D05AA9aE39)| -|mockOVM_BondManager|[0x35a7735F9f517d071d5cFf89D11Ab4488bc5Df8C](https://goerli.etherscan.io/address/0x35a7735F9f517d071d5cFf89D11Ab4488bc5Df8C)| +|Proxy__OVM_L1StandardBridge|[0x74B6CC2F377fB769cEd6c697bC4C58a9c342E424](https://goerli.etherscan.io/address/0x74B6CC2F377fB769cEd6c697bC4C58a9c342E424)| +|mockOVM_BondManager|[0x795F355F75f9B28AEC6cC6A887704191e630065b](https://goerli.etherscan.io/address/0x795F355F75f9B28AEC6cC6A887704191e630065b)| no trie lookup needed.\\n address codeContractAddress =\\n uint(_contract) < 100\\n ? _contract\\n : _getAccountEthAddress(_contract);\\n\\n return _handleExternalMessage(\\n _nextMessageContext,\\n _gasLimit,\\n codeContractAddress,\\n _calldata,\\n false\\n );\\n }\\n\\n /**\\n * Handles all interactions which involve the execution manager calling out to untrusted code (both calls and creates).\\n * Ensures that OVM-related measures are enforced, including L2 gas refunds, nuisance gas, and flagged reversions.\\n *\\n * @param _nextMessageContext Message context to be used for the external message.\\n * @param _gasLimit Amount of gas to be passed into this message.\\n * @param _contract OVM address being called or deployed to\\n * @param _data Data for the message (either calldata or creation code)\\n * @param _isCreate Whether this is a create-type message.\\n * @return Whether or not the message (either a call or deployment) succeeded.\\n * @return Data returned by the message.\\n */\\n function _handleExternalMessage(\\n MessageContext memory _nextMessageContext,\\n uint256 _gasLimit,\\n address _contract,\\n bytes memory _data,\\n bool _isCreate\\n )\\n internal\\n returns (\\n bool,\\n bytes memory\\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. `_contract` 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\\n bool success;\\n bytes memory returndata;\\n if (_isCreate) {\\n // safeCREATE() is a function which replicates a CREATE message, but uses return values\\n // Which match that of CALL (i.e. bool, bytes). This allows many security checks to be\\n // to be shared between untrusted call and create call frames.\\n (success, returndata) = address(this).call(\\n abi.encodeWithSelector(\\n this.safeCREATE.selector,\\n _gasLimit,\\n _data,\\n _contract\\n )\\n );\\n } else {\\n (success, returndata) = _contract.call{gas: _gasLimit}(_data);\\n }\\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 (\\n flag == RevertFlag.INTENTIONAL_REVERT\\n || _isCreate\\n ) {\\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 * Handles the creation-specific safety measures required for OVM contract deployment.\\n * This function sanitizes the return types for creation messages to match calls (bool, bytes),\\n * by being an external function which the EM can call, that mimics the success/fail case of the CREATE.\\n * This allows for consistent handling of both types of messages in _handleExternalMessage().\\n * Having this step occur as a separate call frame also allows us to easily revert the\\n * contract deployment in the event that the code is unsafe.\\n *\\n * @param _gasLimit Amount of gas to be passed into this creation.\\n * @param _creationCode Code to pass into CREATE for deployment.\\n * @param _address OVM address being deployed to.\\n */\\n function safeCREATE(\\n uint _gasLimit,\\n bytes memory _creationCode,\\n address _address\\n )\\n external\\n {\\n // The only way this should callable is from within _createContract(),\\n // and it should DEFINITELY not be callable by a non-EM code contract.\\n if (msg.sender != address(this)) {\\n return;\\n }\\n // Check that there is not already code at this address.\\n if (_hasEmptyAccount(_address) == false) {\\n // Note: in the EVM, this case burns all allotted gas. For improved\\n // developer experience, we do return the remaining gas.\\n _revertWithFlag(\\n RevertFlag.CREATE_COLLISION,\\n Lib_ErrorUtils.encodeRevertString(\\\"A contract has already been deployed to this address\\\")\\n );\\n }\\n\\n // Check the creation bytecode against the OVM_SafetyChecker.\\n if (ovmSafetyChecker.isBytecodeSafe(_creationCode) == false) {\\n _revertWithFlag(\\n RevertFlag.UNSAFE_BYTECODE,\\n Lib_ErrorUtils.encodeRevertString(\\\"Contract creation code contains unsafe opcodes. Did you use the right compiler or pass an unsafe constructor argument?\\\")\\n );\\n }\\n\\n // We always need to initialize the contract with the default account values.\\n _initPendingAccount(_address);\\n\\n // Actually execute the EVM create message.\\n // NOTE: The inline assembly below means we can NOT make any evm calls between here and then.\\n address ethAddress = Lib_EthUtils.createContract(_creationCode);\\n\\n if (ethAddress == address(0)) {\\n // If the creation fails, the EVM lets us grab its revert data. This may contain a revert flag\\n // to be used above in _handleExternalMessage, so we pass the revert data back up unmodified.\\n assembly {\\n returndatacopy(0,0,returndatasize())\\n revert(0, returndatasize())\\n }\\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(\\n RevertFlag.UNSAFE_BYTECODE,\\n Lib_ErrorUtils.encodeRevertString(\\\"Constructor attempted to deploy unsafe bytecode.\\\")\\n );\\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 * 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 ) {\\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 view\\n {\\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 input values of a transaction.\\n * @return _valid Whether or not the transaction data is valid.\\n */\\n function _isValidInput(\\n Lib_OVMCodec.Transaction memory _transaction\\n )\\n view\\n internal\\n returns (\\n bool\\n )\\n {\\n // Prevent reentrancy to run():\\n // This check prevents calling run with the default ovmNumber.\\n // Combined with the first check in run():\\n // if (transactionContext.ovmNUMBER != DEFAULT_UINT256) { return; }\\n // It should be impossible to re-enter since run() returns before any other call frames are created.\\n // Since this value is already being written to storage, we save much gas compared to\\n // using the standard nonReentrant pattern.\\n if (_transaction.blockNumber == DEFAULT_UINT256) {\\n return false;\\n }\\n\\n if (_isValidGasLimit(_transaction.gasLimit, _transaction.l1QueueOrigin) == false) {\\n return false;\\n }\\n\\n return true;\\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 view\\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 = DEFAULT_ADDRESS;\\n transactionContext.ovmTIMESTAMP = DEFAULT_UINT256;\\n transactionContext.ovmNUMBER = DEFAULT_UINT256;\\n transactionContext.ovmGASLIMIT = DEFAULT_UINT256;\\n transactionContext.ovmTXGASLIMIT = DEFAULT_UINT256;\\n transactionContext.ovmL1QUEUEORIGIN = Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE;\\n\\n transactionRecord.ovmGasRefund = DEFAULT_UINT256;\\n\\n messageContext.ovmCALLER = DEFAULT_ADDRESS;\\n messageContext.ovmADDRESS = DEFAULT_ADDRESS;\\n messageContext.isStatic = false;\\n\\n messageRecord.nuisanceGasLeft = DEFAULT_UINT256;\\n\\n // Reset the ovmStateManager.\\n ovmStateManager = iOVM_StateManager(address(0));\\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 messageRecord.nuisanceGasLeft = uint(-1);\\n\\n messageContext.ovmADDRESS = _from;\\n\\n bool isCreate = _transaction.entrypoint == address(0);\\n if (isCreate) {\\n (address created, bytes memory revertData) = ovmCREATE(_transaction.data);\\n if (created == address(0)) {\\n return (false, revertData);\\n } else {\\n // The eth_call RPC endpoint for to = undefined will return the deployed bytecode\\n // in the success case, differing from standard create messages.\\n return (true, Lib_EthUtils.getCode(created));\\n }\\n } else {\\n return ovmCALL(\\n _transaction.gasLimit,\\n _transaction.entrypoint,\\n _transaction.data\\n );\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6d2f2c75fd5e494c53573b90cd1a06f3382a6fac3ea5bcbd1082acea2b0762c4\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/predeploys/OVM_DeployerWhitelist.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Interface Imports */\\nimport { iOVM_DeployerWhitelist } from \\\"../../iOVM/predeploys/iOVM_DeployerWhitelist.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: optimistic-solc\\n * Runtime target: OVM\\n */\\ncontract OVM_DeployerWhitelist is iOVM_DeployerWhitelist {\\n\\n /**********************\\n * Contract Constants *\\n **********************/\\n\\n bool public initialized;\\n bool public allowArbitraryDeployment;\\n address override public owner;\\n mapping (address => bool) public whitelist;\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Blocks functions to anyone except the contract owner.\\n */\\n modifier onlyOwner() {\\n require(\\n msg.sender == 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 if (initialized == true) {\\n return;\\n }\\n\\n initialized = true;\\n allowArbitraryDeployment = _allowArbitraryDeployment;\\n owner = _owner;\\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 whitelist[_deployer] = _isWhitelisted;\\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 owner = _owner;\\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 allowArbitraryDeployment = _allowArbitraryDeployment;\\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\\n )\\n {\\n return (\\n initialized == false\\n || allowArbitraryDeployment == true\\n || whitelist[_deployer]\\n );\\n }\\n}\\n\",\"keccak256\":\"0x371e3d3ca1dd4177738b55eead9ad6f8278280e568694df6b42ee01f5558ccb2\",\"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 * 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\":\"0x2d7973a0ad84c23ec62624d3f1e3aeb198cc72686ff1e6cfa17155556b320c94\",\"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 OUT_OF_GAS,\\n INTENTIONAL_REVERT,\\n EXCEEDS_NUISANCE_GAS,\\n INVALID_STATE_ACCESS,\\n UNSAFE_BYTECODE,\\n CREATE_COLLISION,\\n STATIC_VIOLATION,\\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 }\\n\\n\\n /************************************\\n * Transaction Execution Entrypoint *\\n ************************************/\\n\\n function run(\\n Lib_OVMCodec.Transaction calldata _transaction,\\n address _txStateManager\\n ) external returns (bytes memory);\\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, bytes memory _revertdata);\\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract, bytes memory _revertdata);\\n\\n\\n /*******************************\\n * Account Abstraction Opcodes *\\n ******************************/\\n\\n function ovmGETNONCE() external returns (uint256 _nonce);\\n function ovmINCREMENTNONCE() 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 Context *\\n ***************************************/\\n\\n function getMaxTransactionGasLimit() external view returns (uint _maxTransactionGasLimit);\\n}\\n\",\"keccak256\":\"0xf023d5d6fc6a03bd52f7a57af6e21076de77e8925d065bb79db062e73e43b684\",\"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/predeploys/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 owner() 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\":\"0xdf1f27faf0d26d416bf6d408d146a16de32b4e1772a292c65d39eb7ec2b53ceb\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x2ce671a0e004df88b136bea5a3c59d0732cea8887c8496da1d509e0200b03d7d\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xa5195afe32fb2cf104d156e8f4bd39df1ec79bf6ba232097b9e8e0ee14fbc298\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_ErrorUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/**\\n * @title Lib_ErrorUtils\\n */\\nlibrary Lib_ErrorUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes an error string into raw solidity-style revert data.\\n * (i.e. ascii bytes, prefixed with bytes4(keccak(\\\"Error(string))\\\"))\\n * Ref: https://docs.soliditylang.org/en/v0.8.2/control-structures.html?highlight=Error(string)#panic-via-assert-and-error-via-require\\n * @param _reason Reason for the reversion.\\n * @return Standard solidity revert data for the given reason.\\n */\\n function encodeRevertString(\\n string memory _reason\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return abi.encodeWithSignature(\\n \\\"Error(string)\\\",\\n _reason\\n );\\n }\\n}\\n\",\"keccak256\":\"0xfc64ec4a81fb50865b502a0004ed154e8598e1a313db77303fc95e41f536e6b7\",\"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 *\\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 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\\n )\\n {\\n bytes memory code;\\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 Full code of the contract.\\n */\\n function getCode(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes memory\\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 Size of the contract's code in bytes.\\n */\\n function getCodeSize(\\n address _address\\n )\\n internal\\n view\\n returns (\\n uint256\\n )\\n {\\n uint256 codeSize;\\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 Hash of the contract's code.\\n */\\n function getCodeHash(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n bytes32 codeHash;\\n assembly {\\n codeHash := extcodehash(_address)\\n }\\n\\n return codeHash;\\n }\\n\\n /**\\n * Creates a contract with some given initialization code.\\n * @param _code Contract initialization code.\\n * @return Address of the created contract.\\n */\\n function createContract(\\n bytes memory _code\\n )\\n internal\\n returns (\\n address\\n )\\n {\\n address created;\\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 to be generated by CREATE.\\n */\\n function getAddressForCREATE(\\n address _creator,\\n uint256 _nonce\\n )\\n internal\\n pure\\n returns (\\n 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 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 (\\n address\\n )\\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\":\"0xf29a67d78e61cb472d524b779b32cfcb39a587f4096500d5419e6425ed367d49\",\"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 * Note that the _elements argument is modified, therefore it must not be used again afterwards\\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 pure\\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 == 1) {\\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 (uint256 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\":\"0xa78edb9fbd34712771a1ebff05bc5e1abec7fc1e9a1bfb709d183099b44fa62a\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506040516200315338038062003153833981016040819052620000349162000067565b600080546001600160a01b0319166001600160a01b039590951694909417909355600191909155600255600355620000b2565b600080600080608085870312156200007d578384fd5b84516001600160a01b038116811462000094578485fd5b60208601516040870151606090970151919890975090945092505050565b61309180620000c26000396000f3fe608060405234801561001057600080fd5b50600436106101425760003560e01c8063876ed5cb116100b8578063cfdf677e1161007c578063cfdf677e1461023f578063d0f8934414610247578063e10d29ee1461024f578063e561dddc14610257578063f722b41a1461025f578063facdc5da1461026757610142565b8063876ed5cb146102175780638d38c6c11461021f578063b8f7700514610227578063c139eb151461022f578063c2cf696f1461023757610142565b80634de569ce1161010a5780634de569ce146101c25780635ae6256d146101e25780636fee07e0146101ea57806378f4b2f2146101ff5780637a167a8a146102075780637aa63a861461020f57610142565b8063138387a414610147578063299ca478146101655780632a7f18be1461017a578063378997701461019a578063461a4478146101af575b600080fd5b61014f61027a565b60405161015c91906124c7565b60405180910390f35b61016d610280565b60405161015c91906123eb565b61018d610188366004612388565b61028f565b60405161015c9190612e4e565b6101a26102b0565b60405161015c9190612e8d565b61016d6101bd36600461221b565b6102c4565b6101d56101d0366004612261565b6103a0565b60405161015c9190612484565b6101a26103da565b6101fd6101f8366004612188565b6103ee565b005b61014f61066d565b6101a2610674565b61014f610689565b61014f6106a4565b61014f6106aa565b6101a26106b0565b61014f6106c7565b61014f6106cd565b61016d6106d2565b6101fd6106f5565b61016d610b69565b61014f610b8c565b6101a2610c06565b6101fd610275366004612388565b610c1e565b60025481565b6000546001600160a01b031681565b610297611ed9565b6102a8826102a3610b69565b610c36565b90505b919050565b6000806102bb610d76565b50935050505090565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561032457818101518382015260200161030c565b50505050905090810190601f1680156103515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561036e57600080fd5b505afa158015610382573d6000803e3d6000fd5b505050506040513d602081101561039857600080fd5b505192915050565b82516000901515600114156103c2576103bb85858585610e24565b90506103d2565b6103bb8585602001518585610fef565b949350505050565b6000806103e5610d76565b94505050505090565b61c3508151111561041a5760405162461bcd60e51b81526004016104119061259b565b60405180910390fd5b60035482111561043c5760405162461bcd60e51b8152600401610411906127a1565b620186a082101561045f5760405162461bcd60e51b815260040161041190612983565b6020820460005a90508181116104875760405162461bcd60e51b815260040161041190612b8a565b60005b825a8303101561049c5760010161048a565b6000338787876040516020016104b594939291906123ff565b60408051601f19818403018152919052805160209091012090504360281b421760006104df610b69565b60405163b298e36b60e01b81529091506001600160a01b0382169063b298e36b9061050e9086906004016124c7565b600060405180830381600087803b15801561052857600080fd5b505af115801561053c573d6000803e3d6000fd5b505060405163b298e36b60e01b81526001600160a01b038416925063b298e36b915061056c9085906004016124c7565b600060405180830381600087803b15801561058657600080fd5b505af115801561059a573d6000803e3d6000fd5b50505050600060016002836001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156105dd57600080fd5b505afa1580156105f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106159190612203565b8161061c57fe5b040390507f4b388aecf9fa6cc92253704e5975a6129a4f735bdbd99567df4ed0094ee4ceb5338b8b8b85426040516106599695949392919061243c565b60405180910390a150505050505050505050565b620186a081565b60008061067f610d76565b5090935050505090565b600080610694610d76565b50505064ffffffffff1692915050565b61c35081565b60035481565b60006106c26106bd610b69565b6110c4565b905090565b60015481565b602081565b60006106c2604051806060016040528060258152602001613003602591396102c4565b60043560d81c60093560e890811c90600c35901c610711610689565b8364ffffffffff16146107365760405162461bcd60e51b815260040161041190612a35565b6107646040518060400160405280600d81526020016c27ab26afa9b2b8bab2b731b2b960991b8152506102c4565b6001600160a01b0316336001600160a01b0316146107945760405162461bcd60e51b815260040161041190612a92565b60008162ffffff16116107b95760405162461bcd60e51b8152600401610411906127fe565b60008262ffffff16116107de5760405162461bcd60e51b815260040161041190612cdf565b600f601062ffffff8316020164ffffffffff81163610156108115760405162461bcd60e51b815260040161041190612d66565b600061081b610b69565b90506000610828826110c4565b9050600062ffffff8616368161083a57fe5b0460020267ffffffffffffffff8111801561085457600080fd5b506040519080825280601f01601f19166020018201604052801561087f576020820181803683370190505b50905060008662ffffff1667ffffffffffffffff811180156108a057600080fd5b506040519080825280602002602001820160405280156108ca578160200160208202803683370190505b50905060008060006108da610674565b90506108e4611ef9565b60005b8a62ffffff168163ffffffff161015610a3b57600061090b8263ffffffff16611147565b905063ffffffff82166109215761092181611197565b61092d8382868d611264565b80925060005b835163ffffffff821610156109b1578b3560e81c61c3508111156109695760405162461bcd60e51b81526004016104119061259b565b61097c858e64ffffffffff16838d6112cf565b898963ffffffff168151811061098e57fe5b60209081029190910101529b909b016003019a6001968701969586019501610933565b5060005b83602001518163ffffffff161015610a31578964ffffffffff168564ffffffffff16106109f45760405162461bcd60e51b815260040161041190612da8565b610a048564ffffffffff16611363565b888863ffffffff1681518110610a1657fe5b602090810291909101015260019687019694850194016109b5565b50506001016108e7565b50610a488183898b6113a8565b3664ffffffffff8a1614610a6e5760405162461bcd60e51b815260040161041190612846565b8a62ffffff168463ffffffff1614610a985760405162461bcd60e51b815260040161041190612894565b6000838c62ffffff160363ffffffff169050600080836020015160001415610acb57505060408201516060830151610af3565b6000610ae16001870364ffffffffff168d610c36565b90508060200151925080604001519150505b610b14610aff8961141b565b8f62ffffff168564ffffffffff16858561184f565b7f602f1aeac0ca2e7a13e281a9ef0ad7838542712ce16780fa2ecffd351f05f89983860384610b41610689565b604051610b5093929190612e9f565b60405180910390a1505050505050505050505050505050565b60006106c2604051806060016040528060238152602001612ee6602391396102c4565b6000610b966106d2565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610bce57600080fd5b505afa158015610be2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c29190612203565b6000610c10610674565b610c186106b0565b03905090565b60405162461bcd60e51b81526004016104119061250b565b610c3e611ed9565b604051634a83e9cd60e11b815260028402906000906001600160a01b03851690639507d39a90610c72908590600401612e8d565b60206040518083038186803b158015610c8a57600080fd5b505afa158015610c9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc29190612203565b90506000846001600160a01b0316639507d39a846001016040518263ffffffff1660e01b8152600401610cf59190612e8d565b60206040518083038186803b158015610d0d57600080fd5b505afa158015610d21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d459190612203565b6040805160608101825293845264ffffffffff828116602086015260289290921c9091169083015250949350505050565b6000806000806000610d866106d2565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b158015610dbe57600080fd5b505afa158015610dd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df691906121dd565b64ffffffffff602882901c811697605083901c82169750607883901c8216965060a09290921c169350915050565b600080610e5c6040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b8152506102c4565b90506000816001600160a01b0316631c4712a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610e9957600080fd5b505afa158015610ead573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed19190612203565b90506000610ede87611a02565b9050610eeb818787611a9b565b610f075760405162461bcd60e51b8152600401610411906126ca565b86606001518860200151148015610f22575060408701518851145b8015610f635750610f4a604051806060016040528060228152602001612f09602291396102c4565b6001600160a01b031688608001516001600160a01b0316145b8015610f725750818860a00151145b8015610f89575060608801516001600160a01b0316155b8015610fa45750600088604001516001811115610fa257fe5b145b8015610fc557508660800151805190602001208860c0015180519060200120145b610fe15760405162461bcd60e51b81526004016104119061276a565b506001979650505050505050565b600080610ffb85611363565b9050611008818585611a9b565b6110245760405162461bcd60e51b815260040161041190612c2a565b6000866060015187608001518860a001518960c0015160405160200161104d94939291906123ff565b60405160208183030381529060405280519060200120905060006110708761028f565b80519091508214801561108e57508751602082015164ffffffffff16145b80156110a857508760200151816040015164ffffffffff16145b610fe15760405162461bcd60e51b815260040161041190612adf565b60006002826001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b15801561110157600080fd5b505afa158015611115573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111399190612203565b8161114057fe5b0492915050565b61114f611ef9565b5060408051608081018252601092909202600f81013560e890811c84526012820135901c6020840152601581013560d890811c92840192909252601a0135901c606082015290565b60006111a1610689565b1115611211576000806111b2610d76565b9350935050508064ffffffffff16836060015110156111e35760405162461bcd60e51b815260040161041190612718565b8164ffffffffff168360400151101561120e5760405162461bcd60e51b8152600401610411906125f8565b50505b4260015482604001510110156112395760405162461bcd60e51b815260040161041190612d20565b4360025482606001510110156112615760405162461bcd60e51b815260040161041190612552565b50565b83604001518360400151101561128c5760405162461bcd60e51b815260040161041190612bd5565b8360600151836060015110156112b45760405162461bcd60e51b815260040161041190612df1565b6020830151156112c9576112c9838383611b8c565b50505050565b60008151836041011115611326578260410167ffffffffffffffff811180156112f757600080fd5b506040519080825280601f01601f191660200182016040528015611322576020820181803683370190505b5091505b6040850151606086015160006020850160018153836001820152826021820152866003890160418301376041870190209350505050949350505050565b60006102a86040518060a00160405280600015158152602001848152602001600081526020016000815260200160405180602001604052806000815250815250611c2d565b600083830364ffffffffff161180156113c357506020840151155b156113d3576113d3848483611b8c565b42846040015111156113f75760405162461bcd60e51b815260040161041190612b45565b43846060015111156112c95760405162461bcd60e51b815260040161041190612904565b60008082511161145c5760405162461bcd60e51b81526004018080602001828103825260348152602001806130286034913960400191505060405180910390fd5b815160011415611482578160008151811061147357fe5b602002602001015190506102ab565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b600184111561182b5750506002820460018084161460005b828110156117a7578a816002028151811061174e57fe5b602002602001015196508a816002026001018151811061176a57fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061179457fe5b6020908102919091010152600101611737565b50801561180a578960018503815181106117bd57fe5b602002602001015195508783601081106117d357fe5b602002015160001b945085602088015284604088015286805190602001208a83815181106117fd57fe5b6020026020010181815250505b80611816576000611819565b60015b60ff168201935060019092019161171f565b8960008151811061183857fe5b602002602001015198505050505050505050919050565b60006118596106d2565b9050600080611866610d76565b50509150915060006040518060a00160405280856001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156118b257600080fd5b505afa1580156118c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ea9190612203565b81526020018a81526020018981526020018464ffffffffff16815260200160405180602001604052806000815250815250905080600001517f127186556e7be68c7e31263195225b4de02820707889540969f62c05cf73525e826020015183604001518460600151856080015160405161196794939291906124e6565b60405180910390a2600061197a82611c75565b90506000611992836040015186018a86018a8a611c9e565b60405163080549db60e21b81529091506001600160a01b03871690632015276c906119c390859085906004016124d0565b600060405180830381600087803b1580156119dd57600080fd5b505af11580156119f1573d6000803e3d6000fd5b505050505050505050505050505050565b6080810151805160009190826041820167ffffffffffffffff81118015611a2857600080fd5b506040519080825280601f01601f191660200182016040528015611a53576020820181803683370190505b5060408601516060870151919250906000602084016001815383600182015282602182015285604182018760208a0160045afa50604190950190942095505050505050919050565b6000611aa56106d2565b8351604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a91611ad391600401612e7c565b60206040518083038186803b158015611aeb57600080fd5b505afa158015611aff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b239190612203565b611b2c84611c75565b14611b495760405162461bcd60e51b815260040161041190612b16565b611b66836020015185846000015185602001518760400151611cbd565b611b825760405162461bcd60e51b81526004016104119061294c565b5060019392505050565b6000611b9f8364ffffffffff1683610c36565b9050600154816020015164ffffffffff16014210611bcf5760405162461bcd60e51b815260040161041190612647565b806020015164ffffffffff1684604001511115611bfe5760405162461bcd60e51b8152600401610411906129cc565b806040015164ffffffffff16846060015111156112c95760405162461bcd60e51b815260040161041190612c74565b8051602080830151604080850151606086015160808701519251600096611c5896909594910161248f565b604051602081830303815290604052805190602001209050919050565b60008160200151826040015183606001518460800151604051602001611c5894939291906124e6565b602892831b9390931760509190911b1760789290921b91909117901b90565b6000808211611cfd5760405162461bcd60e51b8152600401808060200182810382526037815260200180612f7f6037913960400191505060405180910390fd5b818410611d3b5760405162461bcd60e51b8152600401808060200182810382526024815260200180612f2b6024913960400191505060405180910390fd5b611d4482611e42565b835114611d825760405162461bcd60e51b815260040180806020018281038252604d815260200180612fb6604d913960600191505060405180910390fd5b8460005b8451811015611e35578560011660011415611de457848181518110611da757fe5b6020026020010151826040516020018083815260200182815260200192505050604051602081830303815290604052805190602001209150611e29565b81858281518110611df157fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c9501611d86565b5090951495945050505050565b6000808211611e825760405162461bcd60e51b8152600401808060200182810382526030815260200180612f4f6030913960400191505060405180910390fd5b8160011415611e93575060006102ab565b81600060805b60018110611ec3576000196001821b01811b831615611ebb5791821c91908101905b60011c611e99565b506001811b8414611ed2576001015b9392505050565b604080516060810182526000808252602082018190529181019190915290565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b600067ffffffffffffffff831115611f3557fe5b611f48601f8401601f1916602001612ec1565b9050828152838383011115611f5c57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102ab57600080fd5b600082601f830112611f9a578081fd5b611ed283833560208501611f21565b8035600281106102ab57600080fd5b600060a08284031215611fc9578081fd5b60405160a0810167ffffffffffffffff8282108183111715611fe757fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561202457600080fd5b5061203185828601611f8a565b6080830152505092915050565b60006040828403121561204f578081fd5b6040516040810167ffffffffffffffff828210818311171561206d57fe5b816040528293508435835260209150818501358181111561208d57600080fd5b8501601f8101871361209e57600080fd5b8035828111156120aa57fe5b83810292506120ba848401612ec1565b8181528481019083860185850187018b10156120d557600080fd5b600095505b838610156120f85780358352600195909501949186019186016120da565b5080868801525050505050505092915050565b600060a0828403121561211c578081fd5b60405160a0810167ffffffffffffffff828210818311171561213a57fe5b8160405282935084359150811515821461215357600080fd5b818352602085013560208401526040850135604084015260608501356060840152608085013591508082111561202457600080fd5b60008060006060848603121561219c578283fd5b6121a584611f73565b925060208401359150604084013567ffffffffffffffff8111156121c7578182fd5b6121d386828701611f8a565b9150509250925092565b6000602082840312156121ee578081fd5b815164ffffffffff1981168114611ed2578182fd5b600060208284031215612214578081fd5b5051919050565b60006020828403121561222c578081fd5b813567ffffffffffffffff811115612242578182fd5b8201601f81018413612252578182fd5b6103d284823560208401611f21565b60008060008060808587031215612276578081fd5b843567ffffffffffffffff8082111561228d578283fd5b9086019060e082890312156122a0578283fd5b6122aa60e0612ec1565b82358152602083013560208201526122c460408401611fa9565b60408201526122d560608401611f73565b60608201526122e660808401611f73565b608082015260a083013560a082015260c083013582811115612306578485fd5b6123128a828601611f8a565b60c0830152509550602087013591508082111561232d578283fd5b6123398883890161210b565b9450604087013591508082111561234e578283fd5b61235a88838901611fb8565b9350606087013591508082111561236f578283fd5b5061237c8782880161203e565b91505092959194509250565b600060208284031215612399578081fd5b5035919050565b60008151808452815b818110156123c5576020818501810151868301820152016123a9565b818111156123d65782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612432908301846123a0565b9695505050505050565b6001600160a01b038781168252861660208201526040810185905260c06060820181905260009061246f908301866123a0565b60808301949094525060a00152949350505050565b901515815260200190565b6000861515825285602083015284604083015283606083015260a060808301526124bc60a08301846123a0565b979650505050505050565b90815260200190565b91825264ffffffffff1916602082015260400190565b60008582528460208301528360408301526080606083015261243260808301846123a0565b60208082526027908201527f617070656e64517565756542617463682069732063757272656e746c7920646960408201526639b0b13632b21760c91b606082015260800190565b60208082526029908201527f436f6e7465787420626c6f636b206e756d62657220746f6f2066617220696e206040820152683a3432903830b9ba1760b91b606082015260800190565b6020808252603d908201527f5472616e73616374696f6e20646174612073697a652065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b6020808252602f908201527f436f6e746578742074696d657374616d70206973206c6f776572207468616e2060408201526e3630b9ba1039bab136b4ba3a32b21760891b606082015260800190565b6020808252605b908201527f50726576696f75736c7920656e7175657565642062617463686573206861766560408201527f206578706972656420616e64206d75737420626520617070656e64656420626560608201527f666f72652061206e65772073657175656e6365722062617463682e0000000000608082015260a00190565b6020808252602e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e20696e60408201526d31b63ab9b4b7b710383937b7b31760911b606082015260800190565b60208082526032908201527f436f6e7465787420626c6f636b206e756d626572206973206c6f77657220746860408201527130b7103630b9ba1039bab136b4ba3a32b21760711b606082015260800190565b6020808252601e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e2e0000604082015260600190565b6020808252603d908201527f5472616e73616374696f6e20676173206c696d69742065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b60208082526028908201527f4d7573742070726f76696465206174206c65617374206f6e652062617463682060408201526731b7b73a32bc3a1760c11b606082015260800190565b6020808252602e908201527f4e6f7420616c6c2073657175656e636572207472616e73616374696f6e73207760408201526d32b93290383937b1b2b9b9b2b21760911b606082015260800190565b6020808252604a908201527f41637475616c207472616e73616374696f6e20696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420746f74616c20656c656d656e7473206060820152693a379030b83832b7321760b11b608082015260a00190565b60208082526028908201527f436f6e7465787420626c6f636b206e756d6265722069732066726f6d2074686560408201526710333aba3ab9329760c11b606082015260800190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b60208082526029908201527f5472616e73616374696f6e20676173206c696d697420746f6f206c6f7720746f6040820152681032b738bab2bab29760b91b606082015260800190565b60208082526043908201527f53657175656e636572207472616e73616374696f6e2074696d657374616d702060408201527f657863656564732074686174206f66206e65787420717565756520656c656d65606082015262373a1760e91b608082015260a00190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b6020808252602d908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c6564206279207460408201526c34329029b2b8bab2b731b2b91760991b606082015260800190565b6020808252601a908201527f496e76616c6964205175657565207472616e73616374696f6e2e000000000000604082015260600190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b60208082526025908201527f436f6e746578742074696d657374616d702069732066726f6d207468652066756040820152643a3ab9329760d91b606082015260800190565b6020808252602b908201527f496e73756666696369656e742067617320666f72204c322072617465206c696d60408201526a34ba34b73390313ab9371760a91b606082015260800190565b60208082526035908201527f436f6e746578742074696d657374616d702076616c756573206d757374206d6f6040820152743737ba37b734b1b0b6363c9034b731b932b0b9b29760591b606082015260800190565b6020808252602a908201527f496e76616c6964205175657565207472616e73616374696f6e20696e636c757360408201526934b7b710383937b7b31760b11b606082015260800190565b60208082526045908201527f53657175656e636572207472616e73616374696f6e20626c6f636b4e756d626560408201527f7220657863656564732074686174206f66206e65787420717565756520656c6560608201526436b2b73a1760d91b608082015260a00190565b60208082526021908201527f4d75737420617070656e64206174206c65617374206f6e6520656c656d656e746040820152601760f91b606082015260800190565b60208082526026908201527f436f6e746578742074696d657374616d7020746f6f2066617220696e20746865604082015265103830b9ba1760d11b606082015260800190565b60208082526022908201527f4e6f7420656e6f756768204261746368436f6e74657874732070726f76696465604082015261321760f11b606082015260800190565b60208082526029908201527f4e6f7420656e6f75676820717565756564207472616e73616374696f6e732074604082015268379030b83832b7321760b91b606082015260800190565b60208082526037908201527f436f6e7465787420626c6f636b4e756d6265722076616c756573206d7573742060408201527f6d6f6e6f746f6e6963616c6c7920696e6372656173652e000000000000000000606082015260800190565b8151815260208083015164ffffffffff90811691830191909152604092830151169181019190915260600190565b63ffffffff91909116815260200190565b64ffffffffff91909116815260200190565b64ffffffffff9384168152919092166020820152604081019190915260600190565b60405181810167ffffffffffffffff81118282101715612edd57fe5b60405291905056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a4354433a71756575654f564d5f4465636f6d7072657373696f6e507265636f6d70696c65416464726573734c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4f564d5f436861696e53746f72616765436f6e7461696e65723a4354433a626174636865734c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea26469706673582212209b8491ed970ee9675604be8c2fab390420552fe108603099f2ea76166694e32c64736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101425760003560e01c8063876ed5cb116100b8578063cfdf677e1161007c578063cfdf677e1461023f578063d0f8934414610247578063e10d29ee1461024f578063e561dddc14610257578063f722b41a1461025f578063facdc5da1461026757610142565b8063876ed5cb146102175780638d38c6c11461021f578063b8f7700514610227578063c139eb151461022f578063c2cf696f1461023757610142565b80634de569ce1161010a5780634de569ce146101c25780635ae6256d146101e25780636fee07e0146101ea57806378f4b2f2146101ff5780637a167a8a146102075780637aa63a861461020f57610142565b8063138387a414610147578063299ca478146101655780632a7f18be1461017a578063378997701461019a578063461a4478146101af575b600080fd5b61014f61027a565b60405161015c91906124c7565b60405180910390f35b61016d610280565b60405161015c91906123eb565b61018d610188366004612388565b61028f565b60405161015c9190612e4e565b6101a26102b0565b60405161015c9190612e8d565b61016d6101bd36600461221b565b6102c4565b6101d56101d0366004612261565b6103a0565b60405161015c9190612484565b6101a26103da565b6101fd6101f8366004612188565b6103ee565b005b61014f61066d565b6101a2610674565b61014f610689565b61014f6106a4565b61014f6106aa565b6101a26106b0565b61014f6106c7565b61014f6106cd565b61016d6106d2565b6101fd6106f5565b61016d610b69565b61014f610b8c565b6101a2610c06565b6101fd610275366004612388565b610c1e565b60025481565b6000546001600160a01b031681565b610297611ed9565b6102a8826102a3610b69565b610c36565b90505b919050565b6000806102bb610d76565b50935050505090565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561032457818101518382015260200161030c565b50505050905090810190601f1680156103515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561036e57600080fd5b505afa158015610382573d6000803e3d6000fd5b505050506040513d602081101561039857600080fd5b505192915050565b82516000901515600114156103c2576103bb85858585610e24565b90506103d2565b6103bb8585602001518585610fef565b949350505050565b6000806103e5610d76565b94505050505090565b61c3508151111561041a5760405162461bcd60e51b81526004016104119061259b565b60405180910390fd5b60035482111561043c5760405162461bcd60e51b8152600401610411906127a1565b620186a082101561045f5760405162461bcd60e51b815260040161041190612983565b6020820460005a90508181116104875760405162461bcd60e51b815260040161041190612b8a565b60005b825a8303101561049c5760010161048a565b6000338787876040516020016104b594939291906123ff565b60408051601f19818403018152919052805160209091012090504360281b421760006104df610b69565b60405163b298e36b60e01b81529091506001600160a01b0382169063b298e36b9061050e9086906004016124c7565b600060405180830381600087803b15801561052857600080fd5b505af115801561053c573d6000803e3d6000fd5b505060405163b298e36b60e01b81526001600160a01b038416925063b298e36b915061056c9085906004016124c7565b600060405180830381600087803b15801561058657600080fd5b505af115801561059a573d6000803e3d6000fd5b50505050600060016002836001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156105dd57600080fd5b505afa1580156105f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106159190612203565b8161061c57fe5b040390507f4b388aecf9fa6cc92253704e5975a6129a4f735bdbd99567df4ed0094ee4ceb5338b8b8b85426040516106599695949392919061243c565b60405180910390a150505050505050505050565b620186a081565b60008061067f610d76565b5090935050505090565b600080610694610d76565b50505064ffffffffff1692915050565b61c35081565b60035481565b60006106c26106bd610b69565b6110c4565b905090565b60015481565b602081565b60006106c2604051806060016040528060258152602001613003602591396102c4565b60043560d81c60093560e890811c90600c35901c610711610689565b8364ffffffffff16146107365760405162461bcd60e51b815260040161041190612a35565b6107646040518060400160405280600d81526020016c27ab26afa9b2b8bab2b731b2b960991b8152506102c4565b6001600160a01b0316336001600160a01b0316146107945760405162461bcd60e51b815260040161041190612a92565b60008162ffffff16116107b95760405162461bcd60e51b8152600401610411906127fe565b60008262ffffff16116107de5760405162461bcd60e51b815260040161041190612cdf565b600f601062ffffff8316020164ffffffffff81163610156108115760405162461bcd60e51b815260040161041190612d66565b600061081b610b69565b90506000610828826110c4565b9050600062ffffff8616368161083a57fe5b0460020267ffffffffffffffff8111801561085457600080fd5b506040519080825280601f01601f19166020018201604052801561087f576020820181803683370190505b50905060008662ffffff1667ffffffffffffffff811180156108a057600080fd5b506040519080825280602002602001820160405280156108ca578160200160208202803683370190505b50905060008060006108da610674565b90506108e4611ef9565b60005b8a62ffffff168163ffffffff161015610a3b57600061090b8263ffffffff16611147565b905063ffffffff82166109215761092181611197565b61092d8382868d611264565b80925060005b835163ffffffff821610156109b1578b3560e81c61c3508111156109695760405162461bcd60e51b81526004016104119061259b565b61097c858e64ffffffffff16838d6112cf565b898963ffffffff168151811061098e57fe5b60209081029190910101529b909b016003019a6001968701969586019501610933565b5060005b83602001518163ffffffff161015610a31578964ffffffffff168564ffffffffff16106109f45760405162461bcd60e51b815260040161041190612da8565b610a048564ffffffffff16611363565b888863ffffffff1681518110610a1657fe5b602090810291909101015260019687019694850194016109b5565b50506001016108e7565b50610a488183898b6113a8565b3664ffffffffff8a1614610a6e5760405162461bcd60e51b815260040161041190612846565b8a62ffffff168463ffffffff1614610a985760405162461bcd60e51b815260040161041190612894565b6000838c62ffffff160363ffffffff169050600080836020015160001415610acb57505060408201516060830151610af3565b6000610ae16001870364ffffffffff168d610c36565b90508060200151925080604001519150505b610b14610aff8961141b565b8f62ffffff168564ffffffffff16858561184f565b7f602f1aeac0ca2e7a13e281a9ef0ad7838542712ce16780fa2ecffd351f05f89983860384610b41610689565b604051610b5093929190612e9f565b60405180910390a1505050505050505050505050505050565b60006106c2604051806060016040528060238152602001612ee6602391396102c4565b6000610b966106d2565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610bce57600080fd5b505afa158015610be2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c29190612203565b6000610c10610674565b610c186106b0565b03905090565b60405162461bcd60e51b81526004016104119061250b565b610c3e611ed9565b604051634a83e9cd60e11b815260028402906000906001600160a01b03851690639507d39a90610c72908590600401612e8d565b60206040518083038186803b158015610c8a57600080fd5b505afa158015610c9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc29190612203565b90506000846001600160a01b0316639507d39a846001016040518263ffffffff1660e01b8152600401610cf59190612e8d565b60206040518083038186803b158015610d0d57600080fd5b505afa158015610d21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d459190612203565b6040805160608101825293845264ffffffffff828116602086015260289290921c9091169083015250949350505050565b6000806000806000610d866106d2565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b158015610dbe57600080fd5b505afa158015610dd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df691906121dd565b64ffffffffff602882901c811697605083901c82169750607883901c8216965060a09290921c169350915050565b600080610e5c6040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b8152506102c4565b90506000816001600160a01b0316631c4712a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610e9957600080fd5b505afa158015610ead573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed19190612203565b90506000610ede87611a02565b9050610eeb818787611a9b565b610f075760405162461bcd60e51b8152600401610411906126ca565b86606001518860200151148015610f22575060408701518851145b8015610f635750610f4a604051806060016040528060228152602001612f09602291396102c4565b6001600160a01b031688608001516001600160a01b0316145b8015610f725750818860a00151145b8015610f89575060608801516001600160a01b0316155b8015610fa45750600088604001516001811115610fa257fe5b145b8015610fc557508660800151805190602001208860c0015180519060200120145b610fe15760405162461bcd60e51b81526004016104119061276a565b506001979650505050505050565b600080610ffb85611363565b9050611008818585611a9b565b6110245760405162461bcd60e51b815260040161041190612c2a565b6000866060015187608001518860a001518960c0015160405160200161104d94939291906123ff565b60405160208183030381529060405280519060200120905060006110708761028f565b80519091508214801561108e57508751602082015164ffffffffff16145b80156110a857508760200151816040015164ffffffffff16145b610fe15760405162461bcd60e51b815260040161041190612adf565b60006002826001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b15801561110157600080fd5b505afa158015611115573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111399190612203565b8161114057fe5b0492915050565b61114f611ef9565b5060408051608081018252601092909202600f81013560e890811c84526012820135901c6020840152601581013560d890811c92840192909252601a0135901c606082015290565b60006111a1610689565b1115611211576000806111b2610d76565b9350935050508064ffffffffff16836060015110156111e35760405162461bcd60e51b815260040161041190612718565b8164ffffffffff168360400151101561120e5760405162461bcd60e51b8152600401610411906125f8565b50505b4260015482604001510110156112395760405162461bcd60e51b815260040161041190612d20565b4360025482606001510110156112615760405162461bcd60e51b815260040161041190612552565b50565b83604001518360400151101561128c5760405162461bcd60e51b815260040161041190612bd5565b8360600151836060015110156112b45760405162461bcd60e51b815260040161041190612df1565b6020830151156112c9576112c9838383611b8c565b50505050565b60008151836041011115611326578260410167ffffffffffffffff811180156112f757600080fd5b506040519080825280601f01601f191660200182016040528015611322576020820181803683370190505b5091505b6040850151606086015160006020850160018153836001820152826021820152866003890160418301376041870190209350505050949350505050565b60006102a86040518060a00160405280600015158152602001848152602001600081526020016000815260200160405180602001604052806000815250815250611c2d565b600083830364ffffffffff161180156113c357506020840151155b156113d3576113d3848483611b8c565b42846040015111156113f75760405162461bcd60e51b815260040161041190612b45565b43846060015111156112c95760405162461bcd60e51b815260040161041190612904565b60008082511161145c5760405162461bcd60e51b81526004018080602001828103825260348152602001806130286034913960400191505060405180910390fd5b815160011415611482578160008151811061147357fe5b602002602001015190506102ab565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b600184111561182b5750506002820460018084161460005b828110156117a7578a816002028151811061174e57fe5b602002602001015196508a816002026001018151811061176a57fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061179457fe5b6020908102919091010152600101611737565b50801561180a578960018503815181106117bd57fe5b602002602001015195508783601081106117d357fe5b602002015160001b945085602088015284604088015286805190602001208a83815181106117fd57fe5b6020026020010181815250505b80611816576000611819565b60015b60ff168201935060019092019161171f565b8960008151811061183857fe5b602002602001015198505050505050505050919050565b60006118596106d2565b9050600080611866610d76565b50509150915060006040518060a00160405280856001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156118b257600080fd5b505afa1580156118c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ea9190612203565b81526020018a81526020018981526020018464ffffffffff16815260200160405180602001604052806000815250815250905080600001517f127186556e7be68c7e31263195225b4de02820707889540969f62c05cf73525e826020015183604001518460600151856080015160405161196794939291906124e6565b60405180910390a2600061197a82611c75565b90506000611992836040015186018a86018a8a611c9e565b60405163080549db60e21b81529091506001600160a01b03871690632015276c906119c390859085906004016124d0565b600060405180830381600087803b1580156119dd57600080fd5b505af11580156119f1573d6000803e3d6000fd5b505050505050505050505050505050565b6080810151805160009190826041820167ffffffffffffffff81118015611a2857600080fd5b506040519080825280601f01601f191660200182016040528015611a53576020820181803683370190505b5060408601516060870151919250906000602084016001815383600182015282602182015285604182018760208a0160045afa50604190950190942095505050505050919050565b6000611aa56106d2565b8351604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a91611ad391600401612e7c565b60206040518083038186803b158015611aeb57600080fd5b505afa158015611aff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b239190612203565b611b2c84611c75565b14611b495760405162461bcd60e51b815260040161041190612b16565b611b66836020015185846000015185602001518760400151611cbd565b611b825760405162461bcd60e51b81526004016104119061294c565b5060019392505050565b6000611b9f8364ffffffffff1683610c36565b9050600154816020015164ffffffffff16014210611bcf5760405162461bcd60e51b815260040161041190612647565b806020015164ffffffffff1684604001511115611bfe5760405162461bcd60e51b8152600401610411906129cc565b806040015164ffffffffff16846060015111156112c95760405162461bcd60e51b815260040161041190612c74565b8051602080830151604080850151606086015160808701519251600096611c5896909594910161248f565b604051602081830303815290604052805190602001209050919050565b60008160200151826040015183606001518460800151604051602001611c5894939291906124e6565b602892831b9390931760509190911b1760789290921b91909117901b90565b6000808211611cfd5760405162461bcd60e51b8152600401808060200182810382526037815260200180612f7f6037913960400191505060405180910390fd5b818410611d3b5760405162461bcd60e51b8152600401808060200182810382526024815260200180612f2b6024913960400191505060405180910390fd5b611d4482611e42565b835114611d825760405162461bcd60e51b815260040180806020018281038252604d815260200180612fb6604d913960600191505060405180910390fd5b8460005b8451811015611e35578560011660011415611de457848181518110611da757fe5b6020026020010151826040516020018083815260200182815260200192505050604051602081830303815290604052805190602001209150611e29565b81858281518110611df157fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c9501611d86565b5090951495945050505050565b6000808211611e825760405162461bcd60e51b8152600401808060200182810382526030815260200180612f4f6030913960400191505060405180910390fd5b8160011415611e93575060006102ab565b81600060805b60018110611ec3576000196001821b01811b831615611ebb5791821c91908101905b60011c611e99565b506001811b8414611ed2576001015b9392505050565b604080516060810182526000808252602082018190529181019190915290565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b600067ffffffffffffffff831115611f3557fe5b611f48601f8401601f1916602001612ec1565b9050828152838383011115611f5c57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102ab57600080fd5b600082601f830112611f9a578081fd5b611ed283833560208501611f21565b8035600281106102ab57600080fd5b600060a08284031215611fc9578081fd5b60405160a0810167ffffffffffffffff8282108183111715611fe757fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561202457600080fd5b5061203185828601611f8a565b6080830152505092915050565b60006040828403121561204f578081fd5b6040516040810167ffffffffffffffff828210818311171561206d57fe5b816040528293508435835260209150818501358181111561208d57600080fd5b8501601f8101871361209e57600080fd5b8035828111156120aa57fe5b83810292506120ba848401612ec1565b8181528481019083860185850187018b10156120d557600080fd5b600095505b838610156120f85780358352600195909501949186019186016120da565b5080868801525050505050505092915050565b600060a0828403121561211c578081fd5b60405160a0810167ffffffffffffffff828210818311171561213a57fe5b8160405282935084359150811515821461215357600080fd5b818352602085013560208401526040850135604084015260608501356060840152608085013591508082111561202457600080fd5b60008060006060848603121561219c578283fd5b6121a584611f73565b925060208401359150604084013567ffffffffffffffff8111156121c7578182fd5b6121d386828701611f8a565b9150509250925092565b6000602082840312156121ee578081fd5b815164ffffffffff1981168114611ed2578182fd5b600060208284031215612214578081fd5b5051919050565b60006020828403121561222c578081fd5b813567ffffffffffffffff811115612242578182fd5b8201601f81018413612252578182fd5b6103d284823560208401611f21565b60008060008060808587031215612276578081fd5b843567ffffffffffffffff8082111561228d578283fd5b9086019060e082890312156122a0578283fd5b6122aa60e0612ec1565b82358152602083013560208201526122c460408401611fa9565b60408201526122d560608401611f73565b60608201526122e660808401611f73565b608082015260a083013560a082015260c083013582811115612306578485fd5b6123128a828601611f8a565b60c0830152509550602087013591508082111561232d578283fd5b6123398883890161210b565b9450604087013591508082111561234e578283fd5b61235a88838901611fb8565b9350606087013591508082111561236f578283fd5b5061237c8782880161203e565b91505092959194509250565b600060208284031215612399578081fd5b5035919050565b60008151808452815b818110156123c5576020818501810151868301820152016123a9565b818111156123d65782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612432908301846123a0565b9695505050505050565b6001600160a01b038781168252861660208201526040810185905260c06060820181905260009061246f908301866123a0565b60808301949094525060a00152949350505050565b901515815260200190565b6000861515825285602083015284604083015283606083015260a060808301526124bc60a08301846123a0565b979650505050505050565b90815260200190565b91825264ffffffffff1916602082015260400190565b60008582528460208301528360408301526080606083015261243260808301846123a0565b60208082526027908201527f617070656e64517565756542617463682069732063757272656e746c7920646960408201526639b0b13632b21760c91b606082015260800190565b60208082526029908201527f436f6e7465787420626c6f636b206e756d62657220746f6f2066617220696e206040820152683a3432903830b9ba1760b91b606082015260800190565b6020808252603d908201527f5472616e73616374696f6e20646174612073697a652065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b6020808252602f908201527f436f6e746578742074696d657374616d70206973206c6f776572207468616e2060408201526e3630b9ba1039bab136b4ba3a32b21760891b606082015260800190565b6020808252605b908201527f50726576696f75736c7920656e7175657565642062617463686573206861766560408201527f206578706972656420616e64206d75737420626520617070656e64656420626560608201527f666f72652061206e65772073657175656e6365722062617463682e0000000000608082015260a00190565b6020808252602e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e20696e60408201526d31b63ab9b4b7b710383937b7b31760911b606082015260800190565b60208082526032908201527f436f6e7465787420626c6f636b206e756d626572206973206c6f77657220746860408201527130b7103630b9ba1039bab136b4ba3a32b21760711b606082015260800190565b6020808252601e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e2e0000604082015260600190565b6020808252603d908201527f5472616e73616374696f6e20676173206c696d69742065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b60208082526028908201527f4d7573742070726f76696465206174206c65617374206f6e652062617463682060408201526731b7b73a32bc3a1760c11b606082015260800190565b6020808252602e908201527f4e6f7420616c6c2073657175656e636572207472616e73616374696f6e73207760408201526d32b93290383937b1b2b9b9b2b21760911b606082015260800190565b6020808252604a908201527f41637475616c207472616e73616374696f6e20696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420746f74616c20656c656d656e7473206060820152693a379030b83832b7321760b11b608082015260a00190565b60208082526028908201527f436f6e7465787420626c6f636b206e756d6265722069732066726f6d2074686560408201526710333aba3ab9329760c11b606082015260800190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b60208082526029908201527f5472616e73616374696f6e20676173206c696d697420746f6f206c6f7720746f6040820152681032b738bab2bab29760b91b606082015260800190565b60208082526043908201527f53657175656e636572207472616e73616374696f6e2074696d657374616d702060408201527f657863656564732074686174206f66206e65787420717565756520656c656d65606082015262373a1760e91b608082015260a00190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b6020808252602d908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c6564206279207460408201526c34329029b2b8bab2b731b2b91760991b606082015260800190565b6020808252601a908201527f496e76616c6964205175657565207472616e73616374696f6e2e000000000000604082015260600190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b60208082526025908201527f436f6e746578742074696d657374616d702069732066726f6d207468652066756040820152643a3ab9329760d91b606082015260800190565b6020808252602b908201527f496e73756666696369656e742067617320666f72204c322072617465206c696d60408201526a34ba34b73390313ab9371760a91b606082015260800190565b60208082526035908201527f436f6e746578742074696d657374616d702076616c756573206d757374206d6f6040820152743737ba37b734b1b0b6363c9034b731b932b0b9b29760591b606082015260800190565b6020808252602a908201527f496e76616c6964205175657565207472616e73616374696f6e20696e636c757360408201526934b7b710383937b7b31760b11b606082015260800190565b60208082526045908201527f53657175656e636572207472616e73616374696f6e20626c6f636b4e756d626560408201527f7220657863656564732074686174206f66206e65787420717565756520656c6560608201526436b2b73a1760d91b608082015260a00190565b60208082526021908201527f4d75737420617070656e64206174206c65617374206f6e6520656c656d656e746040820152601760f91b606082015260800190565b60208082526026908201527f436f6e746578742074696d657374616d7020746f6f2066617220696e20746865604082015265103830b9ba1760d11b606082015260800190565b60208082526022908201527f4e6f7420656e6f756768204261746368436f6e74657874732070726f76696465604082015261321760f11b606082015260800190565b60208082526029908201527f4e6f7420656e6f75676820717565756564207472616e73616374696f6e732074604082015268379030b83832b7321760b91b606082015260800190565b60208082526037908201527f436f6e7465787420626c6f636b4e756d6265722076616c756573206d7573742060408201527f6d6f6e6f746f6e6963616c6c7920696e6372656173652e000000000000000000606082015260800190565b8151815260208083015164ffffffffff90811691830191909152604092830151169181019190915260600190565b63ffffffff91909116815260200190565b64ffffffffff91909116815260200190565b64ffffffffff9384168152919092166020820152604081019190915260600190565b60405181810167ffffffffffffffff81118282101715612edd57fe5b60405291905056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a4354433a71756575654f564d5f4465636f6d7072657373696f6e507265636f6d70696c65416464726573734c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4f564d5f436861696e53746f72616765436f6e7461696e65723a4354433a626174636865734c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea26469706673582212209b8491ed970ee9675604be8c2fab390420552fe108603099f2ea76166694e32c64736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"\",\"type\":\"uint256\"}],\"name\":\"appendQueueBatch\",\"outputs\":[],\"stateMutability\":\"pure\",\"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\":\"transactionHash\",\"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\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"\",\"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\":{\"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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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. param _numQueuedTransactions Number of transactions to append.\"},\"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.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow, so we distribute\\n return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);\\n }\\n}\\n\",\"keccak256\":\"0x363bd3b45201f07c9b71c2edc96533468cf14a3d029fabd82fddceb1eb3ebd9c\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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\\\";\\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/* External Imports */\\nimport { Math } from \\\"@openzeppelin/contracts/math/Math.sol\\\";\\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 = 50000;\\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 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 return _getQueueElement(\\n _index,\\n queue()\\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 return _getQueueLength(\\n queue()\\n );\\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 queueRef = queue();\\n\\n queueRef.push(transactionHash);\\n queueRef.push(timestampAndBlockNumber);\\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 and subtract 1.\\n uint256 queueIndex = queueRef.length() / 2 - 1;\\n emit TransactionEnqueued(\\n msg.sender,\\n _target,\\n _gasLimit,\\n _data,\\n queueIndex,\\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 pure\\n {\\n // TEMPORARY: Disable `appendQueueBatch` for minnet\\n revert(\\\"appendQueueBatch is currently disabled.\\\");\\n\\n // _numQueuedTransactions = 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\\n require(\\n msg.data.length >= nextTransactionPtr,\\n \\\"Not enough BatchContexts provided.\\\"\\n );\\n\\n // Take a reference to the queue and its length so we don't have to keep resolving it.\\n // Length isn't going to change during the course of execution, so it's fine to simply\\n // resolve this once at the start. Saves gas.\\n iOVM_ChainStorageContainer queueRef = queue();\\n uint40 queueLength = _getQueueLength(queueRef);\\n\\n // Reserve some memory to save gas on hashing later on. This is a relatively safe estimate\\n // for the average transaction size that will prevent having to resize this chunk of memory\\n // later on. Saves gas.\\n bytes memory hashMemory = new bytes((msg.data.length / totalElementsToAppend) * 2);\\n\\n // Initialize the array of canonical chain leaves that we will append.\\n bytes32[] memory leaves = new bytes32[](totalElementsToAppend);\\n\\n // Each leaf index corresponds to a tx, either sequenced or enqueued.\\n uint32 leafIndex = 0;\\n\\n // Counter for number of sequencer transactions appended so far.\\n uint32 numSequencerTransactions = 0;\\n\\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 for (uint32 i = 0; i < numContexts; i++) {\\n BatchContext memory nextContext = _getBatchContext(i);\\n\\n if (i == 0) {\\n // Execute a special check for the first batch.\\n _validateFirstBatchContext(nextContext);\\n }\\n\\n // Execute this check on every single batch, including the first one.\\n _validateNextBatchContext(\\n curContext,\\n nextContext,\\n nextQueueIndex,\\n queueRef\\n );\\n\\n // Now we can update our current context.\\n curContext = nextContext;\\n\\n // Process sequencer transactions first.\\n for (uint32 j = 0; j < curContext.numSequencedTransactions; j++) {\\n uint256 txDataLength;\\n assembly {\\n txDataLength := shr(232, calldataload(nextTransactionPtr))\\n }\\n require(\\n txDataLength <= MAX_ROLLUP_TX_SIZE,\\n \\\"Transaction data size exceeds maximum for rollup transaction.\\\"\\n );\\n\\n leaves[leafIndex] = _getSequencerLeafHash(\\n curContext,\\n nextTransactionPtr,\\n txDataLength,\\n hashMemory\\n );\\n\\n nextTransactionPtr += uint40(TX_DATA_HEADER_SIZE + txDataLength);\\n numSequencerTransactions++;\\n leafIndex++;\\n }\\n\\n // Now process any subsequent queue transactions.\\n for (uint32 j = 0; j < curContext.numSubsequentQueueTransactions; j++) {\\n require(\\n nextQueueIndex < queueLength,\\n \\\"Not enough queued transactions to append.\\\"\\n );\\n\\n leaves[leafIndex] = _getQueueLeafHash(nextQueueIndex);\\n nextQueueIndex++;\\n leafIndex++;\\n }\\n }\\n\\n _validateFinalBatchContext(\\n curContext,\\n nextQueueIndex,\\n queueLength,\\n queueRef\\n );\\n\\n require(\\n msg.data.length == 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 blockTimestamp;\\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 blockTimestamp = 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 // curContext.numSubsequentQueueTransactions > 0 which means that we've processed at least one queue element.\\n // We increment nextQueueIndex after processing each queue element,\\n // so the index of the last element we processed is nextQueueIndex - 1.\\n Lib_OVMCodec.QueueElement memory lastElement = _getQueueElement(\\n nextQueueIndex - 1,\\n queueRef\\n );\\n\\n blockTimestamp = lastElement.timestamp;\\n blockNumber = lastElement.blockNumber;\\n }\\n\\n // For efficiency reasons getMerkleRoot modifies the `leaves` argument in place\\n // while calculating the root hash therefore any arguments passed to it must not\\n // be used again afterwards\\n _appendBatch(\\n Lib_MerkleTree.getMerkleRoot(leaves),\\n totalElementsToAppend,\\n numQueuedTransactions,\\n blockTimestamp,\\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 pure\\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 * 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 iOVM_ChainStorageContainer _queueRef\\n )\\n internal\\n view\\n returns (\\n Lib_OVMCodec.QueueElement memory _element\\n )\\n {\\n // The underlying queue data structure stores 2 elements\\n // per insertion, so to get the actual desired queue index\\n // we need to multiply by 2.\\n uint40 trueIndex = uint40(_index * 2);\\n bytes32 transactionHash = _queueRef.get(trueIndex);\\n bytes32 timestampAndBlockNumber = _queueRef.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 transactionHash: transactionHash,\\n timestamp: elementTimestamp,\\n blockNumber: elementBlockNumber\\n });\\n }\\n\\n /**\\n * Retrieves the length of the queue.\\n * @return Length of the queue.\\n */\\n function _getQueueLength(\\n iOVM_ChainStorageContainer _queueRef\\n )\\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.\\n return uint40(_queueRef.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 bytes memory _hashMemory\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n // Only allocate more memory if we didn't reserve enough to begin with.\\n if (BYTES_TILL_TX_DATA + _txDataLength > _hashMemory.length) {\\n _hashMemory = new bytes(BYTES_TILL_TX_DATA + _txDataLength);\\n }\\n\\n uint256 ctxTimestamp = _context.timestamp;\\n uint256 ctxBlockNumber = _context.blockNumber;\\n\\n bytes32 leafHash;\\n assembly {\\n let chainElementStart := add(_hashMemory, 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 iOVM_ChainStorageContainer batchesRef = batches();\\n (uint40 totalElements, uint40 nextQueueIndex,,) = _getBatchExtraData();\\n\\n Lib_OVMCodec.ChainBatchHeader memory header = Lib_OVMCodec.ChainBatchHeader({\\n batchIndex: batchesRef.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 batchesRef.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 have the same context\\n // or a later timestamp and block number.\\n if (getTotalElements() > 0) {\\n (,, uint40 lastTimestamp, uint40 lastBlockNumber) = _getBatchExtraData();\\n\\n require(\\n _firstContext.blockNumber >= lastBlockNumber,\\n \\\"Context block number is lower than last submitted.\\\"\\n );\\n\\n require(\\n _firstContext.timestamp >= lastTimestamp,\\n \\\"Context timestamp is lower than last submitted.\\\"\\n );\\n }\\n\\n // Sequencer cannot submit contexts which are more than the force inclusion period old.\\n require(\\n _firstContext.timestamp + forceInclusionPeriodSeconds >= block.timestamp,\\n \\\"Context timestamp too far in the past.\\\"\\n );\\n\\n require(\\n _firstContext.blockNumber + forceInclusionPeriodBlocks >= block.number,\\n \\\"Context block number too far in the past.\\\"\\n );\\n }\\n\\n /**\\n * Checks that a given batch context has a time context which is below a given que element\\n * @param _context The batch context to validate has values lower.\\n * @param _queueIndex Index of the queue element we are validating came later than the context.\\n * @param _queueRef The storage container for the queue.\\n */\\n function _validateContextBeforeEnqueue(\\n BatchContext memory _context,\\n uint40 _queueIndex,\\n iOVM_ChainStorageContainer _queueRef\\n )\\n internal\\n view\\n {\\n Lib_OVMCodec.QueueElement memory nextQueueElement = _getQueueElement(\\n _queueIndex,\\n _queueRef\\n );\\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 _context.timestamp <= nextQueueElement.timestamp,\\n \\\"Sequencer transaction timestamp exceeds that of next queue element.\\\"\\n );\\n\\n require(\\n _context.blockNumber <= nextQueueElement.blockNumber,\\n \\\"Sequencer transaction blockNumber exceeds that of next queue element.\\\"\\n );\\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 * @param _queueRef The storage container for the queue.\\n */\\n function _validateNextBatchContext(\\n BatchContext memory _prevContext,\\n BatchContext memory _nextContext,\\n uint40 _nextQueueIndex,\\n iOVM_ChainStorageContainer _queueRef\\n )\\n internal\\n view\\n {\\n // All sequencer transactions' times must be greater than or equal to 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 is going to be a queue element pulled in from this context:\\n if (_nextContext.numSubsequentQueueTransactions > 0) {\\n _validateContextBeforeEnqueue(\\n _nextContext,\\n _nextQueueIndex,\\n _queueRef\\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 * @param _queueLength The length of the queue at the start of the batchAppend call.\\n * @param _nextQueueIndex The next element in the queue that will be pulled into the CTC.\\n * @param _queueRef The storage container for the queue.\\n */\\n function _validateFinalBatchContext(\\n BatchContext memory _finalContext,\\n uint40 _nextQueueIndex,\\n uint40 _queueLength,\\n iOVM_ChainStorageContainer _queueRef\\n )\\n internal\\n view\\n {\\n // If the queue is not now empty, check the mononoticity of whatever the next batch that will come in is.\\n if (_queueLength - _nextQueueIndex > 0 && _finalContext.numSubsequentQueueTransactions == 0) {\\n _validateContextBeforeEnqueue(\\n _finalContext,\\n _nextQueueIndex,\\n _queueRef\\n );\\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.transactionHash == 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\":\"0x36760ab13dafc8bb8f71e0906a20059a520e692a69ed8fca09bf6fd43bd6ff15\",\"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_Bytes32Utils } from \\\"../../libraries/utils/Lib_Bytes32Utils.sol\\\";\\nimport { Lib_EthUtils } from \\\"../../libraries/utils/Lib_EthUtils.sol\\\";\\nimport { Lib_ErrorUtils } from \\\"../../libraries/utils/Lib_ErrorUtils.sol\\\";\\nimport { Lib_PredeployAddresses } from \\\"../../libraries/constants/Lib_PredeployAddresses.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_DeployerWhitelist } from \\\"../predeploys/OVM_DeployerWhitelist.sol\\\";\\n\\n/* External Imports */\\nimport { Math } from \\\"@openzeppelin/contracts/math/Math.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 * Native Value Constants *\\n **************************/\\n\\n // Public so we can access and make assertions in integration tests.\\n uint256 public constant CALL_WITH_VALUE_INTRINSIC_GAS = 90000;\\n\\n\\n /**************************\\n * Default Context Values *\\n **************************/\\n\\n uint256 constant DEFAULT_UINT256 = 0xdefa017defa017defa017defa017defa017defa017defa017defa017defa017d;\\n address constant DEFAULT_ADDRESS = 0xdEfa017defA017DeFA017DEfa017DeFA017DeFa0;\\n\\n\\n /*************************************\\n * Container Contract Address Prefix *\\n *************************************/\\n\\n /**\\n * @dev The Execution Manager and State Manager each have this 30 byte prefix, and are uncallable.\\n */\\n address constant CONTAINER_CONTRACT_PREFIX = 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000;\\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 Lib_AddressResolver(_libAddressManager)\\n {\\n ovmSafetyChecker = iOVM_SafetyChecker(resolve(\\\"OVM_SafetyChecker\\\"));\\n gasMeterConfig = _gasMeterConfig;\\n globalContext = _globalContext;\\n _resetContext();\\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 external\\n returns (\\n bytes memory\\n )\\n {\\n // Make sure that run() is not re-enterable. This condition should always be satisfied\\n // Once run has been called once, due to the behavior of _isValidInput().\\n if (transactionContext.ovmNUMBER != DEFAULT_UINT256) {\\n return bytes(\\\"\\\");\\n }\\n\\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 (_isValidInput(_transaction) == false) {\\n _resetContext();\\n return bytes(\\\"\\\");\\n }\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\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 (, bytes memory returndata) = ovmCALL(\\n _transaction.gasLimit - gasMeterConfig.minTransactionGasLimit,\\n _transaction.entrypoint,\\n 0,\\n _transaction.data\\n );\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\n // // Update the cumulative gas based on the amount of gas used.\\n // uint256 gasUsed = gasProvided - gasleft();\\n // _updateCumulativeGas(gasUsed, _transaction.l1QueueOrigin);\\n\\n // Wipe the execution context.\\n _resetContext();\\n\\n return returndata;\\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 external\\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 CALLVALUE.\\n * @return _CALLVALUE Value sent along with the call according to the current message context.\\n */\\n function ovmCALLVALUE()\\n override\\n public\\n view\\n returns (\\n uint256 _CALLVALUE\\n )\\n {\\n return messageContext.ovmCALLVALUE;\\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 external\\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 external\\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 external\\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 external\\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 source (Sequencer or Queue) this transaction originated from.\\n * @return _queueOrigin Enum indicating the ovmL1QUEUEORIGIN within the current message context.\\n */\\n function ovmL1QUEUEORIGIN()\\n override\\n external\\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 external\\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 Address of the created contract.\\n * @return Revert data, if and only if the creation threw an exception.\\n */\\n function ovmCREATE(\\n bytes memory _bytecode\\n )\\n override\\n public\\n notStatic\\n fixedGasDiscount(40000)\\n returns (\\n address,\\n bytes memory\\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 MessageType.ovmCREATE\\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 Address of the created contract.\\n * @return Revert data, if and only if the creation threw an exception.\\n */\\n function ovmCREATE2(\\n bytes memory _bytecode,\\n bytes32 _salt\\n )\\n override\\n external\\n notStatic\\n fixedGasDiscount(40000)\\n returns (\\n address,\\n bytes memory\\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 MessageType.ovmCREATE2\\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 external\\n returns (\\n uint256 _nonce\\n )\\n {\\n return _getAccountNonce(ovmADDRESS());\\n }\\n\\n /**\\n * Bumps the nonce of the current ovmADDRESS by one.\\n */\\n function ovmINCREMENTNONCE()\\n override\\n external\\n notStatic\\n {\\n address account = ovmADDRESS();\\n uint256 nonce = _getAccountNonce(account);\\n\\n // Prevent overflow.\\n if (nonce + 1 > nonce) {\\n _setAccountNonce(account, nonce + 1);\\n }\\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 // Creates a duplicate of the OVM_ProxyEOA located at 0x42....09. Uses the following\\n // \\\"magic\\\" prefix to deploy an exact copy of the code:\\n // PUSH1 0x0D # size of this prefix in bytes\\n // CODESIZE\\n // SUB # subtract prefix size from codesize\\n // DUP1\\n // PUSH1 0x0D\\n // PUSH1 0x00\\n // CODECOPY # copy everything after prefix into memory at pos 0\\n // PUSH1 0x00\\n // RETURN # return the copied code\\n address proxyEOA = Lib_EthUtils.createContract(abi.encodePacked(\\n hex\\\"600D380380600D6000396000f3\\\",\\n ovmEXTCODECOPY(\\n Lib_PredeployAddresses.PROXY_EOA,\\n 0,\\n ovmEXTCODESIZE(Lib_PredeployAddresses.PROXY_EOA)\\n )\\n ));\\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 _value ETH value to pass with the 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 uint256 _value,\\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 nextMessageContext.ovmCALLVALUE = _value;\\n\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata,\\n MessageType.ovmCALL\\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, valueless context.\\n MessageContext memory nextMessageContext = messageContext;\\n nextMessageContext.ovmCALLER = nextMessageContext.ovmADDRESS;\\n nextMessageContext.ovmADDRESS = _address;\\n nextMessageContext.isStatic = true;\\n nextMessageContext.ovmCALLVALUE = 0;\\n\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata,\\n MessageType.ovmSTATICCALL\\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\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata,\\n MessageType.ovmDELEGATECALL\\n );\\n }\\n\\n /**\\n * @notice Legacy ovmCALL function which did not support ETH value; this maintains backwards compatibility.\\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 returns(\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n // Legacy ovmCALL assumed always-0 value.\\n return ovmCALL(\\n _gasLimit,\\n _address,\\n 0,\\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 external\\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 external\\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 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 external\\n returns (\\n bytes32 _EXTCODEHASH\\n )\\n {\\n return Lib_EthUtils.getCodeHash(\\n _getAccountEthAddress(_contract)\\n );\\n }\\n\\n\\n /***************************************\\n * Public Functions: ETH Value Opcodes *\\n ***************************************/\\n\\n /**\\n * @notice Overrides BALANCE.\\n * NOTE: In the future, this could be optimized to directly invoke EM._getContractStorage(...).\\n * @param _contract Address of the contract to query the OVM_ETH balance of.\\n * @return _BALANCE OVM_ETH balance of the requested contract.\\n */\\n function ovmBALANCE(\\n address _contract\\n )\\n override\\n public\\n returns (\\n uint256 _BALANCE\\n )\\n {\\n // Easiest way to get the balance is query OVM_ETH as normal.\\n bytes memory balanceOfCalldata = abi.encodeWithSignature(\\n \\\"balanceOf(address)\\\",\\n _contract\\n );\\n\\n // Static call because this should be a read-only query.\\n (bool success, bytes memory returndata) = ovmSTATICCALL(\\n gasleft(),\\n Lib_PredeployAddresses.OVM_ETH,\\n balanceOfCalldata\\n );\\n\\n // All balanceOf queries should successfully return a uint, otherwise this must be an OOG.\\n if (!success || returndata.length != 32) {\\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\\n }\\n\\n // Return the decoded balance.\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * @notice Overrides SELFBALANCE.\\n * @return _BALANCE OVM_ETH balance of the requesting contract.\\n */\\n function ovmSELFBALANCE()\\n override\\n external\\n returns (\\n uint256 _BALANCE\\n )\\n {\\n return ovmBALANCE(ovmADDRESS());\\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 Whitelisting *\\n ********************************************/\\n\\n /**\\n * Checks whether the given address is on the whitelist 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 semantics perspective, this will appear 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) = ovmSTATICCALL(\\n gasleft(),\\n Lib_PredeployAddresses.DEPLOYER_WHITELIST,\\n abi.encodeWithSelector(\\n OVM_DeployerWhitelist.isDeployerAllowed.selector,\\n _deployerAddress\\n )\\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 Final OVM contract address.\\n * @return Revertdata, if and only if the creation threw an exception.\\n */\\n function _createContract(\\n address _contractAddress,\\n bytes memory _bytecode,\\n MessageType _messageType\\n )\\n internal\\n returns (\\n address,\\n bytes memory\\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 the common logic which occurs between call-type and create-type messages,\\n // passing in the creation bytecode and `true` to trigger create-specific logic.\\n (bool success, bytes memory data) = _handleExternalMessage(\\n nextMessageContext,\\n gasleft(),\\n _contractAddress,\\n _bytecode,\\n _messageType\\n );\\n\\n // Yellow paper requires that address returned is zero if the contract deployment fails.\\n return (\\n success ? _contractAddress : address(0),\\n data\\n );\\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 MessageType _messageType\\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(CONTAINER_CONTRACT_PREFIX)\\n ) {\\n // EVM does not return data in the success case, see: https://github.com/ethereum/go-ethereum/blob/aae7660410f0ef90279e14afaaf2f429fdc2a186/core/vm/instructions.go#L600-L604\\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 _handleExternalMessage(\\n _nextMessageContext,\\n _gasLimit,\\n codeContractAddress,\\n _calldata,\\n _messageType\\n );\\n }\\n\\n /**\\n * Handles all interactions which involve the execution manager calling out to untrusted code (both calls and creates).\\n * Ensures that OVM-related measures are enforced, including L2 gas refunds, nuisance gas, and flagged reversions.\\n *\\n * @param _nextMessageContext Message context to be used for the external message.\\n * @param _gasLimit Amount of gas to be passed into this message. NOTE: this argument is overwritten in some cases to avoid stack-too-deep.\\n * @param _contract OVM address being called or deployed to\\n * @param _data Data for the message (either calldata or creation code)\\n * @param _messageType What type of ovmOPCODE this message corresponds to.\\n * @return Whether or not the message (either a call or deployment) succeeded.\\n * @return Data returned by the message.\\n */\\n function _handleExternalMessage(\\n MessageContext memory _nextMessageContext,\\n // NOTE: this argument is overwritten in some cases to avoid stack-too-deep.\\n uint256 _gasLimit,\\n address _contract,\\n bytes memory _data,\\n MessageType _messageType\\n )\\n internal\\n returns (\\n bool,\\n bytes memory\\n )\\n {\\n uint256 messageValue = _nextMessageContext.ovmCALLVALUE;\\n // If there is value in this message, we need to transfer the ETH over before switching contexts.\\n if (\\n messageValue > 0\\n && _isValueType(_messageType)\\n ) {\\n // Handle out-of-intrinsic gas consistent with EVM behavior -- the subcall \\\"appears to revert\\\" if we don't have enough gas to transfer the ETH.\\n // Similar to dynamic gas cost of value exceeding gas here:\\n // https://github.com/ethereum/go-ethereum/blob/c503f98f6d5e80e079c1d8a3601d188af2a899da/core/vm/interpreter.go#L268-L273\\n if (gasleft() < CALL_WITH_VALUE_INTRINSIC_GAS) {\\n return (false, hex\\\"\\\");\\n }\\n\\n // If there *is* enough gas to transfer ETH, then we need to make sure this amount of gas is reserved (i.e. not\\n // given to the _contract.call below) to guarantee that _handleExternalMessage can't run out of gas.\\n // In particular, in the event that the call fails, we will need to transfer the ETH back to the sender.\\n // Taking the lesser of _gasLimit and gasleft() - CALL_WITH_VALUE_INTRINSIC_GAS guarantees that the second\\n // _attemptForcedEthTransfer below, if needed, always has enough gas to succeed.\\n _gasLimit = Math.min(\\n _gasLimit,\\n gasleft() - CALL_WITH_VALUE_INTRINSIC_GAS // Cannot overflow due to the above check.\\n );\\n\\n // Now transfer the value of the call.\\n // The target is interpreted to be the next message's ovmADDRESS account.\\n bool transferredOvmEth = _attemptForcedEthTransfer(\\n _nextMessageContext.ovmADDRESS,\\n messageValue\\n );\\n\\n // If the ETH transfer fails (should only be possible in the case of insufficient balance), then treat this as a revert.\\n // This mirrors EVM behavior, see https://github.com/ethereum/go-ethereum/blob/2dee31930c9977af2a9fcb518fb9838aa609a7cf/core/vm/evm.go#L298\\n if (!transferredOvmEth) {\\n return (false, hex\\\"\\\");\\n }\\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. `_contract` 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\\n bool success;\\n bytes memory returndata;\\n if (_isCreateType(_messageType)) {\\n // safeCREATE() is a function which replicates a CREATE message, but uses return values\\n // Which match that of CALL (i.e. bool, bytes). This allows many security checks to be\\n // to be shared between untrusted call and create call frames.\\n (success, returndata) = address(this).call{gas: _gasLimit}(\\n abi.encodeWithSelector(\\n this.safeCREATE.selector,\\n _data,\\n _contract\\n )\\n );\\n } else {\\n (success, returndata) = _contract.call{gas: _gasLimit}(_data);\\n }\\n\\n // If the message threw an exception, its value should be returned back to the sender.\\n // So, we force it back, BEFORE returning the messageContext to the previous addresses.\\n // This operation is part of the reason we \\\"reserved the intrinsic gas\\\" above.\\n if (\\n messageValue > 0\\n && _isValueType(_messageType)\\n && !success\\n ) {\\n bool transferredOvmEth = _attemptForcedEthTransfer(\\n prevMessageContext.ovmADDRESS,\\n messageValue\\n );\\n\\n // Since we transferred it in above and the call reverted, the transfer back should always pass.\\n // This code path should NEVER be triggered since we sent `messageValue` worth of OVM_ETH into the target\\n // and reserved sufficient gas to execute the transfer, but in case there is some edge case which has\\n // been missed, we revert the entire frame (and its parent) to make sure the ETH gets sent back.\\n if (!transferredOvmEth) {\\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\\n }\\n }\\n\\n // Switch back to the original message context now that we're out of the call and all OVM_ETH is in the right place.\\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. Additionally, we surface custom error messages\\n // to developers in the case of unsafe creations for improved devex.\\n // All other revert types return no data.\\n if (\\n flag == RevertFlag.INTENTIONAL_REVERT\\n || flag == RevertFlag.UNSAFE_BYTECODE\\n ) {\\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 * Handles the creation-specific safety measures required for OVM contract deployment.\\n * This function sanitizes the return types for creation messages to match calls (bool, bytes),\\n * by being an external function which the EM can call, that mimics the success/fail case of the CREATE.\\n * This allows for consistent handling of both types of messages in _handleExternalMessage().\\n * Having this step occur as a separate call frame also allows us to easily revert the\\n * contract deployment in the event that the code is unsafe.\\n *\\n * @param _creationCode Code to pass into CREATE for deployment.\\n * @param _address OVM address being deployed to.\\n */\\n function safeCREATE(\\n bytes memory _creationCode,\\n address _address\\n )\\n external\\n {\\n // The only way this should callable is from within _createContract(),\\n // and it should DEFINITELY not be callable by a non-EM code contract.\\n if (msg.sender != address(this)) {\\n return;\\n }\\n // Check that there is not already code at this address.\\n if (_hasEmptyAccount(_address) == false) {\\n // Note: in the EVM, this case burns all allotted gas. For improved\\n // developer experience, we do return the remaining gas.\\n _revertWithFlag(\\n RevertFlag.CREATE_COLLISION\\n );\\n }\\n\\n // Check the creation bytecode against the OVM_SafetyChecker.\\n if (ovmSafetyChecker.isBytecodeSafe(_creationCode) == false) {\\n // Note: in the EVM, this case burns all allotted gas. For improved\\n // developer experience, we do return the remaining gas.\\n _revertWithFlag(\\n RevertFlag.UNSAFE_BYTECODE,\\n Lib_ErrorUtils.encodeRevertString(\\\"Contract creation code contains unsafe opcodes. Did you use the right compiler or pass an unsafe constructor argument?\\\")\\n );\\n }\\n\\n // We always need to initialize the contract with the default account values.\\n _initPendingAccount(_address);\\n\\n // Actually execute the EVM create message.\\n // NOTE: The inline assembly below means we can NOT make any evm calls between here and then.\\n address ethAddress = Lib_EthUtils.createContract(_creationCode);\\n\\n if (ethAddress == address(0)) {\\n // If the creation fails, the EVM lets us grab its revert data. This may contain a revert flag\\n // to be used above in _handleExternalMessage, so we pass the revert data back up unmodified.\\n assembly {\\n returndatacopy(0,0,returndatasize())\\n revert(0, returndatasize())\\n }\\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(\\n RevertFlag.UNSAFE_BYTECODE,\\n Lib_ErrorUtils.encodeRevertString(\\\"Constructor attempted to deploy unsafe bytecode.\\\")\\n );\\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 * Internal Functions: Value Manipulation *\\n ******************************************/\\n\\n /**\\n * Invokes an ovmCALL to OVM_ETH.transfer on behalf of the current ovmADDRESS, allowing us to force movement of OVM_ETH in correspondence with ETH's native value functionality.\\n * WARNING: this will send on behalf of whatever the messageContext.ovmADDRESS is in storage at the time of the call.\\n * NOTE: In the future, this could be optimized to directly invoke EM._setContractStorage(...).\\n * @param _to Amount of OVM_ETH to be sent.\\n * @param _value Amount of OVM_ETH to send.\\n * @return _success Whether or not the transfer worked.\\n */\\n function _attemptForcedEthTransfer(\\n address _to,\\n uint256 _value\\n )\\n internal\\n returns(\\n bool _success\\n )\\n {\\n bytes memory transferCalldata = abi.encodeWithSignature(\\n \\\"transfer(address,uint256)\\\",\\n _to,\\n _value\\n );\\n\\n // OVM_ETH inherits from the UniswapV2ERC20 standard. In this implementation, its return type\\n // is a boolean. However, the implementation always returns true if it does not revert.\\n // Thus, success of the call frame is sufficient to infer success of the transfer itself.\\n (bool success, ) = ovmCALL(\\n gasleft(),\\n Lib_PredeployAddresses.OVM_ETH,\\n 0,\\n transferCalldata\\n );\\n\\n return success;\\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 ) {\\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 view\\n {\\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 input values of a transaction.\\n * @return _valid Whether or not the transaction data is valid.\\n */\\n function _isValidInput(\\n Lib_OVMCodec.Transaction memory _transaction\\n )\\n view\\n internal\\n returns (\\n bool\\n )\\n {\\n // Prevent reentrancy to run():\\n // This check prevents calling run with the default ovmNumber.\\n // Combined with the first check in run():\\n // if (transactionContext.ovmNUMBER != DEFAULT_UINT256) { return; }\\n // It should be impossible to re-enter since run() returns before any other call frames are created.\\n // Since this value is already being written to storage, we save much gas compared to\\n // using the standard nonReentrant pattern.\\n if (_transaction.blockNumber == DEFAULT_UINT256) {\\n return false;\\n }\\n\\n if (_isValidGasLimit(_transaction.gasLimit, _transaction.l1QueueOrigin) == false) {\\n return false;\\n }\\n\\n return true;\\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 view\\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 // These conditionals allow us to avoid unneccessary SSTOREs. However, they do mean that the current storage\\n // value for the messageContext MUST equal the _prevMessageContext argument, or an SSTORE might be erroneously skipped.\\n if (_prevMessageContext.ovmCALLER != _nextMessageContext.ovmCALLER) {\\n messageContext.ovmCALLER = _nextMessageContext.ovmCALLER;\\n }\\n\\n if (_prevMessageContext.ovmADDRESS != _nextMessageContext.ovmADDRESS) {\\n messageContext.ovmADDRESS = _nextMessageContext.ovmADDRESS;\\n }\\n\\n if (_prevMessageContext.isStatic != _nextMessageContext.isStatic) {\\n messageContext.isStatic = _nextMessageContext.isStatic;\\n }\\n\\n if (_prevMessageContext.ovmCALLVALUE != _nextMessageContext.ovmCALLVALUE) {\\n messageContext.ovmCALLVALUE = _nextMessageContext.ovmCALLVALUE;\\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 = DEFAULT_ADDRESS;\\n transactionContext.ovmTIMESTAMP = DEFAULT_UINT256;\\n transactionContext.ovmNUMBER = DEFAULT_UINT256;\\n transactionContext.ovmGASLIMIT = DEFAULT_UINT256;\\n transactionContext.ovmTXGASLIMIT = DEFAULT_UINT256;\\n transactionContext.ovmL1QUEUEORIGIN = Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE;\\n\\n transactionRecord.ovmGasRefund = DEFAULT_UINT256;\\n\\n messageContext.ovmCALLER = DEFAULT_ADDRESS;\\n messageContext.ovmADDRESS = DEFAULT_ADDRESS;\\n messageContext.isStatic = false;\\n\\n messageRecord.nuisanceGasLeft = DEFAULT_UINT256;\\n\\n // Reset the ovmStateManager.\\n ovmStateManager = iOVM_StateManager(address(0));\\n }\\n\\n\\n /******************************************\\n * Internal Functions: Message Typechecks *\\n ******************************************/\\n\\n /**\\n * Returns whether or not the given message type is a CREATE-type.\\n * @param _messageType the message type in question.\\n */\\n function _isCreateType(\\n MessageType _messageType\\n )\\n internal\\n pure\\n returns(\\n bool\\n )\\n {\\n return (\\n _messageType == MessageType.ovmCREATE\\n || _messageType == MessageType.ovmCREATE2\\n );\\n }\\n\\n /**\\n * Returns whether or not the given message type (potentially) requires the transfer of ETH value along with the message.\\n * @param _messageType the message type in question.\\n */\\n function _isValueType(\\n MessageType _messageType\\n )\\n internal\\n pure\\n returns(\\n bool\\n )\\n {\\n // ovmSTATICCALL and ovmDELEGATECALL types do not accept or transfer value.\\n return (\\n _messageType == MessageType.ovmCALL\\n || _messageType == MessageType.ovmCREATE\\n || _messageType == MessageType.ovmCREATE2\\n );\\n }\\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 * @param _value the amount of ETH value to send.\\n * @param _ovmStateManager the address of the OVM_StateManager precompile in the L2 state.\\n */\\n function simulateMessage(\\n Lib_OVMCodec.Transaction memory _transaction,\\n address _from,\\n uint256 _value,\\n iOVM_StateManager _ovmStateManager\\n )\\n external\\n returns (\\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 // Initialize the EM's internal state, ignoring nuisance gas.\\n ovmStateManager = _ovmStateManager;\\n _initContext(_transaction);\\n messageRecord.nuisanceGasLeft = uint(-1);\\n\\n // Set the ovmADDRESS to the _from so that the subsequent call frame \\\"comes from\\\" them.\\n messageContext.ovmADDRESS = _from;\\n\\n // Execute the desired message.\\n bool isCreate = _transaction.entrypoint == address(0);\\n if (isCreate) {\\n (address created, bytes memory revertData) = ovmCREATE(_transaction.data);\\n if (created == address(0)) {\\n return abi.encode(false, revertData);\\n } else {\\n // The eth_call RPC endpoint for to = undefined will return the deployed bytecode\\n // in the success case, differing from standard create messages.\\n return abi.encode(true, Lib_EthUtils.getCode(created));\\n }\\n } else {\\n (bool success, bytes memory returndata) = ovmCALL(\\n _transaction.gasLimit,\\n _transaction.entrypoint,\\n _value,\\n _transaction.data\\n );\\n return abi.encode(success, returndata);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x166912c588f2871fd2825ea9288cb3d50a888d4fcafd9fe3cc4461df839acf70\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/predeploys/OVM_DeployerWhitelist.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Interface Imports */\\nimport { iOVM_DeployerWhitelist } from \\\"../../iOVM/predeploys/iOVM_DeployerWhitelist.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: optimistic-solc\\n * Runtime target: OVM\\n */\\ncontract OVM_DeployerWhitelist is iOVM_DeployerWhitelist {\\n\\n /**********************\\n * Contract Constants *\\n **********************/\\n\\n bool public initialized;\\n bool public allowArbitraryDeployment;\\n address override public owner;\\n mapping (address => bool) public whitelist;\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Blocks functions to anyone except the contract owner.\\n */\\n modifier onlyOwner() {\\n require(\\n msg.sender == 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 external\\n {\\n if (initialized == true) {\\n return;\\n }\\n\\n initialized = true;\\n allowArbitraryDeployment = _allowArbitraryDeployment;\\n owner = _owner;\\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 external\\n onlyOwner\\n {\\n whitelist[_deployer] = _isWhitelisted;\\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 owner = _owner;\\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 allowArbitraryDeployment = _allowArbitraryDeployment;\\n }\\n\\n /**\\n * Permanently enables arbitrary contract deployment and deletes the owner.\\n */\\n function enableArbitraryContractDeployment()\\n override\\n external\\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 external\\n returns (\\n bool\\n )\\n {\\n return (\\n initialized == false\\n || allowArbitraryDeployment == true\\n || whitelist[_deployer]\\n );\\n }\\n}\\n\",\"keccak256\":\"0xb96bfb8eb24503b05de41483cc9fb7a7f81107aa1ca146dc281952f8100848a0\",\"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 * 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\",\"keccak256\":\"0x180b9c347e20f1a6efa553b0f2b9a59aebceda92a7484ae6fca4da2bf1d960c3\",\"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 OUT_OF_GAS,\\n INTENTIONAL_REVERT,\\n EXCEEDS_NUISANCE_GAS,\\n INVALID_STATE_ACCESS,\\n UNSAFE_BYTECODE,\\n CREATE_COLLISION,\\n STATIC_VIOLATION,\\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 enum MessageType {\\n ovmCALL,\\n ovmSTATICCALL,\\n ovmDELEGATECALL,\\n ovmCREATE,\\n ovmCREATE2\\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 uint256 ovmCALLVALUE;\\n bool isStatic;\\n }\\n\\n struct MessageRecord {\\n uint256 nuisanceGasLeft;\\n }\\n\\n\\n /************************************\\n * Transaction Execution Entrypoint *\\n ************************************/\\n\\n function run(\\n Lib_OVMCodec.Transaction calldata _transaction,\\n address _txStateManager\\n ) external returns (bytes memory);\\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 ovmCALLVALUE() external view returns (uint _callValue);\\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, bytes memory _revertdata);\\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract, bytes memory _revertdata);\\n\\n\\n /*******************************\\n * Account Abstraction Opcodes *\\n ******************************/\\n\\n function ovmGETNONCE() external returns (uint256 _nonce);\\n function ovmINCREMENTNONCE() external;\\n function ovmCREATEEOA(bytes32 _messageHash, uint8 _v, bytes32 _r, bytes32 _s) external;\\n\\n\\n /****************************\\n * Contract Calling Opcodes *\\n ****************************/\\n\\n // Valueless ovmCALL for maintaining backwards compatibility with legacy OVM bytecode.\\n function ovmCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\\n function ovmCALL(uint256 _gasLimit, address _address, uint256 _value, 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 * ETH Value Opcodes *\\n *********************/\\n\\n function ovmBALANCE(address _contract) external returns (uint256 _balance);\\n function ovmSELFBALANCE() external returns (uint256 _balance);\\n\\n\\n /***************************************\\n * Public Functions: Execution Context *\\n ***************************************/\\n\\n function getMaxTransactionGasLimit() external view returns (uint _maxTransactionGasLimit);\\n}\\n\",\"keccak256\":\"0x87a056425696719488dbd06adbbf89280d86651e75e1f77d9e96b0632c8634cc\",\"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/predeploys/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 owner() 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\":\"0xdf1f27faf0d26d416bf6d408d146a16de32b4e1772a292c65d39eb7ec2b53ceb\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_PredeployAddresses\\n */\\nlibrary Lib_PredeployAddresses {\\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\\n address internal constant ECDSA_CONTRACT_ACCOUNT = 0x4200000000000000000000000000000000000003;\\n address internal constant SEQUENCER_ENTRYPOINT = 0x4200000000000000000000000000000000000005;\\n address payable internal constant OVM_ETH = 0x4200000000000000000000000000000000000006;\\n address internal constant L2_CROSS_DOMAIN_MESSENGER = 0x4200000000000000000000000000000000000007;\\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\\n address internal constant EXECUTION_MANAGER_WRAPPER = 0x420000000000000000000000000000000000000B;\\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\\n address internal constant ERC1820_REGISTRY = 0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24;\\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\\n}\\n\",\"keccak256\":\"0x798dd3fe47c172880978c8e4d35573b25d5135be29a77584e9fac45845748695\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_ErrorUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/**\\n * @title Lib_ErrorUtils\\n */\\nlibrary Lib_ErrorUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes an error string into raw solidity-style revert data.\\n * (i.e. ascii bytes, prefixed with bytes4(keccak(\\\"Error(string))\\\"))\\n * Ref: https://docs.soliditylang.org/en/v0.8.2/control-structures.html?highlight=Error(string)#panic-via-assert-and-error-via-require\\n * @param _reason Reason for the reversion.\\n * @return Standard solidity revert data for the given reason.\\n */\\n function encodeRevertString(\\n string memory _reason\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return abi.encodeWithSignature(\\n \\\"Error(string)\\\",\\n _reason\\n );\\n }\\n}\\n\",\"keccak256\":\"0xfc64ec4a81fb50865b502a0004ed154e8598e1a313db77303fc95e41f536e6b7\",\"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 *\\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 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\\n )\\n {\\n bytes memory code;\\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 Full code of the contract.\\n */\\n function getCode(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes memory\\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 Size of the contract's code in bytes.\\n */\\n function getCodeSize(\\n address _address\\n )\\n internal\\n view\\n returns (\\n uint256\\n )\\n {\\n uint256 codeSize;\\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 Hash of the contract's code.\\n */\\n function getCodeHash(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n bytes32 codeHash;\\n assembly {\\n codeHash := extcodehash(_address)\\n }\\n\\n return codeHash;\\n }\\n\\n /**\\n * Creates a contract with some given initialization code.\\n * @param _code Contract initialization code.\\n * @return Address of the created contract.\\n */\\n function createContract(\\n bytes memory _code\\n )\\n internal\\n returns (\\n address\\n )\\n {\\n address created;\\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 to be generated by CREATE.\\n */\\n function getAddressForCREATE(\\n address _creator,\\n uint256 _nonce\\n )\\n internal\\n pure\\n returns (\\n 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 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 (\\n address\\n )\\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\":\"0xf29a67d78e61cb472d524b779b32cfcb39a587f4096500d5419e6425ed367d49\",\"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 * Note that the _elements argument is modified, therefore it must not be used again afterwards\\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 pure\\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 == 1) {\\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 (uint256 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\":\"0xa78edb9fbd34712771a1ebff05bc5e1abec7fc1e9a1bfb709d183099b44fa62a\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b506040516200315338038062003153833981016040819052620000349162000067565b600080546001600160a01b0319166001600160a01b039590951694909417909355600191909155600255600355620000b2565b600080600080608085870312156200007d578384fd5b84516001600160a01b038116811462000094578485fd5b60208601516040870151606090970151919890975090945092505050565b61309180620000c26000396000f3fe608060405234801561001057600080fd5b50600436106101425760003560e01c8063876ed5cb116100b8578063cfdf677e1161007c578063cfdf677e1461023f578063d0f8934414610247578063e10d29ee1461024f578063e561dddc14610257578063f722b41a1461025f578063facdc5da1461026757610142565b8063876ed5cb146102175780638d38c6c11461021f578063b8f7700514610227578063c139eb151461022f578063c2cf696f1461023757610142565b80634de569ce1161010a5780634de569ce146101c25780635ae6256d146101e25780636fee07e0146101ea57806378f4b2f2146101ff5780637a167a8a146102075780637aa63a861461020f57610142565b8063138387a414610147578063299ca478146101655780632a7f18be1461017a578063378997701461019a578063461a4478146101af575b600080fd5b61014f61027a565b60405161015c91906124c7565b60405180910390f35b61016d610280565b60405161015c91906123eb565b61018d610188366004612388565b61028f565b60405161015c9190612e4e565b6101a26102b0565b60405161015c9190612e8d565b61016d6101bd36600461221b565b6102c4565b6101d56101d0366004612261565b6103a0565b60405161015c9190612484565b6101a26103da565b6101fd6101f8366004612188565b6103ee565b005b61014f61066d565b6101a2610674565b61014f610689565b61014f6106a4565b61014f6106aa565b6101a26106b0565b61014f6106c7565b61014f6106cd565b61016d6106d2565b6101fd6106f5565b61016d610b69565b61014f610b8c565b6101a2610c06565b6101fd610275366004612388565b610c1e565b60025481565b6000546001600160a01b031681565b610297611ed9565b6102a8826102a3610b69565b610c36565b90505b919050565b6000806102bb610d76565b50935050505090565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561032457818101518382015260200161030c565b50505050905090810190601f1680156103515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561036e57600080fd5b505afa158015610382573d6000803e3d6000fd5b505050506040513d602081101561039857600080fd5b505192915050565b82516000901515600114156103c2576103bb85858585610e24565b90506103d2565b6103bb8585602001518585610fef565b949350505050565b6000806103e5610d76565b94505050505090565b61c3508151111561041a5760405162461bcd60e51b81526004016104119061259b565b60405180910390fd5b60035482111561043c5760405162461bcd60e51b8152600401610411906127a1565b620186a082101561045f5760405162461bcd60e51b815260040161041190612983565b6020820460005a90508181116104875760405162461bcd60e51b815260040161041190612b8a565b60005b825a8303101561049c5760010161048a565b6000338787876040516020016104b594939291906123ff565b60408051601f19818403018152919052805160209091012090504360281b421760006104df610b69565b60405163b298e36b60e01b81529091506001600160a01b0382169063b298e36b9061050e9086906004016124c7565b600060405180830381600087803b15801561052857600080fd5b505af115801561053c573d6000803e3d6000fd5b505060405163b298e36b60e01b81526001600160a01b038416925063b298e36b915061056c9085906004016124c7565b600060405180830381600087803b15801561058657600080fd5b505af115801561059a573d6000803e3d6000fd5b50505050600060016002836001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156105dd57600080fd5b505afa1580156105f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106159190612203565b8161061c57fe5b040390507f4b388aecf9fa6cc92253704e5975a6129a4f735bdbd99567df4ed0094ee4ceb5338b8b8b85426040516106599695949392919061243c565b60405180910390a150505050505050505050565b620186a081565b60008061067f610d76565b5090935050505090565b600080610694610d76565b50505064ffffffffff1692915050565b61c35081565b60035481565b60006106c26106bd610b69565b6110c4565b905090565b60015481565b602081565b60006106c2604051806060016040528060258152602001612f08602591396102c4565b60043560d81c60093560e890811c90600c35901c610711610689565b8364ffffffffff16146107365760405162461bcd60e51b815260040161041190612a35565b6107646040518060400160405280600d81526020016c27ab26afa9b2b8bab2b731b2b960991b8152506102c4565b6001600160a01b0316336001600160a01b0316146107945760405162461bcd60e51b815260040161041190612a92565b60008162ffffff16116107b95760405162461bcd60e51b8152600401610411906127fe565b60008262ffffff16116107de5760405162461bcd60e51b815260040161041190612cdf565b600f601062ffffff8316020164ffffffffff81163610156108115760405162461bcd60e51b815260040161041190612d66565b600061081b610b69565b90506000610828826110c4565b9050600062ffffff8616368161083a57fe5b0460020267ffffffffffffffff8111801561085457600080fd5b506040519080825280601f01601f19166020018201604052801561087f576020820181803683370190505b50905060008662ffffff1667ffffffffffffffff811180156108a057600080fd5b506040519080825280602002602001820160405280156108ca578160200160208202803683370190505b50905060008060006108da610674565b90506108e4611ef9565b60005b8a62ffffff168163ffffffff161015610a3b57600061090b8263ffffffff16611147565b905063ffffffff82166109215761092181611197565b61092d8382868d611264565b80925060005b835163ffffffff821610156109b1578b3560e81c61c3508111156109695760405162461bcd60e51b81526004016104119061259b565b61097c858e64ffffffffff16838d6112cf565b898963ffffffff168151811061098e57fe5b60209081029190910101529b909b016003019a6001968701969586019501610933565b5060005b83602001518163ffffffff161015610a31578964ffffffffff168564ffffffffff16106109f45760405162461bcd60e51b815260040161041190612da8565b610a048564ffffffffff16611363565b888863ffffffff1681518110610a1657fe5b602090810291909101015260019687019694850194016109b5565b50506001016108e7565b50610a488183898b6113a8565b3664ffffffffff8a1614610a6e5760405162461bcd60e51b815260040161041190612846565b8a62ffffff168463ffffffff1614610a985760405162461bcd60e51b815260040161041190612894565b6000838c62ffffff160363ffffffff169050600080836020015160001415610acb57505060408201516060830151610af3565b6000610ae16001870364ffffffffff168d610c36565b90508060200151925080604001519150505b610b14610aff8961141b565b8f62ffffff168564ffffffffff16858561184f565b7f602f1aeac0ca2e7a13e281a9ef0ad7838542712ce16780fa2ecffd351f05f89983860384610b41610689565b604051610b5093929190612e9f565b60405180910390a1505050505050505050505050505050565b60006106c2604051806060016040528060238152602001613005602391396102c4565b6000610b966106d2565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610bce57600080fd5b505afa158015610be2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c29190612203565b6000610c10610674565b610c186106b0565b03905090565b60405162461bcd60e51b81526004016104119061250b565b610c3e611ed9565b604051634a83e9cd60e11b815260028402906000906001600160a01b03851690639507d39a90610c72908590600401612e8d565b60206040518083038186803b158015610c8a57600080fd5b505afa158015610c9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc29190612203565b90506000846001600160a01b0316639507d39a846001016040518263ffffffff1660e01b8152600401610cf59190612e8d565b60206040518083038186803b158015610d0d57600080fd5b505afa158015610d21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d459190612203565b6040805160608101825293845264ffffffffff828116602086015260289290921c9091169083015250949350505050565b6000806000806000610d866106d2565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b158015610dbe57600080fd5b505afa158015610dd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df691906121dd565b64ffffffffff602882901c811697605083901c82169750607883901c8216965060a09290921c169350915050565b600080610e5c6040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b8152506102c4565b90506000816001600160a01b0316631c4712a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610e9957600080fd5b505afa158015610ead573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed19190612203565b90506000610ede87611a02565b9050610eeb818787611a9b565b610f075760405162461bcd60e51b8152600401610411906126ca565b86606001518860200151148015610f22575060408701518851145b8015610f635750610f4a604051806060016040528060228152602001612ee6602291396102c4565b6001600160a01b031688608001516001600160a01b0316145b8015610f725750818860a00151145b8015610f89575060608801516001600160a01b0316155b8015610fa45750600088604001516001811115610fa257fe5b145b8015610fc557508660800151805190602001208860c0015180519060200120145b610fe15760405162461bcd60e51b81526004016104119061276a565b506001979650505050505050565b600080610ffb85611363565b9050611008818585611a9b565b6110245760405162461bcd60e51b815260040161041190612c2a565b6000866060015187608001518860a001518960c0015160405160200161104d94939291906123ff565b60405160208183030381529060405280519060200120905060006110708761028f565b80519091508214801561108e57508751602082015164ffffffffff16145b80156110a857508760200151816040015164ffffffffff16145b610fe15760405162461bcd60e51b815260040161041190612adf565b60006002826001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b15801561110157600080fd5b505afa158015611115573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111399190612203565b8161114057fe5b0492915050565b61114f611ef9565b5060408051608081018252601092909202600f81013560e890811c84526012820135901c6020840152601581013560d890811c92840192909252601a0135901c606082015290565b60006111a1610689565b1115611211576000806111b2610d76565b9350935050508064ffffffffff16836060015110156111e35760405162461bcd60e51b815260040161041190612718565b8164ffffffffff168360400151101561120e5760405162461bcd60e51b8152600401610411906125f8565b50505b4260015482604001510110156112395760405162461bcd60e51b815260040161041190612d20565b4360025482606001510110156112615760405162461bcd60e51b815260040161041190612552565b50565b83604001518360400151101561128c5760405162461bcd60e51b815260040161041190612bd5565b8360600151836060015110156112b45760405162461bcd60e51b815260040161041190612df1565b6020830151156112c9576112c9838383611b8c565b50505050565b60008151836041011115611326578260410167ffffffffffffffff811180156112f757600080fd5b506040519080825280601f01601f191660200182016040528015611322576020820181803683370190505b5091505b6040850151606086015160006020850160018153836001820152826021820152866003890160418301376041870190209350505050949350505050565b60006102a86040518060a00160405280600015158152602001848152602001600081526020016000815260200160405180602001604052806000815250815250611c2d565b600083830364ffffffffff161180156113c357506020840151155b156113d3576113d3848483611b8c565b42846040015111156113f75760405162461bcd60e51b815260040161041190612b45565b43846060015111156112c95760405162461bcd60e51b815260040161041190612904565b60008082511161145c5760405162461bcd60e51b81526004018080602001828103825260348152602001806130286034913960400191505060405180910390fd5b815160011415611482578160008151811061147357fe5b602002602001015190506102ab565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b600184111561182b5750506002820460018084161460005b828110156117a7578a816002028151811061174e57fe5b602002602001015196508a816002026001018151811061176a57fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061179457fe5b6020908102919091010152600101611737565b50801561180a578960018503815181106117bd57fe5b602002602001015195508783601081106117d357fe5b602002015160001b945085602088015284604088015286805190602001208a83815181106117fd57fe5b6020026020010181815250505b80611816576000611819565b60015b60ff168201935060019092019161171f565b8960008151811061183857fe5b602002602001015198505050505050505050919050565b60006118596106d2565b9050600080611866610d76565b50509150915060006040518060a00160405280856001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156118b257600080fd5b505afa1580156118c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ea9190612203565b81526020018a81526020018981526020018464ffffffffff16815260200160405180602001604052806000815250815250905080600001517f127186556e7be68c7e31263195225b4de02820707889540969f62c05cf73525e826020015183604001518460600151856080015160405161196794939291906124e6565b60405180910390a2600061197a82611c75565b90506000611992836040015186018a86018a8a611c9e565b60405163080549db60e21b81529091506001600160a01b03871690632015276c906119c390859085906004016124d0565b600060405180830381600087803b1580156119dd57600080fd5b505af11580156119f1573d6000803e3d6000fd5b505050505050505050505050505050565b6080810151805160009190826041820167ffffffffffffffff81118015611a2857600080fd5b506040519080825280601f01601f191660200182016040528015611a53576020820181803683370190505b5060408601516060870151919250906000602084016001815383600182015282602182015285604182018760208a0160045afa50604190950190942095505050505050919050565b6000611aa56106d2565b8351604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a91611ad391600401612e7c565b60206040518083038186803b158015611aeb57600080fd5b505afa158015611aff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b239190612203565b611b2c84611c75565b14611b495760405162461bcd60e51b815260040161041190612b16565b611b66836020015185846000015185602001518760400151611cbd565b611b825760405162461bcd60e51b81526004016104119061294c565b5060019392505050565b6000611b9f8364ffffffffff1683610c36565b9050600154816020015164ffffffffff16014210611bcf5760405162461bcd60e51b815260040161041190612647565b806020015164ffffffffff1684604001511115611bfe5760405162461bcd60e51b8152600401610411906129cc565b806040015164ffffffffff16846060015111156112c95760405162461bcd60e51b815260040161041190612c74565b8051602080830151604080850151606086015160808701519251600096611c5896909594910161248f565b604051602081830303815290604052805190602001209050919050565b60008160200151826040015183606001518460800151604051602001611c5894939291906124e6565b602892831b9390931760509190911b1760789290921b91909117901b90565b6000808211611cfd5760405162461bcd60e51b8152600401808060200182810382526037815260200180612f816037913960400191505060405180910390fd5b818410611d3b5760405162461bcd60e51b8152600401808060200182810382526024815260200180612f2d6024913960400191505060405180910390fd5b611d4482611e42565b835114611d825760405162461bcd60e51b815260040180806020018281038252604d815260200180612fb8604d913960600191505060405180910390fd5b8460005b8451811015611e35578560011660011415611de457848181518110611da757fe5b6020026020010151826040516020018083815260200182815260200192505050604051602081830303815290604052805190602001209150611e29565b81858281518110611df157fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c9501611d86565b5090951495945050505050565b6000808211611e825760405162461bcd60e51b8152600401808060200182810382526030815260200180612f516030913960400191505060405180910390fd5b8160011415611e93575060006102ab565b81600060805b60018110611ec3576000196001821b01811b831615611ebb5791821c91908101905b60011c611e99565b506001811b8414611ed2576001015b9392505050565b604080516060810182526000808252602082018190529181019190915290565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b600067ffffffffffffffff831115611f3557fe5b611f48601f8401601f1916602001612ec1565b9050828152838383011115611f5c57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102ab57600080fd5b600082601f830112611f9a578081fd5b611ed283833560208501611f21565b8035600281106102ab57600080fd5b600060a08284031215611fc9578081fd5b60405160a0810167ffffffffffffffff8282108183111715611fe757fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561202457600080fd5b5061203185828601611f8a565b6080830152505092915050565b60006040828403121561204f578081fd5b6040516040810167ffffffffffffffff828210818311171561206d57fe5b816040528293508435835260209150818501358181111561208d57600080fd5b8501601f8101871361209e57600080fd5b8035828111156120aa57fe5b83810292506120ba848401612ec1565b8181528481019083860185850187018b10156120d557600080fd5b600095505b838610156120f85780358352600195909501949186019186016120da565b5080868801525050505050505092915050565b600060a0828403121561211c578081fd5b60405160a0810167ffffffffffffffff828210818311171561213a57fe5b8160405282935084359150811515821461215357600080fd5b818352602085013560208401526040850135604084015260608501356060840152608085013591508082111561202457600080fd5b60008060006060848603121561219c578283fd5b6121a584611f73565b925060208401359150604084013567ffffffffffffffff8111156121c7578182fd5b6121d386828701611f8a565b9150509250925092565b6000602082840312156121ee578081fd5b815164ffffffffff1981168114611ed2578182fd5b600060208284031215612214578081fd5b5051919050565b60006020828403121561222c578081fd5b813567ffffffffffffffff811115612242578182fd5b8201601f81018413612252578182fd5b6103d284823560208401611f21565b60008060008060808587031215612276578081fd5b843567ffffffffffffffff8082111561228d578283fd5b9086019060e082890312156122a0578283fd5b6122aa60e0612ec1565b82358152602083013560208201526122c460408401611fa9565b60408201526122d560608401611f73565b60608201526122e660808401611f73565b608082015260a083013560a082015260c083013582811115612306578485fd5b6123128a828601611f8a565b60c0830152509550602087013591508082111561232d578283fd5b6123398883890161210b565b9450604087013591508082111561234e578283fd5b61235a88838901611fb8565b9350606087013591508082111561236f578283fd5b5061237c8782880161203e565b91505092959194509250565b600060208284031215612399578081fd5b5035919050565b60008151808452815b818110156123c5576020818501810151868301820152016123a9565b818111156123d65782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612432908301846123a0565b9695505050505050565b6001600160a01b038781168252861660208201526040810185905260c06060820181905260009061246f908301866123a0565b60808301949094525060a00152949350505050565b901515815260200190565b6000861515825285602083015284604083015283606083015260a060808301526124bc60a08301846123a0565b979650505050505050565b90815260200190565b91825264ffffffffff1916602082015260400190565b60008582528460208301528360408301526080606083015261243260808301846123a0565b60208082526027908201527f617070656e64517565756542617463682069732063757272656e746c7920646960408201526639b0b13632b21760c91b606082015260800190565b60208082526029908201527f436f6e7465787420626c6f636b206e756d62657220746f6f2066617220696e206040820152683a3432903830b9ba1760b91b606082015260800190565b6020808252603d908201527f5472616e73616374696f6e20646174612073697a652065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b6020808252602f908201527f436f6e746578742074696d657374616d70206973206c6f776572207468616e2060408201526e3630b9ba1039bab136b4ba3a32b21760891b606082015260800190565b6020808252605b908201527f50726576696f75736c7920656e7175657565642062617463686573206861766560408201527f206578706972656420616e64206d75737420626520617070656e64656420626560608201527f666f72652061206e65772073657175656e6365722062617463682e0000000000608082015260a00190565b6020808252602e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e20696e60408201526d31b63ab9b4b7b710383937b7b31760911b606082015260800190565b60208082526032908201527f436f6e7465787420626c6f636b206e756d626572206973206c6f77657220746860408201527130b7103630b9ba1039bab136b4ba3a32b21760711b606082015260800190565b6020808252601e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e2e0000604082015260600190565b6020808252603d908201527f5472616e73616374696f6e20676173206c696d69742065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b60208082526028908201527f4d7573742070726f76696465206174206c65617374206f6e652062617463682060408201526731b7b73a32bc3a1760c11b606082015260800190565b6020808252602e908201527f4e6f7420616c6c2073657175656e636572207472616e73616374696f6e73207760408201526d32b93290383937b1b2b9b9b2b21760911b606082015260800190565b6020808252604a908201527f41637475616c207472616e73616374696f6e20696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420746f74616c20656c656d656e7473206060820152693a379030b83832b7321760b11b608082015260a00190565b60208082526028908201527f436f6e7465787420626c6f636b206e756d6265722069732066726f6d2074686560408201526710333aba3ab9329760c11b606082015260800190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b60208082526029908201527f5472616e73616374696f6e20676173206c696d697420746f6f206c6f7720746f6040820152681032b738bab2bab29760b91b606082015260800190565b60208082526043908201527f53657175656e636572207472616e73616374696f6e2074696d657374616d702060408201527f657863656564732074686174206f66206e65787420717565756520656c656d65606082015262373a1760e91b608082015260a00190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b6020808252602d908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c6564206279207460408201526c34329029b2b8bab2b731b2b91760991b606082015260800190565b6020808252601a908201527f496e76616c6964205175657565207472616e73616374696f6e2e000000000000604082015260600190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b60208082526025908201527f436f6e746578742074696d657374616d702069732066726f6d207468652066756040820152643a3ab9329760d91b606082015260800190565b6020808252602b908201527f496e73756666696369656e742067617320666f72204c322072617465206c696d60408201526a34ba34b73390313ab9371760a91b606082015260800190565b60208082526035908201527f436f6e746578742074696d657374616d702076616c756573206d757374206d6f6040820152743737ba37b734b1b0b6363c9034b731b932b0b9b29760591b606082015260800190565b6020808252602a908201527f496e76616c6964205175657565207472616e73616374696f6e20696e636c757360408201526934b7b710383937b7b31760b11b606082015260800190565b60208082526045908201527f53657175656e636572207472616e73616374696f6e20626c6f636b4e756d626560408201527f7220657863656564732074686174206f66206e65787420717565756520656c6560608201526436b2b73a1760d91b608082015260a00190565b60208082526021908201527f4d75737420617070656e64206174206c65617374206f6e6520656c656d656e746040820152601760f91b606082015260800190565b60208082526026908201527f436f6e746578742074696d657374616d7020746f6f2066617220696e20746865604082015265103830b9ba1760d11b606082015260800190565b60208082526022908201527f4e6f7420656e6f756768204261746368436f6e74657874732070726f76696465604082015261321760f11b606082015260800190565b60208082526029908201527f4e6f7420656e6f75676820717565756564207472616e73616374696f6e732074604082015268379030b83832b7321760b91b606082015260800190565b60208082526037908201527f436f6e7465787420626c6f636b4e756d6265722076616c756573206d7573742060408201527f6d6f6e6f746f6e6963616c6c7920696e6372656173652e000000000000000000606082015260800190565b8151815260208083015164ffffffffff90811691830191909152604092830151169181019190915260600190565b63ffffffff91909116815260200190565b64ffffffffff91909116815260200190565b64ffffffffff9384168152919092166020820152604081019190915260600190565b60405181810167ffffffffffffffff81118282101715612edd57fe5b60405291905056fe4f564d5f4465636f6d7072657373696f6e507265636f6d70696c65416464726573734f564d5f436861696e53746f72616765436f6e7461696e65722d4354432d626174636865734c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4f564d5f436861696e53746f72616765436f6e7461696e65722d4354432d71756575654c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea2646970667358221220ccd26d70e29e57df01efbc12fcd4152555b136a977c6cd56cd6a3e465f2e8fef64736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101425760003560e01c8063876ed5cb116100b8578063cfdf677e1161007c578063cfdf677e1461023f578063d0f8934414610247578063e10d29ee1461024f578063e561dddc14610257578063f722b41a1461025f578063facdc5da1461026757610142565b8063876ed5cb146102175780638d38c6c11461021f578063b8f7700514610227578063c139eb151461022f578063c2cf696f1461023757610142565b80634de569ce1161010a5780634de569ce146101c25780635ae6256d146101e25780636fee07e0146101ea57806378f4b2f2146101ff5780637a167a8a146102075780637aa63a861461020f57610142565b8063138387a414610147578063299ca478146101655780632a7f18be1461017a578063378997701461019a578063461a4478146101af575b600080fd5b61014f61027a565b60405161015c91906124c7565b60405180910390f35b61016d610280565b60405161015c91906123eb565b61018d610188366004612388565b61028f565b60405161015c9190612e4e565b6101a26102b0565b60405161015c9190612e8d565b61016d6101bd36600461221b565b6102c4565b6101d56101d0366004612261565b6103a0565b60405161015c9190612484565b6101a26103da565b6101fd6101f8366004612188565b6103ee565b005b61014f61066d565b6101a2610674565b61014f610689565b61014f6106a4565b61014f6106aa565b6101a26106b0565b61014f6106c7565b61014f6106cd565b61016d6106d2565b6101fd6106f5565b61016d610b69565b61014f610b8c565b6101a2610c06565b6101fd610275366004612388565b610c1e565b60025481565b6000546001600160a01b031681565b610297611ed9565b6102a8826102a3610b69565b610c36565b90505b919050565b6000806102bb610d76565b50935050505090565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561032457818101518382015260200161030c565b50505050905090810190601f1680156103515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561036e57600080fd5b505afa158015610382573d6000803e3d6000fd5b505050506040513d602081101561039857600080fd5b505192915050565b82516000901515600114156103c2576103bb85858585610e24565b90506103d2565b6103bb8585602001518585610fef565b949350505050565b6000806103e5610d76565b94505050505090565b61c3508151111561041a5760405162461bcd60e51b81526004016104119061259b565b60405180910390fd5b60035482111561043c5760405162461bcd60e51b8152600401610411906127a1565b620186a082101561045f5760405162461bcd60e51b815260040161041190612983565b6020820460005a90508181116104875760405162461bcd60e51b815260040161041190612b8a565b60005b825a8303101561049c5760010161048a565b6000338787876040516020016104b594939291906123ff565b60408051601f19818403018152919052805160209091012090504360281b421760006104df610b69565b60405163b298e36b60e01b81529091506001600160a01b0382169063b298e36b9061050e9086906004016124c7565b600060405180830381600087803b15801561052857600080fd5b505af115801561053c573d6000803e3d6000fd5b505060405163b298e36b60e01b81526001600160a01b038416925063b298e36b915061056c9085906004016124c7565b600060405180830381600087803b15801561058657600080fd5b505af115801561059a573d6000803e3d6000fd5b50505050600060016002836001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156105dd57600080fd5b505afa1580156105f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106159190612203565b8161061c57fe5b040390507f4b388aecf9fa6cc92253704e5975a6129a4f735bdbd99567df4ed0094ee4ceb5338b8b8b85426040516106599695949392919061243c565b60405180910390a150505050505050505050565b620186a081565b60008061067f610d76565b5090935050505090565b600080610694610d76565b50505064ffffffffff1692915050565b61c35081565b60035481565b60006106c26106bd610b69565b6110c4565b905090565b60015481565b602081565b60006106c2604051806060016040528060258152602001612f08602591396102c4565b60043560d81c60093560e890811c90600c35901c610711610689565b8364ffffffffff16146107365760405162461bcd60e51b815260040161041190612a35565b6107646040518060400160405280600d81526020016c27ab26afa9b2b8bab2b731b2b960991b8152506102c4565b6001600160a01b0316336001600160a01b0316146107945760405162461bcd60e51b815260040161041190612a92565b60008162ffffff16116107b95760405162461bcd60e51b8152600401610411906127fe565b60008262ffffff16116107de5760405162461bcd60e51b815260040161041190612cdf565b600f601062ffffff8316020164ffffffffff81163610156108115760405162461bcd60e51b815260040161041190612d66565b600061081b610b69565b90506000610828826110c4565b9050600062ffffff8616368161083a57fe5b0460020267ffffffffffffffff8111801561085457600080fd5b506040519080825280601f01601f19166020018201604052801561087f576020820181803683370190505b50905060008662ffffff1667ffffffffffffffff811180156108a057600080fd5b506040519080825280602002602001820160405280156108ca578160200160208202803683370190505b50905060008060006108da610674565b90506108e4611ef9565b60005b8a62ffffff168163ffffffff161015610a3b57600061090b8263ffffffff16611147565b905063ffffffff82166109215761092181611197565b61092d8382868d611264565b80925060005b835163ffffffff821610156109b1578b3560e81c61c3508111156109695760405162461bcd60e51b81526004016104119061259b565b61097c858e64ffffffffff16838d6112cf565b898963ffffffff168151811061098e57fe5b60209081029190910101529b909b016003019a6001968701969586019501610933565b5060005b83602001518163ffffffff161015610a31578964ffffffffff168564ffffffffff16106109f45760405162461bcd60e51b815260040161041190612da8565b610a048564ffffffffff16611363565b888863ffffffff1681518110610a1657fe5b602090810291909101015260019687019694850194016109b5565b50506001016108e7565b50610a488183898b6113a8565b3664ffffffffff8a1614610a6e5760405162461bcd60e51b815260040161041190612846565b8a62ffffff168463ffffffff1614610a985760405162461bcd60e51b815260040161041190612894565b6000838c62ffffff160363ffffffff169050600080836020015160001415610acb57505060408201516060830151610af3565b6000610ae16001870364ffffffffff168d610c36565b90508060200151925080604001519150505b610b14610aff8961141b565b8f62ffffff168564ffffffffff16858561184f565b7f602f1aeac0ca2e7a13e281a9ef0ad7838542712ce16780fa2ecffd351f05f89983860384610b41610689565b604051610b5093929190612e9f565b60405180910390a1505050505050505050505050505050565b60006106c2604051806060016040528060238152602001613005602391396102c4565b6000610b966106d2565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610bce57600080fd5b505afa158015610be2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c29190612203565b6000610c10610674565b610c186106b0565b03905090565b60405162461bcd60e51b81526004016104119061250b565b610c3e611ed9565b604051634a83e9cd60e11b815260028402906000906001600160a01b03851690639507d39a90610c72908590600401612e8d565b60206040518083038186803b158015610c8a57600080fd5b505afa158015610c9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc29190612203565b90506000846001600160a01b0316639507d39a846001016040518263ffffffff1660e01b8152600401610cf59190612e8d565b60206040518083038186803b158015610d0d57600080fd5b505afa158015610d21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d459190612203565b6040805160608101825293845264ffffffffff828116602086015260289290921c9091169083015250949350505050565b6000806000806000610d866106d2565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b158015610dbe57600080fd5b505afa158015610dd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df691906121dd565b64ffffffffff602882901c811697605083901c82169750607883901c8216965060a09290921c169350915050565b600080610e5c6040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b8152506102c4565b90506000816001600160a01b0316631c4712a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610e9957600080fd5b505afa158015610ead573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed19190612203565b90506000610ede87611a02565b9050610eeb818787611a9b565b610f075760405162461bcd60e51b8152600401610411906126ca565b86606001518860200151148015610f22575060408701518851145b8015610f635750610f4a604051806060016040528060228152602001612ee6602291396102c4565b6001600160a01b031688608001516001600160a01b0316145b8015610f725750818860a00151145b8015610f89575060608801516001600160a01b0316155b8015610fa45750600088604001516001811115610fa257fe5b145b8015610fc557508660800151805190602001208860c0015180519060200120145b610fe15760405162461bcd60e51b81526004016104119061276a565b506001979650505050505050565b600080610ffb85611363565b9050611008818585611a9b565b6110245760405162461bcd60e51b815260040161041190612c2a565b6000866060015187608001518860a001518960c0015160405160200161104d94939291906123ff565b60405160208183030381529060405280519060200120905060006110708761028f565b80519091508214801561108e57508751602082015164ffffffffff16145b80156110a857508760200151816040015164ffffffffff16145b610fe15760405162461bcd60e51b815260040161041190612adf565b60006002826001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b15801561110157600080fd5b505afa158015611115573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111399190612203565b8161114057fe5b0492915050565b61114f611ef9565b5060408051608081018252601092909202600f81013560e890811c84526012820135901c6020840152601581013560d890811c92840192909252601a0135901c606082015290565b60006111a1610689565b1115611211576000806111b2610d76565b9350935050508064ffffffffff16836060015110156111e35760405162461bcd60e51b815260040161041190612718565b8164ffffffffff168360400151101561120e5760405162461bcd60e51b8152600401610411906125f8565b50505b4260015482604001510110156112395760405162461bcd60e51b815260040161041190612d20565b4360025482606001510110156112615760405162461bcd60e51b815260040161041190612552565b50565b83604001518360400151101561128c5760405162461bcd60e51b815260040161041190612bd5565b8360600151836060015110156112b45760405162461bcd60e51b815260040161041190612df1565b6020830151156112c9576112c9838383611b8c565b50505050565b60008151836041011115611326578260410167ffffffffffffffff811180156112f757600080fd5b506040519080825280601f01601f191660200182016040528015611322576020820181803683370190505b5091505b6040850151606086015160006020850160018153836001820152826021820152866003890160418301376041870190209350505050949350505050565b60006102a86040518060a00160405280600015158152602001848152602001600081526020016000815260200160405180602001604052806000815250815250611c2d565b600083830364ffffffffff161180156113c357506020840151155b156113d3576113d3848483611b8c565b42846040015111156113f75760405162461bcd60e51b815260040161041190612b45565b43846060015111156112c95760405162461bcd60e51b815260040161041190612904565b60008082511161145c5760405162461bcd60e51b81526004018080602001828103825260348152602001806130286034913960400191505060405180910390fd5b815160011415611482578160008151811061147357fe5b602002602001015190506102ab565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b600184111561182b5750506002820460018084161460005b828110156117a7578a816002028151811061174e57fe5b602002602001015196508a816002026001018151811061176a57fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061179457fe5b6020908102919091010152600101611737565b50801561180a578960018503815181106117bd57fe5b602002602001015195508783601081106117d357fe5b602002015160001b945085602088015284604088015286805190602001208a83815181106117fd57fe5b6020026020010181815250505b80611816576000611819565b60015b60ff168201935060019092019161171f565b8960008151811061183857fe5b602002602001015198505050505050505050919050565b60006118596106d2565b9050600080611866610d76565b50509150915060006040518060a00160405280856001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156118b257600080fd5b505afa1580156118c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ea9190612203565b81526020018a81526020018981526020018464ffffffffff16815260200160405180602001604052806000815250815250905080600001517f127186556e7be68c7e31263195225b4de02820707889540969f62c05cf73525e826020015183604001518460600151856080015160405161196794939291906124e6565b60405180910390a2600061197a82611c75565b90506000611992836040015186018a86018a8a611c9e565b60405163080549db60e21b81529091506001600160a01b03871690632015276c906119c390859085906004016124d0565b600060405180830381600087803b1580156119dd57600080fd5b505af11580156119f1573d6000803e3d6000fd5b505050505050505050505050505050565b6080810151805160009190826041820167ffffffffffffffff81118015611a2857600080fd5b506040519080825280601f01601f191660200182016040528015611a53576020820181803683370190505b5060408601516060870151919250906000602084016001815383600182015282602182015285604182018760208a0160045afa50604190950190942095505050505050919050565b6000611aa56106d2565b8351604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a91611ad391600401612e7c565b60206040518083038186803b158015611aeb57600080fd5b505afa158015611aff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b239190612203565b611b2c84611c75565b14611b495760405162461bcd60e51b815260040161041190612b16565b611b66836020015185846000015185602001518760400151611cbd565b611b825760405162461bcd60e51b81526004016104119061294c565b5060019392505050565b6000611b9f8364ffffffffff1683610c36565b9050600154816020015164ffffffffff16014210611bcf5760405162461bcd60e51b815260040161041190612647565b806020015164ffffffffff1684604001511115611bfe5760405162461bcd60e51b8152600401610411906129cc565b806040015164ffffffffff16846060015111156112c95760405162461bcd60e51b815260040161041190612c74565b8051602080830151604080850151606086015160808701519251600096611c5896909594910161248f565b604051602081830303815290604052805190602001209050919050565b60008160200151826040015183606001518460800151604051602001611c5894939291906124e6565b602892831b9390931760509190911b1760789290921b91909117901b90565b6000808211611cfd5760405162461bcd60e51b8152600401808060200182810382526037815260200180612f816037913960400191505060405180910390fd5b818410611d3b5760405162461bcd60e51b8152600401808060200182810382526024815260200180612f2d6024913960400191505060405180910390fd5b611d4482611e42565b835114611d825760405162461bcd60e51b815260040180806020018281038252604d815260200180612fb8604d913960600191505060405180910390fd5b8460005b8451811015611e35578560011660011415611de457848181518110611da757fe5b6020026020010151826040516020018083815260200182815260200192505050604051602081830303815290604052805190602001209150611e29565b81858281518110611df157fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c9501611d86565b5090951495945050505050565b6000808211611e825760405162461bcd60e51b8152600401808060200182810382526030815260200180612f516030913960400191505060405180910390fd5b8160011415611e93575060006102ab565b81600060805b60018110611ec3576000196001821b01811b831615611ebb5791821c91908101905b60011c611e99565b506001811b8414611ed2576001015b9392505050565b604080516060810182526000808252602082018190529181019190915290565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b600067ffffffffffffffff831115611f3557fe5b611f48601f8401601f1916602001612ec1565b9050828152838383011115611f5c57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102ab57600080fd5b600082601f830112611f9a578081fd5b611ed283833560208501611f21565b8035600281106102ab57600080fd5b600060a08284031215611fc9578081fd5b60405160a0810167ffffffffffffffff8282108183111715611fe757fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561202457600080fd5b5061203185828601611f8a565b6080830152505092915050565b60006040828403121561204f578081fd5b6040516040810167ffffffffffffffff828210818311171561206d57fe5b816040528293508435835260209150818501358181111561208d57600080fd5b8501601f8101871361209e57600080fd5b8035828111156120aa57fe5b83810292506120ba848401612ec1565b8181528481019083860185850187018b10156120d557600080fd5b600095505b838610156120f85780358352600195909501949186019186016120da565b5080868801525050505050505092915050565b600060a0828403121561211c578081fd5b60405160a0810167ffffffffffffffff828210818311171561213a57fe5b8160405282935084359150811515821461215357600080fd5b818352602085013560208401526040850135604084015260608501356060840152608085013591508082111561202457600080fd5b60008060006060848603121561219c578283fd5b6121a584611f73565b925060208401359150604084013567ffffffffffffffff8111156121c7578182fd5b6121d386828701611f8a565b9150509250925092565b6000602082840312156121ee578081fd5b815164ffffffffff1981168114611ed2578182fd5b600060208284031215612214578081fd5b5051919050565b60006020828403121561222c578081fd5b813567ffffffffffffffff811115612242578182fd5b8201601f81018413612252578182fd5b6103d284823560208401611f21565b60008060008060808587031215612276578081fd5b843567ffffffffffffffff8082111561228d578283fd5b9086019060e082890312156122a0578283fd5b6122aa60e0612ec1565b82358152602083013560208201526122c460408401611fa9565b60408201526122d560608401611f73565b60608201526122e660808401611f73565b608082015260a083013560a082015260c083013582811115612306578485fd5b6123128a828601611f8a565b60c0830152509550602087013591508082111561232d578283fd5b6123398883890161210b565b9450604087013591508082111561234e578283fd5b61235a88838901611fb8565b9350606087013591508082111561236f578283fd5b5061237c8782880161203e565b91505092959194509250565b600060208284031215612399578081fd5b5035919050565b60008151808452815b818110156123c5576020818501810151868301820152016123a9565b818111156123d65782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612432908301846123a0565b9695505050505050565b6001600160a01b038781168252861660208201526040810185905260c06060820181905260009061246f908301866123a0565b60808301949094525060a00152949350505050565b901515815260200190565b6000861515825285602083015284604083015283606083015260a060808301526124bc60a08301846123a0565b979650505050505050565b90815260200190565b91825264ffffffffff1916602082015260400190565b60008582528460208301528360408301526080606083015261243260808301846123a0565b60208082526027908201527f617070656e64517565756542617463682069732063757272656e746c7920646960408201526639b0b13632b21760c91b606082015260800190565b60208082526029908201527f436f6e7465787420626c6f636b206e756d62657220746f6f2066617220696e206040820152683a3432903830b9ba1760b91b606082015260800190565b6020808252603d908201527f5472616e73616374696f6e20646174612073697a652065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b6020808252602f908201527f436f6e746578742074696d657374616d70206973206c6f776572207468616e2060408201526e3630b9ba1039bab136b4ba3a32b21760891b606082015260800190565b6020808252605b908201527f50726576696f75736c7920656e7175657565642062617463686573206861766560408201527f206578706972656420616e64206d75737420626520617070656e64656420626560608201527f666f72652061206e65772073657175656e6365722062617463682e0000000000608082015260a00190565b6020808252602e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e20696e60408201526d31b63ab9b4b7b710383937b7b31760911b606082015260800190565b60208082526032908201527f436f6e7465787420626c6f636b206e756d626572206973206c6f77657220746860408201527130b7103630b9ba1039bab136b4ba3a32b21760711b606082015260800190565b6020808252601e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e2e0000604082015260600190565b6020808252603d908201527f5472616e73616374696f6e20676173206c696d69742065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b60208082526028908201527f4d7573742070726f76696465206174206c65617374206f6e652062617463682060408201526731b7b73a32bc3a1760c11b606082015260800190565b6020808252602e908201527f4e6f7420616c6c2073657175656e636572207472616e73616374696f6e73207760408201526d32b93290383937b1b2b9b9b2b21760911b606082015260800190565b6020808252604a908201527f41637475616c207472616e73616374696f6e20696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420746f74616c20656c656d656e7473206060820152693a379030b83832b7321760b11b608082015260a00190565b60208082526028908201527f436f6e7465787420626c6f636b206e756d6265722069732066726f6d2074686560408201526710333aba3ab9329760c11b606082015260800190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b60208082526029908201527f5472616e73616374696f6e20676173206c696d697420746f6f206c6f7720746f6040820152681032b738bab2bab29760b91b606082015260800190565b60208082526043908201527f53657175656e636572207472616e73616374696f6e2074696d657374616d702060408201527f657863656564732074686174206f66206e65787420717565756520656c656d65606082015262373a1760e91b608082015260a00190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b6020808252602d908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c6564206279207460408201526c34329029b2b8bab2b731b2b91760991b606082015260800190565b6020808252601a908201527f496e76616c6964205175657565207472616e73616374696f6e2e000000000000604082015260600190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b60208082526025908201527f436f6e746578742074696d657374616d702069732066726f6d207468652066756040820152643a3ab9329760d91b606082015260800190565b6020808252602b908201527f496e73756666696369656e742067617320666f72204c322072617465206c696d60408201526a34ba34b73390313ab9371760a91b606082015260800190565b60208082526035908201527f436f6e746578742074696d657374616d702076616c756573206d757374206d6f6040820152743737ba37b734b1b0b6363c9034b731b932b0b9b29760591b606082015260800190565b6020808252602a908201527f496e76616c6964205175657565207472616e73616374696f6e20696e636c757360408201526934b7b710383937b7b31760b11b606082015260800190565b60208082526045908201527f53657175656e636572207472616e73616374696f6e20626c6f636b4e756d626560408201527f7220657863656564732074686174206f66206e65787420717565756520656c6560608201526436b2b73a1760d91b608082015260a00190565b60208082526021908201527f4d75737420617070656e64206174206c65617374206f6e6520656c656d656e746040820152601760f91b606082015260800190565b60208082526026908201527f436f6e746578742074696d657374616d7020746f6f2066617220696e20746865604082015265103830b9ba1760d11b606082015260800190565b60208082526022908201527f4e6f7420656e6f756768204261746368436f6e74657874732070726f76696465604082015261321760f11b606082015260800190565b60208082526029908201527f4e6f7420656e6f75676820717565756564207472616e73616374696f6e732074604082015268379030b83832b7321760b91b606082015260800190565b60208082526037908201527f436f6e7465787420626c6f636b4e756d6265722076616c756573206d7573742060408201527f6d6f6e6f746f6e6963616c6c7920696e6372656173652e000000000000000000606082015260800190565b8151815260208083015164ffffffffff90811691830191909152604092830151169181019190915260600190565b63ffffffff91909116815260200190565b64ffffffffff91909116815260200190565b64ffffffffff9384168152919092166020820152604081019190915260600190565b60405181810167ffffffffffffffff81118282101715612edd57fe5b60405291905056fe4f564d5f4465636f6d7072657373696f6e507265636f6d70696c65416464726573734f564d5f436861696e53746f72616765436f6e7461696e65722d4354432d626174636865734c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4f564d5f436861696e53746f72616765436f6e7461696e65722d4354432d71756575654c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea2646970667358221220ccd26d70e29e57df01efbc12fcd4152555b136a977c6cd56cd6a3e465f2e8fef64736f6c63430007060033", "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", @@ -771,15 +771,15 @@ "storageLayout": { "storage": [ { - "astId": 12055, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol:OVM_CanonicalTransactionChain", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12048" + "type": "t_contract(Lib_AddressManager)15296" }, { - "astId": 2189, + "astId": 4440, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol:OVM_CanonicalTransactionChain", "label": "forceInclusionPeriodSeconds", "offset": 0, @@ -787,7 +787,7 @@ "type": "t_uint256" }, { - "astId": 2191, + "astId": 4442, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol:OVM_CanonicalTransactionChain", "label": "forceInclusionPeriodBlocks", "offset": 0, @@ -795,7 +795,7 @@ "type": "t_uint256" }, { - "astId": 2193, + "astId": 4444, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol:OVM_CanonicalTransactionChain", "label": "maxTransactionGasLimit", "offset": 0, @@ -804,7 +804,7 @@ } ], "types": { - "t_contract(Lib_AddressManager)12048": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" diff --git a/packages/contracts/deployments/goerli/OVM_ChainStorageContainer-CTC-batches.json b/packages/contracts/deployments/goerli/OVM_ChainStorageContainer-CTC-batches.json index 5e148d5feb95..3eacd14e0b23 100644 --- a/packages/contracts/deployments/goerli/OVM_ChainStorageContainer-CTC-batches.json +++ b/packages/contracts/deployments/goerli/OVM_ChainStorageContainer-CTC-batches.json @@ -1,5 +1,5 @@ { - "address": "0x7b439CD647b76F45252858C19093a53b4c5FD4B4", + "address": "0xd5F2B9f6Ee80065b2Ce18bF1e629c5aC1C98c7F6", "abi": [ { "inputs": [ @@ -181,45 +181,32 @@ "outputs": [], "stateMutability": "nonpayable", "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "setNextOverwritableIndex", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" } ], - "transactionHash": "0xccaaa6192d2aa73dae4313be6a950378b1b5d86850e6494dec408f625a0713b3", + "transactionHash": "0xc8f8420608b0c55af4fc6306298056ff3749d73ff484a0b9f1a772ed75367906", "receipt": { "to": null, - "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", - "contractAddress": "0x7b439CD647b76F45252858C19093a53b4c5FD4B4", - "transactionIndex": 7, - "gasUsed": "970990", + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0xd5F2B9f6Ee80065b2Ce18bF1e629c5aC1C98c7F6", + "transactionIndex": 106, + "gasUsed": "742305", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x0689af29938844183d2d0c03d93df4c01f711064da67936dc6b2b77310b729b6", - "transactionHash": "0xccaaa6192d2aa73dae4313be6a950378b1b5d86850e6494dec408f625a0713b3", + "blockHash": "0x4b390bf0dd681e19da8c3d4f575d610a869fc1f69b30bf7eb0f1e1842e175438", + "transactionHash": "0xc8f8420608b0c55af4fc6306298056ff3749d73ff484a0b9f1a772ed75367906", "logs": [], - "blockNumber": 4694091, - "cumulativeGasUsed": "2858675", + "blockNumber": 4974809, + "cumulativeGasUsed": "9047399", "status": 1, "byzantium": true }, "args": [ - "0xE3d08F0D900A2D53cB794cf82d7127764BcC3092", + "0xA4346c8c120DdCE2c5447e68790625F10Bb4d47A", "OVM_CanonicalTransactionChain" ], - "solcInputHash": "dde656dd41f49cad9eac9bc7065fd6a7", - "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\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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 distinct 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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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).\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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 distinct 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 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 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\":\"0x93325c961516aa2a22bf1aacf4029353d5e3b693e04b485753170337b50224e6\",\"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 * 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\":\"0x2d7973a0ad84c23ec62624d3f1e3aeb198cc72686ff1e6cfa17155556b320c94\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x2ce671a0e004df88b136bea5a3c59d0732cea8887c8496da1d509e0200b03d7d\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 * 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 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 {\\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\":\"0xe30fc56d4499f98582e1f800dfa3b343f171163a557266c31a56449d5fd3ffae\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506040516200118d3803806200118d833981810160405260408110156200003757600080fd5b8151602083018051604051929492938301929190846401000000008211156200005f57600080fd5b9083019060208201858111156200007557600080fd5b82516401000000008111828201881017156200009057600080fd5b82525081516020918201929091019080838360005b83811015620000bf578181015183820152602001620000a5565b50505050905090810190601f168015620000ed5780820380516001836020036101000a031916815260200191505b506040525050600080546001600160a01b0319166001600160a01b038516179055508051620001249060019060208401906200012d565b505050620001d9565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282620001655760008555620001b0565b82601f106200018057805160ff1916838001178555620001b0565b82800160010185558215620001b0579182015b82811115620001b057825182559160200191906001019062000193565b50620001be929150620001c2565b5090565b5b80821115620001be5760008155600101620001c3565b610fa480620001e96000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80634651d91e116100715780634651d91e1461021a5780638da5cb5b146102375780639507d39a146102b4578063b298e36b146102d1578063ccf8f969146102ee578063fa9e936c14610311576100b4565b8063167fd681146100b95780631f7b6d32146100e65780632015276c1461010057806329061de21461012b578063299ca47814610150578063461a447814610174575b600080fd5b6100e4600480360360408110156100cf57600080fd5b508035906020013564ffffffffff191661032e565b005b6100ee610423565b60408051918252519081900360200190f35b6100e46004803603604081101561011657600080fd5b508035906020013564ffffffffff191661043b565b6100e46004803603602081101561014157600080fd5b503564ffffffffff19166104f7565b6101586105b5565b604080516001600160a01b039092168252519081900360200190f35b6101586004803603602081101561018a57600080fd5b8101906020810181356401000000008111156101a557600080fd5b8201836020820111156101b757600080fd5b803590602001918460018302840111640100000000831117156101d957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105c4945050505050565b6100e46004803603602081101561023057600080fd5b50356106a0565b61023f61075b565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610279578181015183820152602001610261565b50505050905090810190601f1680156102a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100ee600480360360208110156102ca57600080fd5b50356107e8565b6100e4600480360360208110156102e757600080fd5b5035610802565b6102f66108bd565b6040805164ffffffffff199092168252519081900360200190f35b6100e46004803603602081101561032757600080fd5b50356108ce565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526103c493909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b820191906000526020600020905b81548152906001019060200180831161039d57829003601f168201915b50505050506105c4565b6001600160a01b0316336001600160a01b0316146104135760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610983565b5050565b600061042f6002610a75565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261049c93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146104eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610a89565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261055893909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146105a75760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610b90565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561062457818101518382015260200161060c565b50505050905090810190601f1680156106515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561066e57600080fd5b505afa158015610682573d6000803e3d6000fd5b505050506040513d602081101561069857600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261070193909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146107505760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610bba565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107e05780601f106107b5576101008083540402835291602001916107e0565b820191906000526020600020905b8154815290600101906020018083116107c357829003601f168201915b505050505081565b60006107fc600264ffffffffff8416610be0565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261086393909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146108b25760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610de9565b60006108c96002610e0f565b905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261092f93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b03161461097e5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b600855565b600061098e84610e26565b9050806000015164ffffffffff168364ffffffffff161080156109c35750806060015164ffffffffff168364ffffffffff1610155b610a0b576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b806080015164ffffffffff168364ffffffffff161015610a4d576040810180516000190167ffffffffffffffff169052606081015164ffffffffff1660808201525b64ffffffffff8316815264ffffffffff1982166020820152610a6f8482610e86565b50505050565b600080610a8183610e26565b519392505050565b6000610a9484610e26565b90506000610ab9826040015167ffffffffffffffff1686610edc90919063ffffffff16565b8054909150610ac757601081555b8054608083015183510364ffffffffff1610610b3e578460060154826080015164ffffffffff161015610b365760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610b2f908690610edc565b9050610b3e565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610b888684610e86565b505050505050565b6000610b9b83610e26565b64ffffffffff19831660208201529050610bb58382610e86565b505050565b6000610bc583610e26565b9050610bb5828260200151856109839092919063ffffffff16565b600080610bec84610e26565b805190915064ffffffffff168310610c42576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c65826040015167ffffffffffffffff1686610edc90919063ffffffff16565b90506000610c8d836040015160010167ffffffffffffffff1687610edc90919063ffffffff16565b9050826080015164ffffffffff168510610d1a576080830151825464ffffffffff9091168603908110610cfe576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506107fc9050565b6080830151606084015164ffffffffff9182168781039290911610610d7d576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610dca576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b81540360009081526001909101602052604090205492506107fc915050565b6000610df483610e26565b9050610bb582826020015185610a899092919063ffffffff16565b600080610e1b83610e26565b602001519392505050565b610e2e610efc565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b80516020820151604080840151606085015160808601518754858717969483901b8417606883901b1795939291908714610ebe578689555b85896001015414610ed157600189018690555b505050505050505050565b60006002820615610ef05782600401610ef5565b826002015b9392505050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea2646970667358221220376cbc00341dd082d644157f6511fcd1ac26a6a924d04ae6532cfcab93d9191864736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80634651d91e116100715780634651d91e1461021a5780638da5cb5b146102375780639507d39a146102b4578063b298e36b146102d1578063ccf8f969146102ee578063fa9e936c14610311576100b4565b8063167fd681146100b95780631f7b6d32146100e65780632015276c1461010057806329061de21461012b578063299ca47814610150578063461a447814610174575b600080fd5b6100e4600480360360408110156100cf57600080fd5b508035906020013564ffffffffff191661032e565b005b6100ee610423565b60408051918252519081900360200190f35b6100e46004803603604081101561011657600080fd5b508035906020013564ffffffffff191661043b565b6100e46004803603602081101561014157600080fd5b503564ffffffffff19166104f7565b6101586105b5565b604080516001600160a01b039092168252519081900360200190f35b6101586004803603602081101561018a57600080fd5b8101906020810181356401000000008111156101a557600080fd5b8201836020820111156101b757600080fd5b803590602001918460018302840111640100000000831117156101d957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105c4945050505050565b6100e46004803603602081101561023057600080fd5b50356106a0565b61023f61075b565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610279578181015183820152602001610261565b50505050905090810190601f1680156102a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100ee600480360360208110156102ca57600080fd5b50356107e8565b6100e4600480360360208110156102e757600080fd5b5035610802565b6102f66108bd565b6040805164ffffffffff199092168252519081900360200190f35b6100e46004803603602081101561032757600080fd5b50356108ce565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526103c493909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b820191906000526020600020905b81548152906001019060200180831161039d57829003601f168201915b50505050506105c4565b6001600160a01b0316336001600160a01b0316146104135760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610983565b5050565b600061042f6002610a75565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261049c93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146104eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610a89565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261055893909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146105a75760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610b90565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561062457818101518382015260200161060c565b50505050905090810190601f1680156106515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561066e57600080fd5b505afa158015610682573d6000803e3d6000fd5b505050506040513d602081101561069857600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261070193909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146107505760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610bba565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107e05780601f106107b5576101008083540402835291602001916107e0565b820191906000526020600020905b8154815290600101906020018083116107c357829003601f168201915b505050505081565b60006107fc600264ffffffffff8416610be0565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261086393909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146108b25760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610de9565b60006108c96002610e0f565b905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261092f93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b03161461097e5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b600855565b600061098e84610e26565b9050806000015164ffffffffff168364ffffffffff161080156109c35750806060015164ffffffffff168364ffffffffff1610155b610a0b576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b806080015164ffffffffff168364ffffffffff161015610a4d576040810180516000190167ffffffffffffffff169052606081015164ffffffffff1660808201525b64ffffffffff8316815264ffffffffff1982166020820152610a6f8482610e86565b50505050565b600080610a8183610e26565b519392505050565b6000610a9484610e26565b90506000610ab9826040015167ffffffffffffffff1686610edc90919063ffffffff16565b8054909150610ac757601081555b8054608083015183510364ffffffffff1610610b3e578460060154826080015164ffffffffff161015610b365760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610b2f908690610edc565b9050610b3e565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610b888684610e86565b505050505050565b6000610b9b83610e26565b64ffffffffff19831660208201529050610bb58382610e86565b505050565b6000610bc583610e26565b9050610bb5828260200151856109839092919063ffffffff16565b600080610bec84610e26565b805190915064ffffffffff168310610c42576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c65826040015167ffffffffffffffff1686610edc90919063ffffffff16565b90506000610c8d836040015160010167ffffffffffffffff1687610edc90919063ffffffff16565b9050826080015164ffffffffff168510610d1a576080830151825464ffffffffff9091168603908110610cfe576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506107fc9050565b6080830151606084015164ffffffffff9182168781039290911610610d7d576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610dca576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b81540360009081526001909101602052604090205492506107fc915050565b6000610df483610e26565b9050610bb582826020015185610a899092919063ffffffff16565b600080610e1b83610e26565b602001519392505050565b610e2e610efc565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b80516020820151604080840151606085015160808601518754858717969483901b8417606883901b1795939291908714610ebe578689555b85896001015414610ed157600189018690555b505050505050505050565b60006002820615610ef05782600401610ef5565b826002015b9392505050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea2646970667358221220376cbc00341dd082d644157f6511fcd1ac26a6a924d04ae6532cfcab93d9191864736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"setGlobalMetadata\",\"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 distinct 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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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).\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"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.\"}},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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_Buffer } from \\\"../../libraries/utils/Lib_Buffer.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 distinct 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_Buffer for Lib_Buffer.Buffer;\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n string public owner;\\n Lib_Buffer.Buffer 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 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 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\",\"keccak256\":\"0xace1f7a38106e7e95084ca6b39ea9e706cd561fb37c595afa362bb2a39a676ff\",\"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 * 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\",\"keccak256\":\"0x180b9c347e20f1a6efa553b0f2b9a59aebceda92a7484ae6fca4da2bf1d960c3\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Buffer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Buffer\\n * @dev This library implements a bytes32 storage array with some additional gas-optimized\\n * functionality. In particular, it encodes its length as a uint40, and tightly packs this with an\\n * overwritable \\\"extra data\\\" field so we can store more information with a single SSTORE.\\n */\\nlibrary Lib_Buffer {\\n\\n /*************\\n * Libraries *\\n *************/\\n\\n using Lib_Buffer for Buffer;\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Buffer {\\n bytes32 context;\\n mapping (uint256 => bytes32) buf;\\n }\\n\\n struct BufferContext {\\n // Stores the length of the array. Uint40 is way more elements than we'll ever reasonably\\n // need in an array and we get an extra 27 bytes of extra data to play with.\\n uint40 length;\\n\\n // Arbitrary extra data that can be modified whenever the length is updated. Useful for\\n // squeezing out some gas optimizations.\\n bytes27 extraData;\\n }\\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 Global extra data.\\n */\\n function push(\\n Buffer storage _self,\\n bytes32 _value,\\n bytes27 _extraData\\n )\\n internal\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n _self.buf[ctx.length] = _value;\\n\\n // Bump the global index and insert our extra data, then save the context.\\n ctx.length++;\\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 Buffer storage _self,\\n bytes32 _value\\n )\\n internal\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n _self.push(\\n _value,\\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 Buffer storage _self,\\n uint256 _index\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n return _self.buf[_index];\\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 Buffer storage _self,\\n uint40 _index,\\n bytes27 _extraData\\n )\\n internal\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n // Set our length and extra data, save the context.\\n ctx.length = _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 Buffer storage _self,\\n uint40 _index\\n )\\n internal\\n {\\n BufferContext 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 Buffer storage _self\\n )\\n internal\\n view\\n returns (\\n uint40\\n )\\n {\\n BufferContext memory ctx = _self.getContext();\\n return ctx.length;\\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 Buffer storage _self,\\n bytes27 _extraData\\n )\\n internal\\n {\\n BufferContext 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 Buffer storage _self\\n )\\n internal\\n view\\n returns (\\n bytes27\\n )\\n {\\n BufferContext memory ctx = _self.getContext();\\n return ctx.extraData;\\n }\\n\\n /**\\n * Sets the current buffer context.\\n * @param _self Buffer to access.\\n * @param _ctx Current buffer context.\\n */\\n function setContext(\\n Buffer storage _self,\\n BufferContext memory _ctx\\n )\\n internal\\n {\\n bytes32 context;\\n uint40 length = _ctx.length;\\n bytes27 extraData = _ctx.extraData;\\n assembly {\\n context := length\\n context := or(context, extraData)\\n }\\n\\n if (_self.context != context) {\\n _self.context = context;\\n }\\n }\\n\\n /**\\n * Retrieves the current buffer context.\\n * @param _self Buffer to access.\\n * @return Current buffer context.\\n */\\n function getContext(\\n Buffer storage _self\\n )\\n internal\\n view\\n returns (\\n BufferContext memory\\n )\\n {\\n bytes32 context = _self.context;\\n uint40 length;\\n bytes27 extraData;\\n assembly {\\n length := and(context, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\\n extraData := and(context, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000)\\n }\\n\\n return BufferContext({\\n length: length,\\n extraData: extraData\\n });\\n }\\n}\\n\",\"keccak256\":\"0xbce4f4db3d80b2cb252177752eee1ca38482731d1e2e5d165c7fce2e04c487fb\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405162000d5538038062000d558339818101604052604081101561003557600080fd5b81516020830180516040519294929383019291908464010000000082111561005c57600080fd5b90830190602082018581111561007157600080fd5b825164010000000081118282018810171561008b57600080fd5b82525081516020918201929091019080838360005b838110156100b85781810151838201526020016100a0565b50505050905090810190601f1680156100e55780820380516001836020036101000a031916815260200191505b506040525050600080546001600160a01b0319166001600160a01b03851617905550805161011a906001906020840190610122565b5050506101c3565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282610158576000855561019e565b82601f1061017157805160ff191683800117855561019e565b8280016001018555821561019e579182015b8281111561019e578251825591602001919060010190610183565b506101aa9291506101ae565b5090565b5b808211156101aa57600081556001016101af565b610b8280620001d36000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c8063461a447811610071578063461a4478146101695780634651d91e1461020f5780638da5cb5b1461022c5780639507d39a146102a9578063b298e36b146102c6578063ccf8f969146102e3576100a9565b8063167fd681146100ae5780631f7b6d32146100db5780632015276c146100f557806329061de214610120578063299ca47814610145575b600080fd5b6100d9600480360360408110156100c457600080fd5b508035906020013564ffffffffff1916610306565b005b6100e36103fb565b60408051918252519081900360200190f35b6100d96004803603604081101561010b57600080fd5b508035906020013564ffffffffff1916610413565b6100d96004803603602081101561013657600080fd5b503564ffffffffff19166104cf565b61014d61058d565b604080516001600160a01b039092168252519081900360200190f35b61014d6004803603602081101561017f57600080fd5b81019060208101813564010000000081111561019a57600080fd5b8201836020820111156101ac57600080fd5b803590602001918460018302840111640100000000831117156101ce57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061059c945050505050565b6100d96004803603602081101561022557600080fd5b5035610678565b610234610733565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561026e578181015183820152602001610256565b50505050905090810190601f16801561029b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100e3600480360360208110156102bf57600080fd5b50356107c0565b6100d9600480360360208110156102dc57600080fd5b50356107da565b6102eb610895565b6040805164ffffffffff199092168252519081900360200190f35b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261039c93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b820191906000526020600020905b81548152906001019060200180831161037557829003601f168201915b505050505061059c565b6001600160a01b0316336001600160a01b0316146103eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f7600283836108a6565b5050565b60006104076002610938565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261047493909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146104c35760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f76002838361094c565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261053093909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461057f5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a60028261099a565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156105fc5781810151838201526020016105e4565b50505050905090810190601f1680156106295780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561064657600080fd5b505afa15801561065a573d6000803e3d6000fd5b505050506040513d602081101561067057600080fd5b505192915050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526106d993909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146107285760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a6002826109c4565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107b85780601f1061078d576101008083540402835291602001916107b8565b820191906000526020600020905b81548152906001019060200180831161079b57829003601f168201915b505050505081565b60006107d4600264ffffffffff84166109ea565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261083b93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461088a5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a600282610a64565b60006108a16002610a8a565b905090565b60006108b184610aa1565b9050806000015164ffffffffff168364ffffffffff1610610910576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b64ffffffffff8316815264ffffffffff19821660208201526109328482610ad1565b50505050565b60008061094483610aa1565b519392505050565b600061095784610aa1565b805164ffffffffff9081166000908152600180880160209081526040909220879055835101909116825264ffffffffff1984169082015290506109328482610ad1565b60006109a583610aa1565b64ffffffffff198316602082015290506109bf8382610ad1565b505050565b60006109cf83610aa1565b90506109bf828260200151856108a69092919063ffffffff16565b6000806109f684610aa1565b805190915064ffffffffff168310610a4c576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b50506000908152600191909101602052604090205490565b6000610a6f83610aa1565b90506109bf8282602001518561094c9092919063ffffffff16565b600080610a9683610aa1565b602001519392505050565b610aa9610af1565b50546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b8051602082015183548183179291908314610aea578285555b5050505050565b60408051808201909152600080825260208201529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122038869143d4598418a0ef5faf124214a16dc032f21ac35b7170b13b796c6eb00464736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c8063461a447811610071578063461a4478146101695780634651d91e1461020f5780638da5cb5b1461022c5780639507d39a146102a9578063b298e36b146102c6578063ccf8f969146102e3576100a9565b8063167fd681146100ae5780631f7b6d32146100db5780632015276c146100f557806329061de214610120578063299ca47814610145575b600080fd5b6100d9600480360360408110156100c457600080fd5b508035906020013564ffffffffff1916610306565b005b6100e36103fb565b60408051918252519081900360200190f35b6100d96004803603604081101561010b57600080fd5b508035906020013564ffffffffff1916610413565b6100d96004803603602081101561013657600080fd5b503564ffffffffff19166104cf565b61014d61058d565b604080516001600160a01b039092168252519081900360200190f35b61014d6004803603602081101561017f57600080fd5b81019060208101813564010000000081111561019a57600080fd5b8201836020820111156101ac57600080fd5b803590602001918460018302840111640100000000831117156101ce57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061059c945050505050565b6100d96004803603602081101561022557600080fd5b5035610678565b610234610733565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561026e578181015183820152602001610256565b50505050905090810190601f16801561029b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100e3600480360360208110156102bf57600080fd5b50356107c0565b6100d9600480360360208110156102dc57600080fd5b50356107da565b6102eb610895565b6040805164ffffffffff199092168252519081900360200190f35b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261039c93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b820191906000526020600020905b81548152906001019060200180831161037557829003601f168201915b505050505061059c565b6001600160a01b0316336001600160a01b0316146103eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f7600283836108a6565b5050565b60006104076002610938565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261047493909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146104c35760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f76002838361094c565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261053093909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461057f5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a60028261099a565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156105fc5781810151838201526020016105e4565b50505050905090810190601f1680156106295780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561064657600080fd5b505afa15801561065a573d6000803e3d6000fd5b505050506040513d602081101561067057600080fd5b505192915050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526106d993909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146107285760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a6002826109c4565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107b85780601f1061078d576101008083540402835291602001916107b8565b820191906000526020600020905b81548152906001019060200180831161079b57829003601f168201915b505050505081565b60006107d4600264ffffffffff84166109ea565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261083b93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461088a5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a600282610a64565b60006108a16002610a8a565b905090565b60006108b184610aa1565b9050806000015164ffffffffff168364ffffffffff1610610910576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b64ffffffffff8316815264ffffffffff19821660208201526109328482610ad1565b50505050565b60008061094483610aa1565b519392505050565b600061095784610aa1565b805164ffffffffff9081166000908152600180880160209081526040909220879055835101909116825264ffffffffff1984169082015290506109328482610ad1565b60006109a583610aa1565b64ffffffffff198316602082015290506109bf8382610ad1565b505050565b60006109cf83610aa1565b90506109bf828260200151856108a69092919063ffffffff16565b6000806109f684610aa1565b805190915064ffffffffff168310610a4c576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b50506000908152600191909101602052604090205490565b6000610a6f83610aa1565b90506109bf8282602001518561094c9092919063ffffffff16565b600080610a9683610aa1565b602001519392505050565b610aa9610af1565b50546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b8051602082015183548183179291908314610aea578285555b5050505050565b60408051808201909152600080825260208201529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122038869143d4598418a0ef5faf124214a16dc032f21ac35b7170b13b796c6eb00464736f6c63430007060033", "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 distinct 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", @@ -316,9 +303,6 @@ }, "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 @@ -326,15 +310,15 @@ "storageLayout": { "storage": [ { - "astId": 12055, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12048" + "type": "t_contract(Lib_AddressManager)15296" }, { - "astId": 3712, + "astId": 5963, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "owner", "offset": 0, @@ -342,12 +326,12 @@ "type": "t_string_storage" }, { - "astId": 3714, + "astId": 5965, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "buffer", "offset": 0, "slot": "2", - "type": "t_struct(RingBuffer)17101_storage" + "type": "t_struct(Buffer)18996_storage" } ], "types": { @@ -356,7 +340,7 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(Lib_AddressManager)12048": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" @@ -373,20 +357,20 @@ "label": "string", "numberOfBytes": "32" }, - "t_struct(Buffer)17090_storage": { + "t_struct(Buffer)18996_storage": { "encoding": "inplace", - "label": "struct Lib_RingBuffer.Buffer", + "label": "struct Lib_Buffer.Buffer", "members": [ { - "astId": 17085, + "astId": 18991, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "length", + "label": "context", "offset": 0, "slot": "0", - "type": "t_uint256" + "type": "t_bytes32" }, { - "astId": 17089, + "astId": 18995, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "buf", "offset": 0, @@ -396,53 +380,6 @@ ], "numberOfBytes": "64" }, - "t_struct(RingBuffer)17101_storage": { - "encoding": "inplace", - "label": "struct Lib_RingBuffer.RingBuffer", - "members": [ - { - "astId": 17092, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "contextA", - "offset": 0, - "slot": "0", - "type": "t_bytes32" - }, - { - "astId": 17094, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "contextB", - "offset": 0, - "slot": "1", - "type": "t_bytes32" - }, - { - "astId": 17096, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "bufferA", - "offset": 0, - "slot": "2", - "type": "t_struct(Buffer)17090_storage" - }, - { - "astId": 17098, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "bufferB", - "offset": 0, - "slot": "4", - "type": "t_struct(Buffer)17090_storage" - }, - { - "astId": 17100, - "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", diff --git a/packages/contracts/deployments/goerli/OVM_ChainStorageContainer-CTC-queue.json b/packages/contracts/deployments/goerli/OVM_ChainStorageContainer-CTC-queue.json index c75f6255c10d..397e86cd456e 100644 --- a/packages/contracts/deployments/goerli/OVM_ChainStorageContainer-CTC-queue.json +++ b/packages/contracts/deployments/goerli/OVM_ChainStorageContainer-CTC-queue.json @@ -1,5 +1,5 @@ { - "address": "0xeD5fF8cFFba09fa5fF3104a63bA321733c4553d9", + "address": "0x3EA657c5aA0E4Bce1D8919dC7f248724d7B0987a", "abi": [ { "inputs": [ @@ -181,45 +181,32 @@ "outputs": [], "stateMutability": "nonpayable", "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "setNextOverwritableIndex", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" } ], - "transactionHash": "0xc18d4e89a763706311175193d4f75a4677a551fb0d8c2ee18f4157192460084f", + "transactionHash": "0xcba089e5b66a9bd40bc888c423b990889509ad341f7918b38b752f608810bea7", "receipt": { "to": null, - "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", - "contractAddress": "0xeD5fF8cFFba09fa5fF3104a63bA321733c4553d9", - "transactionIndex": 4, - "gasUsed": "970990", + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0x3EA657c5aA0E4Bce1D8919dC7f248724d7B0987a", + "transactionIndex": 46, + "gasUsed": "742305", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x9fa346bec2f0265f5d068bef12fcde397f7f3a0e808ecdda6516881286575e60", - "transactionHash": "0xc18d4e89a763706311175193d4f75a4677a551fb0d8c2ee18f4157192460084f", + "blockHash": "0x255246072c7ed7956bb4c12d0a7a7886b53ffc5b041329942727f7e5e4ed5817", + "transactionHash": "0xcba089e5b66a9bd40bc888c423b990889509ad341f7918b38b752f608810bea7", "logs": [], - "blockNumber": 4694093, - "cumulativeGasUsed": "1626532", + "blockNumber": 4974812, + "cumulativeGasUsed": "4092532", "status": 1, "byzantium": true }, "args": [ - "0xE3d08F0D900A2D53cB794cf82d7127764BcC3092", + "0xA4346c8c120DdCE2c5447e68790625F10Bb4d47A", "OVM_CanonicalTransactionChain" ], - "solcInputHash": "dde656dd41f49cad9eac9bc7065fd6a7", - "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\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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 distinct 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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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).\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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 distinct 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 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 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\":\"0x93325c961516aa2a22bf1aacf4029353d5e3b693e04b485753170337b50224e6\",\"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 * 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\":\"0x2d7973a0ad84c23ec62624d3f1e3aeb198cc72686ff1e6cfa17155556b320c94\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x2ce671a0e004df88b136bea5a3c59d0732cea8887c8496da1d509e0200b03d7d\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 * 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 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 {\\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\":\"0xe30fc56d4499f98582e1f800dfa3b343f171163a557266c31a56449d5fd3ffae\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506040516200118d3803806200118d833981810160405260408110156200003757600080fd5b8151602083018051604051929492938301929190846401000000008211156200005f57600080fd5b9083019060208201858111156200007557600080fd5b82516401000000008111828201881017156200009057600080fd5b82525081516020918201929091019080838360005b83811015620000bf578181015183820152602001620000a5565b50505050905090810190601f168015620000ed5780820380516001836020036101000a031916815260200191505b506040525050600080546001600160a01b0319166001600160a01b038516179055508051620001249060019060208401906200012d565b505050620001d9565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282620001655760008555620001b0565b82601f106200018057805160ff1916838001178555620001b0565b82800160010185558215620001b0579182015b82811115620001b057825182559160200191906001019062000193565b50620001be929150620001c2565b5090565b5b80821115620001be5760008155600101620001c3565b610fa480620001e96000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80634651d91e116100715780634651d91e1461021a5780638da5cb5b146102375780639507d39a146102b4578063b298e36b146102d1578063ccf8f969146102ee578063fa9e936c14610311576100b4565b8063167fd681146100b95780631f7b6d32146100e65780632015276c1461010057806329061de21461012b578063299ca47814610150578063461a447814610174575b600080fd5b6100e4600480360360408110156100cf57600080fd5b508035906020013564ffffffffff191661032e565b005b6100ee610423565b60408051918252519081900360200190f35b6100e46004803603604081101561011657600080fd5b508035906020013564ffffffffff191661043b565b6100e46004803603602081101561014157600080fd5b503564ffffffffff19166104f7565b6101586105b5565b604080516001600160a01b039092168252519081900360200190f35b6101586004803603602081101561018a57600080fd5b8101906020810181356401000000008111156101a557600080fd5b8201836020820111156101b757600080fd5b803590602001918460018302840111640100000000831117156101d957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105c4945050505050565b6100e46004803603602081101561023057600080fd5b50356106a0565b61023f61075b565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610279578181015183820152602001610261565b50505050905090810190601f1680156102a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100ee600480360360208110156102ca57600080fd5b50356107e8565b6100e4600480360360208110156102e757600080fd5b5035610802565b6102f66108bd565b6040805164ffffffffff199092168252519081900360200190f35b6100e46004803603602081101561032757600080fd5b50356108ce565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526103c493909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b820191906000526020600020905b81548152906001019060200180831161039d57829003601f168201915b50505050506105c4565b6001600160a01b0316336001600160a01b0316146104135760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610983565b5050565b600061042f6002610a75565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261049c93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146104eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610a89565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261055893909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146105a75760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610b90565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561062457818101518382015260200161060c565b50505050905090810190601f1680156106515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561066e57600080fd5b505afa158015610682573d6000803e3d6000fd5b505050506040513d602081101561069857600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261070193909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146107505760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610bba565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107e05780601f106107b5576101008083540402835291602001916107e0565b820191906000526020600020905b8154815290600101906020018083116107c357829003601f168201915b505050505081565b60006107fc600264ffffffffff8416610be0565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261086393909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146108b25760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610de9565b60006108c96002610e0f565b905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261092f93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b03161461097e5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b600855565b600061098e84610e26565b9050806000015164ffffffffff168364ffffffffff161080156109c35750806060015164ffffffffff168364ffffffffff1610155b610a0b576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b806080015164ffffffffff168364ffffffffff161015610a4d576040810180516000190167ffffffffffffffff169052606081015164ffffffffff1660808201525b64ffffffffff8316815264ffffffffff1982166020820152610a6f8482610e86565b50505050565b600080610a8183610e26565b519392505050565b6000610a9484610e26565b90506000610ab9826040015167ffffffffffffffff1686610edc90919063ffffffff16565b8054909150610ac757601081555b8054608083015183510364ffffffffff1610610b3e578460060154826080015164ffffffffff161015610b365760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610b2f908690610edc565b9050610b3e565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610b888684610e86565b505050505050565b6000610b9b83610e26565b64ffffffffff19831660208201529050610bb58382610e86565b505050565b6000610bc583610e26565b9050610bb5828260200151856109839092919063ffffffff16565b600080610bec84610e26565b805190915064ffffffffff168310610c42576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c65826040015167ffffffffffffffff1686610edc90919063ffffffff16565b90506000610c8d836040015160010167ffffffffffffffff1687610edc90919063ffffffff16565b9050826080015164ffffffffff168510610d1a576080830151825464ffffffffff9091168603908110610cfe576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506107fc9050565b6080830151606084015164ffffffffff9182168781039290911610610d7d576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610dca576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b81540360009081526001909101602052604090205492506107fc915050565b6000610df483610e26565b9050610bb582826020015185610a899092919063ffffffff16565b600080610e1b83610e26565b602001519392505050565b610e2e610efc565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b80516020820151604080840151606085015160808601518754858717969483901b8417606883901b1795939291908714610ebe578689555b85896001015414610ed157600189018690555b505050505050505050565b60006002820615610ef05782600401610ef5565b826002015b9392505050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea2646970667358221220376cbc00341dd082d644157f6511fcd1ac26a6a924d04ae6532cfcab93d9191864736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80634651d91e116100715780634651d91e1461021a5780638da5cb5b146102375780639507d39a146102b4578063b298e36b146102d1578063ccf8f969146102ee578063fa9e936c14610311576100b4565b8063167fd681146100b95780631f7b6d32146100e65780632015276c1461010057806329061de21461012b578063299ca47814610150578063461a447814610174575b600080fd5b6100e4600480360360408110156100cf57600080fd5b508035906020013564ffffffffff191661032e565b005b6100ee610423565b60408051918252519081900360200190f35b6100e46004803603604081101561011657600080fd5b508035906020013564ffffffffff191661043b565b6100e46004803603602081101561014157600080fd5b503564ffffffffff19166104f7565b6101586105b5565b604080516001600160a01b039092168252519081900360200190f35b6101586004803603602081101561018a57600080fd5b8101906020810181356401000000008111156101a557600080fd5b8201836020820111156101b757600080fd5b803590602001918460018302840111640100000000831117156101d957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105c4945050505050565b6100e46004803603602081101561023057600080fd5b50356106a0565b61023f61075b565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610279578181015183820152602001610261565b50505050905090810190601f1680156102a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100ee600480360360208110156102ca57600080fd5b50356107e8565b6100e4600480360360208110156102e757600080fd5b5035610802565b6102f66108bd565b6040805164ffffffffff199092168252519081900360200190f35b6100e46004803603602081101561032757600080fd5b50356108ce565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526103c493909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b820191906000526020600020905b81548152906001019060200180831161039d57829003601f168201915b50505050506105c4565b6001600160a01b0316336001600160a01b0316146104135760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610983565b5050565b600061042f6002610a75565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261049c93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146104eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610a89565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261055893909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146105a75760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610b90565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561062457818101518382015260200161060c565b50505050905090810190601f1680156106515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561066e57600080fd5b505afa158015610682573d6000803e3d6000fd5b505050506040513d602081101561069857600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261070193909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146107505760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610bba565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107e05780601f106107b5576101008083540402835291602001916107e0565b820191906000526020600020905b8154815290600101906020018083116107c357829003601f168201915b505050505081565b60006107fc600264ffffffffff8416610be0565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261086393909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146108b25760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610de9565b60006108c96002610e0f565b905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261092f93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b03161461097e5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b600855565b600061098e84610e26565b9050806000015164ffffffffff168364ffffffffff161080156109c35750806060015164ffffffffff168364ffffffffff1610155b610a0b576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b806080015164ffffffffff168364ffffffffff161015610a4d576040810180516000190167ffffffffffffffff169052606081015164ffffffffff1660808201525b64ffffffffff8316815264ffffffffff1982166020820152610a6f8482610e86565b50505050565b600080610a8183610e26565b519392505050565b6000610a9484610e26565b90506000610ab9826040015167ffffffffffffffff1686610edc90919063ffffffff16565b8054909150610ac757601081555b8054608083015183510364ffffffffff1610610b3e578460060154826080015164ffffffffff161015610b365760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610b2f908690610edc565b9050610b3e565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610b888684610e86565b505050505050565b6000610b9b83610e26565b64ffffffffff19831660208201529050610bb58382610e86565b505050565b6000610bc583610e26565b9050610bb5828260200151856109839092919063ffffffff16565b600080610bec84610e26565b805190915064ffffffffff168310610c42576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c65826040015167ffffffffffffffff1686610edc90919063ffffffff16565b90506000610c8d836040015160010167ffffffffffffffff1687610edc90919063ffffffff16565b9050826080015164ffffffffff168510610d1a576080830151825464ffffffffff9091168603908110610cfe576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506107fc9050565b6080830151606084015164ffffffffff9182168781039290911610610d7d576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610dca576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b81540360009081526001909101602052604090205492506107fc915050565b6000610df483610e26565b9050610bb582826020015185610a899092919063ffffffff16565b600080610e1b83610e26565b602001519392505050565b610e2e610efc565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b80516020820151604080840151606085015160808601518754858717969483901b8417606883901b1795939291908714610ebe578689555b85896001015414610ed157600189018690555b505050505050505050565b60006002820615610ef05782600401610ef5565b826002015b9392505050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea2646970667358221220376cbc00341dd082d644157f6511fcd1ac26a6a924d04ae6532cfcab93d9191864736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"setGlobalMetadata\",\"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 distinct 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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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).\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"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.\"}},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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_Buffer } from \\\"../../libraries/utils/Lib_Buffer.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 distinct 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_Buffer for Lib_Buffer.Buffer;\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n string public owner;\\n Lib_Buffer.Buffer 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 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 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\",\"keccak256\":\"0xace1f7a38106e7e95084ca6b39ea9e706cd561fb37c595afa362bb2a39a676ff\",\"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 * 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\",\"keccak256\":\"0x180b9c347e20f1a6efa553b0f2b9a59aebceda92a7484ae6fca4da2bf1d960c3\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Buffer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Buffer\\n * @dev This library implements a bytes32 storage array with some additional gas-optimized\\n * functionality. In particular, it encodes its length as a uint40, and tightly packs this with an\\n * overwritable \\\"extra data\\\" field so we can store more information with a single SSTORE.\\n */\\nlibrary Lib_Buffer {\\n\\n /*************\\n * Libraries *\\n *************/\\n\\n using Lib_Buffer for Buffer;\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Buffer {\\n bytes32 context;\\n mapping (uint256 => bytes32) buf;\\n }\\n\\n struct BufferContext {\\n // Stores the length of the array. Uint40 is way more elements than we'll ever reasonably\\n // need in an array and we get an extra 27 bytes of extra data to play with.\\n uint40 length;\\n\\n // Arbitrary extra data that can be modified whenever the length is updated. Useful for\\n // squeezing out some gas optimizations.\\n bytes27 extraData;\\n }\\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 Global extra data.\\n */\\n function push(\\n Buffer storage _self,\\n bytes32 _value,\\n bytes27 _extraData\\n )\\n internal\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n _self.buf[ctx.length] = _value;\\n\\n // Bump the global index and insert our extra data, then save the context.\\n ctx.length++;\\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 Buffer storage _self,\\n bytes32 _value\\n )\\n internal\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n _self.push(\\n _value,\\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 Buffer storage _self,\\n uint256 _index\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n return _self.buf[_index];\\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 Buffer storage _self,\\n uint40 _index,\\n bytes27 _extraData\\n )\\n internal\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n // Set our length and extra data, save the context.\\n ctx.length = _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 Buffer storage _self,\\n uint40 _index\\n )\\n internal\\n {\\n BufferContext 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 Buffer storage _self\\n )\\n internal\\n view\\n returns (\\n uint40\\n )\\n {\\n BufferContext memory ctx = _self.getContext();\\n return ctx.length;\\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 Buffer storage _self,\\n bytes27 _extraData\\n )\\n internal\\n {\\n BufferContext 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 Buffer storage _self\\n )\\n internal\\n view\\n returns (\\n bytes27\\n )\\n {\\n BufferContext memory ctx = _self.getContext();\\n return ctx.extraData;\\n }\\n\\n /**\\n * Sets the current buffer context.\\n * @param _self Buffer to access.\\n * @param _ctx Current buffer context.\\n */\\n function setContext(\\n Buffer storage _self,\\n BufferContext memory _ctx\\n )\\n internal\\n {\\n bytes32 context;\\n uint40 length = _ctx.length;\\n bytes27 extraData = _ctx.extraData;\\n assembly {\\n context := length\\n context := or(context, extraData)\\n }\\n\\n if (_self.context != context) {\\n _self.context = context;\\n }\\n }\\n\\n /**\\n * Retrieves the current buffer context.\\n * @param _self Buffer to access.\\n * @return Current buffer context.\\n */\\n function getContext(\\n Buffer storage _self\\n )\\n internal\\n view\\n returns (\\n BufferContext memory\\n )\\n {\\n bytes32 context = _self.context;\\n uint40 length;\\n bytes27 extraData;\\n assembly {\\n length := and(context, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\\n extraData := and(context, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000)\\n }\\n\\n return BufferContext({\\n length: length,\\n extraData: extraData\\n });\\n }\\n}\\n\",\"keccak256\":\"0xbce4f4db3d80b2cb252177752eee1ca38482731d1e2e5d165c7fce2e04c487fb\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405162000d5538038062000d558339818101604052604081101561003557600080fd5b81516020830180516040519294929383019291908464010000000082111561005c57600080fd5b90830190602082018581111561007157600080fd5b825164010000000081118282018810171561008b57600080fd5b82525081516020918201929091019080838360005b838110156100b85781810151838201526020016100a0565b50505050905090810190601f1680156100e55780820380516001836020036101000a031916815260200191505b506040525050600080546001600160a01b0319166001600160a01b03851617905550805161011a906001906020840190610122565b5050506101c3565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282610158576000855561019e565b82601f1061017157805160ff191683800117855561019e565b8280016001018555821561019e579182015b8281111561019e578251825591602001919060010190610183565b506101aa9291506101ae565b5090565b5b808211156101aa57600081556001016101af565b610b8280620001d36000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c8063461a447811610071578063461a4478146101695780634651d91e1461020f5780638da5cb5b1461022c5780639507d39a146102a9578063b298e36b146102c6578063ccf8f969146102e3576100a9565b8063167fd681146100ae5780631f7b6d32146100db5780632015276c146100f557806329061de214610120578063299ca47814610145575b600080fd5b6100d9600480360360408110156100c457600080fd5b508035906020013564ffffffffff1916610306565b005b6100e36103fb565b60408051918252519081900360200190f35b6100d96004803603604081101561010b57600080fd5b508035906020013564ffffffffff1916610413565b6100d96004803603602081101561013657600080fd5b503564ffffffffff19166104cf565b61014d61058d565b604080516001600160a01b039092168252519081900360200190f35b61014d6004803603602081101561017f57600080fd5b81019060208101813564010000000081111561019a57600080fd5b8201836020820111156101ac57600080fd5b803590602001918460018302840111640100000000831117156101ce57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061059c945050505050565b6100d96004803603602081101561022557600080fd5b5035610678565b610234610733565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561026e578181015183820152602001610256565b50505050905090810190601f16801561029b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100e3600480360360208110156102bf57600080fd5b50356107c0565b6100d9600480360360208110156102dc57600080fd5b50356107da565b6102eb610895565b6040805164ffffffffff199092168252519081900360200190f35b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261039c93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b820191906000526020600020905b81548152906001019060200180831161037557829003601f168201915b505050505061059c565b6001600160a01b0316336001600160a01b0316146103eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f7600283836108a6565b5050565b60006104076002610938565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261047493909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146104c35760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f76002838361094c565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261053093909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461057f5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a60028261099a565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156105fc5781810151838201526020016105e4565b50505050905090810190601f1680156106295780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561064657600080fd5b505afa15801561065a573d6000803e3d6000fd5b505050506040513d602081101561067057600080fd5b505192915050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526106d993909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146107285760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a6002826109c4565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107b85780601f1061078d576101008083540402835291602001916107b8565b820191906000526020600020905b81548152906001019060200180831161079b57829003601f168201915b505050505081565b60006107d4600264ffffffffff84166109ea565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261083b93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461088a5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a600282610a64565b60006108a16002610a8a565b905090565b60006108b184610aa1565b9050806000015164ffffffffff168364ffffffffff1610610910576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b64ffffffffff8316815264ffffffffff19821660208201526109328482610ad1565b50505050565b60008061094483610aa1565b519392505050565b600061095784610aa1565b805164ffffffffff9081166000908152600180880160209081526040909220879055835101909116825264ffffffffff1984169082015290506109328482610ad1565b60006109a583610aa1565b64ffffffffff198316602082015290506109bf8382610ad1565b505050565b60006109cf83610aa1565b90506109bf828260200151856108a69092919063ffffffff16565b6000806109f684610aa1565b805190915064ffffffffff168310610a4c576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b50506000908152600191909101602052604090205490565b6000610a6f83610aa1565b90506109bf8282602001518561094c9092919063ffffffff16565b600080610a9683610aa1565b602001519392505050565b610aa9610af1565b50546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b8051602082015183548183179291908314610aea578285555b5050505050565b60408051808201909152600080825260208201529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122038869143d4598418a0ef5faf124214a16dc032f21ac35b7170b13b796c6eb00464736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c8063461a447811610071578063461a4478146101695780634651d91e1461020f5780638da5cb5b1461022c5780639507d39a146102a9578063b298e36b146102c6578063ccf8f969146102e3576100a9565b8063167fd681146100ae5780631f7b6d32146100db5780632015276c146100f557806329061de214610120578063299ca47814610145575b600080fd5b6100d9600480360360408110156100c457600080fd5b508035906020013564ffffffffff1916610306565b005b6100e36103fb565b60408051918252519081900360200190f35b6100d96004803603604081101561010b57600080fd5b508035906020013564ffffffffff1916610413565b6100d96004803603602081101561013657600080fd5b503564ffffffffff19166104cf565b61014d61058d565b604080516001600160a01b039092168252519081900360200190f35b61014d6004803603602081101561017f57600080fd5b81019060208101813564010000000081111561019a57600080fd5b8201836020820111156101ac57600080fd5b803590602001918460018302840111640100000000831117156101ce57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061059c945050505050565b6100d96004803603602081101561022557600080fd5b5035610678565b610234610733565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561026e578181015183820152602001610256565b50505050905090810190601f16801561029b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100e3600480360360208110156102bf57600080fd5b50356107c0565b6100d9600480360360208110156102dc57600080fd5b50356107da565b6102eb610895565b6040805164ffffffffff199092168252519081900360200190f35b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261039c93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b820191906000526020600020905b81548152906001019060200180831161037557829003601f168201915b505050505061059c565b6001600160a01b0316336001600160a01b0316146103eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f7600283836108a6565b5050565b60006104076002610938565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261047493909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146104c35760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f76002838361094c565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261053093909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461057f5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a60028261099a565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156105fc5781810151838201526020016105e4565b50505050905090810190601f1680156106295780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561064657600080fd5b505afa15801561065a573d6000803e3d6000fd5b505050506040513d602081101561067057600080fd5b505192915050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526106d993909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146107285760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a6002826109c4565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107b85780601f1061078d576101008083540402835291602001916107b8565b820191906000526020600020905b81548152906001019060200180831161079b57829003601f168201915b505050505081565b60006107d4600264ffffffffff84166109ea565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261083b93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461088a5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a600282610a64565b60006108a16002610a8a565b905090565b60006108b184610aa1565b9050806000015164ffffffffff168364ffffffffff1610610910576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b64ffffffffff8316815264ffffffffff19821660208201526109328482610ad1565b50505050565b60008061094483610aa1565b519392505050565b600061095784610aa1565b805164ffffffffff9081166000908152600180880160209081526040909220879055835101909116825264ffffffffff1984169082015290506109328482610ad1565b60006109a583610aa1565b64ffffffffff198316602082015290506109bf8382610ad1565b505050565b60006109cf83610aa1565b90506109bf828260200151856108a69092919063ffffffff16565b6000806109f684610aa1565b805190915064ffffffffff168310610a4c576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b50506000908152600191909101602052604090205490565b6000610a6f83610aa1565b90506109bf8282602001518561094c9092919063ffffffff16565b600080610a9683610aa1565b602001519392505050565b610aa9610af1565b50546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b8051602082015183548183179291908314610aea578285555b5050505050565b60408051808201909152600080825260208201529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122038869143d4598418a0ef5faf124214a16dc032f21ac35b7170b13b796c6eb00464736f6c63430007060033", "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 distinct 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", @@ -316,9 +303,6 @@ }, "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 @@ -326,15 +310,15 @@ "storageLayout": { "storage": [ { - "astId": 12055, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12048" + "type": "t_contract(Lib_AddressManager)15296" }, { - "astId": 3712, + "astId": 5963, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "owner", "offset": 0, @@ -342,12 +326,12 @@ "type": "t_string_storage" }, { - "astId": 3714, + "astId": 5965, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "buffer", "offset": 0, "slot": "2", - "type": "t_struct(RingBuffer)17101_storage" + "type": "t_struct(Buffer)18996_storage" } ], "types": { @@ -356,7 +340,7 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(Lib_AddressManager)12048": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" @@ -373,20 +357,20 @@ "label": "string", "numberOfBytes": "32" }, - "t_struct(Buffer)17090_storage": { + "t_struct(Buffer)18996_storage": { "encoding": "inplace", - "label": "struct Lib_RingBuffer.Buffer", + "label": "struct Lib_Buffer.Buffer", "members": [ { - "astId": 17085, + "astId": 18991, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "length", + "label": "context", "offset": 0, "slot": "0", - "type": "t_uint256" + "type": "t_bytes32" }, { - "astId": 17089, + "astId": 18995, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "buf", "offset": 0, @@ -396,53 +380,6 @@ ], "numberOfBytes": "64" }, - "t_struct(RingBuffer)17101_storage": { - "encoding": "inplace", - "label": "struct Lib_RingBuffer.RingBuffer", - "members": [ - { - "astId": 17092, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "contextA", - "offset": 0, - "slot": "0", - "type": "t_bytes32" - }, - { - "astId": 17094, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "contextB", - "offset": 0, - "slot": "1", - "type": "t_bytes32" - }, - { - "astId": 17096, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "bufferA", - "offset": 0, - "slot": "2", - "type": "t_struct(Buffer)17090_storage" - }, - { - "astId": 17098, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "bufferB", - "offset": 0, - "slot": "4", - "type": "t_struct(Buffer)17090_storage" - }, - { - "astId": 17100, - "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", diff --git a/packages/contracts/deployments/goerli/OVM_ChainStorageContainer-SCC-batches.json b/packages/contracts/deployments/goerli/OVM_ChainStorageContainer-SCC-batches.json index 2920cf0e81d5..5b30e006c84b 100644 --- a/packages/contracts/deployments/goerli/OVM_ChainStorageContainer-SCC-batches.json +++ b/packages/contracts/deployments/goerli/OVM_ChainStorageContainer-SCC-batches.json @@ -1,5 +1,5 @@ { - "address": "0x2A622E327D7A204b39355202d41BD9B752C8df54", + "address": "0x777adA49d40DAC02AE5b4FdC292feDf9066435A3", "abi": [ { "inputs": [ @@ -181,45 +181,32 @@ "outputs": [], "stateMutability": "nonpayable", "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "setNextOverwritableIndex", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" } ], - "transactionHash": "0x60b610c9b4ebbbbfb38e22d209b0d25a52527cb323941014114a4a2c362e2863", + "transactionHash": "0x609ff6d4e27a0f2ceb06349f35fa0e9020d04490a13a0f12a9099c5b0a4a13f6", "receipt": { "to": null, - "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", - "contractAddress": "0x2A622E327D7A204b39355202d41BD9B752C8df54", - "transactionIndex": 3, - "gasUsed": "970930", + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0x777adA49d40DAC02AE5b4FdC292feDf9066435A3", + "transactionIndex": 84, + "gasUsed": "742245", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xa654708146fc0e44c144ff624caea84d6cf5519c3421882cacb260ca6823123b", - "transactionHash": "0x60b610c9b4ebbbbfb38e22d209b0d25a52527cb323941014114a4a2c362e2863", + "blockHash": "0xd1763a06f8c5740be6ff3f7187ba416f44955c9a8a930e156988e57ba9b727bb", + "transactionHash": "0x609ff6d4e27a0f2ceb06349f35fa0e9020d04490a13a0f12a9099c5b0a4a13f6", "logs": [], - "blockNumber": 4694097, - "cumulativeGasUsed": "1184521", + "blockNumber": 4974816, + "cumulativeGasUsed": "10219612", "status": 1, "byzantium": true }, "args": [ - "0xE3d08F0D900A2D53cB794cf82d7127764BcC3092", + "0xA4346c8c120DdCE2c5447e68790625F10Bb4d47A", "OVM_StateCommitmentChain" ], - "solcInputHash": "dde656dd41f49cad9eac9bc7065fd6a7", - "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\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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 distinct 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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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).\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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 distinct 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 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 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\":\"0x93325c961516aa2a22bf1aacf4029353d5e3b693e04b485753170337b50224e6\",\"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 * 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\":\"0x2d7973a0ad84c23ec62624d3f1e3aeb198cc72686ff1e6cfa17155556b320c94\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x2ce671a0e004df88b136bea5a3c59d0732cea8887c8496da1d509e0200b03d7d\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 * 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 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 {\\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\":\"0xe30fc56d4499f98582e1f800dfa3b343f171163a557266c31a56449d5fd3ffae\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506040516200118d3803806200118d833981810160405260408110156200003757600080fd5b8151602083018051604051929492938301929190846401000000008211156200005f57600080fd5b9083019060208201858111156200007557600080fd5b82516401000000008111828201881017156200009057600080fd5b82525081516020918201929091019080838360005b83811015620000bf578181015183820152602001620000a5565b50505050905090810190601f168015620000ed5780820380516001836020036101000a031916815260200191505b506040525050600080546001600160a01b0319166001600160a01b038516179055508051620001249060019060208401906200012d565b505050620001d9565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282620001655760008555620001b0565b82601f106200018057805160ff1916838001178555620001b0565b82800160010185558215620001b0579182015b82811115620001b057825182559160200191906001019062000193565b50620001be929150620001c2565b5090565b5b80821115620001be5760008155600101620001c3565b610fa480620001e96000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80634651d91e116100715780634651d91e1461021a5780638da5cb5b146102375780639507d39a146102b4578063b298e36b146102d1578063ccf8f969146102ee578063fa9e936c14610311576100b4565b8063167fd681146100b95780631f7b6d32146100e65780632015276c1461010057806329061de21461012b578063299ca47814610150578063461a447814610174575b600080fd5b6100e4600480360360408110156100cf57600080fd5b508035906020013564ffffffffff191661032e565b005b6100ee610423565b60408051918252519081900360200190f35b6100e46004803603604081101561011657600080fd5b508035906020013564ffffffffff191661043b565b6100e46004803603602081101561014157600080fd5b503564ffffffffff19166104f7565b6101586105b5565b604080516001600160a01b039092168252519081900360200190f35b6101586004803603602081101561018a57600080fd5b8101906020810181356401000000008111156101a557600080fd5b8201836020820111156101b757600080fd5b803590602001918460018302840111640100000000831117156101d957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105c4945050505050565b6100e46004803603602081101561023057600080fd5b50356106a0565b61023f61075b565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610279578181015183820152602001610261565b50505050905090810190601f1680156102a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100ee600480360360208110156102ca57600080fd5b50356107e8565b6100e4600480360360208110156102e757600080fd5b5035610802565b6102f66108bd565b6040805164ffffffffff199092168252519081900360200190f35b6100e46004803603602081101561032757600080fd5b50356108ce565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526103c493909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b820191906000526020600020905b81548152906001019060200180831161039d57829003601f168201915b50505050506105c4565b6001600160a01b0316336001600160a01b0316146104135760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610983565b5050565b600061042f6002610a75565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261049c93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146104eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610a89565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261055893909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146105a75760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610b90565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561062457818101518382015260200161060c565b50505050905090810190601f1680156106515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561066e57600080fd5b505afa158015610682573d6000803e3d6000fd5b505050506040513d602081101561069857600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261070193909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146107505760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610bba565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107e05780601f106107b5576101008083540402835291602001916107e0565b820191906000526020600020905b8154815290600101906020018083116107c357829003601f168201915b505050505081565b60006107fc600264ffffffffff8416610be0565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261086393909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146108b25760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610de9565b60006108c96002610e0f565b905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261092f93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b03161461097e5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b600855565b600061098e84610e26565b9050806000015164ffffffffff168364ffffffffff161080156109c35750806060015164ffffffffff168364ffffffffff1610155b610a0b576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b806080015164ffffffffff168364ffffffffff161015610a4d576040810180516000190167ffffffffffffffff169052606081015164ffffffffff1660808201525b64ffffffffff8316815264ffffffffff1982166020820152610a6f8482610e86565b50505050565b600080610a8183610e26565b519392505050565b6000610a9484610e26565b90506000610ab9826040015167ffffffffffffffff1686610edc90919063ffffffff16565b8054909150610ac757601081555b8054608083015183510364ffffffffff1610610b3e578460060154826080015164ffffffffff161015610b365760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610b2f908690610edc565b9050610b3e565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610b888684610e86565b505050505050565b6000610b9b83610e26565b64ffffffffff19831660208201529050610bb58382610e86565b505050565b6000610bc583610e26565b9050610bb5828260200151856109839092919063ffffffff16565b600080610bec84610e26565b805190915064ffffffffff168310610c42576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c65826040015167ffffffffffffffff1686610edc90919063ffffffff16565b90506000610c8d836040015160010167ffffffffffffffff1687610edc90919063ffffffff16565b9050826080015164ffffffffff168510610d1a576080830151825464ffffffffff9091168603908110610cfe576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506107fc9050565b6080830151606084015164ffffffffff9182168781039290911610610d7d576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610dca576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b81540360009081526001909101602052604090205492506107fc915050565b6000610df483610e26565b9050610bb582826020015185610a899092919063ffffffff16565b600080610e1b83610e26565b602001519392505050565b610e2e610efc565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b80516020820151604080840151606085015160808601518754858717969483901b8417606883901b1795939291908714610ebe578689555b85896001015414610ed157600189018690555b505050505050505050565b60006002820615610ef05782600401610ef5565b826002015b9392505050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea2646970667358221220376cbc00341dd082d644157f6511fcd1ac26a6a924d04ae6532cfcab93d9191864736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80634651d91e116100715780634651d91e1461021a5780638da5cb5b146102375780639507d39a146102b4578063b298e36b146102d1578063ccf8f969146102ee578063fa9e936c14610311576100b4565b8063167fd681146100b95780631f7b6d32146100e65780632015276c1461010057806329061de21461012b578063299ca47814610150578063461a447814610174575b600080fd5b6100e4600480360360408110156100cf57600080fd5b508035906020013564ffffffffff191661032e565b005b6100ee610423565b60408051918252519081900360200190f35b6100e46004803603604081101561011657600080fd5b508035906020013564ffffffffff191661043b565b6100e46004803603602081101561014157600080fd5b503564ffffffffff19166104f7565b6101586105b5565b604080516001600160a01b039092168252519081900360200190f35b6101586004803603602081101561018a57600080fd5b8101906020810181356401000000008111156101a557600080fd5b8201836020820111156101b757600080fd5b803590602001918460018302840111640100000000831117156101d957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105c4945050505050565b6100e46004803603602081101561023057600080fd5b50356106a0565b61023f61075b565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610279578181015183820152602001610261565b50505050905090810190601f1680156102a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100ee600480360360208110156102ca57600080fd5b50356107e8565b6100e4600480360360208110156102e757600080fd5b5035610802565b6102f66108bd565b6040805164ffffffffff199092168252519081900360200190f35b6100e46004803603602081101561032757600080fd5b50356108ce565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526103c493909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b820191906000526020600020905b81548152906001019060200180831161039d57829003601f168201915b50505050506105c4565b6001600160a01b0316336001600160a01b0316146104135760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610983565b5050565b600061042f6002610a75565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261049c93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146104eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610a89565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261055893909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146105a75760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610b90565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561062457818101518382015260200161060c565b50505050905090810190601f1680156106515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561066e57600080fd5b505afa158015610682573d6000803e3d6000fd5b505050506040513d602081101561069857600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261070193909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146107505760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610bba565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107e05780601f106107b5576101008083540402835291602001916107e0565b820191906000526020600020905b8154815290600101906020018083116107c357829003601f168201915b505050505081565b60006107fc600264ffffffffff8416610be0565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261086393909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146108b25760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610de9565b60006108c96002610e0f565b905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261092f93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b03161461097e5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b600855565b600061098e84610e26565b9050806000015164ffffffffff168364ffffffffff161080156109c35750806060015164ffffffffff168364ffffffffff1610155b610a0b576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b806080015164ffffffffff168364ffffffffff161015610a4d576040810180516000190167ffffffffffffffff169052606081015164ffffffffff1660808201525b64ffffffffff8316815264ffffffffff1982166020820152610a6f8482610e86565b50505050565b600080610a8183610e26565b519392505050565b6000610a9484610e26565b90506000610ab9826040015167ffffffffffffffff1686610edc90919063ffffffff16565b8054909150610ac757601081555b8054608083015183510364ffffffffff1610610b3e578460060154826080015164ffffffffff161015610b365760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610b2f908690610edc565b9050610b3e565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610b888684610e86565b505050505050565b6000610b9b83610e26565b64ffffffffff19831660208201529050610bb58382610e86565b505050565b6000610bc583610e26565b9050610bb5828260200151856109839092919063ffffffff16565b600080610bec84610e26565b805190915064ffffffffff168310610c42576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c65826040015167ffffffffffffffff1686610edc90919063ffffffff16565b90506000610c8d836040015160010167ffffffffffffffff1687610edc90919063ffffffff16565b9050826080015164ffffffffff168510610d1a576080830151825464ffffffffff9091168603908110610cfe576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506107fc9050565b6080830151606084015164ffffffffff9182168781039290911610610d7d576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610dca576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b81540360009081526001909101602052604090205492506107fc915050565b6000610df483610e26565b9050610bb582826020015185610a899092919063ffffffff16565b600080610e1b83610e26565b602001519392505050565b610e2e610efc565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b80516020820151604080840151606085015160808601518754858717969483901b8417606883901b1795939291908714610ebe578689555b85896001015414610ed157600189018690555b505050505050505050565b60006002820615610ef05782600401610ef5565b826002015b9392505050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea2646970667358221220376cbc00341dd082d644157f6511fcd1ac26a6a924d04ae6532cfcab93d9191864736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"setGlobalMetadata\",\"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 distinct 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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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).\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"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.\"}},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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_Buffer } from \\\"../../libraries/utils/Lib_Buffer.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 distinct 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_Buffer for Lib_Buffer.Buffer;\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n string public owner;\\n Lib_Buffer.Buffer 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 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 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\",\"keccak256\":\"0xace1f7a38106e7e95084ca6b39ea9e706cd561fb37c595afa362bb2a39a676ff\",\"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 * 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\",\"keccak256\":\"0x180b9c347e20f1a6efa553b0f2b9a59aebceda92a7484ae6fca4da2bf1d960c3\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Buffer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Buffer\\n * @dev This library implements a bytes32 storage array with some additional gas-optimized\\n * functionality. In particular, it encodes its length as a uint40, and tightly packs this with an\\n * overwritable \\\"extra data\\\" field so we can store more information with a single SSTORE.\\n */\\nlibrary Lib_Buffer {\\n\\n /*************\\n * Libraries *\\n *************/\\n\\n using Lib_Buffer for Buffer;\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Buffer {\\n bytes32 context;\\n mapping (uint256 => bytes32) buf;\\n }\\n\\n struct BufferContext {\\n // Stores the length of the array. Uint40 is way more elements than we'll ever reasonably\\n // need in an array and we get an extra 27 bytes of extra data to play with.\\n uint40 length;\\n\\n // Arbitrary extra data that can be modified whenever the length is updated. Useful for\\n // squeezing out some gas optimizations.\\n bytes27 extraData;\\n }\\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 Global extra data.\\n */\\n function push(\\n Buffer storage _self,\\n bytes32 _value,\\n bytes27 _extraData\\n )\\n internal\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n _self.buf[ctx.length] = _value;\\n\\n // Bump the global index and insert our extra data, then save the context.\\n ctx.length++;\\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 Buffer storage _self,\\n bytes32 _value\\n )\\n internal\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n _self.push(\\n _value,\\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 Buffer storage _self,\\n uint256 _index\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n return _self.buf[_index];\\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 Buffer storage _self,\\n uint40 _index,\\n bytes27 _extraData\\n )\\n internal\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n // Set our length and extra data, save the context.\\n ctx.length = _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 Buffer storage _self,\\n uint40 _index\\n )\\n internal\\n {\\n BufferContext 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 Buffer storage _self\\n )\\n internal\\n view\\n returns (\\n uint40\\n )\\n {\\n BufferContext memory ctx = _self.getContext();\\n return ctx.length;\\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 Buffer storage _self,\\n bytes27 _extraData\\n )\\n internal\\n {\\n BufferContext 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 Buffer storage _self\\n )\\n internal\\n view\\n returns (\\n bytes27\\n )\\n {\\n BufferContext memory ctx = _self.getContext();\\n return ctx.extraData;\\n }\\n\\n /**\\n * Sets the current buffer context.\\n * @param _self Buffer to access.\\n * @param _ctx Current buffer context.\\n */\\n function setContext(\\n Buffer storage _self,\\n BufferContext memory _ctx\\n )\\n internal\\n {\\n bytes32 context;\\n uint40 length = _ctx.length;\\n bytes27 extraData = _ctx.extraData;\\n assembly {\\n context := length\\n context := or(context, extraData)\\n }\\n\\n if (_self.context != context) {\\n _self.context = context;\\n }\\n }\\n\\n /**\\n * Retrieves the current buffer context.\\n * @param _self Buffer to access.\\n * @return Current buffer context.\\n */\\n function getContext(\\n Buffer storage _self\\n )\\n internal\\n view\\n returns (\\n BufferContext memory\\n )\\n {\\n bytes32 context = _self.context;\\n uint40 length;\\n bytes27 extraData;\\n assembly {\\n length := and(context, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\\n extraData := and(context, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000)\\n }\\n\\n return BufferContext({\\n length: length,\\n extraData: extraData\\n });\\n }\\n}\\n\",\"keccak256\":\"0xbce4f4db3d80b2cb252177752eee1ca38482731d1e2e5d165c7fce2e04c487fb\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405162000d5538038062000d558339818101604052604081101561003557600080fd5b81516020830180516040519294929383019291908464010000000082111561005c57600080fd5b90830190602082018581111561007157600080fd5b825164010000000081118282018810171561008b57600080fd5b82525081516020918201929091019080838360005b838110156100b85781810151838201526020016100a0565b50505050905090810190601f1680156100e55780820380516001836020036101000a031916815260200191505b506040525050600080546001600160a01b0319166001600160a01b03851617905550805161011a906001906020840190610122565b5050506101c3565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282610158576000855561019e565b82601f1061017157805160ff191683800117855561019e565b8280016001018555821561019e579182015b8281111561019e578251825591602001919060010190610183565b506101aa9291506101ae565b5090565b5b808211156101aa57600081556001016101af565b610b8280620001d36000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c8063461a447811610071578063461a4478146101695780634651d91e1461020f5780638da5cb5b1461022c5780639507d39a146102a9578063b298e36b146102c6578063ccf8f969146102e3576100a9565b8063167fd681146100ae5780631f7b6d32146100db5780632015276c146100f557806329061de214610120578063299ca47814610145575b600080fd5b6100d9600480360360408110156100c457600080fd5b508035906020013564ffffffffff1916610306565b005b6100e36103fb565b60408051918252519081900360200190f35b6100d96004803603604081101561010b57600080fd5b508035906020013564ffffffffff1916610413565b6100d96004803603602081101561013657600080fd5b503564ffffffffff19166104cf565b61014d61058d565b604080516001600160a01b039092168252519081900360200190f35b61014d6004803603602081101561017f57600080fd5b81019060208101813564010000000081111561019a57600080fd5b8201836020820111156101ac57600080fd5b803590602001918460018302840111640100000000831117156101ce57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061059c945050505050565b6100d96004803603602081101561022557600080fd5b5035610678565b610234610733565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561026e578181015183820152602001610256565b50505050905090810190601f16801561029b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100e3600480360360208110156102bf57600080fd5b50356107c0565b6100d9600480360360208110156102dc57600080fd5b50356107da565b6102eb610895565b6040805164ffffffffff199092168252519081900360200190f35b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261039c93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b820191906000526020600020905b81548152906001019060200180831161037557829003601f168201915b505050505061059c565b6001600160a01b0316336001600160a01b0316146103eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f7600283836108a6565b5050565b60006104076002610938565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261047493909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146104c35760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f76002838361094c565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261053093909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461057f5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a60028261099a565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156105fc5781810151838201526020016105e4565b50505050905090810190601f1680156106295780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561064657600080fd5b505afa15801561065a573d6000803e3d6000fd5b505050506040513d602081101561067057600080fd5b505192915050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526106d993909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146107285760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a6002826109c4565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107b85780601f1061078d576101008083540402835291602001916107b8565b820191906000526020600020905b81548152906001019060200180831161079b57829003601f168201915b505050505081565b60006107d4600264ffffffffff84166109ea565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261083b93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461088a5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a600282610a64565b60006108a16002610a8a565b905090565b60006108b184610aa1565b9050806000015164ffffffffff168364ffffffffff1610610910576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b64ffffffffff8316815264ffffffffff19821660208201526109328482610ad1565b50505050565b60008061094483610aa1565b519392505050565b600061095784610aa1565b805164ffffffffff9081166000908152600180880160209081526040909220879055835101909116825264ffffffffff1984169082015290506109328482610ad1565b60006109a583610aa1565b64ffffffffff198316602082015290506109bf8382610ad1565b505050565b60006109cf83610aa1565b90506109bf828260200151856108a69092919063ffffffff16565b6000806109f684610aa1565b805190915064ffffffffff168310610a4c576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b50506000908152600191909101602052604090205490565b6000610a6f83610aa1565b90506109bf8282602001518561094c9092919063ffffffff16565b600080610a9683610aa1565b602001519392505050565b610aa9610af1565b50546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b8051602082015183548183179291908314610aea578285555b5050505050565b60408051808201909152600080825260208201529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122038869143d4598418a0ef5faf124214a16dc032f21ac35b7170b13b796c6eb00464736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c8063461a447811610071578063461a4478146101695780634651d91e1461020f5780638da5cb5b1461022c5780639507d39a146102a9578063b298e36b146102c6578063ccf8f969146102e3576100a9565b8063167fd681146100ae5780631f7b6d32146100db5780632015276c146100f557806329061de214610120578063299ca47814610145575b600080fd5b6100d9600480360360408110156100c457600080fd5b508035906020013564ffffffffff1916610306565b005b6100e36103fb565b60408051918252519081900360200190f35b6100d96004803603604081101561010b57600080fd5b508035906020013564ffffffffff1916610413565b6100d96004803603602081101561013657600080fd5b503564ffffffffff19166104cf565b61014d61058d565b604080516001600160a01b039092168252519081900360200190f35b61014d6004803603602081101561017f57600080fd5b81019060208101813564010000000081111561019a57600080fd5b8201836020820111156101ac57600080fd5b803590602001918460018302840111640100000000831117156101ce57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061059c945050505050565b6100d96004803603602081101561022557600080fd5b5035610678565b610234610733565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561026e578181015183820152602001610256565b50505050905090810190601f16801561029b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100e3600480360360208110156102bf57600080fd5b50356107c0565b6100d9600480360360208110156102dc57600080fd5b50356107da565b6102eb610895565b6040805164ffffffffff199092168252519081900360200190f35b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261039c93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b820191906000526020600020905b81548152906001019060200180831161037557829003601f168201915b505050505061059c565b6001600160a01b0316336001600160a01b0316146103eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f7600283836108a6565b5050565b60006104076002610938565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261047493909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146104c35760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f76002838361094c565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261053093909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461057f5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a60028261099a565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156105fc5781810151838201526020016105e4565b50505050905090810190601f1680156106295780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561064657600080fd5b505afa15801561065a573d6000803e3d6000fd5b505050506040513d602081101561067057600080fd5b505192915050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526106d993909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146107285760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a6002826109c4565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107b85780601f1061078d576101008083540402835291602001916107b8565b820191906000526020600020905b81548152906001019060200180831161079b57829003601f168201915b505050505081565b60006107d4600264ffffffffff84166109ea565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261083b93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461088a5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a600282610a64565b60006108a16002610a8a565b905090565b60006108b184610aa1565b9050806000015164ffffffffff168364ffffffffff1610610910576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b64ffffffffff8316815264ffffffffff19821660208201526109328482610ad1565b50505050565b60008061094483610aa1565b519392505050565b600061095784610aa1565b805164ffffffffff9081166000908152600180880160209081526040909220879055835101909116825264ffffffffff1984169082015290506109328482610ad1565b60006109a583610aa1565b64ffffffffff198316602082015290506109bf8382610ad1565b505050565b60006109cf83610aa1565b90506109bf828260200151856108a69092919063ffffffff16565b6000806109f684610aa1565b805190915064ffffffffff168310610a4c576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b50506000908152600191909101602052604090205490565b6000610a6f83610aa1565b90506109bf8282602001518561094c9092919063ffffffff16565b600080610a9683610aa1565b602001519392505050565b610aa9610af1565b50546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b8051602082015183548183179291908314610aea578285555b5050505050565b60408051808201909152600080825260208201529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122038869143d4598418a0ef5faf124214a16dc032f21ac35b7170b13b796c6eb00464736f6c63430007060033", "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 distinct 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", @@ -316,9 +303,6 @@ }, "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 @@ -326,15 +310,15 @@ "storageLayout": { "storage": [ { - "astId": 12055, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12048" + "type": "t_contract(Lib_AddressManager)15296" }, { - "astId": 3712, + "astId": 5963, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "owner", "offset": 0, @@ -342,12 +326,12 @@ "type": "t_string_storage" }, { - "astId": 3714, + "astId": 5965, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "buffer", "offset": 0, "slot": "2", - "type": "t_struct(RingBuffer)17101_storage" + "type": "t_struct(Buffer)18996_storage" } ], "types": { @@ -356,7 +340,7 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(Lib_AddressManager)12048": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" @@ -373,20 +357,20 @@ "label": "string", "numberOfBytes": "32" }, - "t_struct(Buffer)17090_storage": { + "t_struct(Buffer)18996_storage": { "encoding": "inplace", - "label": "struct Lib_RingBuffer.Buffer", + "label": "struct Lib_Buffer.Buffer", "members": [ { - "astId": 17085, + "astId": 18991, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "length", + "label": "context", "offset": 0, "slot": "0", - "type": "t_uint256" + "type": "t_bytes32" }, { - "astId": 17089, + "astId": 18995, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "buf", "offset": 0, @@ -396,53 +380,6 @@ ], "numberOfBytes": "64" }, - "t_struct(RingBuffer)17101_storage": { - "encoding": "inplace", - "label": "struct Lib_RingBuffer.RingBuffer", - "members": [ - { - "astId": 17092, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "contextA", - "offset": 0, - "slot": "0", - "type": "t_bytes32" - }, - { - "astId": 17094, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "contextB", - "offset": 0, - "slot": "1", - "type": "t_bytes32" - }, - { - "astId": 17096, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "bufferA", - "offset": 0, - "slot": "2", - "type": "t_struct(Buffer)17090_storage" - }, - { - "astId": 17098, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "bufferB", - "offset": 0, - "slot": "4", - "type": "t_struct(Buffer)17090_storage" - }, - { - "astId": 17100, - "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", diff --git a/packages/contracts/deployments/goerli/OVM_ExecutionManager.json b/packages/contracts/deployments/goerli/OVM_ExecutionManager.json index ede173c71acb..e9a006eb2fb0 100644 --- a/packages/contracts/deployments/goerli/OVM_ExecutionManager.json +++ b/packages/contracts/deployments/goerli/OVM_ExecutionManager.json @@ -1,5 +1,5 @@ { - "address": "0x45B459295d6b08D7dA3B9daae541D5F75E1CF818", + "address": "0x838a74bAdfD28Fd0e32E4A88BddDa502D56ae7F7", "abi": [ { "inputs": [ @@ -51,6 +51,19 @@ "stateMutability": "nonpayable", "type": "constructor" }, + { + "inputs": [], + "name": "CALL_WITH_VALUE_INTRINSIC_GAS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "getMaxTransactionGasLimit", @@ -90,6 +103,64 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contract", + "type": "address" + } + ], + "name": "ovmBALANCE", + "outputs": [ + { + "internalType": "uint256", + "name": "_BALANCE", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_gasLimit", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_address", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + }, + { + "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": [ { @@ -137,6 +208,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "ovmCALLVALUE", + "outputs": [ + { + "internalType": "uint256", + "name": "_CALLVALUE", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "ovmCHAINID", @@ -417,6 +501,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "ovmSELFBALANCE", + "outputs": [ + { + "internalType": "uint256", + "name": "_BALANCE", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -583,11 +680,6 @@ }, { "inputs": [ - { - "internalType": "uint256", - "name": "_gasLimit", - "type": "uint256" - }, { "internalType": "bytes", "name": "_creationCode", @@ -653,6 +745,11 @@ "name": "_from", "type": "address" }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + }, { "internalType": "contract iOVM_StateManager", "name": "_ovmStateManager", @@ -661,11 +758,6 @@ ], "name": "simulateMessage", "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - }, { "internalType": "bytes", "name": "", @@ -676,27 +768,27 @@ "type": "function" } ], - "transactionHash": "0xcda10869e171175332a8b2722029f315fe9742242599f6884958af3273c49fa0", + "transactionHash": "0x681651d6045291e3a9732dc48cdeb3e62b10e46324d39124a028ad0dc21a4716", "receipt": { "to": null, - "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", - "contractAddress": "0x45B459295d6b08D7dA3B9daae541D5F75E1CF818", - "transactionIndex": 2, - "gasUsed": "2937053", + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0x838a74bAdfD28Fd0e32E4A88BddDa502D56ae7F7", + "transactionIndex": 5, + "gasUsed": "3122036", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x35f0b7509eaacd23e211fd8242c268f94c1ab83a2e08567e65d82911da0364c4", - "transactionHash": "0xcda10869e171175332a8b2722029f315fe9742242599f6884958af3273c49fa0", + "blockHash": "0xf5479e3a73f1df70aba834b133a4ce5162a3bcc224adbb1cb6079d4b8d2249b1", + "transactionHash": "0x681651d6045291e3a9732dc48cdeb3e62b10e46324d39124a028ad0dc21a4716", "logs": [], - "blockNumber": 4694112, - "cumulativeGasUsed": "3078528", + "blockNumber": 4974839, + "cumulativeGasUsed": "3427977", "status": 1, "byzantium": true }, "args": [ - "0xE3d08F0D900A2D53cB794cf82d7127764BcC3092", + "0xA4346c8c120DdCE2c5447e68790625F10Bb4d47A", { "minTransactionGasLimit": 50000, - "maxTransactionGasLimit": 9000000, + "maxTransactionGasLimit": 11000000, "maxGasPerQueuePerEpoch": 250000000, "secondsPerEpoch": 0 }, @@ -704,10 +796,10 @@ "ovmCHAINID": 420 } ], - "solcInputHash": "dde656dd41f49cad9eac9bc7065fd6a7", - "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\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_bytecode\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"ovmCREATE2\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"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\":\"ovmINCREMENTNONCE\",\"outputs\":[],\"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\":\"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\":\"\",\"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\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_creationCode\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"}],\"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\":{\"_0\":\"Address of the created contract.\",\"_1\":\"Revert data, if and only if the creation threw an exception.\"}},\"ovmCREATE2(bytes,bytes32)\":{\"params\":{\"_bytecode\":\"Code to be used to CREATE2 a new contract.\",\"_salt\":\"Value used to determine the contract's address.\"},\"returns\":{\"_0\":\"Address of the created contract.\",\"_1\":\"Revert data, if and only if the creation threw an exception.\"}},\"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\":\"Enum indicating 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.\"}},\"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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"run((uint256,uint256,uint8,address,address,uint256,bytes),address)\":{\"params\":{\"_ovmStateManager\":\"iOVM_StateManager implementation providing account state.\",\"_transaction\":\"Transaction data to be executed.\"}},\"safeCREATE(uint256,bytes,address)\":{\"params\":{\"_address\":\"OVM address being deployed to.\",\"_creationCode\":\"Code to pass into CREATE for deployment.\",\"_gasLimit\":\"Amount of gas to be passed into this creation.\"}},\"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.\"},\"ovmINCREMENTNONCE()\":{\"notice\":\"Bumps the nonce of the current ovmADDRESS by one.\"},\"ovmL1QUEUEORIGIN()\":{\"notice\":\"Specifies from which source (Sequencer or 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.\"},\"ovmSLOAD(bytes32)\":{\"notice\":\"Overrides SLOAD.\"},\"ovmSSTORE(bytes32,bytes32)\":{\"notice\":\"Overrides SSTORE.\"},\"ovmSTATICCALL(uint256,address,bytes)\":{\"notice\":\"Overrides STATICCALL.\"},\"ovmTIMESTAMP()\":{\"notice\":\"Overrides TIMESTAMP.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"run((uint256,uint256,uint8,address,address,uint256,bytes),address)\":{\"notice\":\"Starts the execution of a transaction via the OVM_ExecutionManager.\"},\"safeCREATE(uint256,bytes,address)\":{\"notice\":\"Handles the creation-specific safety measures required for OVM contract deployment. This function sanitizes the return types for creation messages to match calls (bool, bytes), by being an external function which the EM can call, that mimics the success/fail case of the CREATE. This allows for consistent handling of both types of messages in _handleExternalMessage(). Having this step occur as a separate call frame also allows us to easily revert the contract deployment in the event that the code is unsafe.\"},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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\\\";\\nimport { Lib_ErrorUtils } from \\\"../../libraries/utils/Lib_ErrorUtils.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_DeployerWhitelist } from \\\"../predeploys/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 * Default Context Values *\\n **************************/\\n\\n uint256 constant DEFAULT_UINT256 = 0xdefa017defa017defa017defa017defa017defa017defa017defa017defa017d;\\n address constant DEFAULT_ADDRESS = 0xdEfa017defA017DeFA017DEfa017DeFA017DeFa0;\\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 Lib_AddressResolver(_libAddressManager)\\n {\\n ovmSafetyChecker = iOVM_SafetyChecker(resolve(\\\"OVM_SafetyChecker\\\"));\\n gasMeterConfig = _gasMeterConfig;\\n globalContext = _globalContext;\\n _resetContext();\\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 returns (\\n bytes memory\\n )\\n {\\n // Make sure that run() is not re-enterable. This condition should always be satisfied\\n // Once run has been called once, due to the behavior of _isValidInput().\\n if (transactionContext.ovmNUMBER != DEFAULT_UINT256) {\\n return bytes(\\\"\\\");\\n }\\n\\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 (_isValidInput(_transaction) == false) {\\n _resetContext();\\n return bytes(\\\"\\\");\\n }\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\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 (, bytes memory returndata) = ovmCALL(\\n _transaction.gasLimit - gasMeterConfig.minTransactionGasLimit,\\n _transaction.entrypoint,\\n _transaction.data\\n );\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\n // // Update the cumulative gas based on the amount of gas used.\\n // uint256 gasUsed = gasProvided - gasleft();\\n // _updateCumulativeGas(gasUsed, _transaction.l1QueueOrigin);\\n\\n // Wipe the execution context.\\n _resetContext();\\n\\n return returndata;\\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 source (Sequencer or Queue) this transaction originated from.\\n * @return _queueOrigin Enum indicating 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 Address of the created contract.\\n * @return Revert data, if and only if the creation threw an exception.\\n */\\n function ovmCREATE(\\n bytes memory _bytecode\\n )\\n override\\n public\\n notStatic\\n fixedGasDiscount(40000)\\n returns (\\n address,\\n bytes memory\\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 Address of the created contract.\\n * @return Revert data, if and only if the creation threw an exception.\\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,\\n bytes memory\\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 * Bumps the nonce of the current ovmADDRESS by one.\\n */\\n function ovmINCREMENTNONCE()\\n override\\n public\\n notStatic\\n {\\n address account = ovmADDRESS();\\n uint256 nonce = _getAccountNonce(account);\\n\\n // Prevent overflow.\\n if (nonce + 1 > nonce) {\\n _setAccountNonce(account, nonce + 1);\\n }\\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 // Creates a duplicate of the OVM_ProxyEOA located at 0x42....09. Uses the following\\n // \\\"magic\\\" prefix to deploy an exact copy of the code:\\n // PUSH1 0x0D # size of this prefix in bytes\\n // CODESIZE\\n // SUB # subtract prefix size from codesize\\n // DUP1\\n // PUSH1 0x0D\\n // PUSH1 0x00\\n // CODECOPY # copy everything after prefix into memory at pos 0\\n // PUSH1 0x00\\n // RETURN # return the copied code\\n address proxyEOA = Lib_EthUtils.createContract(abi.encodePacked(\\n hex\\\"600D380380600D6000396000f3\\\",\\n ovmEXTCODECOPY(\\n 0x4200000000000000000000000000000000000009,\\n 0,\\n ovmEXTCODESIZE(0x4200000000000000000000000000000000000009)\\n )\\n ));\\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\\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 * 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 Whitelisting *\\n ********************************************/\\n\\n /**\\n * Checks whether the given address is on the whitelist 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 semantics perspective, this will appear 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 Final OVM contract address.\\n * @return Revertdata, if and only if the creation threw an exception.\\n */\\n function _createContract(\\n address _contractAddress,\\n bytes memory _bytecode\\n )\\n internal\\n returns (\\n address,\\n bytes memory\\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 the common logic which occurs between call-type and create-type messages,\\n // passing in the creation bytecode and `true` to trigger create-specific logic.\\n (bool success, bytes memory data) = _handleExternalMessage(\\n nextMessageContext,\\n gasleft(),\\n _contractAddress,\\n _bytecode,\\n true\\n );\\n\\n // Yellow paper requires that address returned is zero if the contract deployment fails.\\n return (\\n success ? _contractAddress : address(0),\\n data\\n );\\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 // EVM does not return data in the success case, see: https://github.com/ethereum/go-ethereum/blob/aae7660410f0ef90279e14afaaf2f429fdc2a186/core/vm/instructions.go#L600-L604\\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 _handleExternalMessage(\\n _nextMessageContext,\\n _gasLimit,\\n codeContractAddress,\\n _calldata,\\n false\\n );\\n }\\n\\n /**\\n * Handles all interactions which involve the execution manager calling out to untrusted code (both calls and creates).\\n * Ensures that OVM-related measures are enforced, including L2 gas refunds, nuisance gas, and flagged reversions.\\n *\\n * @param _nextMessageContext Message context to be used for the external message.\\n * @param _gasLimit Amount of gas to be passed into this message.\\n * @param _contract OVM address being called or deployed to\\n * @param _data Data for the message (either calldata or creation code)\\n * @param _isCreate Whether this is a create-type message.\\n * @return Whether or not the message (either a call or deployment) succeeded.\\n * @return Data returned by the message.\\n */\\n function _handleExternalMessage(\\n MessageContext memory _nextMessageContext,\\n uint256 _gasLimit,\\n address _contract,\\n bytes memory _data,\\n bool _isCreate\\n )\\n internal\\n returns (\\n bool,\\n bytes memory\\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. `_contract` 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\\n bool success;\\n bytes memory returndata;\\n if (_isCreate) {\\n // safeCREATE() is a function which replicates a CREATE message, but uses return values\\n // Which match that of CALL (i.e. bool, bytes). This allows many security checks to be\\n // to be shared between untrusted call and create call frames.\\n (success, returndata) = address(this).call(\\n abi.encodeWithSelector(\\n this.safeCREATE.selector,\\n _gasLimit,\\n _data,\\n _contract\\n )\\n );\\n } else {\\n (success, returndata) = _contract.call{gas: _gasLimit}(_data);\\n }\\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 (\\n flag == RevertFlag.INTENTIONAL_REVERT\\n || _isCreate\\n ) {\\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 * Handles the creation-specific safety measures required for OVM contract deployment.\\n * This function sanitizes the return types for creation messages to match calls (bool, bytes),\\n * by being an external function which the EM can call, that mimics the success/fail case of the CREATE.\\n * This allows for consistent handling of both types of messages in _handleExternalMessage().\\n * Having this step occur as a separate call frame also allows us to easily revert the\\n * contract deployment in the event that the code is unsafe.\\n *\\n * @param _gasLimit Amount of gas to be passed into this creation.\\n * @param _creationCode Code to pass into CREATE for deployment.\\n * @param _address OVM address being deployed to.\\n */\\n function safeCREATE(\\n uint _gasLimit,\\n bytes memory _creationCode,\\n address _address\\n )\\n external\\n {\\n // The only way this should callable is from within _createContract(),\\n // and it should DEFINITELY not be callable by a non-EM code contract.\\n if (msg.sender != address(this)) {\\n return;\\n }\\n // Check that there is not already code at this address.\\n if (_hasEmptyAccount(_address) == false) {\\n // Note: in the EVM, this case burns all allotted gas. For improved\\n // developer experience, we do return the remaining gas.\\n _revertWithFlag(\\n RevertFlag.CREATE_COLLISION,\\n Lib_ErrorUtils.encodeRevertString(\\\"A contract has already been deployed to this address\\\")\\n );\\n }\\n\\n // Check the creation bytecode against the OVM_SafetyChecker.\\n if (ovmSafetyChecker.isBytecodeSafe(_creationCode) == false) {\\n _revertWithFlag(\\n RevertFlag.UNSAFE_BYTECODE,\\n Lib_ErrorUtils.encodeRevertString(\\\"Contract creation code contains unsafe opcodes. Did you use the right compiler or pass an unsafe constructor argument?\\\")\\n );\\n }\\n\\n // We always need to initialize the contract with the default account values.\\n _initPendingAccount(_address);\\n\\n // Actually execute the EVM create message.\\n // NOTE: The inline assembly below means we can NOT make any evm calls between here and then.\\n address ethAddress = Lib_EthUtils.createContract(_creationCode);\\n\\n if (ethAddress == address(0)) {\\n // If the creation fails, the EVM lets us grab its revert data. This may contain a revert flag\\n // to be used above in _handleExternalMessage, so we pass the revert data back up unmodified.\\n assembly {\\n returndatacopy(0,0,returndatasize())\\n revert(0, returndatasize())\\n }\\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(\\n RevertFlag.UNSAFE_BYTECODE,\\n Lib_ErrorUtils.encodeRevertString(\\\"Constructor attempted to deploy unsafe bytecode.\\\")\\n );\\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 * 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 ) {\\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 view\\n {\\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 input values of a transaction.\\n * @return _valid Whether or not the transaction data is valid.\\n */\\n function _isValidInput(\\n Lib_OVMCodec.Transaction memory _transaction\\n )\\n view\\n internal\\n returns (\\n bool\\n )\\n {\\n // Prevent reentrancy to run():\\n // This check prevents calling run with the default ovmNumber.\\n // Combined with the first check in run():\\n // if (transactionContext.ovmNUMBER != DEFAULT_UINT256) { return; }\\n // It should be impossible to re-enter since run() returns before any other call frames are created.\\n // Since this value is already being written to storage, we save much gas compared to\\n // using the standard nonReentrant pattern.\\n if (_transaction.blockNumber == DEFAULT_UINT256) {\\n return false;\\n }\\n\\n if (_isValidGasLimit(_transaction.gasLimit, _transaction.l1QueueOrigin) == false) {\\n return false;\\n }\\n\\n return true;\\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 view\\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 = DEFAULT_ADDRESS;\\n transactionContext.ovmTIMESTAMP = DEFAULT_UINT256;\\n transactionContext.ovmNUMBER = DEFAULT_UINT256;\\n transactionContext.ovmGASLIMIT = DEFAULT_UINT256;\\n transactionContext.ovmTXGASLIMIT = DEFAULT_UINT256;\\n transactionContext.ovmL1QUEUEORIGIN = Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE;\\n\\n transactionRecord.ovmGasRefund = DEFAULT_UINT256;\\n\\n messageContext.ovmCALLER = DEFAULT_ADDRESS;\\n messageContext.ovmADDRESS = DEFAULT_ADDRESS;\\n messageContext.isStatic = false;\\n\\n messageRecord.nuisanceGasLeft = DEFAULT_UINT256;\\n\\n // Reset the ovmStateManager.\\n ovmStateManager = iOVM_StateManager(address(0));\\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 messageRecord.nuisanceGasLeft = uint(-1);\\n\\n messageContext.ovmADDRESS = _from;\\n\\n bool isCreate = _transaction.entrypoint == address(0);\\n if (isCreate) {\\n (address created, bytes memory revertData) = ovmCREATE(_transaction.data);\\n if (created == address(0)) {\\n return (false, revertData);\\n } else {\\n // The eth_call RPC endpoint for to = undefined will return the deployed bytecode\\n // in the success case, differing from standard create messages.\\n return (true, Lib_EthUtils.getCode(created));\\n }\\n } else {\\n return ovmCALL(\\n _transaction.gasLimit,\\n _transaction.entrypoint,\\n _transaction.data\\n );\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6d2f2c75fd5e494c53573b90cd1a06f3382a6fac3ea5bcbd1082acea2b0762c4\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/predeploys/OVM_DeployerWhitelist.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Interface Imports */\\nimport { iOVM_DeployerWhitelist } from \\\"../../iOVM/predeploys/iOVM_DeployerWhitelist.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: optimistic-solc\\n * Runtime target: OVM\\n */\\ncontract OVM_DeployerWhitelist is iOVM_DeployerWhitelist {\\n\\n /**********************\\n * Contract Constants *\\n **********************/\\n\\n bool public initialized;\\n bool public allowArbitraryDeployment;\\n address override public owner;\\n mapping (address => bool) public whitelist;\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Blocks functions to anyone except the contract owner.\\n */\\n modifier onlyOwner() {\\n require(\\n msg.sender == 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 if (initialized == true) {\\n return;\\n }\\n\\n initialized = true;\\n allowArbitraryDeployment = _allowArbitraryDeployment;\\n owner = _owner;\\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 whitelist[_deployer] = _isWhitelisted;\\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 owner = _owner;\\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 allowArbitraryDeployment = _allowArbitraryDeployment;\\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\\n )\\n {\\n return (\\n initialized == false\\n || allowArbitraryDeployment == true\\n || whitelist[_deployer]\\n );\\n }\\n}\\n\",\"keccak256\":\"0x371e3d3ca1dd4177738b55eead9ad6f8278280e568694df6b42ee01f5558ccb2\",\"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 OUT_OF_GAS,\\n INTENTIONAL_REVERT,\\n EXCEEDS_NUISANCE_GAS,\\n INVALID_STATE_ACCESS,\\n UNSAFE_BYTECODE,\\n CREATE_COLLISION,\\n STATIC_VIOLATION,\\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 }\\n\\n\\n /************************************\\n * Transaction Execution Entrypoint *\\n ************************************/\\n\\n function run(\\n Lib_OVMCodec.Transaction calldata _transaction,\\n address _txStateManager\\n ) external returns (bytes memory);\\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, bytes memory _revertdata);\\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract, bytes memory _revertdata);\\n\\n\\n /*******************************\\n * Account Abstraction Opcodes *\\n ******************************/\\n\\n function ovmGETNONCE() external returns (uint256 _nonce);\\n function ovmINCREMENTNONCE() 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 Context *\\n ***************************************/\\n\\n function getMaxTransactionGasLimit() external view returns (uint _maxTransactionGasLimit);\\n}\\n\",\"keccak256\":\"0xf023d5d6fc6a03bd52f7a57af6e21076de77e8925d065bb79db062e73e43b684\",\"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/predeploys/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 owner() 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\":\"0xdf1f27faf0d26d416bf6d408d146a16de32b4e1772a292c65d39eb7ec2b53ceb\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x2ce671a0e004df88b136bea5a3c59d0732cea8887c8496da1d509e0200b03d7d\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xa5195afe32fb2cf104d156e8f4bd39df1ec79bf6ba232097b9e8e0ee14fbc298\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_ErrorUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/**\\n * @title Lib_ErrorUtils\\n */\\nlibrary Lib_ErrorUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes an error string into raw solidity-style revert data.\\n * (i.e. ascii bytes, prefixed with bytes4(keccak(\\\"Error(string))\\\"))\\n * Ref: https://docs.soliditylang.org/en/v0.8.2/control-structures.html?highlight=Error(string)#panic-via-assert-and-error-via-require\\n * @param _reason Reason for the reversion.\\n * @return Standard solidity revert data for the given reason.\\n */\\n function encodeRevertString(\\n string memory _reason\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return abi.encodeWithSignature(\\n \\\"Error(string)\\\",\\n _reason\\n );\\n }\\n}\\n\",\"keccak256\":\"0xfc64ec4a81fb50865b502a0004ed154e8598e1a313db77303fc95e41f536e6b7\",\"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 *\\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 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\\n )\\n {\\n bytes memory code;\\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 Full code of the contract.\\n */\\n function getCode(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes memory\\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 Size of the contract's code in bytes.\\n */\\n function getCodeSize(\\n address _address\\n )\\n internal\\n view\\n returns (\\n uint256\\n )\\n {\\n uint256 codeSize;\\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 Hash of the contract's code.\\n */\\n function getCodeHash(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n bytes32 codeHash;\\n assembly {\\n codeHash := extcodehash(_address)\\n }\\n\\n return codeHash;\\n }\\n\\n /**\\n * Creates a contract with some given initialization code.\\n * @param _code Contract initialization code.\\n * @return Address of the created contract.\\n */\\n function createContract(\\n bytes memory _code\\n )\\n internal\\n returns (\\n address\\n )\\n {\\n address created;\\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 to be generated by CREATE.\\n */\\n function getAddressForCREATE(\\n address _creator,\\n uint256 _nonce\\n )\\n internal\\n pure\\n returns (\\n 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 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 (\\n address\\n )\\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\":\"0xf29a67d78e61cb472d524b779b32cfcb39a587f4096500d5419e6425ed367d49\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506040516200314d3803806200314d833981016040819052620000349162000292565b600080546001600160a01b0319166001600160a01b03851617905560408051808201909152601181527027ab26afa9b0b332ba3ca1b432b1b5b2b960791b60208201526200008290620000d7565b600180546001600160a01b0319166001600160a01b039290921691909117905581516003556020820151600455604082015160055560608201516006558051600755620000ce620001b9565b50505062000337565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015620001395781810151838201526020016200011f565b50505050905090810190601f168015620001675780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156200018557600080fd5b505afa1580156200019a573d6000803e3d6000fd5b505050506040513d6020811015620001b157600080fd5b505192915050565b600d80546001600160a01b031990811673defa017defa017defa017defa017defa017defa09081179092557fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d6009819055600a819055600b819055600c8190556008805460ff191690556010819055600e8054831684179055600f8054831690931760ff60a01b1916909255601191909155600280549091169055565b60006020828403121562000268578081fd5b604051602081016001600160401b03811182821017156200028557fe5b6040529151825250919050565b600080600083850360c0811215620002a8578384fd5b84516001600160a01b0381168114620002bf578485fd5b93506080601f1982011215620002d3578283fd5b50604051608081016001600160401b0381118282101715620002f157fe5b806040525060208501518152604085015160208201526060850151604082015260808501516060820152809250506200032e8560a0860162000256565b90509250925092565b612e0680620003476000396000f3fe608060405234801561001057600080fd5b50600436106101c45760003560e01c80637cebbe94116100f957806399ccd98b11610097578063bdbf8c3611610071578063bdbf8c361461037e578063c1fb2ea214610386578063fcb6829b1461038e578063ffe73914146103a1576101c4565b806399ccd98b146103505780639be3ad67146103635780639dc9dc9314610376576101c4565b806385979f76116100d357806385979f761461031a5780638bb42e151461032d5780639058025614610340578063996d79a514610348576101c4565b80637cebbe94146102de5780638435035b146102e65780638540661f146102f9576101c4565b8063299ca478116101665780635a98c361116101405780635a98c3611461029b57806373509064146102a3578063741a33eb146102ab578063746c32f1146102be576101c4565b8063299ca478146102605780632a2a7adb14610275578063461a447814610288576101c4565b80631c4712a7116101a25780631c4712a71461022857806320160f3a1461023057806322bd64c01461023857806324749d5c1461024d576101c4565b806303daa959146101c9578063101185a4146101f257806314aa2ff714610207575b600080fd5b6101dc6101d73660046125e1565b6103b4565b6040516101e99190612a35565b60405180910390f35b6101fa6103f9565b6040516101e99190612b20565b61021a610215366004612673565b610402565b6040516101e9929190612ab0565b6101dc61049a565b6101dc6104a0565b61024b610246366004612611565b6104a6565b005b6101dc61025b366004612555565b610509565b610268610524565b6040516101e99190612a3e565b61024b610283366004612673565b610533565b61026861029636600461278c565b610541565b6101dc61061d565b610268610623565b61024b6102b9366004612632565b610632565b6102d16102cc36600461258d565b61079f565b6040516101e99190612b0d565b61024b6107d2565b6101dc6102f4366004612555565b610829565b61030c610307366004612881565b61083c565b6040516101e9929190612ad4565b61030c610328366004612881565b6108b5565b61030c61033b366004612820565b610904565b6101dc6109d7565b6102686109dd565b61021a61035e3660046126ad565b6109ec565b6102d16103713660046127d1565b610a7f565b610268610be1565b6101dc610bf0565b6101dc610bf6565b61024b61039c3660046128d7565b610c0d565b61030c6103af366004612881565b610df7565b6000619c4060005a905060006103c86109dd565b90506103d48186610e48565b93505060005a82039050808310156103f157601080548483030190555b505050919050565b60085460ff1690565b600f5460009060609060ff600160a01b9091041615156001141561042a5761042a6006610ed6565b619c4060005a9050600061043c6109dd565b905061044781610eef565b600061045b8261045684610f74565b610fff565b90506104678188611090565b95509550505060005a8203905080831015610489576010805484019055610492565b60108054820190555b505050915091565b60045490565b600b5490565b600f5460ff600160a01b909104161515600114156104c8576104c86006610ed6565b61ea6060005a905060006104da6109dd565b90506104e7818686611116565b5060005a820390508083101561050257601080548483030190555b5050505050565b600061051c61051783611198565b611223565b90505b919050565b6000546001600160a01b031681565b61053e600182611227565b50565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156105a1578181015183820152602001610589565b50505050905090810190601f1680156105ce5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156105eb57600080fd5b505afa1580156105ff573d6000803e3d6000fd5b505050506040513d602081101561061557600080fd5b505192915050565b600a5490565b600e546001600160a01b031690565b600f5460ff600160a01b90910416151560011415610654576106546006610ed6565b600060018585601b0185856040516000815260200160405260405161067c9493929190612aef565b6020604051602081039080840390855afa15801561069e573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166106da576106da604051806060016040528060388152602001612cbf60389139610533565b6106e38161123d565b6106ed5750610799565b6106f6816112c8565b600f80546001600160a01b038381166001600160a01b031983161790925516600061075361072f6009602160991b01836102cc82610829565b60405160200161073f91906129ff565b60405160208183030381529060405261132f565b600f80546001600160a01b0319166001600160a01b038516179055905061078a838261077e81611342565b80519060200120611358565b610795836000611395565b5050505b50505050565b60606000826001146107b157826107b4565b60025b90506107c96107c286611198565b8583611406565b95945050505050565b600f5460ff600160a01b909104161515600114156107f4576107f46006610ed6565b60006107fe6109dd565b9050600061080b82610f74565b905080816001011115610825576108258282600101611395565b5050565b600061051c61083783611198565b61142a565b600060606201388060005a60408051606081018252600f546001600160a01b039081168252891660208201526001918101919091529091506108808189898961142e565b945094505060005a82039050808310156108a15760108054840190556108aa565b60108054820190555b505050935093915050565b60006060620186a060005a60408051606081018252600f5460ff600160a01b8204161515928201929092526001600160a01b03918216815290881660208201529091506108808189898961142e565b60006060331561091357600080fd5b600280546001600160a01b0319166001600160a01b038516179055610937856114bf565b600019601155600f80546001600160a01b0319166001600160a01b03868116919091179091556080860151161580156109b25760008061097a8860c00151610402565b90925090506001600160a01b03821661099b576000945092506109cf915050565b60016109a683611342565b945094505050506109cf565b6109c98660a0015187608001518860c001516108b5565b92509250505b935093915050565b60075490565b600f546001600160a01b031690565b600f5460009060609060ff600160a01b90910416151560011415610a1457610a146006610ed6565b619c4060005a90506000610a266109dd565b9050610a3181610eef565b6000610a3e828989611531565b9050610a4a8189611090565b95509550505060005a8203905080831015610a6c576010805484019055610a75565b60108054820190555b5050509250929050565b600a546060907fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d14610ac05750604080516020810190915260008152610bdb565b600280546001600160a01b0319166001600160a01b038481169190911791829055604051630d15d41560e41b815291169063d15d415090610b05903390600401612a3e565b60206040518083038186803b158015610b1d57600080fd5b505afa158015610b31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b5591906125c1565b610b7a5760405162461bcd60e51b8152600401610b7190612b9c565b60405180910390fd5b610b83836114bf565b610b8c83611577565b610bad57610b986115d3565b50604080516020810190915260008152610bdb565b6000610bcd6003600001548560a001510385608001518660c001516108b5565b915050610bd86115d3565b90505b92915050565b600d546001600160a01b031690565b60095490565b6000610c08610c036109dd565b610f74565b905090565b333014610c1957610df2565b610c228161123d565b610c5157610c516005610c4c604051806060016040528060348152602001612d6d60349139611670565b611227565b6001546040516352275acd60e11b81526001600160a01b039091169063a44eb59a90610c81908590600401612b0d565b60206040518083038186803b158015610c9957600080fd5b505afa158015610cad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd191906125c1565b610cfb57610cfb6004610c4c6040518060a0016040528060768152602001612cf760769139611670565b610d04816112c8565b6000610d0f8361132f565b90506001600160a01b038116610d29573d6000803e3d6000fd5b6000610d3482611342565b6001546040516352275acd60e11b81529192506001600160a01b03169063a44eb59a90610d65908490600401612b0d565b60206040518083038186803b158015610d7d57600080fd5b505afa158015610d91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db591906125c1565b610ddf57610ddf6004610c4c604051806060016040528060308152602001612da160309139611670565b6105028383610ded85611223565b611358565b505050565b60006060619c4060005a60408051606081018252600e546001600160a01b039081168252600f549081166020830152600160a01b900460ff161515918101919091529091506108808189898961142e565b6000610e5483836116b3565b600254604051631aaf392f60e01b81526001600160a01b0390911690631aaf392f90610e869086908690600401612a76565b60206040518083038186803b158015610e9e57600080fd5b505afa158015610eb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bd891906125f9565b61053e8160405180602001604052806000815250611227565b600080610f3e5a6002602160991b0185604051602401610f0f9190612a3e565b60408051601f198184030181529190526020810180516001600160e01b031663b1540a0160e01b1790526108b5565b91509150600081806020019051810190610f5891906125c1565b9050801580610f65575082155b15610799576107996007610ed6565b6000610f7f826117ee565b60025460405163d126199f60e01b81526001600160a01b039091169063d126199f90610faf908590600401612a3e565b60206040518083038186803b158015610fc757600080fd5b505afa158015610fdb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051c91906125f9565b60408051600280825260608201909252600091829190816020015b606081526020019060019003908161101a57905050905061103a84611935565b8160008151811061104757fe5b602002602001018190525061105b8361195f565b8160018151811061106857fe5b6020026020010181905250600061107e82611972565b90506107c981805190602001206119b6565b600060606110b261109f6109dd565b6110aa610c036109dd565b600101611395565b60408051606081018252600f5460ff600160a01b8204161515928201929092526001600160a01b03918216815290851660208201526000806110f8835a898960016119b9565b915091508161110857600061110a565b865b97909650945050505050565b806111218484610e48565b141561112c57610df2565b6111368383611c27565b600254604051635c17d62960e01b81526001600160a01b0390911690635c17d6299061116a90869086908690600401612a8f565b600060405180830381600087803b15801561118457600080fd5b505af1158015610795573d6000803e3d6000fd5b60006111a3826117ee565b600254604051637c8ee70360e01b81526001600160a01b0390911690637c8ee703906111d3908590600401612a3e565b60206040518083038186803b1580156111eb57600080fd5b505afa1580156111ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051c9190612571565b3f90565b60006112338383611d39565b9050805160208201fd5b6000611248826117ee565b6002546040516307a1294560e01b81526001600160a01b03909116906307a1294590611278908590600401612a3e565b60206040518083038186803b15801561129057600080fd5b505afa1580156112a4573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051c91906125c1565b6112d1816117ee565b600254604051637e78a4d160e11b81526001600160a01b039091169063fcf149a290611301908490600401612a3e565b600060405180830381600087803b15801561131b57600080fd5b505af1158015610502573d6000803e3d6000fd5b6000808251602084016000f09392505050565b606061051c8260006113538561142a565b611406565b61136183611de2565b6002546040516368510af960e11b81526001600160a01b039091169063d0a215f29061116a90869086908690600401612a52565b61139e82611de2565b6002546040516374855dc360e11b81526001600160a01b039091169063e90abb86906113d09085908590600401612a76565b600060405180830381600087803b1580156113ea57600080fd5b505af11580156113fe573d6000803e3d6000fd5b505050505050565b6060806040519050602083018101604052828152828460208301873c949350505050565b3b90565b6000606073ffffffffffffffffffffffffffffffffffff0000841673deaddeaddeaddeaddeaddeaddeaddeaddead0000141561147d5750506040805160208101909152600081526001906114b6565b60006064856001600160a01b03161061149e5761149985611198565b6114a0565b845b90506114b08787838760006119b9565b92509250505b94509492505050565b80516009556020810151600a5560a0810151600c5560408101516008805460ff1916600183818111156114ee57fe5b02179055506060810151600d80546001600160a01b0319166001600160a01b03909216919091179055600554600b5560a081015161152b90611ef1565b60115550565b60008060ff60f81b85848680519060200120604051602001611556949392919061297b565b6040516020818303038152906040528051906020012090506107c9816119b6565b60007fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d826020015114156115ad5750600061051f565b6115bf8260a001518360400151611f04565b6115cb5750600061051f565b506001919050565b600d80546001600160a01b031990811673defa017defa017defa017defa017defa017defa09081179092557fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d6009819055600a819055600b819055600c8190556008805460ff191690556010819055600e8054831684179055600f8054831690931760ff60a01b1916909255601191909155600280549091169055565b6060816040516024016116839190612b0d565b60408051601f198184030181529190526020810180516001600160e01b031662461bcd60e51b1790529050919050565b6175305a10156116c7576116c76000610ed6565b600254604051630ad2267960e01b81526001600160a01b0390911690630ad22679906116f99085908590600401612a76565b60206040518083038186803b15801561171157600080fd5b505afa158015611725573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061174991906125c1565b611757576117576003610ed6565b600254604051632bcdee1960e21b81526000916001600160a01b03169063af37b8649061178a9086908690600401612a76565b602060405180830381600087803b1580156117a457600080fd5b505af11580156117b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117dc91906125c1565b905080610df257610df2614e20611f34565b6175305a1015611802576118026000610ed6565b60025460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf90611832908490600401612a3e565b60206040518083038186803b15801561184a57600080fd5b505afa15801561185e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061188291906125c1565b611890576118906003610ed6565b600254604051633ecdecc760e21b81526000916001600160a01b03169063fb37b31c906118c1908590600401612a3e565b602060405180830381600087803b1580156118db57600080fd5b505af11580156118ef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061191391906125c1565b90508061082557610825617530606461192e61083786611198565b0201611f34565b606061051c8260405160200161194b919061295e565b604051602081830303815290604052611f54565b606061051c61196d83611fa6565b611f54565b6060600061197f836120aa565b905061198d815160c06121aa565b8160405160200161199f9291906129d0565b604051602081830303815290604052915050919050565b90565b6040805160608082018352600e546001600160a01b039081168352600f549081166020840152600160a01b900460ff1615159282019290925260009190611a0081896122fa565b6011546000611a0e89611ef1565b60118190559050600060608715611aca57604051309063fcb6829b60e01b90611a3f908e908d908f90602401612c08565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051611a7d91906129b4565b6000604051808303816000865af19150503d8060008114611aba576040519150601f19603f3d011682016040523d82523d6000602084013e611abf565b606091505b509092509050611b2d565b896001600160a01b03168b8a604051611ae391906129b4565b60006040518083038160008787f1925050503d8060008114611b21576040519150601f19603f3d011682016040523d82523d6000602084013e611b26565b606091505b5090925090505b611b378c866122fa565b60115482611c0f57600080600080611b4e866123ae565b929650909450925090506003846007811115611b6657fe5b1415611b7557611b7584610ed6565b6001846007811115611b8357fe5b1480611b9a57506004846007811115611b9857fe5b145b80611bb057506006846007811115611bae57fe5b145b80611bc657506007846007811115611bc457fe5b145b15611bd15760108290555b6001846007811115611bdf57fe5b1480611be857508c5b15611bf557809550611c08565b6040518060200160405280600081525095505b5090925050505b90920390920360115590999098509650505050505050565b611c3182826116b3565b60025460405163af3dc01160e01b81526000916001600160a01b03169063af3dc01190611c649086908690600401612a76565b602060405180830381600087803b158015611c7e57600080fd5b505af1158015611c92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cb691906125c1565b905080610df257611cc683611de2565b600260009054906101000a90046001600160a01b03166001600160a01b031663c3fd9b256040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611d1657600080fd5b505af1158015611d2a573d6000803e3d6000fd5b50505050610df2614e20611f34565b60606000836007811115611d4957fe5b1415611d645750604080516020810190915260008152610bdb565b6003836007811115611d7257fe5b1415611db057604080516020808201835260008083529251611d9a9387939092839201612b34565b6040516020818303038152906040529050610bdb565b601154601054604051611dcb92869290918690602001612b70565b604051602081830303815290604052905092915050565b611deb816117ee565b60025460405163011b1f7960e41b81526000916001600160a01b0316906311b1f79090611e1c908590600401612a3e565b602060405180830381600087803b158015611e3657600080fd5b505af1158015611e4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e6e91906125c1565b90508061082557600260009054906101000a90046001600160a01b03166001600160a01b03166333f943056040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611ec557600080fd5b505af1158015611ed9573d6000803e3d6000fd5b50505050610825617530606461192e61083786611198565b60005a8210611f00575a61051c565b5090565b600454600090831115611f1957506000610bdb565b600354831015611f2b57506000610bdb565b50600192915050565b601154811115611f4857611f486002610ed6565b60118054919091039055565b60608082516001148015611f7c5750608083600081518110611f7257fe5b016020015160f81c105b15611f8857508161051c565b611f94835160806121aa565b83604051602001611dcb9291906129d0565b6060600082604051602001611fbb9190612a35565b604051602081830303815290604052905060005b602081101561200557818181518110611fe457fe5b01602001516001600160f81b03191615611ffd57612005565b600101611fcf565b6000816020036001600160401b038111801561202057600080fd5b506040519080825280601f01601f19166020018201604052801561204b576020820181803683370190505b50905060005b81518110156120a157835160018401938591811061206b57fe5b602001015160f81c60f81b82828151811061208257fe5b60200101906001600160f81b031916908160001a905350600101612051565b50949350505050565b60608151600014156120cb575060408051600081526020810190915261051f565b6000805b83518110156120fe578381815181106120e457fe5b6020026020010151518201915080806001019150506120cf565b6000826001600160401b038111801561211657600080fd5b506040519080825280601f01601f191660200182016040528015612141576020820181803683370190505b50600092509050602081015b85518310156120a157600086848151811061216457fe5b60200260200101519050600060208201905061218283828451612401565b87858151811061218e57fe5b602002602001015151830192505050828060010193505061214d565b6060806038841015612204576040805160018082528183019092529060208201818036833701905050905082840160f81b816000815181106121e857fe5b60200101906001600160f81b031916908160001a905350610bd8565b600060015b80868161221257fe5b04156122275760019091019061010002612209565b816001016001600160401b038111801561224057600080fd5b506040519080825280601f01601f19166020018201604052801561226b576020820181803683370190505b50925084820160370160f81b8360008151811061228457fe5b60200101906001600160f81b031916908160001a905350600190505b8181116122f0576101008183036101000a87816122b957fe5b04816122c157fe5b0660f81b8382815181106122d157fe5b60200101906001600160f81b031916908160001a9053506001016122a0565b5050905092915050565b805182516001600160a01b03908116911614612332578051600e80546001600160a01b0319166001600160a01b039092169190911790555b80602001516001600160a01b031682602001516001600160a01b031614612378576020810151600f80546001600160a01b0319166001600160a01b039092169190911790555b8060400151151582604001511515146108255760400151600f8054911515600160a01b0260ff60a01b1990921691909117905550565b600080600060608451600014156123dd57505060408051602081019091526000808252925082915081906123fa565b848060200190518101906123f191906126ef565b93509350935093505b9193509193565b8282825b60208110612424578151835260209283019290910190601f1901612405565b905182516020929092036101000a6000190180199091169116179052505050565b600061245861245384612c5c565b612c39565b905082815283838301111561246c57600080fd5b828260208301376000602084830101529392505050565b803561051f81612ca9565b600082601f83011261249e578081fd5b610bd883833560208501612445565b80356002811061051f57600080fd5b600060e082840312156124cd578081fd5b6124d760e0612c39565b905081358152602082013560208201526124f3604083016124ad565b604082015261250460608301612483565b606082015261251560808301612483565b608082015260a082013560a082015260c08201356001600160401b0381111561253d57600080fd5b6125498482850161248e565b60c08301525092915050565b600060208284031215612566578081fd5b8135610bd881612ca9565b600060208284031215612582578081fd5b8151610bd881612ca9565b6000806000606084860312156125a1578182fd5b83356125ac81612ca9565b95602085013595506040909401359392505050565b6000602082840312156125d2578081fd5b81518015158114610bd8578182fd5b6000602082840312156125f2578081fd5b5035919050565b60006020828403121561260a578081fd5b5051919050565b60008060408385031215612623578182fd5b50508035926020909101359150565b60008060008060808587031215612647578081fd5b84359350602085013560ff8116811461265e578182fd5b93969395505050506040820135916060013590565b600060208284031215612684578081fd5b81356001600160401b03811115612699578182fd5b6126a58482850161248e565b949350505050565b600080604083850312156126bf578182fd5b82356001600160401b038111156126d4578283fd5b6126e08582860161248e565b95602094909401359450505050565b60008060008060808587031215612704578182fd5b845160088110612712578283fd5b80945050602085015192506040850151915060608501516001600160401b0381111561273c578182fd5b8501601f8101871361274c578182fd5b805161275a61245382612c5c565b81815288602083850101111561276e578384fd5b61277f826020830160208601612c7d565b9598949750929550505050565b60006020828403121561279d578081fd5b81356001600160401b038111156127b2578182fd5b8201601f810184136127c2578182fd5b6126a584823560208401612445565b600080604083850312156127e3578182fd5b82356001600160401b038111156127f8578283fd5b612804858286016124bc565b925050602083013561281581612ca9565b809150509250929050565b600080600060608486031215612834578081fd5b83356001600160401b03811115612849578182fd5b612855868287016124bc565b935050602084013561286681612ca9565b9150604084013561287681612ca9565b809150509250925092565b600080600060608486031215612895578081fd5b8335925060208401356128a781612ca9565b915060408401356001600160401b038111156128c1578182fd5b6128cd8682870161248e565b9150509250925092565b6000806000606084860312156128eb578081fd5b8335925060208401356001600160401b03811115612907578182fd5b6129138682870161248e565b925050604084013561287681612ca9565b6000815180845261293c816020860160208601612c7d565b601f01601f19169290920160200192915050565b6008811061295a57fe5b9052565b60609190911b6bffffffffffffffffffffffff1916815260140190565b6001600160f81b031994909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b600082516129c6818460208701612c7d565b9190910192915050565b600083516129e2818460208801612c7d565b8351908301906129f6818360208801612c7d565b01949350505050565b6c600d380380600d6000396000f360981b81528151600090612a2881600d850160208701612c7d565b91909101600d0192915050565b90815260200190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b03831681526040602082018190526000906126a590830184612924565b60008315158252604060208301526126a56040830184612924565b93845260ff9290921660208401526040830152606082015260800190565b600060208252610bd86020830184612924565b6020810160028310612b2e57fe5b91905290565b6000612b408287612950565b60ff8516602083015260ff8416604083015260806060830152612b666080830184612924565b9695505050505050565b6000612b7c8287612950565b84602083015283604083015260806060830152612b666080830184612924565b60208082526046908201527f4f6e6c792061757468656e746963617465642061646472657373657320696e2060408201527f6f766d53746174654d616e616765722063616e2063616c6c20746869732066756060820152653731ba34b7b760d11b608082015260a00190565b600084825260606020830152612c216060830185612924565b905060018060a01b0383166040830152949350505050565b6040518181016001600160401b0381118282101715612c5457fe5b604052919050565b60006001600160401b03821115612c6f57fe5b50601f01601f191660200190565b60005b83811015612c98578181015183820152602001612c80565b838111156107995750506000910152565b6001600160a01b038116811461053e57600080fdfe5369676e61747572652070726f766964656420666f7220454f4120636f6e7472616374206372656174696f6e20697320696e76616c69642e436f6e7472616374206372656174696f6e20636f646520636f6e7461696e7320756e73616665206f70636f6465732e2044696420796f75207573652074686520726967687420636f6d70696c6572206f72207061737320616e20756e7361666520636f6e7374727563746f7220617267756d656e743f4120636f6e74726163742068617320616c7265616479206265656e206465706c6f79656420746f20746869732061646472657373436f6e7374727563746f7220617474656d7074656420746f206465706c6f7920756e736166652062797465636f64652ea2646970667358221220d8d7793db294565fc54ab1c9bb5a859a63bd13d82487c00d15922977b1ab32ed64736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101c45760003560e01c80637cebbe94116100f957806399ccd98b11610097578063bdbf8c3611610071578063bdbf8c361461037e578063c1fb2ea214610386578063fcb6829b1461038e578063ffe73914146103a1576101c4565b806399ccd98b146103505780639be3ad67146103635780639dc9dc9314610376576101c4565b806385979f76116100d357806385979f761461031a5780638bb42e151461032d5780639058025614610340578063996d79a514610348576101c4565b80637cebbe94146102de5780638435035b146102e65780638540661f146102f9576101c4565b8063299ca478116101665780635a98c361116101405780635a98c3611461029b57806373509064146102a3578063741a33eb146102ab578063746c32f1146102be576101c4565b8063299ca478146102605780632a2a7adb14610275578063461a447814610288576101c4565b80631c4712a7116101a25780631c4712a71461022857806320160f3a1461023057806322bd64c01461023857806324749d5c1461024d576101c4565b806303daa959146101c9578063101185a4146101f257806314aa2ff714610207575b600080fd5b6101dc6101d73660046125e1565b6103b4565b6040516101e99190612a35565b60405180910390f35b6101fa6103f9565b6040516101e99190612b20565b61021a610215366004612673565b610402565b6040516101e9929190612ab0565b6101dc61049a565b6101dc6104a0565b61024b610246366004612611565b6104a6565b005b6101dc61025b366004612555565b610509565b610268610524565b6040516101e99190612a3e565b61024b610283366004612673565b610533565b61026861029636600461278c565b610541565b6101dc61061d565b610268610623565b61024b6102b9366004612632565b610632565b6102d16102cc36600461258d565b61079f565b6040516101e99190612b0d565b61024b6107d2565b6101dc6102f4366004612555565b610829565b61030c610307366004612881565b61083c565b6040516101e9929190612ad4565b61030c610328366004612881565b6108b5565b61030c61033b366004612820565b610904565b6101dc6109d7565b6102686109dd565b61021a61035e3660046126ad565b6109ec565b6102d16103713660046127d1565b610a7f565b610268610be1565b6101dc610bf0565b6101dc610bf6565b61024b61039c3660046128d7565b610c0d565b61030c6103af366004612881565b610df7565b6000619c4060005a905060006103c86109dd565b90506103d48186610e48565b93505060005a82039050808310156103f157601080548483030190555b505050919050565b60085460ff1690565b600f5460009060609060ff600160a01b9091041615156001141561042a5761042a6006610ed6565b619c4060005a9050600061043c6109dd565b905061044781610eef565b600061045b8261045684610f74565b610fff565b90506104678188611090565b95509550505060005a8203905080831015610489576010805484019055610492565b60108054820190555b505050915091565b60045490565b600b5490565b600f5460ff600160a01b909104161515600114156104c8576104c86006610ed6565b61ea6060005a905060006104da6109dd565b90506104e7818686611116565b5060005a820390508083101561050257601080548483030190555b5050505050565b600061051c61051783611198565b611223565b90505b919050565b6000546001600160a01b031681565b61053e600182611227565b50565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156105a1578181015183820152602001610589565b50505050905090810190601f1680156105ce5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156105eb57600080fd5b505afa1580156105ff573d6000803e3d6000fd5b505050506040513d602081101561061557600080fd5b505192915050565b600a5490565b600e546001600160a01b031690565b600f5460ff600160a01b90910416151560011415610654576106546006610ed6565b600060018585601b0185856040516000815260200160405260405161067c9493929190612aef565b6020604051602081039080840390855afa15801561069e573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166106da576106da604051806060016040528060388152602001612cbf60389139610533565b6106e38161123d565b6106ed5750610799565b6106f6816112c8565b600f80546001600160a01b038381166001600160a01b031983161790925516600061075361072f6009602160991b01836102cc82610829565b60405160200161073f91906129ff565b60405160208183030381529060405261132f565b600f80546001600160a01b0319166001600160a01b038516179055905061078a838261077e81611342565b80519060200120611358565b610795836000611395565b5050505b50505050565b60606000826001146107b157826107b4565b60025b90506107c96107c286611198565b8583611406565b95945050505050565b600f5460ff600160a01b909104161515600114156107f4576107f46006610ed6565b60006107fe6109dd565b9050600061080b82610f74565b905080816001011115610825576108258282600101611395565b5050565b600061051c61083783611198565b61142a565b600060606201388060005a60408051606081018252600f546001600160a01b039081168252891660208201526001918101919091529091506108808189898961142e565b945094505060005a82039050808310156108a15760108054840190556108aa565b60108054820190555b505050935093915050565b60006060620186a060005a60408051606081018252600f5460ff600160a01b8204161515928201929092526001600160a01b03918216815290881660208201529091506108808189898961142e565b60006060331561091357600080fd5b600280546001600160a01b0319166001600160a01b038516179055610937856114bf565b600019601155600f80546001600160a01b0319166001600160a01b03868116919091179091556080860151161580156109b25760008061097a8860c00151610402565b90925090506001600160a01b03821661099b576000945092506109cf915050565b60016109a683611342565b945094505050506109cf565b6109c98660a0015187608001518860c001516108b5565b92509250505b935093915050565b60075490565b600f546001600160a01b031690565b600f5460009060609060ff600160a01b90910416151560011415610a1457610a146006610ed6565b619c4060005a90506000610a266109dd565b9050610a3181610eef565b6000610a3e828989611531565b9050610a4a8189611090565b95509550505060005a8203905080831015610a6c576010805484019055610a75565b60108054820190555b5050509250929050565b600a546060907fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d14610ac05750604080516020810190915260008152610bdb565b600280546001600160a01b0319166001600160a01b038481169190911791829055604051630d15d41560e41b815291169063d15d415090610b05903390600401612a3e565b60206040518083038186803b158015610b1d57600080fd5b505afa158015610b31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b5591906125c1565b610b7a5760405162461bcd60e51b8152600401610b7190612b9c565b60405180910390fd5b610b83836114bf565b610b8c83611577565b610bad57610b986115d3565b50604080516020810190915260008152610bdb565b6000610bcd6003600001548560a001510385608001518660c001516108b5565b915050610bd86115d3565b90505b92915050565b600d546001600160a01b031690565b60095490565b6000610c08610c036109dd565b610f74565b905090565b333014610c1957610df2565b610c228161123d565b610c5157610c516005610c4c604051806060016040528060348152602001612d6d60349139611670565b611227565b6001546040516352275acd60e11b81526001600160a01b039091169063a44eb59a90610c81908590600401612b0d565b60206040518083038186803b158015610c9957600080fd5b505afa158015610cad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd191906125c1565b610cfb57610cfb6004610c4c6040518060a0016040528060768152602001612cf760769139611670565b610d04816112c8565b6000610d0f8361132f565b90506001600160a01b038116610d29573d6000803e3d6000fd5b6000610d3482611342565b6001546040516352275acd60e11b81529192506001600160a01b03169063a44eb59a90610d65908490600401612b0d565b60206040518083038186803b158015610d7d57600080fd5b505afa158015610d91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db591906125c1565b610ddf57610ddf6004610c4c604051806060016040528060308152602001612da160309139611670565b6105028383610ded85611223565b611358565b505050565b60006060619c4060005a60408051606081018252600e546001600160a01b039081168252600f549081166020830152600160a01b900460ff161515918101919091529091506108808189898961142e565b6000610e5483836116b3565b600254604051631aaf392f60e01b81526001600160a01b0390911690631aaf392f90610e869086908690600401612a76565b60206040518083038186803b158015610e9e57600080fd5b505afa158015610eb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bd891906125f9565b61053e8160405180602001604052806000815250611227565b600080610f3e5a6002602160991b0185604051602401610f0f9190612a3e565b60408051601f198184030181529190526020810180516001600160e01b031663b1540a0160e01b1790526108b5565b91509150600081806020019051810190610f5891906125c1565b9050801580610f65575082155b15610799576107996007610ed6565b6000610f7f826117ee565b60025460405163d126199f60e01b81526001600160a01b039091169063d126199f90610faf908590600401612a3e565b60206040518083038186803b158015610fc757600080fd5b505afa158015610fdb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051c91906125f9565b60408051600280825260608201909252600091829190816020015b606081526020019060019003908161101a57905050905061103a84611935565b8160008151811061104757fe5b602002602001018190525061105b8361195f565b8160018151811061106857fe5b6020026020010181905250600061107e82611972565b90506107c981805190602001206119b6565b600060606110b261109f6109dd565b6110aa610c036109dd565b600101611395565b60408051606081018252600f5460ff600160a01b8204161515928201929092526001600160a01b03918216815290851660208201526000806110f8835a898960016119b9565b915091508161110857600061110a565b865b97909650945050505050565b806111218484610e48565b141561112c57610df2565b6111368383611c27565b600254604051635c17d62960e01b81526001600160a01b0390911690635c17d6299061116a90869086908690600401612a8f565b600060405180830381600087803b15801561118457600080fd5b505af1158015610795573d6000803e3d6000fd5b60006111a3826117ee565b600254604051637c8ee70360e01b81526001600160a01b0390911690637c8ee703906111d3908590600401612a3e565b60206040518083038186803b1580156111eb57600080fd5b505afa1580156111ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051c9190612571565b3f90565b60006112338383611d39565b9050805160208201fd5b6000611248826117ee565b6002546040516307a1294560e01b81526001600160a01b03909116906307a1294590611278908590600401612a3e565b60206040518083038186803b15801561129057600080fd5b505afa1580156112a4573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051c91906125c1565b6112d1816117ee565b600254604051637e78a4d160e11b81526001600160a01b039091169063fcf149a290611301908490600401612a3e565b600060405180830381600087803b15801561131b57600080fd5b505af1158015610502573d6000803e3d6000fd5b6000808251602084016000f09392505050565b606061051c8260006113538561142a565b611406565b61136183611de2565b6002546040516368510af960e11b81526001600160a01b039091169063d0a215f29061116a90869086908690600401612a52565b61139e82611de2565b6002546040516374855dc360e11b81526001600160a01b039091169063e90abb86906113d09085908590600401612a76565b600060405180830381600087803b1580156113ea57600080fd5b505af11580156113fe573d6000803e3d6000fd5b505050505050565b6060806040519050602083018101604052828152828460208301873c949350505050565b3b90565b6000606073ffffffffffffffffffffffffffffffffffff0000841673deaddeaddeaddeaddeaddeaddeaddeaddead0000141561147d5750506040805160208101909152600081526001906114b6565b60006064856001600160a01b03161061149e5761149985611198565b6114a0565b845b90506114b08787838760006119b9565b92509250505b94509492505050565b80516009556020810151600a5560a0810151600c5560408101516008805460ff1916600183818111156114ee57fe5b02179055506060810151600d80546001600160a01b0319166001600160a01b03909216919091179055600554600b5560a081015161152b90611ef1565b60115550565b60008060ff60f81b85848680519060200120604051602001611556949392919061297b565b6040516020818303038152906040528051906020012090506107c9816119b6565b60007fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d826020015114156115ad5750600061051f565b6115bf8260a001518360400151611f04565b6115cb5750600061051f565b506001919050565b600d80546001600160a01b031990811673defa017defa017defa017defa017defa017defa09081179092557fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d6009819055600a819055600b819055600c8190556008805460ff191690556010819055600e8054831684179055600f8054831690931760ff60a01b1916909255601191909155600280549091169055565b6060816040516024016116839190612b0d565b60408051601f198184030181529190526020810180516001600160e01b031662461bcd60e51b1790529050919050565b6175305a10156116c7576116c76000610ed6565b600254604051630ad2267960e01b81526001600160a01b0390911690630ad22679906116f99085908590600401612a76565b60206040518083038186803b15801561171157600080fd5b505afa158015611725573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061174991906125c1565b611757576117576003610ed6565b600254604051632bcdee1960e21b81526000916001600160a01b03169063af37b8649061178a9086908690600401612a76565b602060405180830381600087803b1580156117a457600080fd5b505af11580156117b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117dc91906125c1565b905080610df257610df2614e20611f34565b6175305a1015611802576118026000610ed6565b60025460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf90611832908490600401612a3e565b60206040518083038186803b15801561184a57600080fd5b505afa15801561185e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061188291906125c1565b611890576118906003610ed6565b600254604051633ecdecc760e21b81526000916001600160a01b03169063fb37b31c906118c1908590600401612a3e565b602060405180830381600087803b1580156118db57600080fd5b505af11580156118ef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061191391906125c1565b90508061082557610825617530606461192e61083786611198565b0201611f34565b606061051c8260405160200161194b919061295e565b604051602081830303815290604052611f54565b606061051c61196d83611fa6565b611f54565b6060600061197f836120aa565b905061198d815160c06121aa565b8160405160200161199f9291906129d0565b604051602081830303815290604052915050919050565b90565b6040805160608082018352600e546001600160a01b039081168352600f549081166020840152600160a01b900460ff1615159282019290925260009190611a0081896122fa565b6011546000611a0e89611ef1565b60118190559050600060608715611aca57604051309063fcb6829b60e01b90611a3f908e908d908f90602401612c08565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051611a7d91906129b4565b6000604051808303816000865af19150503d8060008114611aba576040519150601f19603f3d011682016040523d82523d6000602084013e611abf565b606091505b509092509050611b2d565b896001600160a01b03168b8a604051611ae391906129b4565b60006040518083038160008787f1925050503d8060008114611b21576040519150601f19603f3d011682016040523d82523d6000602084013e611b26565b606091505b5090925090505b611b378c866122fa565b60115482611c0f57600080600080611b4e866123ae565b929650909450925090506003846007811115611b6657fe5b1415611b7557611b7584610ed6565b6001846007811115611b8357fe5b1480611b9a57506004846007811115611b9857fe5b145b80611bb057506006846007811115611bae57fe5b145b80611bc657506007846007811115611bc457fe5b145b15611bd15760108290555b6001846007811115611bdf57fe5b1480611be857508c5b15611bf557809550611c08565b6040518060200160405280600081525095505b5090925050505b90920390920360115590999098509650505050505050565b611c3182826116b3565b60025460405163af3dc01160e01b81526000916001600160a01b03169063af3dc01190611c649086908690600401612a76565b602060405180830381600087803b158015611c7e57600080fd5b505af1158015611c92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cb691906125c1565b905080610df257611cc683611de2565b600260009054906101000a90046001600160a01b03166001600160a01b031663c3fd9b256040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611d1657600080fd5b505af1158015611d2a573d6000803e3d6000fd5b50505050610df2614e20611f34565b60606000836007811115611d4957fe5b1415611d645750604080516020810190915260008152610bdb565b6003836007811115611d7257fe5b1415611db057604080516020808201835260008083529251611d9a9387939092839201612b34565b6040516020818303038152906040529050610bdb565b601154601054604051611dcb92869290918690602001612b70565b604051602081830303815290604052905092915050565b611deb816117ee565b60025460405163011b1f7960e41b81526000916001600160a01b0316906311b1f79090611e1c908590600401612a3e565b602060405180830381600087803b158015611e3657600080fd5b505af1158015611e4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e6e91906125c1565b90508061082557600260009054906101000a90046001600160a01b03166001600160a01b03166333f943056040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611ec557600080fd5b505af1158015611ed9573d6000803e3d6000fd5b50505050610825617530606461192e61083786611198565b60005a8210611f00575a61051c565b5090565b600454600090831115611f1957506000610bdb565b600354831015611f2b57506000610bdb565b50600192915050565b601154811115611f4857611f486002610ed6565b60118054919091039055565b60608082516001148015611f7c5750608083600081518110611f7257fe5b016020015160f81c105b15611f8857508161051c565b611f94835160806121aa565b83604051602001611dcb9291906129d0565b6060600082604051602001611fbb9190612a35565b604051602081830303815290604052905060005b602081101561200557818181518110611fe457fe5b01602001516001600160f81b03191615611ffd57612005565b600101611fcf565b6000816020036001600160401b038111801561202057600080fd5b506040519080825280601f01601f19166020018201604052801561204b576020820181803683370190505b50905060005b81518110156120a157835160018401938591811061206b57fe5b602001015160f81c60f81b82828151811061208257fe5b60200101906001600160f81b031916908160001a905350600101612051565b50949350505050565b60608151600014156120cb575060408051600081526020810190915261051f565b6000805b83518110156120fe578381815181106120e457fe5b6020026020010151518201915080806001019150506120cf565b6000826001600160401b038111801561211657600080fd5b506040519080825280601f01601f191660200182016040528015612141576020820181803683370190505b50600092509050602081015b85518310156120a157600086848151811061216457fe5b60200260200101519050600060208201905061218283828451612401565b87858151811061218e57fe5b602002602001015151830192505050828060010193505061214d565b6060806038841015612204576040805160018082528183019092529060208201818036833701905050905082840160f81b816000815181106121e857fe5b60200101906001600160f81b031916908160001a905350610bd8565b600060015b80868161221257fe5b04156122275760019091019061010002612209565b816001016001600160401b038111801561224057600080fd5b506040519080825280601f01601f19166020018201604052801561226b576020820181803683370190505b50925084820160370160f81b8360008151811061228457fe5b60200101906001600160f81b031916908160001a905350600190505b8181116122f0576101008183036101000a87816122b957fe5b04816122c157fe5b0660f81b8382815181106122d157fe5b60200101906001600160f81b031916908160001a9053506001016122a0565b5050905092915050565b805182516001600160a01b03908116911614612332578051600e80546001600160a01b0319166001600160a01b039092169190911790555b80602001516001600160a01b031682602001516001600160a01b031614612378576020810151600f80546001600160a01b0319166001600160a01b039092169190911790555b8060400151151582604001511515146108255760400151600f8054911515600160a01b0260ff60a01b1990921691909117905550565b600080600060608451600014156123dd57505060408051602081019091526000808252925082915081906123fa565b848060200190518101906123f191906126ef565b93509350935093505b9193509193565b8282825b60208110612424578151835260209283019290910190601f1901612405565b905182516020929092036101000a6000190180199091169116179052505050565b600061245861245384612c5c565b612c39565b905082815283838301111561246c57600080fd5b828260208301376000602084830101529392505050565b803561051f81612ca9565b600082601f83011261249e578081fd5b610bd883833560208501612445565b80356002811061051f57600080fd5b600060e082840312156124cd578081fd5b6124d760e0612c39565b905081358152602082013560208201526124f3604083016124ad565b604082015261250460608301612483565b606082015261251560808301612483565b608082015260a082013560a082015260c08201356001600160401b0381111561253d57600080fd5b6125498482850161248e565b60c08301525092915050565b600060208284031215612566578081fd5b8135610bd881612ca9565b600060208284031215612582578081fd5b8151610bd881612ca9565b6000806000606084860312156125a1578182fd5b83356125ac81612ca9565b95602085013595506040909401359392505050565b6000602082840312156125d2578081fd5b81518015158114610bd8578182fd5b6000602082840312156125f2578081fd5b5035919050565b60006020828403121561260a578081fd5b5051919050565b60008060408385031215612623578182fd5b50508035926020909101359150565b60008060008060808587031215612647578081fd5b84359350602085013560ff8116811461265e578182fd5b93969395505050506040820135916060013590565b600060208284031215612684578081fd5b81356001600160401b03811115612699578182fd5b6126a58482850161248e565b949350505050565b600080604083850312156126bf578182fd5b82356001600160401b038111156126d4578283fd5b6126e08582860161248e565b95602094909401359450505050565b60008060008060808587031215612704578182fd5b845160088110612712578283fd5b80945050602085015192506040850151915060608501516001600160401b0381111561273c578182fd5b8501601f8101871361274c578182fd5b805161275a61245382612c5c565b81815288602083850101111561276e578384fd5b61277f826020830160208601612c7d565b9598949750929550505050565b60006020828403121561279d578081fd5b81356001600160401b038111156127b2578182fd5b8201601f810184136127c2578182fd5b6126a584823560208401612445565b600080604083850312156127e3578182fd5b82356001600160401b038111156127f8578283fd5b612804858286016124bc565b925050602083013561281581612ca9565b809150509250929050565b600080600060608486031215612834578081fd5b83356001600160401b03811115612849578182fd5b612855868287016124bc565b935050602084013561286681612ca9565b9150604084013561287681612ca9565b809150509250925092565b600080600060608486031215612895578081fd5b8335925060208401356128a781612ca9565b915060408401356001600160401b038111156128c1578182fd5b6128cd8682870161248e565b9150509250925092565b6000806000606084860312156128eb578081fd5b8335925060208401356001600160401b03811115612907578182fd5b6129138682870161248e565b925050604084013561287681612ca9565b6000815180845261293c816020860160208601612c7d565b601f01601f19169290920160200192915050565b6008811061295a57fe5b9052565b60609190911b6bffffffffffffffffffffffff1916815260140190565b6001600160f81b031994909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b600082516129c6818460208701612c7d565b9190910192915050565b600083516129e2818460208801612c7d565b8351908301906129f6818360208801612c7d565b01949350505050565b6c600d380380600d6000396000f360981b81528151600090612a2881600d850160208701612c7d565b91909101600d0192915050565b90815260200190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b03831681526040602082018190526000906126a590830184612924565b60008315158252604060208301526126a56040830184612924565b93845260ff9290921660208401526040830152606082015260800190565b600060208252610bd86020830184612924565b6020810160028310612b2e57fe5b91905290565b6000612b408287612950565b60ff8516602083015260ff8416604083015260806060830152612b666080830184612924565b9695505050505050565b6000612b7c8287612950565b84602083015283604083015260806060830152612b666080830184612924565b60208082526046908201527f4f6e6c792061757468656e746963617465642061646472657373657320696e2060408201527f6f766d53746174654d616e616765722063616e2063616c6c20746869732066756060820152653731ba34b7b760d11b608082015260a00190565b600084825260606020830152612c216060830185612924565b905060018060a01b0383166040830152949350505050565b6040518181016001600160401b0381118282101715612c5457fe5b604052919050565b60006001600160401b03821115612c6f57fe5b50601f01601f191660200190565b60005b83811015612c98578181015183820152602001612c80565b838111156107995750506000910152565b6001600160a01b038116811461053e57600080fdfe5369676e61747572652070726f766964656420666f7220454f4120636f6e7472616374206372656174696f6e20697320696e76616c69642e436f6e7472616374206372656174696f6e20636f646520636f6e7461696e7320756e73616665206f70636f6465732e2044696420796f75207573652074686520726967687420636f6d70696c6572206f72207061737320616e20756e7361666520636f6e7374727563746f7220617267756d656e743f4120636f6e74726163742068617320616c7265616479206265656e206465706c6f79656420746f20746869732061646472657373436f6e7374727563746f7220617474656d7074656420746f206465706c6f7920756e736166652062797465636f64652ea2646970667358221220d8d7793db294565fc54ab1c9bb5a859a63bd13d82487c00d15922977b1ab32ed64736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"CALL_WITH_VALUE_INTRINSIC_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMaxTransactionGasLimit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxTransactionGasLimit\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ovmADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_ADDRESS\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"name\":\"ovmBALANCE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_BALANCE\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"},{\"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\":[{\"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\":\"ovmCALLVALUE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_CALLVALUE\",\"type\":\"uint256\"}],\"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\":\"\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_bytecode\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"ovmCREATE2\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"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\":\"ovmINCREMENTNONCE\",\"outputs\":[],\"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\":[],\"name\":\"ovmSELFBALANCE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_BALANCE\",\"type\":\"uint256\"}],\"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\":\"\",\"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\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_creationCode\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"}],\"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\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"},{\"internalType\":\"contract iOVM_StateManager\",\"name\":\"_ovmStateManager\",\"type\":\"address\"}],\"name\":\"simulateMessage\",\"outputs\":[{\"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.\"}},\"ovmBALANCE(address)\":{\"params\":{\"_contract\":\"Address of the contract to query the OVM_ETH balance of.\"},\"returns\":{\"_BALANCE\":\"OVM_ETH balance of the requested contract.\"}},\"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).\"}},\"ovmCALL(uint256,address,uint256,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.\",\"_value\":\"ETH value to pass with the 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.\"}},\"ovmCALLVALUE()\":{\"returns\":{\"_CALLVALUE\":\"Value sent along with the call according to 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\":{\"_0\":\"Address of the created contract.\",\"_1\":\"Revert data, if and only if the creation threw an exception.\"}},\"ovmCREATE2(bytes,bytes32)\":{\"params\":{\"_bytecode\":\"Code to be used to CREATE2 a new contract.\",\"_salt\":\"Value used to determine the contract's address.\"},\"returns\":{\"_0\":\"Address of the created contract.\",\"_1\":\"Revert data, if and only if the creation threw an exception.\"}},\"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\":\"Enum indicating 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.\"}},\"ovmSELFBALANCE()\":{\"returns\":{\"_BALANCE\":\"OVM_ETH balance of the requesting 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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"run((uint256,uint256,uint8,address,address,uint256,bytes),address)\":{\"params\":{\"_ovmStateManager\":\"iOVM_StateManager implementation providing account state.\",\"_transaction\":\"Transaction data to be executed.\"}},\"safeCREATE(bytes,address)\":{\"params\":{\"_address\":\"OVM address being deployed to.\",\"_creationCode\":\"Code to pass into CREATE for deployment.\"}},\"simulateMessage((uint256,uint256,uint8,address,address,uint256,bytes),address,uint256,address)\":{\"params\":{\"_from\":\"the OVM account the simulated call should be from.\",\"_ovmStateManager\":\"the address of the OVM_StateManager precompile in the L2 state.\",\"_transaction\":\"the message transaction to simulate.\",\"_value\":\"the amount of ETH value to send.\"}}},\"stateVariables\":{\"CONTAINER_CONTRACT_PREFIX\":{\"details\":\"The Execution Manager and State Manager each have this 30 byte prefix, and are uncallable.\"}},\"title\":\"OVM_ExecutionManager\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"ovmADDRESS()\":{\"notice\":\"Overrides ADDRESS.\"},\"ovmBALANCE(address)\":{\"notice\":\"Overrides BALANCE. NOTE: In the future, this could be optimized to directly invoke EM._getContractStorage(...).\"},\"ovmCALL(uint256,address,bytes)\":{\"notice\":\"Legacy ovmCALL function which did not support ETH value; this maintains backwards compatibility.\"},\"ovmCALL(uint256,address,uint256,bytes)\":{\"notice\":\"Overrides CALL.\"},\"ovmCALLER()\":{\"notice\":\"Overrides CALLER.\"},\"ovmCALLVALUE()\":{\"notice\":\"Overrides CALLVALUE.\"},\"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.\"},\"ovmINCREMENTNONCE()\":{\"notice\":\"Bumps the nonce of the current ovmADDRESS by one.\"},\"ovmL1QUEUEORIGIN()\":{\"notice\":\"Specifies from which source (Sequencer or 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.\"},\"ovmSELFBALANCE()\":{\"notice\":\"Overrides SELFBALANCE.\"},\"ovmSLOAD(bytes32)\":{\"notice\":\"Overrides SLOAD.\"},\"ovmSSTORE(bytes32,bytes32)\":{\"notice\":\"Overrides SSTORE.\"},\"ovmSTATICCALL(uint256,address,bytes)\":{\"notice\":\"Overrides STATICCALL.\"},\"ovmTIMESTAMP()\":{\"notice\":\"Overrides TIMESTAMP.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"run((uint256,uint256,uint8,address,address,uint256,bytes),address)\":{\"notice\":\"Starts the execution of a transaction via the OVM_ExecutionManager.\"},\"safeCREATE(bytes,address)\":{\"notice\":\"Handles the creation-specific safety measures required for OVM contract deployment. This function sanitizes the return types for creation messages to match calls (bool, bytes), by being an external function which the EM can call, that mimics the success/fail case of the CREATE. This allows for consistent handling of both types of messages in _handleExternalMessage(). Having this step occur as a separate call frame also allows us to easily revert the contract deployment in the event that the code is unsafe.\"},\"simulateMessage((uint256,uint256,uint8,address,address,uint256,bytes),address,uint256,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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow, so we distribute\\n return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);\\n }\\n}\\n\",\"keccak256\":\"0x363bd3b45201f07c9b71c2edc96533468cf14a3d029fabd82fddceb1eb3ebd9c\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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_Bytes32Utils } from \\\"../../libraries/utils/Lib_Bytes32Utils.sol\\\";\\nimport { Lib_EthUtils } from \\\"../../libraries/utils/Lib_EthUtils.sol\\\";\\nimport { Lib_ErrorUtils } from \\\"../../libraries/utils/Lib_ErrorUtils.sol\\\";\\nimport { Lib_PredeployAddresses } from \\\"../../libraries/constants/Lib_PredeployAddresses.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_DeployerWhitelist } from \\\"../predeploys/OVM_DeployerWhitelist.sol\\\";\\n\\n/* External Imports */\\nimport { Math } from \\\"@openzeppelin/contracts/math/Math.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 * Native Value Constants *\\n **************************/\\n\\n // Public so we can access and make assertions in integration tests.\\n uint256 public constant CALL_WITH_VALUE_INTRINSIC_GAS = 90000;\\n\\n\\n /**************************\\n * Default Context Values *\\n **************************/\\n\\n uint256 constant DEFAULT_UINT256 = 0xdefa017defa017defa017defa017defa017defa017defa017defa017defa017d;\\n address constant DEFAULT_ADDRESS = 0xdEfa017defA017DeFA017DEfa017DeFA017DeFa0;\\n\\n\\n /*************************************\\n * Container Contract Address Prefix *\\n *************************************/\\n\\n /**\\n * @dev The Execution Manager and State Manager each have this 30 byte prefix, and are uncallable.\\n */\\n address constant CONTAINER_CONTRACT_PREFIX = 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000;\\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 Lib_AddressResolver(_libAddressManager)\\n {\\n ovmSafetyChecker = iOVM_SafetyChecker(resolve(\\\"OVM_SafetyChecker\\\"));\\n gasMeterConfig = _gasMeterConfig;\\n globalContext = _globalContext;\\n _resetContext();\\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 external\\n returns (\\n bytes memory\\n )\\n {\\n // Make sure that run() is not re-enterable. This condition should always be satisfied\\n // Once run has been called once, due to the behavior of _isValidInput().\\n if (transactionContext.ovmNUMBER != DEFAULT_UINT256) {\\n return bytes(\\\"\\\");\\n }\\n\\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 (_isValidInput(_transaction) == false) {\\n _resetContext();\\n return bytes(\\\"\\\");\\n }\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\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 (, bytes memory returndata) = ovmCALL(\\n _transaction.gasLimit - gasMeterConfig.minTransactionGasLimit,\\n _transaction.entrypoint,\\n 0,\\n _transaction.data\\n );\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\n // // Update the cumulative gas based on the amount of gas used.\\n // uint256 gasUsed = gasProvided - gasleft();\\n // _updateCumulativeGas(gasUsed, _transaction.l1QueueOrigin);\\n\\n // Wipe the execution context.\\n _resetContext();\\n\\n return returndata;\\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 external\\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 CALLVALUE.\\n * @return _CALLVALUE Value sent along with the call according to the current message context.\\n */\\n function ovmCALLVALUE()\\n override\\n public\\n view\\n returns (\\n uint256 _CALLVALUE\\n )\\n {\\n return messageContext.ovmCALLVALUE;\\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 external\\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 external\\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 external\\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 external\\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 source (Sequencer or Queue) this transaction originated from.\\n * @return _queueOrigin Enum indicating the ovmL1QUEUEORIGIN within the current message context.\\n */\\n function ovmL1QUEUEORIGIN()\\n override\\n external\\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 external\\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 Address of the created contract.\\n * @return Revert data, if and only if the creation threw an exception.\\n */\\n function ovmCREATE(\\n bytes memory _bytecode\\n )\\n override\\n public\\n notStatic\\n fixedGasDiscount(40000)\\n returns (\\n address,\\n bytes memory\\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 MessageType.ovmCREATE\\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 Address of the created contract.\\n * @return Revert data, if and only if the creation threw an exception.\\n */\\n function ovmCREATE2(\\n bytes memory _bytecode,\\n bytes32 _salt\\n )\\n override\\n external\\n notStatic\\n fixedGasDiscount(40000)\\n returns (\\n address,\\n bytes memory\\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 MessageType.ovmCREATE2\\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 external\\n returns (\\n uint256 _nonce\\n )\\n {\\n return _getAccountNonce(ovmADDRESS());\\n }\\n\\n /**\\n * Bumps the nonce of the current ovmADDRESS by one.\\n */\\n function ovmINCREMENTNONCE()\\n override\\n external\\n notStatic\\n {\\n address account = ovmADDRESS();\\n uint256 nonce = _getAccountNonce(account);\\n\\n // Prevent overflow.\\n if (nonce + 1 > nonce) {\\n _setAccountNonce(account, nonce + 1);\\n }\\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 // Creates a duplicate of the OVM_ProxyEOA located at 0x42....09. Uses the following\\n // \\\"magic\\\" prefix to deploy an exact copy of the code:\\n // PUSH1 0x0D # size of this prefix in bytes\\n // CODESIZE\\n // SUB # subtract prefix size from codesize\\n // DUP1\\n // PUSH1 0x0D\\n // PUSH1 0x00\\n // CODECOPY # copy everything after prefix into memory at pos 0\\n // PUSH1 0x00\\n // RETURN # return the copied code\\n address proxyEOA = Lib_EthUtils.createContract(abi.encodePacked(\\n hex\\\"600D380380600D6000396000f3\\\",\\n ovmEXTCODECOPY(\\n Lib_PredeployAddresses.PROXY_EOA,\\n 0,\\n ovmEXTCODESIZE(Lib_PredeployAddresses.PROXY_EOA)\\n )\\n ));\\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 _value ETH value to pass with the 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 uint256 _value,\\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 nextMessageContext.ovmCALLVALUE = _value;\\n\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata,\\n MessageType.ovmCALL\\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, valueless context.\\n MessageContext memory nextMessageContext = messageContext;\\n nextMessageContext.ovmCALLER = nextMessageContext.ovmADDRESS;\\n nextMessageContext.ovmADDRESS = _address;\\n nextMessageContext.isStatic = true;\\n nextMessageContext.ovmCALLVALUE = 0;\\n\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata,\\n MessageType.ovmSTATICCALL\\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\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata,\\n MessageType.ovmDELEGATECALL\\n );\\n }\\n\\n /**\\n * @notice Legacy ovmCALL function which did not support ETH value; this maintains backwards compatibility.\\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 returns(\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n // Legacy ovmCALL assumed always-0 value.\\n return ovmCALL(\\n _gasLimit,\\n _address,\\n 0,\\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 external\\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 external\\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 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 external\\n returns (\\n bytes32 _EXTCODEHASH\\n )\\n {\\n return Lib_EthUtils.getCodeHash(\\n _getAccountEthAddress(_contract)\\n );\\n }\\n\\n\\n /***************************************\\n * Public Functions: ETH Value Opcodes *\\n ***************************************/\\n\\n /**\\n * @notice Overrides BALANCE.\\n * NOTE: In the future, this could be optimized to directly invoke EM._getContractStorage(...).\\n * @param _contract Address of the contract to query the OVM_ETH balance of.\\n * @return _BALANCE OVM_ETH balance of the requested contract.\\n */\\n function ovmBALANCE(\\n address _contract\\n )\\n override\\n public\\n returns (\\n uint256 _BALANCE\\n )\\n {\\n // Easiest way to get the balance is query OVM_ETH as normal.\\n bytes memory balanceOfCalldata = abi.encodeWithSignature(\\n \\\"balanceOf(address)\\\",\\n _contract\\n );\\n\\n // Static call because this should be a read-only query.\\n (bool success, bytes memory returndata) = ovmSTATICCALL(\\n gasleft(),\\n Lib_PredeployAddresses.OVM_ETH,\\n balanceOfCalldata\\n );\\n\\n // All balanceOf queries should successfully return a uint, otherwise this must be an OOG.\\n if (!success || returndata.length != 32) {\\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\\n }\\n\\n // Return the decoded balance.\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * @notice Overrides SELFBALANCE.\\n * @return _BALANCE OVM_ETH balance of the requesting contract.\\n */\\n function ovmSELFBALANCE()\\n override\\n external\\n returns (\\n uint256 _BALANCE\\n )\\n {\\n return ovmBALANCE(ovmADDRESS());\\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 Whitelisting *\\n ********************************************/\\n\\n /**\\n * Checks whether the given address is on the whitelist 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 semantics perspective, this will appear 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) = ovmSTATICCALL(\\n gasleft(),\\n Lib_PredeployAddresses.DEPLOYER_WHITELIST,\\n abi.encodeWithSelector(\\n OVM_DeployerWhitelist.isDeployerAllowed.selector,\\n _deployerAddress\\n )\\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 Final OVM contract address.\\n * @return Revertdata, if and only if the creation threw an exception.\\n */\\n function _createContract(\\n address _contractAddress,\\n bytes memory _bytecode,\\n MessageType _messageType\\n )\\n internal\\n returns (\\n address,\\n bytes memory\\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 the common logic which occurs between call-type and create-type messages,\\n // passing in the creation bytecode and `true` to trigger create-specific logic.\\n (bool success, bytes memory data) = _handleExternalMessage(\\n nextMessageContext,\\n gasleft(),\\n _contractAddress,\\n _bytecode,\\n _messageType\\n );\\n\\n // Yellow paper requires that address returned is zero if the contract deployment fails.\\n return (\\n success ? _contractAddress : address(0),\\n data\\n );\\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 MessageType _messageType\\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(CONTAINER_CONTRACT_PREFIX)\\n ) {\\n // EVM does not return data in the success case, see: https://github.com/ethereum/go-ethereum/blob/aae7660410f0ef90279e14afaaf2f429fdc2a186/core/vm/instructions.go#L600-L604\\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 _handleExternalMessage(\\n _nextMessageContext,\\n _gasLimit,\\n codeContractAddress,\\n _calldata,\\n _messageType\\n );\\n }\\n\\n /**\\n * Handles all interactions which involve the execution manager calling out to untrusted code (both calls and creates).\\n * Ensures that OVM-related measures are enforced, including L2 gas refunds, nuisance gas, and flagged reversions.\\n *\\n * @param _nextMessageContext Message context to be used for the external message.\\n * @param _gasLimit Amount of gas to be passed into this message. NOTE: this argument is overwritten in some cases to avoid stack-too-deep.\\n * @param _contract OVM address being called or deployed to\\n * @param _data Data for the message (either calldata or creation code)\\n * @param _messageType What type of ovmOPCODE this message corresponds to.\\n * @return Whether or not the message (either a call or deployment) succeeded.\\n * @return Data returned by the message.\\n */\\n function _handleExternalMessage(\\n MessageContext memory _nextMessageContext,\\n // NOTE: this argument is overwritten in some cases to avoid stack-too-deep.\\n uint256 _gasLimit,\\n address _contract,\\n bytes memory _data,\\n MessageType _messageType\\n )\\n internal\\n returns (\\n bool,\\n bytes memory\\n )\\n {\\n uint256 messageValue = _nextMessageContext.ovmCALLVALUE;\\n // If there is value in this message, we need to transfer the ETH over before switching contexts.\\n if (\\n messageValue > 0\\n && _isValueType(_messageType)\\n ) {\\n // Handle out-of-intrinsic gas consistent with EVM behavior -- the subcall \\\"appears to revert\\\" if we don't have enough gas to transfer the ETH.\\n // Similar to dynamic gas cost of value exceeding gas here:\\n // https://github.com/ethereum/go-ethereum/blob/c503f98f6d5e80e079c1d8a3601d188af2a899da/core/vm/interpreter.go#L268-L273\\n if (gasleft() < CALL_WITH_VALUE_INTRINSIC_GAS) {\\n return (false, hex\\\"\\\");\\n }\\n\\n // If there *is* enough gas to transfer ETH, then we need to make sure this amount of gas is reserved (i.e. not\\n // given to the _contract.call below) to guarantee that _handleExternalMessage can't run out of gas.\\n // In particular, in the event that the call fails, we will need to transfer the ETH back to the sender.\\n // Taking the lesser of _gasLimit and gasleft() - CALL_WITH_VALUE_INTRINSIC_GAS guarantees that the second\\n // _attemptForcedEthTransfer below, if needed, always has enough gas to succeed.\\n _gasLimit = Math.min(\\n _gasLimit,\\n gasleft() - CALL_WITH_VALUE_INTRINSIC_GAS // Cannot overflow due to the above check.\\n );\\n\\n // Now transfer the value of the call.\\n // The target is interpreted to be the next message's ovmADDRESS account.\\n bool transferredOvmEth = _attemptForcedEthTransfer(\\n _nextMessageContext.ovmADDRESS,\\n messageValue\\n );\\n\\n // If the ETH transfer fails (should only be possible in the case of insufficient balance), then treat this as a revert.\\n // This mirrors EVM behavior, see https://github.com/ethereum/go-ethereum/blob/2dee31930c9977af2a9fcb518fb9838aa609a7cf/core/vm/evm.go#L298\\n if (!transferredOvmEth) {\\n return (false, hex\\\"\\\");\\n }\\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. `_contract` 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\\n bool success;\\n bytes memory returndata;\\n if (_isCreateType(_messageType)) {\\n // safeCREATE() is a function which replicates a CREATE message, but uses return values\\n // Which match that of CALL (i.e. bool, bytes). This allows many security checks to be\\n // to be shared between untrusted call and create call frames.\\n (success, returndata) = address(this).call{gas: _gasLimit}(\\n abi.encodeWithSelector(\\n this.safeCREATE.selector,\\n _data,\\n _contract\\n )\\n );\\n } else {\\n (success, returndata) = _contract.call{gas: _gasLimit}(_data);\\n }\\n\\n // If the message threw an exception, its value should be returned back to the sender.\\n // So, we force it back, BEFORE returning the messageContext to the previous addresses.\\n // This operation is part of the reason we \\\"reserved the intrinsic gas\\\" above.\\n if (\\n messageValue > 0\\n && _isValueType(_messageType)\\n && !success\\n ) {\\n bool transferredOvmEth = _attemptForcedEthTransfer(\\n prevMessageContext.ovmADDRESS,\\n messageValue\\n );\\n\\n // Since we transferred it in above and the call reverted, the transfer back should always pass.\\n // This code path should NEVER be triggered since we sent `messageValue` worth of OVM_ETH into the target\\n // and reserved sufficient gas to execute the transfer, but in case there is some edge case which has\\n // been missed, we revert the entire frame (and its parent) to make sure the ETH gets sent back.\\n if (!transferredOvmEth) {\\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\\n }\\n }\\n\\n // Switch back to the original message context now that we're out of the call and all OVM_ETH is in the right place.\\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. Additionally, we surface custom error messages\\n // to developers in the case of unsafe creations for improved devex.\\n // All other revert types return no data.\\n if (\\n flag == RevertFlag.INTENTIONAL_REVERT\\n || flag == RevertFlag.UNSAFE_BYTECODE\\n ) {\\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 * Handles the creation-specific safety measures required for OVM contract deployment.\\n * This function sanitizes the return types for creation messages to match calls (bool, bytes),\\n * by being an external function which the EM can call, that mimics the success/fail case of the CREATE.\\n * This allows for consistent handling of both types of messages in _handleExternalMessage().\\n * Having this step occur as a separate call frame also allows us to easily revert the\\n * contract deployment in the event that the code is unsafe.\\n *\\n * @param _creationCode Code to pass into CREATE for deployment.\\n * @param _address OVM address being deployed to.\\n */\\n function safeCREATE(\\n bytes memory _creationCode,\\n address _address\\n )\\n external\\n {\\n // The only way this should callable is from within _createContract(),\\n // and it should DEFINITELY not be callable by a non-EM code contract.\\n if (msg.sender != address(this)) {\\n return;\\n }\\n // Check that there is not already code at this address.\\n if (_hasEmptyAccount(_address) == false) {\\n // Note: in the EVM, this case burns all allotted gas. For improved\\n // developer experience, we do return the remaining gas.\\n _revertWithFlag(\\n RevertFlag.CREATE_COLLISION\\n );\\n }\\n\\n // Check the creation bytecode against the OVM_SafetyChecker.\\n if (ovmSafetyChecker.isBytecodeSafe(_creationCode) == false) {\\n // Note: in the EVM, this case burns all allotted gas. For improved\\n // developer experience, we do return the remaining gas.\\n _revertWithFlag(\\n RevertFlag.UNSAFE_BYTECODE,\\n Lib_ErrorUtils.encodeRevertString(\\\"Contract creation code contains unsafe opcodes. Did you use the right compiler or pass an unsafe constructor argument?\\\")\\n );\\n }\\n\\n // We always need to initialize the contract with the default account values.\\n _initPendingAccount(_address);\\n\\n // Actually execute the EVM create message.\\n // NOTE: The inline assembly below means we can NOT make any evm calls between here and then.\\n address ethAddress = Lib_EthUtils.createContract(_creationCode);\\n\\n if (ethAddress == address(0)) {\\n // If the creation fails, the EVM lets us grab its revert data. This may contain a revert flag\\n // to be used above in _handleExternalMessage, so we pass the revert data back up unmodified.\\n assembly {\\n returndatacopy(0,0,returndatasize())\\n revert(0, returndatasize())\\n }\\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(\\n RevertFlag.UNSAFE_BYTECODE,\\n Lib_ErrorUtils.encodeRevertString(\\\"Constructor attempted to deploy unsafe bytecode.\\\")\\n );\\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 * Internal Functions: Value Manipulation *\\n ******************************************/\\n\\n /**\\n * Invokes an ovmCALL to OVM_ETH.transfer on behalf of the current ovmADDRESS, allowing us to force movement of OVM_ETH in correspondence with ETH's native value functionality.\\n * WARNING: this will send on behalf of whatever the messageContext.ovmADDRESS is in storage at the time of the call.\\n * NOTE: In the future, this could be optimized to directly invoke EM._setContractStorage(...).\\n * @param _to Amount of OVM_ETH to be sent.\\n * @param _value Amount of OVM_ETH to send.\\n * @return _success Whether or not the transfer worked.\\n */\\n function _attemptForcedEthTransfer(\\n address _to,\\n uint256 _value\\n )\\n internal\\n returns(\\n bool _success\\n )\\n {\\n bytes memory transferCalldata = abi.encodeWithSignature(\\n \\\"transfer(address,uint256)\\\",\\n _to,\\n _value\\n );\\n\\n // OVM_ETH inherits from the UniswapV2ERC20 standard. In this implementation, its return type\\n // is a boolean. However, the implementation always returns true if it does not revert.\\n // Thus, success of the call frame is sufficient to infer success of the transfer itself.\\n (bool success, ) = ovmCALL(\\n gasleft(),\\n Lib_PredeployAddresses.OVM_ETH,\\n 0,\\n transferCalldata\\n );\\n\\n return success;\\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 ) {\\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 view\\n {\\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 input values of a transaction.\\n * @return _valid Whether or not the transaction data is valid.\\n */\\n function _isValidInput(\\n Lib_OVMCodec.Transaction memory _transaction\\n )\\n view\\n internal\\n returns (\\n bool\\n )\\n {\\n // Prevent reentrancy to run():\\n // This check prevents calling run with the default ovmNumber.\\n // Combined with the first check in run():\\n // if (transactionContext.ovmNUMBER != DEFAULT_UINT256) { return; }\\n // It should be impossible to re-enter since run() returns before any other call frames are created.\\n // Since this value is already being written to storage, we save much gas compared to\\n // using the standard nonReentrant pattern.\\n if (_transaction.blockNumber == DEFAULT_UINT256) {\\n return false;\\n }\\n\\n if (_isValidGasLimit(_transaction.gasLimit, _transaction.l1QueueOrigin) == false) {\\n return false;\\n }\\n\\n return true;\\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 view\\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 // These conditionals allow us to avoid unneccessary SSTOREs. However, they do mean that the current storage\\n // value for the messageContext MUST equal the _prevMessageContext argument, or an SSTORE might be erroneously skipped.\\n if (_prevMessageContext.ovmCALLER != _nextMessageContext.ovmCALLER) {\\n messageContext.ovmCALLER = _nextMessageContext.ovmCALLER;\\n }\\n\\n if (_prevMessageContext.ovmADDRESS != _nextMessageContext.ovmADDRESS) {\\n messageContext.ovmADDRESS = _nextMessageContext.ovmADDRESS;\\n }\\n\\n if (_prevMessageContext.isStatic != _nextMessageContext.isStatic) {\\n messageContext.isStatic = _nextMessageContext.isStatic;\\n }\\n\\n if (_prevMessageContext.ovmCALLVALUE != _nextMessageContext.ovmCALLVALUE) {\\n messageContext.ovmCALLVALUE = _nextMessageContext.ovmCALLVALUE;\\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 = DEFAULT_ADDRESS;\\n transactionContext.ovmTIMESTAMP = DEFAULT_UINT256;\\n transactionContext.ovmNUMBER = DEFAULT_UINT256;\\n transactionContext.ovmGASLIMIT = DEFAULT_UINT256;\\n transactionContext.ovmTXGASLIMIT = DEFAULT_UINT256;\\n transactionContext.ovmL1QUEUEORIGIN = Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE;\\n\\n transactionRecord.ovmGasRefund = DEFAULT_UINT256;\\n\\n messageContext.ovmCALLER = DEFAULT_ADDRESS;\\n messageContext.ovmADDRESS = DEFAULT_ADDRESS;\\n messageContext.isStatic = false;\\n\\n messageRecord.nuisanceGasLeft = DEFAULT_UINT256;\\n\\n // Reset the ovmStateManager.\\n ovmStateManager = iOVM_StateManager(address(0));\\n }\\n\\n\\n /******************************************\\n * Internal Functions: Message Typechecks *\\n ******************************************/\\n\\n /**\\n * Returns whether or not the given message type is a CREATE-type.\\n * @param _messageType the message type in question.\\n */\\n function _isCreateType(\\n MessageType _messageType\\n )\\n internal\\n pure\\n returns(\\n bool\\n )\\n {\\n return (\\n _messageType == MessageType.ovmCREATE\\n || _messageType == MessageType.ovmCREATE2\\n );\\n }\\n\\n /**\\n * Returns whether or not the given message type (potentially) requires the transfer of ETH value along with the message.\\n * @param _messageType the message type in question.\\n */\\n function _isValueType(\\n MessageType _messageType\\n )\\n internal\\n pure\\n returns(\\n bool\\n )\\n {\\n // ovmSTATICCALL and ovmDELEGATECALL types do not accept or transfer value.\\n return (\\n _messageType == MessageType.ovmCALL\\n || _messageType == MessageType.ovmCREATE\\n || _messageType == MessageType.ovmCREATE2\\n );\\n }\\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 * @param _value the amount of ETH value to send.\\n * @param _ovmStateManager the address of the OVM_StateManager precompile in the L2 state.\\n */\\n function simulateMessage(\\n Lib_OVMCodec.Transaction memory _transaction,\\n address _from,\\n uint256 _value,\\n iOVM_StateManager _ovmStateManager\\n )\\n external\\n returns (\\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 // Initialize the EM's internal state, ignoring nuisance gas.\\n ovmStateManager = _ovmStateManager;\\n _initContext(_transaction);\\n messageRecord.nuisanceGasLeft = uint(-1);\\n\\n // Set the ovmADDRESS to the _from so that the subsequent call frame \\\"comes from\\\" them.\\n messageContext.ovmADDRESS = _from;\\n\\n // Execute the desired message.\\n bool isCreate = _transaction.entrypoint == address(0);\\n if (isCreate) {\\n (address created, bytes memory revertData) = ovmCREATE(_transaction.data);\\n if (created == address(0)) {\\n return abi.encode(false, revertData);\\n } else {\\n // The eth_call RPC endpoint for to = undefined will return the deployed bytecode\\n // in the success case, differing from standard create messages.\\n return abi.encode(true, Lib_EthUtils.getCode(created));\\n }\\n } else {\\n (bool success, bytes memory returndata) = ovmCALL(\\n _transaction.gasLimit,\\n _transaction.entrypoint,\\n _value,\\n _transaction.data\\n );\\n return abi.encode(success, returndata);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x166912c588f2871fd2825ea9288cb3d50a888d4fcafd9fe3cc4461df839acf70\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/predeploys/OVM_DeployerWhitelist.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Interface Imports */\\nimport { iOVM_DeployerWhitelist } from \\\"../../iOVM/predeploys/iOVM_DeployerWhitelist.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: optimistic-solc\\n * Runtime target: OVM\\n */\\ncontract OVM_DeployerWhitelist is iOVM_DeployerWhitelist {\\n\\n /**********************\\n * Contract Constants *\\n **********************/\\n\\n bool public initialized;\\n bool public allowArbitraryDeployment;\\n address override public owner;\\n mapping (address => bool) public whitelist;\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Blocks functions to anyone except the contract owner.\\n */\\n modifier onlyOwner() {\\n require(\\n msg.sender == 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 external\\n {\\n if (initialized == true) {\\n return;\\n }\\n\\n initialized = true;\\n allowArbitraryDeployment = _allowArbitraryDeployment;\\n owner = _owner;\\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 external\\n onlyOwner\\n {\\n whitelist[_deployer] = _isWhitelisted;\\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 owner = _owner;\\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 allowArbitraryDeployment = _allowArbitraryDeployment;\\n }\\n\\n /**\\n * Permanently enables arbitrary contract deployment and deletes the owner.\\n */\\n function enableArbitraryContractDeployment()\\n override\\n external\\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 external\\n returns (\\n bool\\n )\\n {\\n return (\\n initialized == false\\n || allowArbitraryDeployment == true\\n || whitelist[_deployer]\\n );\\n }\\n}\\n\",\"keccak256\":\"0xb96bfb8eb24503b05de41483cc9fb7a7f81107aa1ca146dc281952f8100848a0\",\"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 OUT_OF_GAS,\\n INTENTIONAL_REVERT,\\n EXCEEDS_NUISANCE_GAS,\\n INVALID_STATE_ACCESS,\\n UNSAFE_BYTECODE,\\n CREATE_COLLISION,\\n STATIC_VIOLATION,\\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 enum MessageType {\\n ovmCALL,\\n ovmSTATICCALL,\\n ovmDELEGATECALL,\\n ovmCREATE,\\n ovmCREATE2\\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 uint256 ovmCALLVALUE;\\n bool isStatic;\\n }\\n\\n struct MessageRecord {\\n uint256 nuisanceGasLeft;\\n }\\n\\n\\n /************************************\\n * Transaction Execution Entrypoint *\\n ************************************/\\n\\n function run(\\n Lib_OVMCodec.Transaction calldata _transaction,\\n address _txStateManager\\n ) external returns (bytes memory);\\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 ovmCALLVALUE() external view returns (uint _callValue);\\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, bytes memory _revertdata);\\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract, bytes memory _revertdata);\\n\\n\\n /*******************************\\n * Account Abstraction Opcodes *\\n ******************************/\\n\\n function ovmGETNONCE() external returns (uint256 _nonce);\\n function ovmINCREMENTNONCE() external;\\n function ovmCREATEEOA(bytes32 _messageHash, uint8 _v, bytes32 _r, bytes32 _s) external;\\n\\n\\n /****************************\\n * Contract Calling Opcodes *\\n ****************************/\\n\\n // Valueless ovmCALL for maintaining backwards compatibility with legacy OVM bytecode.\\n function ovmCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\\n function ovmCALL(uint256 _gasLimit, address _address, uint256 _value, 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 * ETH Value Opcodes *\\n *********************/\\n\\n function ovmBALANCE(address _contract) external returns (uint256 _balance);\\n function ovmSELFBALANCE() external returns (uint256 _balance);\\n\\n\\n /***************************************\\n * Public Functions: Execution Context *\\n ***************************************/\\n\\n function getMaxTransactionGasLimit() external view returns (uint _maxTransactionGasLimit);\\n}\\n\",\"keccak256\":\"0x87a056425696719488dbd06adbbf89280d86651e75e1f77d9e96b0632c8634cc\",\"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/predeploys/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 owner() 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\":\"0xdf1f27faf0d26d416bf6d408d146a16de32b4e1772a292c65d39eb7ec2b53ceb\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_PredeployAddresses\\n */\\nlibrary Lib_PredeployAddresses {\\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\\n address internal constant ECDSA_CONTRACT_ACCOUNT = 0x4200000000000000000000000000000000000003;\\n address internal constant SEQUENCER_ENTRYPOINT = 0x4200000000000000000000000000000000000005;\\n address payable internal constant OVM_ETH = 0x4200000000000000000000000000000000000006;\\n address internal constant L2_CROSS_DOMAIN_MESSENGER = 0x4200000000000000000000000000000000000007;\\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\\n address internal constant EXECUTION_MANAGER_WRAPPER = 0x420000000000000000000000000000000000000B;\\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\\n address internal constant ERC1820_REGISTRY = 0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24;\\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\\n}\\n\",\"keccak256\":\"0x798dd3fe47c172880978c8e4d35573b25d5135be29a77584e9fac45845748695\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_ErrorUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/**\\n * @title Lib_ErrorUtils\\n */\\nlibrary Lib_ErrorUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes an error string into raw solidity-style revert data.\\n * (i.e. ascii bytes, prefixed with bytes4(keccak(\\\"Error(string))\\\"))\\n * Ref: https://docs.soliditylang.org/en/v0.8.2/control-structures.html?highlight=Error(string)#panic-via-assert-and-error-via-require\\n * @param _reason Reason for the reversion.\\n * @return Standard solidity revert data for the given reason.\\n */\\n function encodeRevertString(\\n string memory _reason\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return abi.encodeWithSignature(\\n \\\"Error(string)\\\",\\n _reason\\n );\\n }\\n}\\n\",\"keccak256\":\"0xfc64ec4a81fb50865b502a0004ed154e8598e1a313db77303fc95e41f536e6b7\",\"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 *\\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 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\\n )\\n {\\n bytes memory code;\\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 Full code of the contract.\\n */\\n function getCode(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes memory\\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 Size of the contract's code in bytes.\\n */\\n function getCodeSize(\\n address _address\\n )\\n internal\\n view\\n returns (\\n uint256\\n )\\n {\\n uint256 codeSize;\\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 Hash of the contract's code.\\n */\\n function getCodeHash(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n bytes32 codeHash;\\n assembly {\\n codeHash := extcodehash(_address)\\n }\\n\\n return codeHash;\\n }\\n\\n /**\\n * Creates a contract with some given initialization code.\\n * @param _code Contract initialization code.\\n * @return Address of the created contract.\\n */\\n function createContract(\\n bytes memory _code\\n )\\n internal\\n returns (\\n address\\n )\\n {\\n address created;\\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 to be generated by CREATE.\\n */\\n function getAddressForCREATE(\\n address _creator,\\n uint256 _nonce\\n )\\n internal\\n pure\\n returns (\\n 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 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 (\\n address\\n )\\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\":\"0xf29a67d78e61cb472d524b779b32cfcb39a587f4096500d5419e6425ed367d49\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50604051620034a0380380620034a0833981016040819052620000349162000297565b600080546001600160a01b0319166001600160a01b03851617905560408051808201909152601181527027ab26afa9b0b332ba3ca1b432b1b5b2b960791b60208201526200008290620000d7565b600180546001600160a01b0319166001600160a01b039290921691909117905581516003556020820151600455604082015160055560608201516006558051600755620000ce620001b9565b5050506200033c565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015620001395781810151838201526020016200011f565b50505050905090810190601f168015620001675780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156200018557600080fd5b505afa1580156200019a573d6000803e3d6000fd5b505050506040513d6020811015620001b157600080fd5b505192915050565b600d805473defa017defa017defa017defa017defa017defa06001600160a01b031991821681179092557fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d6009819055600a819055600b819055600c8190556008805460ff199081169091556012829055600e8054841685179055600f8054841690941790935560118054909316909255601391909155600280549091169055565b6000602082840312156200026d578081fd5b604051602081016001600160401b03811182821017156200028a57fe5b6040529151825250919050565b600080600083850360c0811215620002ad578384fd5b84516001600160a01b0381168114620002c4578485fd5b93506080601f1982011215620002d8578283fd5b50604051608081016001600160401b0381118282101715620002f657fe5b80604052506020850151815260408501516020820152606085015160408201526080850151606082015280925050620003338560a086016200025b565b90509250925092565b613154806200034c6000396000f3fe608060405234801561001057600080fd5b50600436106101fb5760003560e01c8063741a33eb1161011a578063996d79a5116100ad578063a8c4c5ec1161007c578063a8c4c5ec146103eb578063bdbf8c36146103f3578063c1fb2ea2146103fb578063f573102114610403578063ffe7391414610416576101fb565b8063996d79a5146103b557806399ccd98b146103bd5780639be3ad67146103d05780639dc9dc93146103e3576101fb565b80638435035b116100e95780638435035b146103745780638540661f1461038757806385979f761461039a57806390580256146103ad576101fb565b8063741a33eb14610326578063746c32f11461033957806376427cac146103595780637cebbe941461036c576101fb565b806322bd64c011610192578063461a447811610161578063461a4478146102e25780635a98c361146102f55780635b99d1c5146102fd578063735090641461031e576101fb565b806322bd64c01461029257806324749d5c146102a7578063299ca478146102ba5780632a2a7adb146102cf576101fb565b806314aa2ff7116101ce57806314aa2ff7146102595780631c4712a71461027a5780631f64338b1461028257806320160f3a1461028a576101fb565b806303daa9591461020057806308bf7dbf146102295780630a5635ae14610231578063101185a414610244575b600080fd5b61021361020e366004612924565b610429565b6040516102209190612dbe565b60405180910390f35b61021361046e565b61021361023f366004612898565b610480565b61024c610516565b6040516102209190612ed3565b61026c6102673660046129b6565b61051f565b604051610220929190612e39565b6102136105b1565b6102136105b7565b6102136105be565b6102a56102a0366004612954565b6105c4565b005b6102136102b5366004612898565b61061f565b6102c2610638565b6040516102209190612dc7565b6102a56102dd3660046129b6565b610647565b6102c26102f0366004612b16565b610655565b610213610731565b61031061030b366004612c4d565b610737565b604051610220929190612e5d565b6102c26107bd565b6102a5610334366004612975565b6107cc565b61034c6103473660046128d0565b610931565b6040516102209190612e96565b61034c610367366004612b8e565b61094e565b6102a5610a50565b610213610382366004612898565b610a9f565b610310610395366004612bf7565b610ab2565b6103106103a8366004612bf7565b610b39565b610213610b56565b6102c2610b5c565b61026c6103cb366004612a37565b610b6b565b61034c6103de366004612b5b565b610bf8565b6102c2610d5a565b610213610d69565b610213610d6f565b610213610d75565b6102a56104113660046129e8565b610d87565b610310610424366004612bf7565b610f50565b6000619c4060005a9050600061043d610b5c565b90506104498186610fa5565b93505060005a820390508083101561046657601280548483030190555b505050919050565b600061047b61023f610b5c565b905090565b600080826040516024016104949190612dc7565b60408051601f198184030181529190526020810180516001600160e01b03166370a0823160e01b17905290506000806104d55a6006602160991b0185610ab2565b915091508115806104e857508051602014155b156104f7576104f76000611033565b8080602001905181019061050b919061293c565b93505050505b919050565b60085460ff1690565b60115460009060609060ff1615156001141561053f5761053f6006611033565b619c4060005a90506000610551610b5c565b905061055c8161104c565b60006105708261056b846110e1565b61116c565b905061057e81886003611206565b95509550505060005a82039050808310156105a05760128054840190556105a9565b60128054820190555b505050915091565b60045490565b62015f9081565b600b5490565b60115460ff161515600114156105de576105de6006611033565b61ea6060005a905060006105f0610b5c565b90506105fd818686611290565b5060005a820390508083101561061857601280548483030190555b5050505050565b600061063261062d83611317565b6113a2565b92915050565b6000546001600160a01b031681565b6106526001826113a6565b50565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156106b557818101518382015260200161069d565b50505050905090810190601f1680156106e25780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156106ff57600080fd5b505afa158015610713573d6000803e3d6000fd5b505050506040513d602081101561072957600080fd5b505192915050565b600a5490565b60006060620186a060005a60408051608081018252600f5460115460ff16151560608301526001600160a01b0390811682528a166020820152908101889052909150610787818a8a8960006113bc565b945094505060005a82039050808310156107a85760128054840190556107b1565b60128054820190555b50505094509492505050565b600e546001600160a01b031690565b60115460ff161515600114156107e6576107e66006611033565b600060018585601b0185856040516000815260200160405260405161080e9493929190612e78565b6020604051602081039080840390855afa158015610830573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661086c5761086c60405180606001604052806038815260200161304160389139610647565b6108758161144d565b61087f575061092b565b610888816114d8565b600f80546001600160a01b038381166001600160a01b03198316179092551660006108e56108c16009602160991b018361034782610a9f565b6040516020016108d19190612d88565b60405160208183030381529060405261153f565b600f80546001600160a01b0319166001600160a01b038516179055905061091c838261091081611552565b80519060200120611568565b6109278360006115a5565b5050505b50505050565b606061094661093f85611317565b8484611616565b949350505050565b6060331561095b57600080fd5b600280546001600160a01b0319166001600160a01b03841617905561097f8561163a565b600019601355600f80546001600160a01b0319166001600160a01b0386811691909117909155608086015116158015610a1e576000806109c28860c0015161051f565b90925090506001600160a01b038216610a02576000816040516020016109e9929190612e5d565b6040516020818303038152906040529350505050610946565b6001610a0d83611552565b6040516020016109e9929190612e5d565b600080610a398860a001518960800151888b60c00151610737565b9150915081816040516020016109e9929190612e5d565b60115460ff16151560011415610a6a57610a6a6006611033565b6000610a74610b5c565b90506000610a81826110e1565b905080816001011115610a9b57610a9b82826001016115a5565b5050565b6000610632610aad83611317565b6116ac565b600060606201388060005a60408051608081018252600f546001600160a01b03908116825289166020820152600160608201819052600092820192909252919250610b049082908a908a908a906113bc565b945094505060005a8203905080831015610b25576012805484019055610b2e565b60128054820190555b505050935093915050565b60006060610b4a8585600086610737565b91509150935093915050565b60075490565b600f546001600160a01b031690565b60115460009060609060ff16151560011415610b8b57610b8b6006611033565b619c4060005a90506000610b9d610b5c565b9050610ba88161104c565b6000610bb58289896116b0565b9050610bc381896004611206565b95509550505060005a8203905080831015610be5576012805484019055610bee565b60128054820190555b5050509250929050565b600a546060907fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d14610c395750604080516020810190915260008152610632565b600280546001600160a01b0319166001600160a01b038481169190911791829055604051630d15d41560e41b815291169063d15d415090610c7e903390600401612dc7565b60206040518083038186803b158015610c9657600080fd5b505afa158015610caa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cce9190612904565b610cf35760405162461bcd60e51b8152600401610cea90612f4f565b60405180910390fd5b610cfc8361163a565b610d05836116f6565b610d2657610d11611752565b50604080516020810190915260008152610632565b6000610d486003600001548560a0015103856080015160008760c00151610737565b915050610d53611752565b9392505050565b600d546001600160a01b031690565b60105490565b60095490565b600061047b610d82610b5c565b6110e1565b333014610d9357610a9b565b610d9c8161144d565b610daa57610daa6005611033565b6001546040516352275acd60e11b81526001600160a01b039091169063a44eb59a90610dda908590600401612e96565b60206040518083038186803b158015610df257600080fd5b505afa158015610e06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2a9190612904565b610e5957610e596004610e546040518060a0016040528060768152602001613079607691396117f4565b6113a6565b610e62816114d8565b6000610e6d8361153f565b90506001600160a01b038116610e87573d6000803e3d6000fd5b6000610e9282611552565b6001546040516352275acd60e11b81529192506001600160a01b03169063a44eb59a90610ec3908490600401612e96565b60206040518083038186803b158015610edb57600080fd5b505afa158015610eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f139190612904565b610f3d57610f3d6004610e546040518060600160405280603081526020016130ef603091396117f4565b61092b8383610f4b856113a2565b611568565b60006060619c4060005a60408051608081018252600e546001600160a01b039081168252600f541660208201526010549181019190915260115460ff1615156060820152909150610b048189898960026113bc565b6000610fb18383611837565b600254604051631aaf392f60e01b81526001600160a01b0390911690631aaf392f90610fe39086908690600401612dff565b60206040518083038186803b158015610ffb57600080fd5b505afa15801561100f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d53919061293c565b61065281604051806020016040528060008152506113a6565b6000806110ab5a6002602160991b0163b1540a0160e01b866040516024016110749190612dc7565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610ab2565b915091506000818060200190518101906110c59190612904565b90508015806110d2575082155b1561092b5761092b6007611033565b60006110ec82611972565b60025460405163d126199f60e01b81526001600160a01b039091169063d126199f9061111c908590600401612dc7565b60206040518083038186803b15801561113457600080fd5b505afa158015611148573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610632919061293c565b60408051600280825260608201909252600091829190816020015b60608152602001906001900390816111875790505090506111a784611ab9565b816000815181106111b457fe5b60200260200101819052506111c883611ae3565b816001815181106111d557fe5b602002602001018190525060006111eb82611af6565b90506111fd8180519060200120611b3a565b95945050505050565b60006060611228611215610b5c565b611220610d82610b5c565b6001016115a5565b60408051608081018252600f546010549282019290925260115460ff16151560608201526001600160a01b0391821681529086166020820152600080611271835a8a8a8a611b3d565b9150915081611281576000611283565b875b9890975095505050505050565b8061129b8484610fa5565b14156112a657611312565b6112b08383611e9a565b600254604051635c17d62960e01b81526001600160a01b0390911690635c17d629906112e490869086908690600401612e18565b600060405180830381600087803b1580156112fe57600080fd5b505af1158015610927573d6000803e3d6000fd5b505050565b600061132282611972565b600254604051637c8ee70360e01b81526001600160a01b0390911690637c8ee70390611352908590600401612dc7565b60206040518083038186803b15801561136a57600080fd5b505afa15801561137e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063291906128b4565b3f90565b60006113b28383611fac565b9050805160208201fd5b6000606073ffffffffffffffffffffffffffffffffffff0000851673deaddeaddeaddeaddeaddeaddeaddeaddead0000141561140b575050604080516020810190915260008152600190611443565b60006064866001600160a01b03161061142c5761142786611317565b61142e565b855b905061143d8888838888611b3d565b92509250505b9550959350505050565b600061145882611972565b6002546040516307a1294560e01b81526001600160a01b03909116906307a1294590611488908590600401612dc7565b60206040518083038186803b1580156114a057600080fd5b505afa1580156114b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106329190612904565b6114e181611972565b600254604051637e78a4d160e11b81526001600160a01b039091169063fcf149a290611511908490600401612dc7565b600060405180830381600087803b15801561152b57600080fd5b505af1158015610618573d6000803e3d6000fd5b6000808251602084016000f09392505050565b6060610632826000611563856116ac565b611616565b61157183612055565b6002546040516368510af960e11b81526001600160a01b039091169063d0a215f2906112e490869086908690600401612ddb565b6115ae82612055565b6002546040516374855dc360e11b81526001600160a01b039091169063e90abb86906115e09085908590600401612dff565b600060405180830381600087803b1580156115fa57600080fd5b505af115801561160e573d6000803e3d6000fd5b505050505050565b6060806040519050602083018101604052828152828460208301873c949350505050565b80516009556020810151600a5560a0810151600c5560408101516008805460ff19166001838181111561166957fe5b02179055506060810151600d80546001600160a01b0319166001600160a01b03909216919091179055600554600b5560a08101516116a690612164565b60135550565b3b90565b60008060ff60f81b858486805190602001206040516020016116d59493929190612d04565b6040516020818303038152906040528051906020012090506111fd81611b3a565b60007fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d8260200151141561172c57506000610511565b61173e8260a001518360400151612177565b61174a57506000610511565b506001919050565b600d805473defa017defa017defa017defa017defa017defa06001600160a01b031991821681179092557fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d6009819055600a819055600b819055600c8190556008805460ff199081169091556012829055600e8054841685179055600f8054841690941790935560118054909316909255601391909155600280549091169055565b6060816040516024016118079190612e96565b60408051601f198184030181529190526020810180516001600160e01b031662461bcd60e51b1790529050919050565b6175305a101561184b5761184b6000611033565b600254604051630ad2267960e01b81526001600160a01b0390911690630ad226799061187d9085908590600401612dff565b60206040518083038186803b15801561189557600080fd5b505afa1580156118a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118cd9190612904565b6118db576118db6003611033565b600254604051632bcdee1960e21b81526000916001600160a01b03169063af37b8649061190e9086908690600401612dff565b602060405180830381600087803b15801561192857600080fd5b505af115801561193c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119609190612904565b90508061131257611312614e206121a7565b6175305a1015611986576119866000611033565b60025460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf906119b6908490600401612dc7565b60206040518083038186803b1580156119ce57600080fd5b505afa1580156119e2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a069190612904565b611a1457611a146003611033565b600254604051633ecdecc760e21b81526000916001600160a01b03169063fb37b31c90611a45908590600401612dc7565b602060405180830381600087803b158015611a5f57600080fd5b505af1158015611a73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a979190612904565b905080610a9b57610a9b6175306064611ab2610aad86611317565b02016121a7565b606061063282604051602001611acf9190612ce7565b6040516020818303038152906040526121c7565b6060610632611af183612219565b6121c7565b60606000611b038361231d565b9050611b11815160c061241d565b81604051602001611b23929190612d59565b604051602081830303815290604052915050919050565b90565b60408501516000906060908015801590611b5b5750611b5b8461256d565b15611bcb5762015f905a1015611b84575050604080516020810190915260008082529150611443565b611b938762015f905a036125af565b96506000611ba58960200151836125c5565b905080611bc957600060405180602001604052806000815250935093505050611443565b505b60408051608081018252600e546001600160a01b039081168252600f541660208201526010549181019190915260115460ff1615156060820152611c0f818a612627565b6013546000611c1d8a612164565b6013819055905060006060611c31896126e8565b15611ce857306001600160a01b03168c63f573102160e01b8c8e604051602401611c5c929190612ea9565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051611c9a9190612d3d565b60006040518083038160008787f1925050503d8060008114611cd8576040519150601f19603f3d011682016040523d82523d6000602084013e611cdd565b606091505b509092509050611d4b565b8a6001600160a01b03168c8b604051611d019190612d3d565b60006040518083038160008787f1925050503d8060008114611d3f576040519150601f19603f3d011682016040523d82523d6000602084013e611d44565b606091505b5090925090505b600086118015611d5f5750611d5f8961256d565b8015611d69575081155b15611d91576000611d7e8660200151886125c5565b905080611d8f57611d8f6000611033565b505b611d9b8d86612627565b60135482611e8157600080600080611db2866126f1565b929650909450925090506003846007811115611dca57fe5b1415611dd957611dd984611033565b6001846007811115611de757fe5b1480611dfe57506004846007811115611dfc57fe5b145b80611e1457506006846007811115611e1257fe5b145b80611e2a57506007846007811115611e2857fe5b145b15611e355760128290555b6001846007811115611e4357fe5b1480611e5a57506004846007811115611e5857fe5b145b15611e6757809550611e7a565b6040518060200160405280600081525095505b5090925050505b909203909203601355909a909950975050505050505050565b611ea48282611837565b60025460405163af3dc01160e01b81526000916001600160a01b03169063af3dc01190611ed79086908690600401612dff565b602060405180830381600087803b158015611ef157600080fd5b505af1158015611f05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f299190612904565b90508061131257611f3983612055565b600260009054906101000a90046001600160a01b03166001600160a01b031663c3fd9b256040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611f8957600080fd5b505af1158015611f9d573d6000803e3d6000fd5b50505050611312614e206121a7565b60606000836007811115611fbc57fe5b1415611fd75750604080516020810190915260008152610632565b6003836007811115611fe557fe5b14156120235760408051602080820183526000808352925161200d9387939092839201612ee7565b6040516020818303038152906040529050610632565b60135460125460405161203e92869290918690602001612f23565b604051602081830303815290604052905092915050565b61205e81611972565b60025460405163011b1f7960e41b81526000916001600160a01b0316906311b1f7909061208f908590600401612dc7565b602060405180830381600087803b1580156120a957600080fd5b505af11580156120bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120e19190612904565b905080610a9b57600260009054906101000a90046001600160a01b03166001600160a01b03166333f943056040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561213857600080fd5b505af115801561214c573d6000803e3d6000fd5b50505050610a9b6175306064611ab2610aad86611317565b60005a8210612173575a610632565b5090565b60045460009083111561218c57506000610632565b60035483101561219e57506000610632565b50600192915050565b6013548111156121bb576121bb6002611033565b60138054919091039055565b606080825160011480156121ef57506080836000815181106121e557fe5b016020015160f81c105b156121fb575081610632565b6122078351608061241d565b8360405160200161203e929190612d59565b606060008260405160200161222e9190612dbe565b604051602081830303815290604052905060005b60208110156122785781818151811061225757fe5b01602001516001600160f81b0319161561227057612278565b600101612242565b6000816020036001600160401b038111801561229357600080fd5b506040519080825280601f01601f1916602001820160405280156122be576020820181803683370190505b50905060005b81518110156123145783516001840193859181106122de57fe5b602001015160f81c60f81b8282815181106122f557fe5b60200101906001600160f81b031916908160001a9053506001016122c4565b50949350505050565b606081516000141561233e5750604080516000815260208101909152610511565b6000805b83518110156123715783818151811061235757fe5b602002602001015151820191508080600101915050612342565b6000826001600160401b038111801561238957600080fd5b506040519080825280601f01601f1916602001820160405280156123b4576020820181803683370190505b50600092509050602081015b85518310156123145760008684815181106123d757fe5b6020026020010151905060006020820190506123f583828451612744565b87858151811061240157fe5b60200260200101515183019250505082806001019350506123c0565b6060806038841015612477576040805160018082528183019092529060208201818036833701905050905082840160f81b8160008151811061245b57fe5b60200101906001600160f81b031916908160001a905350610d53565b600060015b80868161248557fe5b041561249a576001909101906101000261247c565b816001016001600160401b03811180156124b357600080fd5b506040519080825280601f01601f1916602001820160405280156124de576020820181803683370190505b50925084820160370160f81b836000815181106124f757fe5b60200101906001600160f81b031916908160001a905350600190505b818111612563576101008183036101000a878161252c57fe5b048161253457fe5b0660f81b83828151811061254457fe5b60200101906001600160f81b031916908160001a905350600101612513565b5050905092915050565b60008082600481111561257c57fe5b1480612594575060035b82600481111561259257fe5b145b80610632575060048260048111156125a857fe5b1492915050565b60008183106125be5781610d53565b5090919050565b60008083836040516024016125db929190612dff565b60408051601f198184030181529190526020810180516001600160e01b031663a9059cbb60e01b1790529050600061261d5a6006602160991b01600085610737565b5095945050505050565b805182516001600160a01b0390811691161461265f578051600e80546001600160a01b0319166001600160a01b039092169190911790555b80602001516001600160a01b031682602001516001600160a01b0316146126a5576020810151600f80546001600160a01b0319166001600160a01b039092169190911790555b8060600151151582606001511515146126cf5760608101516011805460ff19169115159190911790555b8060400151826040015114610a9b576040015160105550565b60006003612586565b60008060006060845160001415612720575050604080516020810190915260008082529250829150819061273d565b848060200190518101906127349190612a79565b93509350935093505b9193509193565b8282825b60208110612767578151835260209283019290910190601f1901612748565b905182516020929092036101000a6000190180199091169116179052505050565b600061279b61279684612fde565b612fbb565b90508281528383830111156127af57600080fd5b828260208301376000602084830101529392505050565b80356105118161302b565b600082601f8301126127e1578081fd5b610d5383833560208501612788565b80356002811061051157600080fd5b600060e08284031215612810578081fd5b61281a60e0612fbb565b90508135815260208201356020820152612836604083016127f0565b6040820152612847606083016127c6565b6060820152612858608083016127c6565b608082015260a082013560a082015260c08201356001600160401b0381111561288057600080fd5b61288c848285016127d1565b60c08301525092915050565b6000602082840312156128a9578081fd5b8135610d538161302b565b6000602082840312156128c5578081fd5b8151610d538161302b565b6000806000606084860312156128e4578182fd5b83356128ef8161302b565b95602085013595506040909401359392505050565b600060208284031215612915578081fd5b81518015158114610d53578182fd5b600060208284031215612935578081fd5b5035919050565b60006020828403121561294d578081fd5b5051919050565b60008060408385031215612966578182fd5b50508035926020909101359150565b6000806000806080858703121561298a578081fd5b84359350602085013560ff811681146129a1578182fd5b93969395505050506040820135916060013590565b6000602082840312156129c7578081fd5b81356001600160401b038111156129dc578182fd5b610946848285016127d1565b600080604083850312156129fa578182fd5b82356001600160401b03811115612a0f578283fd5b612a1b858286016127d1565b9250506020830135612a2c8161302b565b809150509250929050565b60008060408385031215612a49578182fd5b82356001600160401b03811115612a5e578283fd5b612a6a858286016127d1565b95602094909401359450505050565b60008060008060808587031215612a8e578182fd5b845160088110612a9c578283fd5b80945050602085015192506040850151915060608501516001600160401b03811115612ac6578182fd5b8501601f81018713612ad6578182fd5b8051612ae461279682612fde565b818152886020838501011115612af8578384fd5b612b09826020830160208601612fff565b9598949750929550505050565b600060208284031215612b27578081fd5b81356001600160401b03811115612b3c578182fd5b8201601f81018413612b4c578182fd5b61094684823560208401612788565b60008060408385031215612b6d578182fd5b82356001600160401b03811115612b82578283fd5b612a1b858286016127ff565b60008060008060808587031215612ba3578182fd5b84356001600160401b03811115612bb8578283fd5b612bc4878288016127ff565b9450506020850135612bd58161302b565b9250604085013591506060850135612bec8161302b565b939692955090935050565b600080600060608486031215612c0b578081fd5b833592506020840135612c1d8161302b565b915060408401356001600160401b03811115612c37578182fd5b612c43868287016127d1565b9150509250925092565b60008060008060808587031215612c62578182fd5b843593506020850135612c748161302b565b92506040850135915060608501356001600160401b03811115612c95578182fd5b612ca1878288016127d1565b91505092959194509250565b60008151808452612cc5816020860160208601612fff565b601f01601f19169290920160200192915050565b60088110612ce357fe5b9052565b60609190911b6bffffffffffffffffffffffff1916815260140190565b6001600160f81b031994909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b60008251612d4f818460208701612fff565b9190910192915050565b60008351612d6b818460208801612fff565b835190830190612d7f818360208801612fff565b01949350505050565b6c600d380380600d6000396000f360981b81528151600090612db181600d850160208701612fff565b91909101600d0192915050565b90815260200190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b038316815260406020820181905260009061094690830184612cad565b60008315158252604060208301526109466040830184612cad565b93845260ff9290921660208401526040830152606082015260800190565b600060208252610d536020830184612cad565b600060408252612ebc6040830185612cad565b905060018060a01b03831660208301529392505050565b6020810160028310612ee157fe5b91905290565b6000612ef38287612cd9565b60ff8516602083015260ff8416604083015260806060830152612f196080830184612cad565b9695505050505050565b6000612f2f8287612cd9565b84602083015283604083015260806060830152612f196080830184612cad565b60208082526046908201527f4f6e6c792061757468656e746963617465642061646472657373657320696e2060408201527f6f766d53746174654d616e616765722063616e2063616c6c20746869732066756060820152653731ba34b7b760d11b608082015260a00190565b6040518181016001600160401b0381118282101715612fd657fe5b604052919050565b60006001600160401b03821115612ff157fe5b50601f01601f191660200190565b60005b8381101561301a578181015183820152602001613002565b8381111561092b5750506000910152565b6001600160a01b038116811461065257600080fdfe5369676e61747572652070726f766964656420666f7220454f4120636f6e7472616374206372656174696f6e20697320696e76616c69642e436f6e7472616374206372656174696f6e20636f646520636f6e7461696e7320756e73616665206f70636f6465732e2044696420796f75207573652074686520726967687420636f6d70696c6572206f72207061737320616e20756e7361666520636f6e7374727563746f7220617267756d656e743f436f6e7374727563746f7220617474656d7074656420746f206465706c6f7920756e736166652062797465636f64652ea2646970667358221220fe0b47506ec2f40df111ba865323ee43ffbd7ef91f30eae2dfc209de19a78c0a64736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101fb5760003560e01c8063741a33eb1161011a578063996d79a5116100ad578063a8c4c5ec1161007c578063a8c4c5ec146103eb578063bdbf8c36146103f3578063c1fb2ea2146103fb578063f573102114610403578063ffe7391414610416576101fb565b8063996d79a5146103b557806399ccd98b146103bd5780639be3ad67146103d05780639dc9dc93146103e3576101fb565b80638435035b116100e95780638435035b146103745780638540661f1461038757806385979f761461039a57806390580256146103ad576101fb565b8063741a33eb14610326578063746c32f11461033957806376427cac146103595780637cebbe941461036c576101fb565b806322bd64c011610192578063461a447811610161578063461a4478146102e25780635a98c361146102f55780635b99d1c5146102fd578063735090641461031e576101fb565b806322bd64c01461029257806324749d5c146102a7578063299ca478146102ba5780632a2a7adb146102cf576101fb565b806314aa2ff7116101ce57806314aa2ff7146102595780631c4712a71461027a5780631f64338b1461028257806320160f3a1461028a576101fb565b806303daa9591461020057806308bf7dbf146102295780630a5635ae14610231578063101185a414610244575b600080fd5b61021361020e366004612924565b610429565b6040516102209190612dbe565b60405180910390f35b61021361046e565b61021361023f366004612898565b610480565b61024c610516565b6040516102209190612ed3565b61026c6102673660046129b6565b61051f565b604051610220929190612e39565b6102136105b1565b6102136105b7565b6102136105be565b6102a56102a0366004612954565b6105c4565b005b6102136102b5366004612898565b61061f565b6102c2610638565b6040516102209190612dc7565b6102a56102dd3660046129b6565b610647565b6102c26102f0366004612b16565b610655565b610213610731565b61031061030b366004612c4d565b610737565b604051610220929190612e5d565b6102c26107bd565b6102a5610334366004612975565b6107cc565b61034c6103473660046128d0565b610931565b6040516102209190612e96565b61034c610367366004612b8e565b61094e565b6102a5610a50565b610213610382366004612898565b610a9f565b610310610395366004612bf7565b610ab2565b6103106103a8366004612bf7565b610b39565b610213610b56565b6102c2610b5c565b61026c6103cb366004612a37565b610b6b565b61034c6103de366004612b5b565b610bf8565b6102c2610d5a565b610213610d69565b610213610d6f565b610213610d75565b6102a56104113660046129e8565b610d87565b610310610424366004612bf7565b610f50565b6000619c4060005a9050600061043d610b5c565b90506104498186610fa5565b93505060005a820390508083101561046657601280548483030190555b505050919050565b600061047b61023f610b5c565b905090565b600080826040516024016104949190612dc7565b60408051601f198184030181529190526020810180516001600160e01b03166370a0823160e01b17905290506000806104d55a6006602160991b0185610ab2565b915091508115806104e857508051602014155b156104f7576104f76000611033565b8080602001905181019061050b919061293c565b93505050505b919050565b60085460ff1690565b60115460009060609060ff1615156001141561053f5761053f6006611033565b619c4060005a90506000610551610b5c565b905061055c8161104c565b60006105708261056b846110e1565b61116c565b905061057e81886003611206565b95509550505060005a82039050808310156105a05760128054840190556105a9565b60128054820190555b505050915091565b60045490565b62015f9081565b600b5490565b60115460ff161515600114156105de576105de6006611033565b61ea6060005a905060006105f0610b5c565b90506105fd818686611290565b5060005a820390508083101561061857601280548483030190555b5050505050565b600061063261062d83611317565b6113a2565b92915050565b6000546001600160a01b031681565b6106526001826113a6565b50565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156106b557818101518382015260200161069d565b50505050905090810190601f1680156106e25780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156106ff57600080fd5b505afa158015610713573d6000803e3d6000fd5b505050506040513d602081101561072957600080fd5b505192915050565b600a5490565b60006060620186a060005a60408051608081018252600f5460115460ff16151560608301526001600160a01b0390811682528a166020820152908101889052909150610787818a8a8960006113bc565b945094505060005a82039050808310156107a85760128054840190556107b1565b60128054820190555b50505094509492505050565b600e546001600160a01b031690565b60115460ff161515600114156107e6576107e66006611033565b600060018585601b0185856040516000815260200160405260405161080e9493929190612e78565b6020604051602081039080840390855afa158015610830573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661086c5761086c60405180606001604052806038815260200161304160389139610647565b6108758161144d565b61087f575061092b565b610888816114d8565b600f80546001600160a01b038381166001600160a01b03198316179092551660006108e56108c16009602160991b018361034782610a9f565b6040516020016108d19190612d88565b60405160208183030381529060405261153f565b600f80546001600160a01b0319166001600160a01b038516179055905061091c838261091081611552565b80519060200120611568565b6109278360006115a5565b5050505b50505050565b606061094661093f85611317565b8484611616565b949350505050565b6060331561095b57600080fd5b600280546001600160a01b0319166001600160a01b03841617905561097f8561163a565b600019601355600f80546001600160a01b0319166001600160a01b0386811691909117909155608086015116158015610a1e576000806109c28860c0015161051f565b90925090506001600160a01b038216610a02576000816040516020016109e9929190612e5d565b6040516020818303038152906040529350505050610946565b6001610a0d83611552565b6040516020016109e9929190612e5d565b600080610a398860a001518960800151888b60c00151610737565b9150915081816040516020016109e9929190612e5d565b60115460ff16151560011415610a6a57610a6a6006611033565b6000610a74610b5c565b90506000610a81826110e1565b905080816001011115610a9b57610a9b82826001016115a5565b5050565b6000610632610aad83611317565b6116ac565b600060606201388060005a60408051608081018252600f546001600160a01b03908116825289166020820152600160608201819052600092820192909252919250610b049082908a908a908a906113bc565b945094505060005a8203905080831015610b25576012805484019055610b2e565b60128054820190555b505050935093915050565b60006060610b4a8585600086610737565b91509150935093915050565b60075490565b600f546001600160a01b031690565b60115460009060609060ff16151560011415610b8b57610b8b6006611033565b619c4060005a90506000610b9d610b5c565b9050610ba88161104c565b6000610bb58289896116b0565b9050610bc381896004611206565b95509550505060005a8203905080831015610be5576012805484019055610bee565b60128054820190555b5050509250929050565b600a546060907fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d14610c395750604080516020810190915260008152610632565b600280546001600160a01b0319166001600160a01b038481169190911791829055604051630d15d41560e41b815291169063d15d415090610c7e903390600401612dc7565b60206040518083038186803b158015610c9657600080fd5b505afa158015610caa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cce9190612904565b610cf35760405162461bcd60e51b8152600401610cea90612f4f565b60405180910390fd5b610cfc8361163a565b610d05836116f6565b610d2657610d11611752565b50604080516020810190915260008152610632565b6000610d486003600001548560a0015103856080015160008760c00151610737565b915050610d53611752565b9392505050565b600d546001600160a01b031690565b60105490565b60095490565b600061047b610d82610b5c565b6110e1565b333014610d9357610a9b565b610d9c8161144d565b610daa57610daa6005611033565b6001546040516352275acd60e11b81526001600160a01b039091169063a44eb59a90610dda908590600401612e96565b60206040518083038186803b158015610df257600080fd5b505afa158015610e06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2a9190612904565b610e5957610e596004610e546040518060a0016040528060768152602001613079607691396117f4565b6113a6565b610e62816114d8565b6000610e6d8361153f565b90506001600160a01b038116610e87573d6000803e3d6000fd5b6000610e9282611552565b6001546040516352275acd60e11b81529192506001600160a01b03169063a44eb59a90610ec3908490600401612e96565b60206040518083038186803b158015610edb57600080fd5b505afa158015610eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f139190612904565b610f3d57610f3d6004610e546040518060600160405280603081526020016130ef603091396117f4565b61092b8383610f4b856113a2565b611568565b60006060619c4060005a60408051608081018252600e546001600160a01b039081168252600f541660208201526010549181019190915260115460ff1615156060820152909150610b048189898960026113bc565b6000610fb18383611837565b600254604051631aaf392f60e01b81526001600160a01b0390911690631aaf392f90610fe39086908690600401612dff565b60206040518083038186803b158015610ffb57600080fd5b505afa15801561100f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d53919061293c565b61065281604051806020016040528060008152506113a6565b6000806110ab5a6002602160991b0163b1540a0160e01b866040516024016110749190612dc7565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610ab2565b915091506000818060200190518101906110c59190612904565b90508015806110d2575082155b1561092b5761092b6007611033565b60006110ec82611972565b60025460405163d126199f60e01b81526001600160a01b039091169063d126199f9061111c908590600401612dc7565b60206040518083038186803b15801561113457600080fd5b505afa158015611148573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610632919061293c565b60408051600280825260608201909252600091829190816020015b60608152602001906001900390816111875790505090506111a784611ab9565b816000815181106111b457fe5b60200260200101819052506111c883611ae3565b816001815181106111d557fe5b602002602001018190525060006111eb82611af6565b90506111fd8180519060200120611b3a565b95945050505050565b60006060611228611215610b5c565b611220610d82610b5c565b6001016115a5565b60408051608081018252600f546010549282019290925260115460ff16151560608201526001600160a01b0391821681529086166020820152600080611271835a8a8a8a611b3d565b9150915081611281576000611283565b875b9890975095505050505050565b8061129b8484610fa5565b14156112a657611312565b6112b08383611e9a565b600254604051635c17d62960e01b81526001600160a01b0390911690635c17d629906112e490869086908690600401612e18565b600060405180830381600087803b1580156112fe57600080fd5b505af1158015610927573d6000803e3d6000fd5b505050565b600061132282611972565b600254604051637c8ee70360e01b81526001600160a01b0390911690637c8ee70390611352908590600401612dc7565b60206040518083038186803b15801561136a57600080fd5b505afa15801561137e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063291906128b4565b3f90565b60006113b28383611fac565b9050805160208201fd5b6000606073ffffffffffffffffffffffffffffffffffff0000851673deaddeaddeaddeaddeaddeaddeaddeaddead0000141561140b575050604080516020810190915260008152600190611443565b60006064866001600160a01b03161061142c5761142786611317565b61142e565b855b905061143d8888838888611b3d565b92509250505b9550959350505050565b600061145882611972565b6002546040516307a1294560e01b81526001600160a01b03909116906307a1294590611488908590600401612dc7565b60206040518083038186803b1580156114a057600080fd5b505afa1580156114b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106329190612904565b6114e181611972565b600254604051637e78a4d160e11b81526001600160a01b039091169063fcf149a290611511908490600401612dc7565b600060405180830381600087803b15801561152b57600080fd5b505af1158015610618573d6000803e3d6000fd5b6000808251602084016000f09392505050565b6060610632826000611563856116ac565b611616565b61157183612055565b6002546040516368510af960e11b81526001600160a01b039091169063d0a215f2906112e490869086908690600401612ddb565b6115ae82612055565b6002546040516374855dc360e11b81526001600160a01b039091169063e90abb86906115e09085908590600401612dff565b600060405180830381600087803b1580156115fa57600080fd5b505af115801561160e573d6000803e3d6000fd5b505050505050565b6060806040519050602083018101604052828152828460208301873c949350505050565b80516009556020810151600a5560a0810151600c5560408101516008805460ff19166001838181111561166957fe5b02179055506060810151600d80546001600160a01b0319166001600160a01b03909216919091179055600554600b5560a08101516116a690612164565b60135550565b3b90565b60008060ff60f81b858486805190602001206040516020016116d59493929190612d04565b6040516020818303038152906040528051906020012090506111fd81611b3a565b60007fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d8260200151141561172c57506000610511565b61173e8260a001518360400151612177565b61174a57506000610511565b506001919050565b600d805473defa017defa017defa017defa017defa017defa06001600160a01b031991821681179092557fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d6009819055600a819055600b819055600c8190556008805460ff199081169091556012829055600e8054841685179055600f8054841690941790935560118054909316909255601391909155600280549091169055565b6060816040516024016118079190612e96565b60408051601f198184030181529190526020810180516001600160e01b031662461bcd60e51b1790529050919050565b6175305a101561184b5761184b6000611033565b600254604051630ad2267960e01b81526001600160a01b0390911690630ad226799061187d9085908590600401612dff565b60206040518083038186803b15801561189557600080fd5b505afa1580156118a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118cd9190612904565b6118db576118db6003611033565b600254604051632bcdee1960e21b81526000916001600160a01b03169063af37b8649061190e9086908690600401612dff565b602060405180830381600087803b15801561192857600080fd5b505af115801561193c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119609190612904565b90508061131257611312614e206121a7565b6175305a1015611986576119866000611033565b60025460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf906119b6908490600401612dc7565b60206040518083038186803b1580156119ce57600080fd5b505afa1580156119e2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a069190612904565b611a1457611a146003611033565b600254604051633ecdecc760e21b81526000916001600160a01b03169063fb37b31c90611a45908590600401612dc7565b602060405180830381600087803b158015611a5f57600080fd5b505af1158015611a73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a979190612904565b905080610a9b57610a9b6175306064611ab2610aad86611317565b02016121a7565b606061063282604051602001611acf9190612ce7565b6040516020818303038152906040526121c7565b6060610632611af183612219565b6121c7565b60606000611b038361231d565b9050611b11815160c061241d565b81604051602001611b23929190612d59565b604051602081830303815290604052915050919050565b90565b60408501516000906060908015801590611b5b5750611b5b8461256d565b15611bcb5762015f905a1015611b84575050604080516020810190915260008082529150611443565b611b938762015f905a036125af565b96506000611ba58960200151836125c5565b905080611bc957600060405180602001604052806000815250935093505050611443565b505b60408051608081018252600e546001600160a01b039081168252600f541660208201526010549181019190915260115460ff1615156060820152611c0f818a612627565b6013546000611c1d8a612164565b6013819055905060006060611c31896126e8565b15611ce857306001600160a01b03168c63f573102160e01b8c8e604051602401611c5c929190612ea9565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051611c9a9190612d3d565b60006040518083038160008787f1925050503d8060008114611cd8576040519150601f19603f3d011682016040523d82523d6000602084013e611cdd565b606091505b509092509050611d4b565b8a6001600160a01b03168c8b604051611d019190612d3d565b60006040518083038160008787f1925050503d8060008114611d3f576040519150601f19603f3d011682016040523d82523d6000602084013e611d44565b606091505b5090925090505b600086118015611d5f5750611d5f8961256d565b8015611d69575081155b15611d91576000611d7e8660200151886125c5565b905080611d8f57611d8f6000611033565b505b611d9b8d86612627565b60135482611e8157600080600080611db2866126f1565b929650909450925090506003846007811115611dca57fe5b1415611dd957611dd984611033565b6001846007811115611de757fe5b1480611dfe57506004846007811115611dfc57fe5b145b80611e1457506006846007811115611e1257fe5b145b80611e2a57506007846007811115611e2857fe5b145b15611e355760128290555b6001846007811115611e4357fe5b1480611e5a57506004846007811115611e5857fe5b145b15611e6757809550611e7a565b6040518060200160405280600081525095505b5090925050505b909203909203601355909a909950975050505050505050565b611ea48282611837565b60025460405163af3dc01160e01b81526000916001600160a01b03169063af3dc01190611ed79086908690600401612dff565b602060405180830381600087803b158015611ef157600080fd5b505af1158015611f05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f299190612904565b90508061131257611f3983612055565b600260009054906101000a90046001600160a01b03166001600160a01b031663c3fd9b256040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611f8957600080fd5b505af1158015611f9d573d6000803e3d6000fd5b50505050611312614e206121a7565b60606000836007811115611fbc57fe5b1415611fd75750604080516020810190915260008152610632565b6003836007811115611fe557fe5b14156120235760408051602080820183526000808352925161200d9387939092839201612ee7565b6040516020818303038152906040529050610632565b60135460125460405161203e92869290918690602001612f23565b604051602081830303815290604052905092915050565b61205e81611972565b60025460405163011b1f7960e41b81526000916001600160a01b0316906311b1f7909061208f908590600401612dc7565b602060405180830381600087803b1580156120a957600080fd5b505af11580156120bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120e19190612904565b905080610a9b57600260009054906101000a90046001600160a01b03166001600160a01b03166333f943056040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561213857600080fd5b505af115801561214c573d6000803e3d6000fd5b50505050610a9b6175306064611ab2610aad86611317565b60005a8210612173575a610632565b5090565b60045460009083111561218c57506000610632565b60035483101561219e57506000610632565b50600192915050565b6013548111156121bb576121bb6002611033565b60138054919091039055565b606080825160011480156121ef57506080836000815181106121e557fe5b016020015160f81c105b156121fb575081610632565b6122078351608061241d565b8360405160200161203e929190612d59565b606060008260405160200161222e9190612dbe565b604051602081830303815290604052905060005b60208110156122785781818151811061225757fe5b01602001516001600160f81b0319161561227057612278565b600101612242565b6000816020036001600160401b038111801561229357600080fd5b506040519080825280601f01601f1916602001820160405280156122be576020820181803683370190505b50905060005b81518110156123145783516001840193859181106122de57fe5b602001015160f81c60f81b8282815181106122f557fe5b60200101906001600160f81b031916908160001a9053506001016122c4565b50949350505050565b606081516000141561233e5750604080516000815260208101909152610511565b6000805b83518110156123715783818151811061235757fe5b602002602001015151820191508080600101915050612342565b6000826001600160401b038111801561238957600080fd5b506040519080825280601f01601f1916602001820160405280156123b4576020820181803683370190505b50600092509050602081015b85518310156123145760008684815181106123d757fe5b6020026020010151905060006020820190506123f583828451612744565b87858151811061240157fe5b60200260200101515183019250505082806001019350506123c0565b6060806038841015612477576040805160018082528183019092529060208201818036833701905050905082840160f81b8160008151811061245b57fe5b60200101906001600160f81b031916908160001a905350610d53565b600060015b80868161248557fe5b041561249a576001909101906101000261247c565b816001016001600160401b03811180156124b357600080fd5b506040519080825280601f01601f1916602001820160405280156124de576020820181803683370190505b50925084820160370160f81b836000815181106124f757fe5b60200101906001600160f81b031916908160001a905350600190505b818111612563576101008183036101000a878161252c57fe5b048161253457fe5b0660f81b83828151811061254457fe5b60200101906001600160f81b031916908160001a905350600101612513565b5050905092915050565b60008082600481111561257c57fe5b1480612594575060035b82600481111561259257fe5b145b80610632575060048260048111156125a857fe5b1492915050565b60008183106125be5781610d53565b5090919050565b60008083836040516024016125db929190612dff565b60408051601f198184030181529190526020810180516001600160e01b031663a9059cbb60e01b1790529050600061261d5a6006602160991b01600085610737565b5095945050505050565b805182516001600160a01b0390811691161461265f578051600e80546001600160a01b0319166001600160a01b039092169190911790555b80602001516001600160a01b031682602001516001600160a01b0316146126a5576020810151600f80546001600160a01b0319166001600160a01b039092169190911790555b8060600151151582606001511515146126cf5760608101516011805460ff19169115159190911790555b8060400151826040015114610a9b576040015160105550565b60006003612586565b60008060006060845160001415612720575050604080516020810190915260008082529250829150819061273d565b848060200190518101906127349190612a79565b93509350935093505b9193509193565b8282825b60208110612767578151835260209283019290910190601f1901612748565b905182516020929092036101000a6000190180199091169116179052505050565b600061279b61279684612fde565b612fbb565b90508281528383830111156127af57600080fd5b828260208301376000602084830101529392505050565b80356105118161302b565b600082601f8301126127e1578081fd5b610d5383833560208501612788565b80356002811061051157600080fd5b600060e08284031215612810578081fd5b61281a60e0612fbb565b90508135815260208201356020820152612836604083016127f0565b6040820152612847606083016127c6565b6060820152612858608083016127c6565b608082015260a082013560a082015260c08201356001600160401b0381111561288057600080fd5b61288c848285016127d1565b60c08301525092915050565b6000602082840312156128a9578081fd5b8135610d538161302b565b6000602082840312156128c5578081fd5b8151610d538161302b565b6000806000606084860312156128e4578182fd5b83356128ef8161302b565b95602085013595506040909401359392505050565b600060208284031215612915578081fd5b81518015158114610d53578182fd5b600060208284031215612935578081fd5b5035919050565b60006020828403121561294d578081fd5b5051919050565b60008060408385031215612966578182fd5b50508035926020909101359150565b6000806000806080858703121561298a578081fd5b84359350602085013560ff811681146129a1578182fd5b93969395505050506040820135916060013590565b6000602082840312156129c7578081fd5b81356001600160401b038111156129dc578182fd5b610946848285016127d1565b600080604083850312156129fa578182fd5b82356001600160401b03811115612a0f578283fd5b612a1b858286016127d1565b9250506020830135612a2c8161302b565b809150509250929050565b60008060408385031215612a49578182fd5b82356001600160401b03811115612a5e578283fd5b612a6a858286016127d1565b95602094909401359450505050565b60008060008060808587031215612a8e578182fd5b845160088110612a9c578283fd5b80945050602085015192506040850151915060608501516001600160401b03811115612ac6578182fd5b8501601f81018713612ad6578182fd5b8051612ae461279682612fde565b818152886020838501011115612af8578384fd5b612b09826020830160208601612fff565b9598949750929550505050565b600060208284031215612b27578081fd5b81356001600160401b03811115612b3c578182fd5b8201601f81018413612b4c578182fd5b61094684823560208401612788565b60008060408385031215612b6d578182fd5b82356001600160401b03811115612b82578283fd5b612a1b858286016127ff565b60008060008060808587031215612ba3578182fd5b84356001600160401b03811115612bb8578283fd5b612bc4878288016127ff565b9450506020850135612bd58161302b565b9250604085013591506060850135612bec8161302b565b939692955090935050565b600080600060608486031215612c0b578081fd5b833592506020840135612c1d8161302b565b915060408401356001600160401b03811115612c37578182fd5b612c43868287016127d1565b9150509250925092565b60008060008060808587031215612c62578182fd5b843593506020850135612c748161302b565b92506040850135915060608501356001600160401b03811115612c95578182fd5b612ca1878288016127d1565b91505092959194509250565b60008151808452612cc5816020860160208601612fff565b601f01601f19169290920160200192915050565b60088110612ce357fe5b9052565b60609190911b6bffffffffffffffffffffffff1916815260140190565b6001600160f81b031994909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b60008251612d4f818460208701612fff565b9190910192915050565b60008351612d6b818460208801612fff565b835190830190612d7f818360208801612fff565b01949350505050565b6c600d380380600d6000396000f360981b81528151600090612db181600d850160208701612fff565b91909101600d0192915050565b90815260200190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b038316815260406020820181905260009061094690830184612cad565b60008315158252604060208301526109466040830184612cad565b93845260ff9290921660208401526040830152606082015260800190565b600060208252610d536020830184612cad565b600060408252612ebc6040830185612cad565b905060018060a01b03831660208301529392505050565b6020810160028310612ee157fe5b91905290565b6000612ef38287612cd9565b60ff8516602083015260ff8416604083015260806060830152612f196080830184612cad565b9695505050505050565b6000612f2f8287612cd9565b84602083015283604083015260806060830152612f196080830184612cad565b60208082526046908201527f4f6e6c792061757468656e746963617465642061646472657373657320696e2060408201527f6f766d53746174654d616e616765722063616e2063616c6c20746869732066756060820152653731ba34b7b760d11b608082015260a00190565b6040518181016001600160401b0381118282101715612fd657fe5b604052919050565b60006001600160401b03821115612ff157fe5b50601f01601f191660200190565b60005b8381101561301a578181015183820152602001613002565b8381111561092b5750506000910152565b6001600160a01b038116811461065257600080fdfe5369676e61747572652070726f766964656420666f7220454f4120636f6e7472616374206372656174696f6e20697320696e76616c69642e436f6e7472616374206372656174696f6e20636f646520636f6e7461696e7320756e73616665206f70636f6465732e2044696420796f75207573652074686520726967687420636f6d70696c6572206f72207061737320616e20756e7361666520636f6e7374727563746f7220617267756d656e743f436f6e7374727563746f7220617474656d7074656420746f206465706c6f7920756e736166652062797465636f64652ea2646970667358221220fe0b47506ec2f40df111ba865323ee43ffbd7ef91f30eae2dfc209de19a78c0a64736f6c63430007060033", "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", @@ -722,6 +814,14 @@ "_ADDRESS": "Active ADDRESS within the current message context." } }, + "ovmBALANCE(address)": { + "params": { + "_contract": "Address of the contract to query the OVM_ETH balance of." + }, + "returns": { + "_BALANCE": "OVM_ETH balance of the requested contract." + } + }, "ovmCALL(uint256,address,bytes)": { "params": { "_address": "Address of the contract to call.", @@ -733,11 +833,28 @@ "_success": "Whether or not the call returned (rather than reverted)." } }, + "ovmCALL(uint256,address,uint256,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.", + "_value": "ETH value to pass with the 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." } }, + "ovmCALLVALUE()": { + "returns": { + "_CALLVALUE": "Value sent along with the call according to the current message context." + } + }, "ovmCHAINID()": { "returns": { "_CHAINID": "Value of the chain's CHAINID within the global context." @@ -838,6 +955,11 @@ "_data": "Bytes data to pass along with the REVERT." } }, + "ovmSELFBALANCE()": { + "returns": { + "_BALANCE": "OVM_ETH balance of the requesting contract." + } + }, "ovmSLOAD(bytes32)": { "params": { "_key": "32 byte key of the storage slot to load." @@ -882,20 +1004,26 @@ "_transaction": "Transaction data to be executed." } }, - "safeCREATE(uint256,bytes,address)": { + "safeCREATE(bytes,address)": { "params": { "_address": "OVM address being deployed to.", - "_creationCode": "Code to pass into CREATE for deployment.", - "_gasLimit": "Amount of gas to be passed into this creation." + "_creationCode": "Code to pass into CREATE for deployment." } }, - "simulateMessage((uint256,uint256,uint8,address,address,uint256,bytes),address,address)": { + "simulateMessage((uint256,uint256,uint8,address,address,uint256,bytes),address,uint256,address)": { "params": { "_from": "the OVM account the simulated call should be from.", - "_transaction": "the message transaction to simulate." + "_ovmStateManager": "the address of the OVM_StateManager precompile in the L2 state.", + "_transaction": "the message transaction to simulate.", + "_value": "the amount of ETH value to send." } } }, + "stateVariables": { + "CONTAINER_CONTRACT_PREFIX": { + "details": "The Execution Manager and State Manager each have this 30 byte prefix, and are uncallable." + } + }, "title": "OVM_ExecutionManager", "version": 1 }, @@ -905,12 +1033,21 @@ "ovmADDRESS()": { "notice": "Overrides ADDRESS." }, + "ovmBALANCE(address)": { + "notice": "Overrides BALANCE. NOTE: In the future, this could be optimized to directly invoke EM._getContractStorage(...)." + }, "ovmCALL(uint256,address,bytes)": { + "notice": "Legacy ovmCALL function which did not support ETH value; this maintains backwards compatibility." + }, + "ovmCALL(uint256,address,uint256,bytes)": { "notice": "Overrides CALL." }, "ovmCALLER()": { "notice": "Overrides CALLER." }, + "ovmCALLVALUE()": { + "notice": "Overrides CALLVALUE." + }, "ovmCHAINID()": { "notice": "Overrides CHAINID." }, @@ -956,6 +1093,9 @@ "ovmREVERT(bytes)": { "notice": "Overrides REVERT." }, + "ovmSELFBALANCE()": { + "notice": "Overrides SELFBALANCE." + }, "ovmSLOAD(bytes32)": { "notice": "Overrides SLOAD." }, @@ -974,10 +1114,10 @@ "run((uint256,uint256,uint8,address,address,uint256,bytes),address)": { "notice": "Starts the execution of a transaction via the OVM_ExecutionManager." }, - "safeCREATE(uint256,bytes,address)": { + "safeCREATE(bytes,address)": { "notice": "Handles the creation-specific safety measures required for OVM contract deployment. This function sanitizes the return types for creation messages to match calls (bool, bytes), by being an external function which the EM can call, that mimics the success/fail case of the CREATE. This allows for consistent handling of both types of messages in _handleExternalMessage(). Having this step occur as a separate call frame also allows us to easily revert the contract deployment in the event that the code is unsafe." }, - "simulateMessage((uint256,uint256,uint8,address,address,uint256,bytes),address,address)": { + "simulateMessage((uint256,uint256,uint8,address,address,uint256,bytes),address,uint256,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." } }, @@ -986,76 +1126,76 @@ "storageLayout": { "storage": [ { - "astId": 12055, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12048" + "type": "t_contract(Lib_AddressManager)15296" }, { - "astId": 4430, + "astId": 6671, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmSafetyChecker", "offset": 0, "slot": "1", - "type": "t_contract(iOVM_SafetyChecker)10535" + "type": "t_contract(iOVM_SafetyChecker)13768" }, { - "astId": 4432, + "astId": 6673, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmStateManager", "offset": 0, "slot": "2", - "type": "t_contract(iOVM_StateManager)10767" + "type": "t_contract(iOVM_StateManager)14000" }, { - "astId": 4434, + "astId": 6675, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "gasMeterConfig", "offset": 0, "slot": "3", - "type": "t_struct(GasMeterConfig)10318_storage" + "type": "t_struct(GasMeterConfig)13517_storage" }, { - "astId": 4436, + "astId": 6677, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "globalContext", "offset": 0, "slot": "7", - "type": "t_struct(GlobalContext)10321_storage" + "type": "t_struct(GlobalContext)13520_storage" }, { - "astId": 4438, + "astId": 6679, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "transactionContext", "offset": 0, "slot": "8", - "type": "t_struct(TransactionContext)10334_storage" + "type": "t_struct(TransactionContext)13533_storage" }, { - "astId": 4440, + "astId": 6681, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "messageContext", "offset": 0, "slot": "14", - "type": "t_struct(MessageContext)10344_storage" + "type": "t_struct(MessageContext)13545_storage" }, { - "astId": 4442, + "astId": 6683, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "transactionRecord", "offset": 0, - "slot": "16", - "type": "t_struct(TransactionRecord)10337_storage" + "slot": "18", + "type": "t_struct(TransactionRecord)13536_storage" }, { - "astId": 4444, + "astId": 6685, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "messageRecord", "offset": 0, - "slot": "17", - "type": "t_struct(MessageRecord)10347_storage" + "slot": "19", + "type": "t_struct(MessageRecord)13548_storage" } ], "types": { @@ -1069,32 +1209,32 @@ "label": "bool", "numberOfBytes": "1" }, - "t_contract(Lib_AddressManager)12048": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" }, - "t_contract(iOVM_SafetyChecker)10535": { + "t_contract(iOVM_SafetyChecker)13768": { "encoding": "inplace", "label": "contract iOVM_SafetyChecker", "numberOfBytes": "20" }, - "t_contract(iOVM_StateManager)10767": { + "t_contract(iOVM_StateManager)14000": { "encoding": "inplace", "label": "contract iOVM_StateManager", "numberOfBytes": "20" }, - "t_enum(QueueOrigin)11688": { + "t_enum(QueueOrigin)14880": { "encoding": "inplace", "label": "enum Lib_OVMCodec.QueueOrigin", "numberOfBytes": "1" }, - "t_struct(GasMeterConfig)10318_storage": { + "t_struct(GasMeterConfig)13517_storage": { "encoding": "inplace", "label": "struct iOVM_ExecutionManager.GasMeterConfig", "members": [ { - "astId": 10311, + "astId": 13510, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "minTransactionGasLimit", "offset": 0, @@ -1102,7 +1242,7 @@ "type": "t_uint256" }, { - "astId": 10313, + "astId": 13512, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "maxTransactionGasLimit", "offset": 0, @@ -1110,7 +1250,7 @@ "type": "t_uint256" }, { - "astId": 10315, + "astId": 13514, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "maxGasPerQueuePerEpoch", "offset": 0, @@ -1118,7 +1258,7 @@ "type": "t_uint256" }, { - "astId": 10317, + "astId": 13516, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "secondsPerEpoch", "offset": 0, @@ -1128,12 +1268,12 @@ ], "numberOfBytes": "128" }, - "t_struct(GlobalContext)10321_storage": { + "t_struct(GlobalContext)13520_storage": { "encoding": "inplace", "label": "struct iOVM_ExecutionManager.GlobalContext", "members": [ { - "astId": 10320, + "astId": 13519, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmCHAINID", "offset": 0, @@ -1143,12 +1283,12 @@ ], "numberOfBytes": "32" }, - "t_struct(MessageContext)10344_storage": { + "t_struct(MessageContext)13545_storage": { "encoding": "inplace", "label": "struct iOVM_ExecutionManager.MessageContext", "members": [ { - "astId": 10339, + "astId": 13538, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmCALLER", "offset": 0, @@ -1156,7 +1296,7 @@ "type": "t_address" }, { - "astId": 10341, + "astId": 13540, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmADDRESS", "offset": 0, @@ -1164,22 +1304,30 @@ "type": "t_address" }, { - "astId": 10343, + "astId": 13542, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmCALLVALUE", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 13544, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "isStatic", - "offset": 20, - "slot": "1", + "offset": 0, + "slot": "3", "type": "t_bool" } ], - "numberOfBytes": "64" + "numberOfBytes": "128" }, - "t_struct(MessageRecord)10347_storage": { + "t_struct(MessageRecord)13548_storage": { "encoding": "inplace", "label": "struct iOVM_ExecutionManager.MessageRecord", "members": [ { - "astId": 10346, + "astId": 13547, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "nuisanceGasLeft", "offset": 0, @@ -1189,20 +1337,20 @@ ], "numberOfBytes": "32" }, - "t_struct(TransactionContext)10334_storage": { + "t_struct(TransactionContext)13533_storage": { "encoding": "inplace", "label": "struct iOVM_ExecutionManager.TransactionContext", "members": [ { - "astId": 10323, + "astId": 13522, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmL1QUEUEORIGIN", "offset": 0, "slot": "0", - "type": "t_enum(QueueOrigin)11688" + "type": "t_enum(QueueOrigin)14880" }, { - "astId": 10325, + "astId": 13524, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmTIMESTAMP", "offset": 0, @@ -1210,7 +1358,7 @@ "type": "t_uint256" }, { - "astId": 10327, + "astId": 13526, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmNUMBER", "offset": 0, @@ -1218,7 +1366,7 @@ "type": "t_uint256" }, { - "astId": 10329, + "astId": 13528, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmGASLIMIT", "offset": 0, @@ -1226,7 +1374,7 @@ "type": "t_uint256" }, { - "astId": 10331, + "astId": 13530, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmTXGASLIMIT", "offset": 0, @@ -1234,7 +1382,7 @@ "type": "t_uint256" }, { - "astId": 10333, + "astId": 13532, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmL1TXORIGIN", "offset": 0, @@ -1244,12 +1392,12 @@ ], "numberOfBytes": "192" }, - "t_struct(TransactionRecord)10337_storage": { + "t_struct(TransactionRecord)13536_storage": { "encoding": "inplace", "label": "struct iOVM_ExecutionManager.TransactionRecord", "members": [ { - "astId": 10336, + "astId": 13535, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmGasRefund", "offset": 0, diff --git a/packages/contracts/deployments/goerli/OVM_FraudVerifier.json b/packages/contracts/deployments/goerli/OVM_FraudVerifier.json index 7cd7890026ec..d15fbaf195dc 100644 --- a/packages/contracts/deployments/goerli/OVM_FraudVerifier.json +++ b/packages/contracts/deployments/goerli/OVM_FraudVerifier.json @@ -1,5 +1,5 @@ { - "address": "0xfA590cE7fE1d80D4b286e23f3f6e9f9357D6A90b", + "address": "0x916f75037b87Bf4Fe0Dc7719815bd972F0618669", "abi": [ { "inputs": [ @@ -437,29 +437,29 @@ "type": "function" } ], - "transactionHash": "0x189c405d4c429a074b507c5110b14ce1d2397becac20fad4a768c3def9c0ccd7", + "transactionHash": "0x14da43921774b9bd9563a29a555ff7075123cf603e559f6997af20525bd3763c", "receipt": { "to": null, - "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", - "contractAddress": "0xfA590cE7fE1d80D4b286e23f3f6e9f9357D6A90b", + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0x916f75037b87Bf4Fe0Dc7719815bd972F0618669", "transactionIndex": 0, "gasUsed": "1386998", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x36e6b6bab1d2fceb4b01f6fb56cbe0fe566f9d3cbcc66d80bf6072e3be43033a", - "transactionHash": "0x189c405d4c429a074b507c5110b14ce1d2397becac20fad4a768c3def9c0ccd7", + "blockHash": "0xe6e39e184bcbbd8f012bad4fc044ef582e699ec4952a11be8e76a720e60bc6cb", + "transactionHash": "0x14da43921774b9bd9563a29a555ff7075123cf603e559f6997af20525bd3763c", "logs": [], - "blockNumber": 4694114, + "blockNumber": 4974842, "cumulativeGasUsed": "1386998", "status": 1, "byzantium": true }, "args": [ - "0xE3d08F0D900A2D53cB794cf82d7127764BcC3092" + "0xA4346c8c120DdCE2c5447e68790625F10Bb4d47A" ], - "solcInputHash": "dde656dd41f49cad9eac9bc7065fd6a7", - "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\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}}},\"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.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"}},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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 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\\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\":\"0x879cef57019254ad958a75db64f0b58eb0a6fcf74f386ed958f75384b860dd35\",\"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 * 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\":\"0x2d7973a0ad84c23ec62624d3f1e3aeb198cc72686ff1e6cfa17155556b320c94\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x2ce671a0e004df88b136bea5a3c59d0732cea8887c8496da1d509e0200b03d7d\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xa5195afe32fb2cf104d156e8f4bd39df1ec79bf6ba232097b9e8e0ee14fbc298\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b5060405161184138038061184183398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b6117b0806100916000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063299ca4781461005c578063461a44781461007a57806398d8867d1461008d578063a286ba1c146100a2578063b48ec820146100b5575b600080fd5b6100646100c8565b6040516100719190611306565b60405180910390f35b610064610088366004611101565b6100d7565b6100a061009b366004611029565b6101b5565b005b6100a06100b0366004610f64565b6104f4565b6100646100c3366004610f43565b6108bb565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561013757818101518382015260200161011f565b50505050905090810190601f1680156101645780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561018157600080fd5b505afa158015610195573d6000803e3d6000fd5b505050506040513d60208110156101ab57600080fd5b505190505b919050565b866101bf8561090a565b60005a905060006101cf8861090a565b90506101db8b82610923565b156101e65750610432565b60006102216040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b905060006102636040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e0000008152506100d7565b9050816001600160a01b0316634d69ee578e8e8e6040518463ffffffff1660e01b81526004016102959392919061135f565b60206040518083038186803b1580156102ad57600080fd5b505afa1580156102c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102e59190610f0f565b61030a5760405162461bcd60e51b8152600401610301906115e7565b60405180910390fd5b6040516326f2b4e760e11b81526001600160a01b03821690634de569ce9061033c908d908d908d908d90600401611641565b60206040518083038186803b15801561035457600080fd5b505afa158015610368573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038c9190610f0f565b6103a85760405162461bcd60e51b815260040161030190611499565b86600001518860600151018b600001518d6060015101600101146103de5760405162461bcd60e51b815260040161030190611525565b6103ed8d848d60000151610942565b7f41a48bde2468fac6f670f39b66d7b91f311053e1f28eab9d75056546e6eaac958d8c6000015185336040516104269493929190611394565b60405180910390a15050505b60005a820390506104696040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b1580156104cf57600080fd5b505af11580156104e3573d6000803e3d6000fd5b505050505050505050505050505050565b868460005a905060006105078b896108bb565b905060006105446040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b9050816001600160a01b031663b2fa1c9e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561057f57600080fd5b505afa158015610593573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b79190610f0f565b15156001146105d85760405162461bcd60e51b8152600401610301906113b8565b89600001518b606001510160010186600001518860600151011461060e5760405162461bcd60e51b81526004016103019061141f565b604051634d69ee5760e01b81526001600160a01b03821690634d69ee579061063e908f908f908f9060040161135f565b60206040518083038186803b15801561065657600080fd5b505afa15801561066a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068e9190610f0f565b6106aa5760405162461bcd60e51b8152600401610301906115e7565b604051634d69ee5760e01b81526001600160a01b03821690634d69ee57906106da908b908b908b9060040161135f565b60206040518083038186803b1580156106f257600080fd5b505afa158015610706573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072a9190610f0f565b6107465760405162461bcd60e51b8152600401610301906114dd565b816001600160a01b031663c1c618b86040518163ffffffff1660e01b815260040160206040518083038186803b15801561077f57600080fd5b505afa158015610793573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b79190610f2b565b8814156107d65760405162461bcd60e51b815260040161030190611597565b6107e0878d610a6d565b6000600160008e8c6040516020016107f9929190611289565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507f1e5fff3c23daf51ea67aaa3bbc738bcedaa98be5a5503f0e63a336a004b075b18c8b600001518b3360405161087a9493929190611394565b60405180910390a1505060005a820390506104696040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b60006001600084846040516020016108d4929190611289565b60408051808303601f19018152918152815160209283012083529082019290925201600020546001600160a01b03169392505050565b600061091582610bc7565b805190602001209050919050565b60008061093084846108bb565b6001600160a01b031614159392505050565b6109806040518060400160405280601c81526020017f4f564d5f53746174655472616e736974696f6e6572466163746f7279000000008152506100d7565b600054604051631168a38160e11b81526001600160a01b03928316926322d14702926109b79291169085908890889060040161131a565b602060405180830381600087803b1580156109d157600080fd5b505af11580156109e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0991906110e5565b600160008585604051602001610a20929190611289565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550505050565b6000610aa86040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b90506000610adc6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b604051632e38626b60e21b81529091506001600160a01b0383169063b8e189ac90610b0b90879060040161162e565b600060405180830381600087803b158015610b2557600080fd5b505af1158015610b39573d6000803e3d6000fd5b505050506000808560800151806020019051810190610b58919061114f565b60405163abfbbe1360e01b815291935091506001600160a01b0384169063abfbbe1390610b8d90889085908790600401611340565b600060405180830381600087803b158015610ba757600080fd5b505af1158015610bbb573d6000803e3d6000fd5b50505050505050505050565b6060816000015182602001518360400151846060015185608001518660a001518760c00151604051602001610c029796959493929190611297565b6040516020818303038152906040529050919050565b600067ffffffffffffffff831115610c2c57fe5b610c3f601f8401601f1916602001611700565b9050828152838383011115610c5357600080fd5b828260208301376000602084830101529392505050565b80356101b081611754565b600082601f830112610c85578081fd5b610c9483833560208501610c18565b9392505050565b8035600281106101b057600080fd5b600060a08284031215610cbb578081fd5b60405160a0810167ffffffffffffffff8282108183111715610cd957fe5b81604052829350843583526020850135602084015260408501356040840152606085013560608401526080850135915080821115610d1657600080fd5b50610d2385828601610c75565b6080830152505092915050565b600060408284031215610d41578081fd5b6040516040810167ffffffffffffffff8282108183111715610d5f57fe5b8160405282935084358352602091508185013581811115610d7f57600080fd5b8501601f81018713610d9057600080fd5b803582811115610d9c57fe5b8381029250610dac848401611700565b8181528481019083860185850187018b1015610dc757600080fd5b600095505b83861015610dea578035835260019590950194918601918601610dcc565b5080868801525050505050505092915050565b600060a08284031215610e0e578081fd5b60405160a0810167ffffffffffffffff8282108183111715610e2c57fe5b8160405282935084359150610e408261176c565b8183526020850135602084015260408501356040840152606085013560608401526080850135915080821115610d1657600080fd5b600060e08284031215610e86578081fd5b610e9060e0611700565b90508135815260208201356020820152610eac60408301610c9b565b6040820152610ebd60608301610c6a565b6060820152610ece60808301610c6a565b608082015260a082013560a082015260c082013567ffffffffffffffff811115610ef757600080fd5b610f0384828501610c75565b60c08301525092915050565b600060208284031215610f20578081fd5b8151610c948161176c565b600060208284031215610f3c578081fd5b5051919050565b60008060408385031215610f55578081fd5b50508035926020909101359150565b600080600080600080600060e0888a031215610f7e578283fd5b87359650602088013567ffffffffffffffff80821115610f9c578485fd5b610fa88b838c01610caa565b975060408a0135915080821115610fbd578485fd5b610fc98b838c01610d30565b965060608a0135955060808a0135945060a08a0135915080821115610fec578384fd5b610ff88b838c01610caa565b935060c08a013591508082111561100d578283fd5b5061101a8a828b01610d30565b91505092959891949750929550565b600080600080600080600060e0888a031215611043578081fd5b87359650602088013567ffffffffffffffff80821115611061578283fd5b61106d8b838c01610caa565b975060408a0135915080821115611082578283fd5b61108e8b838c01610d30565b965060608a01359150808211156110a3578283fd5b6110af8b838c01610e75565b955060808a01359150808211156110c4578283fd5b6110d08b838c01610dfd565b945060a08a0135915080821115610fec578283fd5b6000602082840312156110f6578081fd5b8151610c9481611754565b600060208284031215611112578081fd5b813567ffffffffffffffff811115611128578182fd5b8201601f81018413611138578182fd5b61114784823560208401610c18565b949350505050565b60008060408385031215611161578182fd5b82519150602083015161117381611754565b809150509250929050565b6001600160a01b03169052565b600081518084526111a3816020860160208601611724565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261114760a085018261118b565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b8083101561123f578451825293830193600192909201919083019061121f565b509695505050505050565b6000815115158352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261114760a085018261118b565b918252602082015260400190565b6000888252876020830152600287106112ac57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b1660558401525083606983015282516112f3816089850160208701611724565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b9283526001600160a01b03919091166020830152604082015260600190565b60008482526060602083015261137860608301856111b7565b828103604084015261138a81856111f4565b9695505050505050565b938452602084019290925260408301526001600160a01b0316606082015260800190565b60208082526041908201527f5374617465207472616e736974696f6e2070726f63657373206d75737420626560408201527f20636f6d706c65746564207072696f7220746f2066696e616c697a6174696f6e6060820152601760f91b608082015260a00190565b60208082526054908201527f506f73742d737461746520726f6f7420676c6f62616c20696e646578206d757360408201527f7420657175616c20746f207468652070726520737461746520726f6f7420676c60608201527337b130b61034b73232bc1038363ab99037b7329760611b608082015260a00190565b60208082526024908201527f496e76616c6964207472616e73616374696f6e20696e636c7573696f6e20707260408201526337b7b31760e11b606082015260800190565b60208082526028908201527f496e76616c696420706f73742d737461746520726f6f7420696e636c7573696f6040820152673710383937b7b31760c11b606082015260800190565b6020808252604c908201527f5072652d737461746520726f6f7420676c6f62616c20696e646578206d75737460408201527f20657175616c20746f20746865207472616e73616374696f6e20726f6f74206760608201526b3637b130b61034b73232bc1760a11b608082015260a00190565b60208082526030908201527f5374617465207472616e736974696f6e20686173206e6f74206265656e20707260408201526f37bb32b710333930bab23ab632b73a1760811b606082015260800190565b60208082526027908201527f496e76616c6964207072652d737461746520726f6f7420696e636c7573696f6e60408201526610383937b7b31760c91b606082015260800190565b600060208252610c9460208301846111b7565b60006080825285516080830152602086015160a083015260408601516002811061166757fe5b60c083015260608601516001600160a01b031660e0830152608086015161169261010084018261117e565b5060a086015161012083015260c086015160e06101408401526116b961016084018261118b565b905082810360208401526116cd818761124a565b905082810360408401526116e181866111b7565b905082810360608401526116f581856111f4565b979650505050505050565b60405181810167ffffffffffffffff8111828210171561171c57fe5b604052919050565b60005b8381101561173f578181015183820152602001611727565b8381111561174e576000848401525b50505050565b6001600160a01b038116811461176957600080fd5b50565b801515811461176957600080fdfea26469706673582212205dbab94b86b7fa55149dd4efe74e8533d11e06735abd7d989856c9aa60c89c1064736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c8063299ca4781461005c578063461a44781461007a57806398d8867d1461008d578063a286ba1c146100a2578063b48ec820146100b5575b600080fd5b6100646100c8565b6040516100719190611306565b60405180910390f35b610064610088366004611101565b6100d7565b6100a061009b366004611029565b6101b5565b005b6100a06100b0366004610f64565b6104f4565b6100646100c3366004610f43565b6108bb565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561013757818101518382015260200161011f565b50505050905090810190601f1680156101645780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561018157600080fd5b505afa158015610195573d6000803e3d6000fd5b505050506040513d60208110156101ab57600080fd5b505190505b919050565b866101bf8561090a565b60005a905060006101cf8861090a565b90506101db8b82610923565b156101e65750610432565b60006102216040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b905060006102636040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e0000008152506100d7565b9050816001600160a01b0316634d69ee578e8e8e6040518463ffffffff1660e01b81526004016102959392919061135f565b60206040518083038186803b1580156102ad57600080fd5b505afa1580156102c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102e59190610f0f565b61030a5760405162461bcd60e51b8152600401610301906115e7565b60405180910390fd5b6040516326f2b4e760e11b81526001600160a01b03821690634de569ce9061033c908d908d908d908d90600401611641565b60206040518083038186803b15801561035457600080fd5b505afa158015610368573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038c9190610f0f565b6103a85760405162461bcd60e51b815260040161030190611499565b86600001518860600151018b600001518d6060015101600101146103de5760405162461bcd60e51b815260040161030190611525565b6103ed8d848d60000151610942565b7f41a48bde2468fac6f670f39b66d7b91f311053e1f28eab9d75056546e6eaac958d8c6000015185336040516104269493929190611394565b60405180910390a15050505b60005a820390506104696040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b1580156104cf57600080fd5b505af11580156104e3573d6000803e3d6000fd5b505050505050505050505050505050565b868460005a905060006105078b896108bb565b905060006105446040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b9050816001600160a01b031663b2fa1c9e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561057f57600080fd5b505afa158015610593573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b79190610f0f565b15156001146105d85760405162461bcd60e51b8152600401610301906113b8565b89600001518b606001510160010186600001518860600151011461060e5760405162461bcd60e51b81526004016103019061141f565b604051634d69ee5760e01b81526001600160a01b03821690634d69ee579061063e908f908f908f9060040161135f565b60206040518083038186803b15801561065657600080fd5b505afa15801561066a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068e9190610f0f565b6106aa5760405162461bcd60e51b8152600401610301906115e7565b604051634d69ee5760e01b81526001600160a01b03821690634d69ee57906106da908b908b908b9060040161135f565b60206040518083038186803b1580156106f257600080fd5b505afa158015610706573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072a9190610f0f565b6107465760405162461bcd60e51b8152600401610301906114dd565b816001600160a01b031663c1c618b86040518163ffffffff1660e01b815260040160206040518083038186803b15801561077f57600080fd5b505afa158015610793573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b79190610f2b565b8814156107d65760405162461bcd60e51b815260040161030190611597565b6107e0878d610a6d565b6000600160008e8c6040516020016107f9929190611289565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507f1e5fff3c23daf51ea67aaa3bbc738bcedaa98be5a5503f0e63a336a004b075b18c8b600001518b3360405161087a9493929190611394565b60405180910390a1505060005a820390506104696040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b60006001600084846040516020016108d4929190611289565b60408051808303601f19018152918152815160209283012083529082019290925201600020546001600160a01b03169392505050565b600061091582610bc7565b805190602001209050919050565b60008061093084846108bb565b6001600160a01b031614159392505050565b6109806040518060400160405280601c81526020017f4f564d5f53746174655472616e736974696f6e6572466163746f7279000000008152506100d7565b600054604051631168a38160e11b81526001600160a01b03928316926322d14702926109b79291169085908890889060040161131a565b602060405180830381600087803b1580156109d157600080fd5b505af11580156109e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0991906110e5565b600160008585604051602001610a20929190611289565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550505050565b6000610aa86040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b90506000610adc6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b604051632e38626b60e21b81529091506001600160a01b0383169063b8e189ac90610b0b90879060040161162e565b600060405180830381600087803b158015610b2557600080fd5b505af1158015610b39573d6000803e3d6000fd5b505050506000808560800151806020019051810190610b58919061114f565b60405163abfbbe1360e01b815291935091506001600160a01b0384169063abfbbe1390610b8d90889085908790600401611340565b600060405180830381600087803b158015610ba757600080fd5b505af1158015610bbb573d6000803e3d6000fd5b50505050505050505050565b6060816000015182602001518360400151846060015185608001518660a001518760c00151604051602001610c029796959493929190611297565b6040516020818303038152906040529050919050565b600067ffffffffffffffff831115610c2c57fe5b610c3f601f8401601f1916602001611700565b9050828152838383011115610c5357600080fd5b828260208301376000602084830101529392505050565b80356101b081611754565b600082601f830112610c85578081fd5b610c9483833560208501610c18565b9392505050565b8035600281106101b057600080fd5b600060a08284031215610cbb578081fd5b60405160a0810167ffffffffffffffff8282108183111715610cd957fe5b81604052829350843583526020850135602084015260408501356040840152606085013560608401526080850135915080821115610d1657600080fd5b50610d2385828601610c75565b6080830152505092915050565b600060408284031215610d41578081fd5b6040516040810167ffffffffffffffff8282108183111715610d5f57fe5b8160405282935084358352602091508185013581811115610d7f57600080fd5b8501601f81018713610d9057600080fd5b803582811115610d9c57fe5b8381029250610dac848401611700565b8181528481019083860185850187018b1015610dc757600080fd5b600095505b83861015610dea578035835260019590950194918601918601610dcc565b5080868801525050505050505092915050565b600060a08284031215610e0e578081fd5b60405160a0810167ffffffffffffffff8282108183111715610e2c57fe5b8160405282935084359150610e408261176c565b8183526020850135602084015260408501356040840152606085013560608401526080850135915080821115610d1657600080fd5b600060e08284031215610e86578081fd5b610e9060e0611700565b90508135815260208201356020820152610eac60408301610c9b565b6040820152610ebd60608301610c6a565b6060820152610ece60808301610c6a565b608082015260a082013560a082015260c082013567ffffffffffffffff811115610ef757600080fd5b610f0384828501610c75565b60c08301525092915050565b600060208284031215610f20578081fd5b8151610c948161176c565b600060208284031215610f3c578081fd5b5051919050565b60008060408385031215610f55578081fd5b50508035926020909101359150565b600080600080600080600060e0888a031215610f7e578283fd5b87359650602088013567ffffffffffffffff80821115610f9c578485fd5b610fa88b838c01610caa565b975060408a0135915080821115610fbd578485fd5b610fc98b838c01610d30565b965060608a0135955060808a0135945060a08a0135915080821115610fec578384fd5b610ff88b838c01610caa565b935060c08a013591508082111561100d578283fd5b5061101a8a828b01610d30565b91505092959891949750929550565b600080600080600080600060e0888a031215611043578081fd5b87359650602088013567ffffffffffffffff80821115611061578283fd5b61106d8b838c01610caa565b975060408a0135915080821115611082578283fd5b61108e8b838c01610d30565b965060608a01359150808211156110a3578283fd5b6110af8b838c01610e75565b955060808a01359150808211156110c4578283fd5b6110d08b838c01610dfd565b945060a08a0135915080821115610fec578283fd5b6000602082840312156110f6578081fd5b8151610c9481611754565b600060208284031215611112578081fd5b813567ffffffffffffffff811115611128578182fd5b8201601f81018413611138578182fd5b61114784823560208401610c18565b949350505050565b60008060408385031215611161578182fd5b82519150602083015161117381611754565b809150509250929050565b6001600160a01b03169052565b600081518084526111a3816020860160208601611724565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261114760a085018261118b565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b8083101561123f578451825293830193600192909201919083019061121f565b509695505050505050565b6000815115158352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261114760a085018261118b565b918252602082015260400190565b6000888252876020830152600287106112ac57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b1660558401525083606983015282516112f3816089850160208701611724565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b9283526001600160a01b03919091166020830152604082015260600190565b60008482526060602083015261137860608301856111b7565b828103604084015261138a81856111f4565b9695505050505050565b938452602084019290925260408301526001600160a01b0316606082015260800190565b60208082526041908201527f5374617465207472616e736974696f6e2070726f63657373206d75737420626560408201527f20636f6d706c65746564207072696f7220746f2066696e616c697a6174696f6e6060820152601760f91b608082015260a00190565b60208082526054908201527f506f73742d737461746520726f6f7420676c6f62616c20696e646578206d757360408201527f7420657175616c20746f207468652070726520737461746520726f6f7420676c60608201527337b130b61034b73232bc1038363ab99037b7329760611b608082015260a00190565b60208082526024908201527f496e76616c6964207472616e73616374696f6e20696e636c7573696f6e20707260408201526337b7b31760e11b606082015260800190565b60208082526028908201527f496e76616c696420706f73742d737461746520726f6f7420696e636c7573696f6040820152673710383937b7b31760c11b606082015260800190565b6020808252604c908201527f5072652d737461746520726f6f7420676c6f62616c20696e646578206d75737460408201527f20657175616c20746f20746865207472616e73616374696f6e20726f6f74206760608201526b3637b130b61034b73232bc1760a11b608082015260a00190565b60208082526030908201527f5374617465207472616e736974696f6e20686173206e6f74206265656e20707260408201526f37bb32b710333930bab23ab632b73a1760811b606082015260800190565b60208082526027908201527f496e76616c6964207072652d737461746520726f6f7420696e636c7573696f6e60408201526610383937b7b31760c91b606082015260800190565b600060208252610c9460208301846111b7565b60006080825285516080830152602086015160a083015260408601516002811061166757fe5b60c083015260608601516001600160a01b031660e0830152608086015161169261010084018261117e565b5060a086015161012083015260c086015160e06101408401526116b961016084018261118b565b905082810360208401526116cd818761124a565b905082810360408401526116e181866111b7565b905082810360608401526116f581856111f4565b979650505050505050565b60405181810167ffffffffffffffff8111828210171561171c57fe5b604052919050565b60005b8381101561173f578181015183820152602001611727565b8381111561174e576000848401525b50505050565b6001600160a01b038116811461176957600080fd5b50565b801515811461176957600080fdfea26469706673582212205dbab94b86b7fa55149dd4efe74e8533d11e06735abd7d989856c9aa60c89c1064736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}}},\"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.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"}},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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 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\\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\":\"0x879cef57019254ad958a75db64f0b58eb0a6fcf74f386ed958f75384b860dd35\",\"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 * 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\",\"keccak256\":\"0x180b9c347e20f1a6efa553b0f2b9a59aebceda92a7484ae6fca4da2bf1d960c3\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405161184138038061184183398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b6117b0806100916000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063299ca4781461005c578063461a44781461007a57806398d8867d1461008d578063a286ba1c146100a2578063b48ec820146100b5575b600080fd5b6100646100c8565b6040516100719190611306565b60405180910390f35b610064610088366004611101565b6100d7565b6100a061009b366004611029565b6101b5565b005b6100a06100b0366004610f64565b6104f4565b6100646100c3366004610f43565b6108bb565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561013757818101518382015260200161011f565b50505050905090810190601f1680156101645780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561018157600080fd5b505afa158015610195573d6000803e3d6000fd5b505050506040513d60208110156101ab57600080fd5b505190505b919050565b866101bf8561090a565b60005a905060006101cf8861090a565b90506101db8b82610923565b156101e65750610432565b60006102216040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b905060006102636040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e0000008152506100d7565b9050816001600160a01b0316634d69ee578e8e8e6040518463ffffffff1660e01b81526004016102959392919061135f565b60206040518083038186803b1580156102ad57600080fd5b505afa1580156102c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102e59190610f0f565b61030a5760405162461bcd60e51b8152600401610301906115e7565b60405180910390fd5b6040516326f2b4e760e11b81526001600160a01b03821690634de569ce9061033c908d908d908d908d90600401611641565b60206040518083038186803b15801561035457600080fd5b505afa158015610368573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038c9190610f0f565b6103a85760405162461bcd60e51b815260040161030190611499565b86600001518860600151018b600001518d6060015101600101146103de5760405162461bcd60e51b815260040161030190611525565b6103ed8d848d60000151610942565b7f41a48bde2468fac6f670f39b66d7b91f311053e1f28eab9d75056546e6eaac958d8c6000015185336040516104269493929190611394565b60405180910390a15050505b60005a820390506104696040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b1580156104cf57600080fd5b505af11580156104e3573d6000803e3d6000fd5b505050505050505050505050505050565b868460005a905060006105078b896108bb565b905060006105446040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b9050816001600160a01b031663b2fa1c9e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561057f57600080fd5b505afa158015610593573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b79190610f0f565b15156001146105d85760405162461bcd60e51b8152600401610301906113b8565b89600001518b606001510160010186600001518860600151011461060e5760405162461bcd60e51b81526004016103019061141f565b604051634d69ee5760e01b81526001600160a01b03821690634d69ee579061063e908f908f908f9060040161135f565b60206040518083038186803b15801561065657600080fd5b505afa15801561066a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068e9190610f0f565b6106aa5760405162461bcd60e51b8152600401610301906115e7565b604051634d69ee5760e01b81526001600160a01b03821690634d69ee57906106da908b908b908b9060040161135f565b60206040518083038186803b1580156106f257600080fd5b505afa158015610706573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072a9190610f0f565b6107465760405162461bcd60e51b8152600401610301906114dd565b816001600160a01b031663c1c618b86040518163ffffffff1660e01b815260040160206040518083038186803b15801561077f57600080fd5b505afa158015610793573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b79190610f2b565b8814156107d65760405162461bcd60e51b815260040161030190611597565b6107e0878d610a6d565b6000600160008e8c6040516020016107f9929190611289565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507f1e5fff3c23daf51ea67aaa3bbc738bcedaa98be5a5503f0e63a336a004b075b18c8b600001518b3360405161087a9493929190611394565b60405180910390a1505060005a820390506104696040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b60006001600084846040516020016108d4929190611289565b60408051808303601f19018152918152815160209283012083529082019290925201600020546001600160a01b03169392505050565b600061091582610bc7565b805190602001209050919050565b60008061093084846108bb565b6001600160a01b031614159392505050565b6109806040518060400160405280601c81526020017f4f564d5f53746174655472616e736974696f6e6572466163746f7279000000008152506100d7565b600054604051631168a38160e11b81526001600160a01b03928316926322d14702926109b79291169085908890889060040161131a565b602060405180830381600087803b1580156109d157600080fd5b505af11580156109e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0991906110e5565b600160008585604051602001610a20929190611289565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550505050565b6000610aa86040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b90506000610adc6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b604051632e38626b60e21b81529091506001600160a01b0383169063b8e189ac90610b0b90879060040161162e565b600060405180830381600087803b158015610b2557600080fd5b505af1158015610b39573d6000803e3d6000fd5b505050506000808560800151806020019051810190610b58919061114f565b60405163abfbbe1360e01b815291935091506001600160a01b0384169063abfbbe1390610b8d90889085908790600401611340565b600060405180830381600087803b158015610ba757600080fd5b505af1158015610bbb573d6000803e3d6000fd5b50505050505050505050565b6060816000015182602001518360400151846060015185608001518660a001518760c00151604051602001610c029796959493929190611297565b6040516020818303038152906040529050919050565b600067ffffffffffffffff831115610c2c57fe5b610c3f601f8401601f1916602001611700565b9050828152838383011115610c5357600080fd5b828260208301376000602084830101529392505050565b80356101b081611754565b600082601f830112610c85578081fd5b610c9483833560208501610c18565b9392505050565b8035600281106101b057600080fd5b600060a08284031215610cbb578081fd5b60405160a0810167ffffffffffffffff8282108183111715610cd957fe5b81604052829350843583526020850135602084015260408501356040840152606085013560608401526080850135915080821115610d1657600080fd5b50610d2385828601610c75565b6080830152505092915050565b600060408284031215610d41578081fd5b6040516040810167ffffffffffffffff8282108183111715610d5f57fe5b8160405282935084358352602091508185013581811115610d7f57600080fd5b8501601f81018713610d9057600080fd5b803582811115610d9c57fe5b8381029250610dac848401611700565b8181528481019083860185850187018b1015610dc757600080fd5b600095505b83861015610dea578035835260019590950194918601918601610dcc565b5080868801525050505050505092915050565b600060a08284031215610e0e578081fd5b60405160a0810167ffffffffffffffff8282108183111715610e2c57fe5b8160405282935084359150610e408261176c565b8183526020850135602084015260408501356040840152606085013560608401526080850135915080821115610d1657600080fd5b600060e08284031215610e86578081fd5b610e9060e0611700565b90508135815260208201356020820152610eac60408301610c9b565b6040820152610ebd60608301610c6a565b6060820152610ece60808301610c6a565b608082015260a082013560a082015260c082013567ffffffffffffffff811115610ef757600080fd5b610f0384828501610c75565b60c08301525092915050565b600060208284031215610f20578081fd5b8151610c948161176c565b600060208284031215610f3c578081fd5b5051919050565b60008060408385031215610f55578081fd5b50508035926020909101359150565b600080600080600080600060e0888a031215610f7e578283fd5b87359650602088013567ffffffffffffffff80821115610f9c578485fd5b610fa88b838c01610caa565b975060408a0135915080821115610fbd578485fd5b610fc98b838c01610d30565b965060608a0135955060808a0135945060a08a0135915080821115610fec578384fd5b610ff88b838c01610caa565b935060c08a013591508082111561100d578283fd5b5061101a8a828b01610d30565b91505092959891949750929550565b600080600080600080600060e0888a031215611043578081fd5b87359650602088013567ffffffffffffffff80821115611061578283fd5b61106d8b838c01610caa565b975060408a0135915080821115611082578283fd5b61108e8b838c01610d30565b965060608a01359150808211156110a3578283fd5b6110af8b838c01610e75565b955060808a01359150808211156110c4578283fd5b6110d08b838c01610dfd565b945060a08a0135915080821115610fec578283fd5b6000602082840312156110f6578081fd5b8151610c9481611754565b600060208284031215611112578081fd5b813567ffffffffffffffff811115611128578182fd5b8201601f81018413611138578182fd5b61114784823560208401610c18565b949350505050565b60008060408385031215611161578182fd5b82519150602083015161117381611754565b809150509250929050565b6001600160a01b03169052565b600081518084526111a3816020860160208601611724565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261114760a085018261118b565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b8083101561123f578451825293830193600192909201919083019061121f565b509695505050505050565b6000815115158352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261114760a085018261118b565b918252602082015260400190565b6000888252876020830152600287106112ac57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b1660558401525083606983015282516112f3816089850160208701611724565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b9283526001600160a01b03919091166020830152604082015260600190565b60008482526060602083015261137860608301856111b7565b828103604084015261138a81856111f4565b9695505050505050565b938452602084019290925260408301526001600160a01b0316606082015260800190565b60208082526041908201527f5374617465207472616e736974696f6e2070726f63657373206d75737420626560408201527f20636f6d706c65746564207072696f7220746f2066696e616c697a6174696f6e6060820152601760f91b608082015260a00190565b60208082526054908201527f506f73742d737461746520726f6f7420676c6f62616c20696e646578206d757360408201527f7420657175616c20746f207468652070726520737461746520726f6f7420676c60608201527337b130b61034b73232bc1038363ab99037b7329760611b608082015260a00190565b60208082526024908201527f496e76616c6964207472616e73616374696f6e20696e636c7573696f6e20707260408201526337b7b31760e11b606082015260800190565b60208082526028908201527f496e76616c696420706f73742d737461746520726f6f7420696e636c7573696f6040820152673710383937b7b31760c11b606082015260800190565b6020808252604c908201527f5072652d737461746520726f6f7420676c6f62616c20696e646578206d75737460408201527f20657175616c20746f20746865207472616e73616374696f6e20726f6f74206760608201526b3637b130b61034b73232bc1760a11b608082015260a00190565b60208082526030908201527f5374617465207472616e736974696f6e20686173206e6f74206265656e20707260408201526f37bb32b710333930bab23ab632b73a1760811b606082015260800190565b60208082526027908201527f496e76616c6964207072652d737461746520726f6f7420696e636c7573696f6e60408201526610383937b7b31760c91b606082015260800190565b600060208252610c9460208301846111b7565b60006080825285516080830152602086015160a083015260408601516002811061166757fe5b60c083015260608601516001600160a01b031660e0830152608086015161169261010084018261117e565b5060a086015161012083015260c086015160e06101408401526116b961016084018261118b565b905082810360208401526116cd818761124a565b905082810360408401526116e181866111b7565b905082810360608401526116f581856111f4565b979650505050505050565b60405181810167ffffffffffffffff8111828210171561171c57fe5b604052919050565b60005b8381101561173f578181015183820152602001611727565b8381111561174e576000848401525b50505050565b6001600160a01b038116811461176957600080fd5b50565b801515811461176957600080fdfea264697066735822122090fa94f972b734dd4c794ce3c199f593acb07d65d0fea3b0025bd8132b68bc7a64736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c8063299ca4781461005c578063461a44781461007a57806398d8867d1461008d578063a286ba1c146100a2578063b48ec820146100b5575b600080fd5b6100646100c8565b6040516100719190611306565b60405180910390f35b610064610088366004611101565b6100d7565b6100a061009b366004611029565b6101b5565b005b6100a06100b0366004610f64565b6104f4565b6100646100c3366004610f43565b6108bb565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561013757818101518382015260200161011f565b50505050905090810190601f1680156101645780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561018157600080fd5b505afa158015610195573d6000803e3d6000fd5b505050506040513d60208110156101ab57600080fd5b505190505b919050565b866101bf8561090a565b60005a905060006101cf8861090a565b90506101db8b82610923565b156101e65750610432565b60006102216040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b905060006102636040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e0000008152506100d7565b9050816001600160a01b0316634d69ee578e8e8e6040518463ffffffff1660e01b81526004016102959392919061135f565b60206040518083038186803b1580156102ad57600080fd5b505afa1580156102c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102e59190610f0f565b61030a5760405162461bcd60e51b8152600401610301906115e7565b60405180910390fd5b6040516326f2b4e760e11b81526001600160a01b03821690634de569ce9061033c908d908d908d908d90600401611641565b60206040518083038186803b15801561035457600080fd5b505afa158015610368573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038c9190610f0f565b6103a85760405162461bcd60e51b815260040161030190611499565b86600001518860600151018b600001518d6060015101600101146103de5760405162461bcd60e51b815260040161030190611525565b6103ed8d848d60000151610942565b7f41a48bde2468fac6f670f39b66d7b91f311053e1f28eab9d75056546e6eaac958d8c6000015185336040516104269493929190611394565b60405180910390a15050505b60005a820390506104696040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b1580156104cf57600080fd5b505af11580156104e3573d6000803e3d6000fd5b505050505050505050505050505050565b868460005a905060006105078b896108bb565b905060006105446040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b9050816001600160a01b031663b2fa1c9e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561057f57600080fd5b505afa158015610593573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b79190610f0f565b15156001146105d85760405162461bcd60e51b8152600401610301906113b8565b89600001518b606001510160010186600001518860600151011461060e5760405162461bcd60e51b81526004016103019061141f565b604051634d69ee5760e01b81526001600160a01b03821690634d69ee579061063e908f908f908f9060040161135f565b60206040518083038186803b15801561065657600080fd5b505afa15801561066a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068e9190610f0f565b6106aa5760405162461bcd60e51b8152600401610301906115e7565b604051634d69ee5760e01b81526001600160a01b03821690634d69ee57906106da908b908b908b9060040161135f565b60206040518083038186803b1580156106f257600080fd5b505afa158015610706573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072a9190610f0f565b6107465760405162461bcd60e51b8152600401610301906114dd565b816001600160a01b031663c1c618b86040518163ffffffff1660e01b815260040160206040518083038186803b15801561077f57600080fd5b505afa158015610793573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b79190610f2b565b8814156107d65760405162461bcd60e51b815260040161030190611597565b6107e0878d610a6d565b6000600160008e8c6040516020016107f9929190611289565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507f1e5fff3c23daf51ea67aaa3bbc738bcedaa98be5a5503f0e63a336a004b075b18c8b600001518b3360405161087a9493929190611394565b60405180910390a1505060005a820390506104696040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b60006001600084846040516020016108d4929190611289565b60408051808303601f19018152918152815160209283012083529082019290925201600020546001600160a01b03169392505050565b600061091582610bc7565b805190602001209050919050565b60008061093084846108bb565b6001600160a01b031614159392505050565b6109806040518060400160405280601c81526020017f4f564d5f53746174655472616e736974696f6e6572466163746f7279000000008152506100d7565b600054604051631168a38160e11b81526001600160a01b03928316926322d14702926109b79291169085908890889060040161131a565b602060405180830381600087803b1580156109d157600080fd5b505af11580156109e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0991906110e5565b600160008585604051602001610a20929190611289565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550505050565b6000610aa86040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b90506000610adc6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b604051632e38626b60e21b81529091506001600160a01b0383169063b8e189ac90610b0b90879060040161162e565b600060405180830381600087803b158015610b2557600080fd5b505af1158015610b39573d6000803e3d6000fd5b505050506000808560800151806020019051810190610b58919061114f565b60405163abfbbe1360e01b815291935091506001600160a01b0384169063abfbbe1390610b8d90889085908790600401611340565b600060405180830381600087803b158015610ba757600080fd5b505af1158015610bbb573d6000803e3d6000fd5b50505050505050505050565b6060816000015182602001518360400151846060015185608001518660a001518760c00151604051602001610c029796959493929190611297565b6040516020818303038152906040529050919050565b600067ffffffffffffffff831115610c2c57fe5b610c3f601f8401601f1916602001611700565b9050828152838383011115610c5357600080fd5b828260208301376000602084830101529392505050565b80356101b081611754565b600082601f830112610c85578081fd5b610c9483833560208501610c18565b9392505050565b8035600281106101b057600080fd5b600060a08284031215610cbb578081fd5b60405160a0810167ffffffffffffffff8282108183111715610cd957fe5b81604052829350843583526020850135602084015260408501356040840152606085013560608401526080850135915080821115610d1657600080fd5b50610d2385828601610c75565b6080830152505092915050565b600060408284031215610d41578081fd5b6040516040810167ffffffffffffffff8282108183111715610d5f57fe5b8160405282935084358352602091508185013581811115610d7f57600080fd5b8501601f81018713610d9057600080fd5b803582811115610d9c57fe5b8381029250610dac848401611700565b8181528481019083860185850187018b1015610dc757600080fd5b600095505b83861015610dea578035835260019590950194918601918601610dcc565b5080868801525050505050505092915050565b600060a08284031215610e0e578081fd5b60405160a0810167ffffffffffffffff8282108183111715610e2c57fe5b8160405282935084359150610e408261176c565b8183526020850135602084015260408501356040840152606085013560608401526080850135915080821115610d1657600080fd5b600060e08284031215610e86578081fd5b610e9060e0611700565b90508135815260208201356020820152610eac60408301610c9b565b6040820152610ebd60608301610c6a565b6060820152610ece60808301610c6a565b608082015260a082013560a082015260c082013567ffffffffffffffff811115610ef757600080fd5b610f0384828501610c75565b60c08301525092915050565b600060208284031215610f20578081fd5b8151610c948161176c565b600060208284031215610f3c578081fd5b5051919050565b60008060408385031215610f55578081fd5b50508035926020909101359150565b600080600080600080600060e0888a031215610f7e578283fd5b87359650602088013567ffffffffffffffff80821115610f9c578485fd5b610fa88b838c01610caa565b975060408a0135915080821115610fbd578485fd5b610fc98b838c01610d30565b965060608a0135955060808a0135945060a08a0135915080821115610fec578384fd5b610ff88b838c01610caa565b935060c08a013591508082111561100d578283fd5b5061101a8a828b01610d30565b91505092959891949750929550565b600080600080600080600060e0888a031215611043578081fd5b87359650602088013567ffffffffffffffff80821115611061578283fd5b61106d8b838c01610caa565b975060408a0135915080821115611082578283fd5b61108e8b838c01610d30565b965060608a01359150808211156110a3578283fd5b6110af8b838c01610e75565b955060808a01359150808211156110c4578283fd5b6110d08b838c01610dfd565b945060a08a0135915080821115610fec578283fd5b6000602082840312156110f6578081fd5b8151610c9481611754565b600060208284031215611112578081fd5b813567ffffffffffffffff811115611128578182fd5b8201601f81018413611138578182fd5b61114784823560208401610c18565b949350505050565b60008060408385031215611161578182fd5b82519150602083015161117381611754565b809150509250929050565b6001600160a01b03169052565b600081518084526111a3816020860160208601611724565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261114760a085018261118b565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b8083101561123f578451825293830193600192909201919083019061121f565b509695505050505050565b6000815115158352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261114760a085018261118b565b918252602082015260400190565b6000888252876020830152600287106112ac57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b1660558401525083606983015282516112f3816089850160208701611724565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b9283526001600160a01b03919091166020830152604082015260600190565b60008482526060602083015261137860608301856111b7565b828103604084015261138a81856111f4565b9695505050505050565b938452602084019290925260408301526001600160a01b0316606082015260800190565b60208082526041908201527f5374617465207472616e736974696f6e2070726f63657373206d75737420626560408201527f20636f6d706c65746564207072696f7220746f2066696e616c697a6174696f6e6060820152601760f91b608082015260a00190565b60208082526054908201527f506f73742d737461746520726f6f7420676c6f62616c20696e646578206d757360408201527f7420657175616c20746f207468652070726520737461746520726f6f7420676c60608201527337b130b61034b73232bc1038363ab99037b7329760611b608082015260a00190565b60208082526024908201527f496e76616c6964207472616e73616374696f6e20696e636c7573696f6e20707260408201526337b7b31760e11b606082015260800190565b60208082526028908201527f496e76616c696420706f73742d737461746520726f6f7420696e636c7573696f6040820152673710383937b7b31760c11b606082015260800190565b6020808252604c908201527f5072652d737461746520726f6f7420676c6f62616c20696e646578206d75737460408201527f20657175616c20746f20746865207472616e73616374696f6e20726f6f74206760608201526b3637b130b61034b73232bc1760a11b608082015260a00190565b60208082526030908201527f5374617465207472616e736974696f6e20686173206e6f74206265656e20707260408201526f37bb32b710333930bab23ab632b73a1760811b606082015260800190565b60208082526027908201527f496e76616c6964207072652d737461746520726f6f7420696e636c7573696f6e60408201526610383937b7b31760c91b606082015260800190565b600060208252610c9460208301846111b7565b60006080825285516080830152602086015160a083015260408601516002811061166757fe5b60c083015260608601516001600160a01b031660e0830152608086015161169261010084018261117e565b5060a086015161012083015260c086015160e06101408401526116b961016084018261118b565b905082810360208401526116cd818761124a565b905082810360408401526116e181866111b7565b905082810360608401526116f581856111f4565b979650505050505050565b60405181810167ffffffffffffffff8111828210171561171c57fe5b604052919050565b60005b8381101561173f578181015183820152602001611727565b8381111561174e576000848401525b50505050565b6001600160a01b038116811461176957600080fd5b50565b801515811461176957600080fdfea264697066735822122090fa94f972b734dd4c794ce3c199f593acb07d65d0fea3b0025bd8132b68bc7a64736f6c63430007060033", "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", @@ -532,20 +532,20 @@ "storageLayout": { "storage": [ { - "astId": 12055, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_FraudVerifier.sol:OVM_FraudVerifier", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12048" + "type": "t_contract(Lib_AddressManager)15296" }, { - "astId": 8646, + "astId": 11750, "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)11217)" + "type": "t_mapping(t_bytes32,t_contract(iOVM_StateTransitioner)14378)" } ], "types": { @@ -554,22 +554,22 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(Lib_AddressManager)12048": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" }, - "t_contract(iOVM_StateTransitioner)11217": { + "t_contract(iOVM_StateTransitioner)14378": { "encoding": "inplace", "label": "contract iOVM_StateTransitioner", "numberOfBytes": "20" }, - "t_mapping(t_bytes32,t_contract(iOVM_StateTransitioner)11217)": { + "t_mapping(t_bytes32,t_contract(iOVM_StateTransitioner)14378)": { "encoding": "mapping", "key": "t_bytes32", "label": "mapping(bytes32 => contract iOVM_StateTransitioner)", "numberOfBytes": "32", - "value": "t_contract(iOVM_StateTransitioner)11217" + "value": "t_contract(iOVM_StateTransitioner)14378" } } } diff --git a/packages/contracts/deployments/goerli/OVM_L1CrossDomainMessenger.json b/packages/contracts/deployments/goerli/OVM_L1CrossDomainMessenger.json index 503ab92b97a2..3f4af4927827 100644 --- a/packages/contracts/deployments/goerli/OVM_L1CrossDomainMessenger.json +++ b/packages/contracts/deployments/goerli/OVM_L1CrossDomainMessenger.json @@ -1,5 +1,5 @@ { - "address": "0x27BdfF69C72d29493bfD2152DbE28657f8Ddd5df", + "address": "0x3B1D4DE5F7Fe8487980Ee7608BE302dC60a9caE9", "abi": [ { "inputs": [], @@ -19,6 +19,64 @@ "name": "FailedRelayedMessage", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "_xDomainCalldataHash", + "type": "bytes32" + } + ], + "name": "MessageAllowed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "_xDomainCalldataHash", + "type": "bytes32" + } + ], + "name": "MessageBlocked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -45,6 +103,64 @@ "name": "SentMessage", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_xDomainCalldataHash", + "type": "bytes32" + } + ], + "name": "allowMessage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_xDomainCalldataHash", + "type": "bytes32" + } + ], + "name": "blockMessage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "blockedMessages", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -73,12 +189,32 @@ }, { "inputs": [], - "name": "messageNonce", + "name": "owner", "outputs": [ { - "internalType": "uint256", + "internalType": "address", "name": "", - "type": "uint256" + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" } ], "stateMutability": "view", @@ -202,6 +338,13 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -221,7 +364,7 @@ }, { "internalType": "uint256", - "name": "_messageNonce", + "name": "_queueIndex", "type": "uint256" }, { @@ -285,7 +428,7 @@ "type": "bytes32" } ], - "name": "sentMessages", + "name": "successfulMessages", "outputs": [ { "internalType": "bool", @@ -299,20 +442,14 @@ { "inputs": [ { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "successfulMessages", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" + "internalType": "address", + "name": "newOwner", + "type": "address" } ], - "stateMutability": "view", + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", "type": "function" }, { @@ -329,36 +466,52 @@ "type": "function" } ], - "transactionHash": "0x75714a6d9ca51a7b21d8556ab605cee562224d7f13670f3b703043433f8b0ac5", + "transactionHash": "0xd5488c1e8ecb38d2cf9d6c5777135716eb7e0e85a4a1c13ec916f8fffdde133f", "receipt": { "to": null, - "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", - "contractAddress": "0x27BdfF69C72d29493bfD2152DbE28657f8Ddd5df", - "transactionIndex": 3, - "gasUsed": "2236734", + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0x3B1D4DE5F7Fe8487980Ee7608BE302dC60a9caE9", + "transactionIndex": 1, + "gasUsed": "2900721", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x10ae1fc56166e1992c7ece059bf38b711ed5a1f696335fd2f2b9dc82c3d56495", - "transactionHash": "0x75714a6d9ca51a7b21d8556ab605cee562224d7f13670f3b703043433f8b0ac5", + "blockHash": "0xacc5d20c40db0d175906d56f586930dcb9fdefc3397c0276d80c12dba6db92a2", + "transactionHash": "0xd5488c1e8ecb38d2cf9d6c5777135716eb7e0e85a4a1c13ec916f8fffdde133f", "logs": [], - "blockNumber": 4694106, - "cumulativeGasUsed": "3135625", + "blockNumber": 4974831, + "cumulativeGasUsed": "2952984", "status": 1, "byzantium": true }, "args": [], - "solcInputHash": "dde656dd41f49cad9eac9bc7065fd6a7", - "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\":\"FailedRelayedMessage\",\"type\":\"event\"},{\"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\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"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\":\"\",\"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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"sendMessage(address,bytes,uint32)\":{\"notice\":\"Sends a cross domain message to the target messenger.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol\":\"OVM_L1CrossDomainMessenger\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.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 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\":\"0x8bbbc2f5c10065ee272592ae0a7a6ceb23de2fbd81564ee0bb015ecf404d5f61\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/bridge/messaging/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/messaging/iAbs_BaseCrossDomainMessenger.sol\\\";\\n\\n/* External Imports */\\nimport { ReentrancyGuard } from \\\"@openzeppelin/contracts/utils/ReentrancyGuard.sol\\\";\\n\\n/**\\n * @title Abs_BaseCrossDomainMessenger\\n * @dev The Base Cross Domain Messenger is an abstract contract providing the interface and common\\n * functionality used in the L1 and L2 Cross Domain Messengers. It can also serve as a template for\\n * developers wishing to implement a custom bridge 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, ReentrancyGuard {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n // The default x-domain message sender being set to a non-zero value makes\\n // deployment a bit more expensive, but in exchange the refund on every call to\\n // `relayMessage` by the L1 and L2 messengers will be higher.\\n address internal constant DEFAULT_XDOMAIN_SENDER = 0x000000000000000000000000000000000000dEaD;\\n\\n\\n /*************\\n * 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 internal xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() ReentrancyGuard() {}\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function xDomainMessageSender()\\n public\\n override\\n view\\n returns (\\n address\\n )\\n {\\n require(xDomainMsgSender != DEFAULT_XDOMAIN_SENDER, \\\"xDomainMessageSender is not set\\\");\\n return xDomainMsgSender;\\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 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 /**********************\\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 to send.\\n * param // 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\":\"0x8a19df0879604c636834ca5e34482d78dff8acdf415caf913a95415a240f9d62\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/bridge/messaging/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\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_L1CrossDomainMessenger } from \\\"../../../iOVM/bridge/messaging/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\\n * from L2 onto L1. In the event that a message sent from L1 to L2 is rejected for exceeding the L2\\n * epoch gas limit, it can be resubmitted 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 Lib_AddressResolver(address(0))\\n {}\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Modifier to enforce that, if configured, only the OVM_L2MessageRelayer contract may\\n * 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 * @param _libAddressManager Address of the Address Manager.\\n */\\n function initialize(\\n address _libAddressManager\\n )\\n public\\n {\\n require(\\n address(libAddressManager) == address(0),\\n \\\"L1CrossDomainMessenger already intialized.\\\"\\n );\\n\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\\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 xDomainMsgSender = _sender;\\n (bool success, ) = _target.call(_message);\\n xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\\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 } else {\\n emit FailedRelayedMessage(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(\\n resolve(\\\"OVM_StateCommitmentChain\\\")\\n );\\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 predeploy 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\":\"0xaebba6452b71f17982465897efcd935a5724890fe10effaa901051ae2f28f397\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/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\\n event SentMessage(bytes message);\\n event RelayedMessage(bytes32 msgHash);\\n event FailedRelayedMessage(bytes32 msgHash);\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n function xDomainMessageSender() external view returns (address);\\n\\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\":\"0x89981ed48e99d6939cc6cdef827d484fa3e2292d66c0ba5056c7050cb6282d7e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/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 * 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\":\"0x2d7973a0ad84c23ec62624d3f1e3aeb198cc72686ff1e6cfa17155556b320c94\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x2ce671a0e004df88b136bea5a3c59d0732cea8887c8496da1d509e0200b03d7d\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 abi.encodePacked(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\":\"0x161f65220b8c5cf295232f8c58c2744fbc898bf77da5f9d9c5b2dd673dafc6f6\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xa5195afe32fb2cf104d156e8f4bd39df1ec79bf6ba232097b9e8e0ee14fbc298\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x6080604052600580546001600160a01b03191661dead17905534801561002457600080fd5b506001600055600680546001600160a01b03191690556126a9806100496000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c8063706ceab611610071578063706ceab61461011c57806382e3702d1461012f578063b1b1b20914610142578063c4d66de814610155578063d7fd19dd14610168578063ecc704281461017b576100a9565b806321d800ec146100ae578063299ca478146100d75780633dbb202b146100ec578063461a4478146101015780636e296e4514610114575b600080fd5b6100c16100bc3660046120ea565b610190565b6040516100ce9190612300565b60405180910390f35b6100df6101a5565b6040516100ce9190612288565b6100ff6100fa36600461206e565b6101b4565b005b6100df61010f366004612102565b610243565b6100df61031f565b6100ff61012a366004611ff7565b610368565b6100c161013d3660046120ea565b6103cf565b6100c16101503660046120ea565b6103e4565b6100ff610163366004611eae565b6103f9565b6100ff610176366004611ec8565b61044f565b61018361070c565b6040516100ce91906121d1565b60016020526000908152604090205460ff1681565b6006546001600160a01b031681565b60006101c4843385600454610712565b60048054600190810190915581516020808401919091206000908152600390915260409020805460ff1916909117905590506102068163ffffffff841661075f565b7f0ee9ffdb2334d78de97ffb066b23a352a4d35180cefb36589d663fbb1eb6f326816040516102359190612382565b60405180910390a150505050565b60065460405163bf40fac160e01b81526020600482018181528451602484015284516000946001600160a01b03169363bf40fac1938793928392604401918501908083838b5b838110156102a1578181015183820152602001610289565b50505050905090810190601f1680156102ce5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102eb57600080fd5b505afa1580156102ff573d6000803e3d6000fd5b505050506040513d602081101561031557600080fd5b505190505b919050565b6005546000906001600160a01b031661dead14156103585760405162461bcd60e51b815260040161034f90612395565b60405180910390fd5b506005546001600160a01b031690565b600061037686868686610712565b805160208083019190912060009081526003909152604090205490915060ff1615156001146103b75760405162461bcd60e51b815260040161034f9061248a565b6103c7818363ffffffff1661075f565b505050505050565b60036020526000908152604090205460ff1681565b60026020526000908152604090205460ff1681565b6006546001600160a01b0316156104225760405162461bcd60e51b815260040161034f90612572565b600680546001600160a01b039092166001600160a01b03199283161790556005805490911661dead179055565b600260005414156104a7576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600090815560408051808201909152601481527327ab26afa61926b2b9b9b0b3b2a932b630bcb2b960611b60208201526104e290610243565b90506001600160a01b0381161561051b57336001600160a01b0382161461051b5760405162461bcd60e51b815260040161034f906124d5565b600061052987878787610712565b90506105358184610837565b15156001146105565760405162461bcd60e51b815260040161034f9061252b565b80516020808301919091206000818152600290925260409091205460ff16156105915760405162461bcd60e51b815260040161034f906123cc565b600580546001600160a01b0319166001600160a01b03898116919091179091556040516000918a16906105c59089906121e8565b6000604051808303816000865af19150503d8060008114610602576040519150601f19603f3d011682016040523d82523d6000602084013e610607565b606091505b5050600580546001600160a01b03191661dead1790559050801515600114156106805760008281526002602052604090819020805460ff19166001179055517f4641df4a962071e12719d8c8c8e5ac7fc4d97b927346a3d7a335b1f7517e133c906106739084906121d1565b60405180910390a16106b8565b7f99d0e048484baa1b1540b1367cb128acd7ab2946d1ed91ec10e3c85e4bf51b8f826040516106af91906121d1565b60405180910390a15b60008333436040516020016106cf93929190612236565b60408051601f1981840301815291815281516020928301206000908152600192839052908120805460ff1916831790555550505050505050505050565b60045481565b60608484848460405160240161072b949392919061229c565b60408051601f198184030181529190526020810180516001600160e01b031663cbd4ece960e01b1790529050949350505050565b61079d6040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e000000815250610243565b6001600160a01b0316636fee07e06107e96040518060400160405280601a81526020017f4f564d5f4c3243726f7373446f6d61696e4d657373656e676572000000000000815250610243565b83856040518463ffffffff1660e01b8152600401610809939291906122d9565b600060405180830381600087803b15801561082357600080fd5b505af11580156103c7573d6000803e3d6000fd5b60006108428261085c565b8015610853575061085383836109b9565b90505b92915050565b60008061089d6040518060400160405280601881526020017f4f564d5f5374617465436f6d6d69746d656e74436861696e0000000000000000815250610243565b6020840151604051639418bddd60e01b81529192506001600160a01b03831691639418bddd916108cf916004016125bc565b60206040518083038186803b1580156108e757600080fd5b505afa1580156108fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091f91906120ca565b1580156109b25750825160208401516040808601519051634d69ee5760e01b81526001600160a01b03851693634d69ee579361096293919290919060040161230b565b60206040518083038186803b15801561097a57600080fd5b505afa15801561098e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b291906120ca565b9392505050565b600080836109fb6040518060400160405280601a81526020017f4f564d5f4c3243726f7373446f6d61696e4d657373656e676572000000000000815250610243565b604051602001610a0c929190612204565b604051602081830303815290604052805190602001206000604051602001610a359291906121da565b604051602081830303815290604052805190602001209050600080610a84602160991b604051602001610a6891906121b9565b60408051601f1981840301815291905260608701518751610b16565b9092509050600182151514610aab5760405162461bcd60e51b815260040161034f90612417565b6000610ab682610b3f565b9050610b0b84604051602001610acc91906121d1565b6040516020818303038152906040526001604051602001610aed9190612270565b60405160208183030381529060405288608001518460400151610bd1565b979650505050505050565b600060606000610b2586610bf5565b9050610b32818686610c25565b9250925050935093915050565b610b47611c64565b6000610b5283610cf8565b90506040518060800160405280610b7c83600081518110610b6f57fe5b6020026020010151610d0b565b8152602001610b9183600181518110610b6f57fe5b8152602001610bb383600281518110610ba657fe5b6020026020010151610d12565b8152602001610bc883600381518110610ba657fe5b90529392505050565b600080610bdd86610bf5565b9050610beb81868686610e0b565b9695505050505050565b60608180519060200120604051602001610c0f91906121d1565b6040516020818303038152906040529050919050565b600060606000610c3485610e31565b90506000806000610c46848a89610f08565b81519295509093509150158080610c5a5750815b610cab576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b600081610cc75760405180602001604052806000815250610ce6565b610ce6866001870381518110610cd957fe5b60200260200101516112ab565b919b919a509098505050505050505050565b6060610856610d06836112c7565b6112ec565b6000610856825b6000602182600001511115610d6e576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6000806000610d7c85611462565b919450925090506000816001811115610d9157fe5b14610de3576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b602080860151840180519091841015610beb5760208490036101000a90049695505050505050565b6000806000610e1b878686610c25565b91509150818015610b0b5750610b0b868261178b565b60606000610e3e83610cf8565b90506000815167ffffffffffffffff81118015610e5a57600080fd5b50604051908082528060200260200182016040528015610e9457816020015b610e81611c8b565b815260200190600190039081610e795790505b50905060005b8251811015610f00576000610ec1848381518110610eb457fe5b60200260200101516117a1565b90506040518060400160405280828152602001610edd83610cf8565b815250838381518110610eec57fe5b602090810291909101015250600101610e9a565b509392505050565b60006060818080610f1887611830565b905085600080610f26611c8b565b60005b8c51811015611283578c8181518110610f3e57fe5b6020026020010151915082840193506001870196508360001415610fb257815180516020909101208514610fad576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b611079565b81515160201161101957815180516020909101208514610fad576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b84611027836000015161192d565b14611079576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b602082015151601114156110e857855184141561109557611283565b60008685815181106110a357fe5b602001015160f81c60f81b60f81c9050600083602001518260ff16815181106110c857fe5b602002602001015190506110db81611959565b965060019450505061127b565b6002826020015151141561122e5760006111018361198f565b905060008160008151811061111257fe5b016020015160f81c90506001811660020360006111328460ff84166119ad565b905060006111408b8a6119ad565b9050600061114e83836119de565b905060ff851660021480611165575060ff85166003145b156111975780835114801561117a5750808251145b1561118457988901985b50600160ff1b9950611283945050505050565b60ff851615806111aa575060ff85166001145b156111f757806111c75750600160ff1b9950611283945050505050565b6111e888602001516001815181106111db57fe5b6020026020010151611959565b9a50975061127b945050505050565b60405162461bcd60e51b815260040180806020018281038252602681526020018061264e6026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b600101610f29565b50600160ff1b84148661129687866119ad565b909e909d50909b509950505050505050505050565b60208101518051606091610856916000198101908110610eb457fe5b6112cf611ca5565b506040805180820190915281518152602082810190820152919050565b60606000806112fa84611462565b9193509091506001905081600181111561131057fe5b14611362576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b611383611ca5565b81526020019060019003908161137b5790505090506000835b865181101561145757602082106113e45760405162461bcd60e51b815260040180806020018281038252602a815260200180612624602a913960400191505060405180910390fd5b6000806114106040518060400160405280858c60000151038152602001858c6020015101815250611462565b509150915060405180604001604052808383018152602001848b602001510181525085858151811061143e57fe5b602090810291909101015260019390930192010161139c565b508152949350505050565b6000806000808460000151116114bf576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f81116114e4576000600160009450945094505050611784565b60b78111611559578551607f198201908110611547576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b60019550935060009250611784915050565b60bf811161163d57855160b61982019081106115bc576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111611628576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b60019091019550935060009250611784915050565b60f781116116b157855160bf1982019081106116a0576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b600195509350849250611784915050565b855160f619820190811061170c576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111611771576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b6001918201965094509250611784915050565b9193909250565b8051602091820120825192909101919091201490565b606060008060006117b185611462565b9194509250905060008160018111156117c657fe5b14611818576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b61182785602001518484611a44565b95945050505050565b60606000825160020267ffffffffffffffff8111801561184f57600080fd5b506040519080825280601f01601f19166020018201604052801561187a576020820181803683370190505b50905060005b835181101561192657600484828151811061189757fe5b602001015160f81c60f81b6001600160f81b031916901c8282600202815181106118bd57fe5b60200101906001600160f81b031916908160001a90535060108482815181106118e257fe5b016020015160f81c816118f157fe5b0660f81b82826002026001018151811061190757fe5b60200101906001600160f81b031916908160001a905350600101611880565b5092915050565b60006020825110156119445750602081015161031a565b81806020019051602081101561031557600080fd5b6000606060208360000151101561197a5761197383611af2565b9050611986565b611983836117a1565b90505b6109b28161192d565b60606108566119a88360200151600081518110610eb457fe5b611830565b606081835103600014156119d05750604080516020810190915260008152610856565b610853838384865103611afd565b6000805b8084511180156119f25750808351115b8015611a375750828181518110611a0557fe5b602001015160f81c60f81b6001600160f81b031916848281518110611a2657fe5b01602001516001600160f81b031916145b15610853576001016119e2565b606060008267ffffffffffffffff81118015611a5f57600080fd5b506040519080825280601f01601f191660200182016040528015611a8a576020820181803683370190505b509050805160001415611a9e5790506109b2565b8484016020820160005b60208604811015611ac9578251825260209283019290910190600101611aa8565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b606061085682611c4e565b60608182601f011015611b48576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b828284011015611b90576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b81830184511015611bdc576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b606082158015611bfb5760405191506000825260208201604052611c45565b6040519150601f8416801560200281840101858101878315602002848b0101015b81831015611c34578051835260209283019201611c1c565b5050858452601f01601f1916604052505b50949350505050565b6060610856826020015160008460000151611a44565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060608152602001606081525090565b604051806040016040528060008152602001600081525090565b600067ffffffffffffffff831115611cd357fe5b611ce6601f8401601f19166020016125cf565b9050828152838383011115611cfa57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b038116811461031a57600080fd5b600082601f830112611d38578081fd5b61085383833560208501611cbf565b600060a08284031215611d58578081fd5b60405160a0810167ffffffffffffffff8282108183111715611d7657fe5b81604052829350843583526020850135602084015260408501356040840152606085013560608401526080850135915080821115611db357600080fd5b50611dc085828601611d28565b6080830152505092915050565b600060408284031215611dde578081fd5b6040516040810167ffffffffffffffff8282108183111715611dfc57fe5b8160405282935084358352602091508185013581811115611e1c57600080fd5b8501601f81018713611e2d57600080fd5b803582811115611e3957fe5b8381029250611e498484016125cf565b8181528481019083860185850187018b1015611e6457600080fd5b600095505b83861015611e87578035835260019590950194918601918601611e69565b5080868801525050505050505092915050565b803563ffffffff8116811461031a57600080fd5b600060208284031215611ebf578081fd5b61085382611d11565b600080600080600060a08688031215611edf578081fd5b611ee886611d11565b9450611ef660208701611d11565b9350604086013567ffffffffffffffff80821115611f12578283fd5b611f1e89838a01611d28565b9450606088013593506080880135915080821115611f3a578283fd5b9087019060a0828a031215611f4d578283fd5b611f5760a06125cf565b82358152602083013582811115611f6c578485fd5b611f788b828601611d47565b602083015250604083013582811115611f8f578485fd5b611f9b8b828601611dcd565b604083015250606083013582811115611fb2578485fd5b611fbe8b828601611d28565b606083015250608083013582811115611fd5578485fd5b611fe18b828601611d28565b6080830152508093505050509295509295909350565b600080600080600060a0868803121561200e578081fd5b61201786611d11565b945061202560208701611d11565b9350604086013567ffffffffffffffff811115612040578182fd5b61204c88828901611d28565b9350506060860135915061206260808701611e9a565b90509295509295909350565b600080600060608486031215612082578283fd5b61208b84611d11565b9250602084013567ffffffffffffffff8111156120a6578283fd5b6120b286828701611d28565b9250506120c160408501611e9a565b90509250925092565b6000602082840312156120db578081fd5b81518015158114610853578182fd5b6000602082840312156120fb578081fd5b5035919050565b600060208284031215612113578081fd5b813567ffffffffffffffff811115612129578182fd5b8201601f81018413612139578182fd5b61214884823560208401611cbf565b949350505050565b600081518084526121688160208601602086016125f3565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261214860a0850182612150565b60609190911b6001600160601b031916815260140190565b90815260200190565b918252602082015260400190565b600082516121fa8184602087016125f3565b9190910192915050565b600083516122168184602088016125f3565b60609390931b6001600160601b0319169190920190815260140192915050565b600084516122488184602089016125f3565b60609490941b6001600160601b03191691909301908152601481019190915260340192915050565b60f89190911b6001600160f81b031916815260010190565b6001600160a01b0391909116815260200190565b6001600160a01b038581168252841660208201526080604082018190526000906122c890830185612150565b905082606083015295945050505050565b600060018060a01b0385168252836020830152606060408301526118276060830184612150565b901515815260200190565b60008482526020606081840152612325606084018661217c565b838103604085015260408101855182528286015160408484015281815180845260608501915085830194508693505b808410156123745784518252938501936001939093019290850190612354565b509998505050505050505050565b6000602082526108536020830184612150565b6020808252601f908201527f78446f6d61696e4d65737361676553656e646572206973206e6f742073657400604082015260600190565b6020808252602b908201527f50726f7669646564206d6573736167652068617320616c72656164792062656560408201526a37103932b1b2b4bb32b21760a91b606082015260800190565b6020808252604d908201527f4d6573736167652070617373696e67207072656465706c6f7920686173206e6f60408201527f74206265656e20696e697469616c697a6564206f7220696e76616c696420707260608201526c37b7b310383937bb34b232b21760991b608082015260a00190565b6020808252602b908201527f50726f7669646564206d65737361676520686173206e6f7420616c726561647960408201526a103132b2b71039b2b73a1760a91b606082015260800190565b60208082526036908201527f4f6e6c79204f564d5f4c324d65737361676552656c617965722063616e2072656040820152753630bc90261916ba3796a6189036b2b9b9b0b3b2b99760511b606082015260800190565b60208082526027908201527f50726f7669646564206d65737361676520636f756c64206e6f742062652076656040820152663934b334b2b21760c91b606082015260800190565b6020808252602a908201527f4c3143726f7373446f6d61696e4d657373656e67657220616c72656164792069604082015269373a34b0b634bd32b21760b11b606082015260800190565b600060208252610853602083018461217c565b60405181810167ffffffffffffffff811182821017156125eb57fe5b604052919050565b60005b8381101561260e5781810151838201526020016125f6565b8381111561261d576000848401525b5050505056fe50726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e52656365697665642061206e6f6465207769746820616e20756e6b6e6f776e20707265666978a2646970667358221220a662a5b81fc96637d5eb204496c3361c9a88ba50adf515314202446c37fc10ad64736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c8063706ceab611610071578063706ceab61461011c57806382e3702d1461012f578063b1b1b20914610142578063c4d66de814610155578063d7fd19dd14610168578063ecc704281461017b576100a9565b806321d800ec146100ae578063299ca478146100d75780633dbb202b146100ec578063461a4478146101015780636e296e4514610114575b600080fd5b6100c16100bc3660046120ea565b610190565b6040516100ce9190612300565b60405180910390f35b6100df6101a5565b6040516100ce9190612288565b6100ff6100fa36600461206e565b6101b4565b005b6100df61010f366004612102565b610243565b6100df61031f565b6100ff61012a366004611ff7565b610368565b6100c161013d3660046120ea565b6103cf565b6100c16101503660046120ea565b6103e4565b6100ff610163366004611eae565b6103f9565b6100ff610176366004611ec8565b61044f565b61018361070c565b6040516100ce91906121d1565b60016020526000908152604090205460ff1681565b6006546001600160a01b031681565b60006101c4843385600454610712565b60048054600190810190915581516020808401919091206000908152600390915260409020805460ff1916909117905590506102068163ffffffff841661075f565b7f0ee9ffdb2334d78de97ffb066b23a352a4d35180cefb36589d663fbb1eb6f326816040516102359190612382565b60405180910390a150505050565b60065460405163bf40fac160e01b81526020600482018181528451602484015284516000946001600160a01b03169363bf40fac1938793928392604401918501908083838b5b838110156102a1578181015183820152602001610289565b50505050905090810190601f1680156102ce5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102eb57600080fd5b505afa1580156102ff573d6000803e3d6000fd5b505050506040513d602081101561031557600080fd5b505190505b919050565b6005546000906001600160a01b031661dead14156103585760405162461bcd60e51b815260040161034f90612395565b60405180910390fd5b506005546001600160a01b031690565b600061037686868686610712565b805160208083019190912060009081526003909152604090205490915060ff1615156001146103b75760405162461bcd60e51b815260040161034f9061248a565b6103c7818363ffffffff1661075f565b505050505050565b60036020526000908152604090205460ff1681565b60026020526000908152604090205460ff1681565b6006546001600160a01b0316156104225760405162461bcd60e51b815260040161034f90612572565b600680546001600160a01b039092166001600160a01b03199283161790556005805490911661dead179055565b600260005414156104a7576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600090815560408051808201909152601481527327ab26afa61926b2b9b9b0b3b2a932b630bcb2b960611b60208201526104e290610243565b90506001600160a01b0381161561051b57336001600160a01b0382161461051b5760405162461bcd60e51b815260040161034f906124d5565b600061052987878787610712565b90506105358184610837565b15156001146105565760405162461bcd60e51b815260040161034f9061252b565b80516020808301919091206000818152600290925260409091205460ff16156105915760405162461bcd60e51b815260040161034f906123cc565b600580546001600160a01b0319166001600160a01b03898116919091179091556040516000918a16906105c59089906121e8565b6000604051808303816000865af19150503d8060008114610602576040519150601f19603f3d011682016040523d82523d6000602084013e610607565b606091505b5050600580546001600160a01b03191661dead1790559050801515600114156106805760008281526002602052604090819020805460ff19166001179055517f4641df4a962071e12719d8c8c8e5ac7fc4d97b927346a3d7a335b1f7517e133c906106739084906121d1565b60405180910390a16106b8565b7f99d0e048484baa1b1540b1367cb128acd7ab2946d1ed91ec10e3c85e4bf51b8f826040516106af91906121d1565b60405180910390a15b60008333436040516020016106cf93929190612236565b60408051601f1981840301815291815281516020928301206000908152600192839052908120805460ff1916831790555550505050505050505050565b60045481565b60608484848460405160240161072b949392919061229c565b60408051601f198184030181529190526020810180516001600160e01b031663cbd4ece960e01b1790529050949350505050565b61079d6040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e000000815250610243565b6001600160a01b0316636fee07e06107e96040518060400160405280601a81526020017f4f564d5f4c3243726f7373446f6d61696e4d657373656e676572000000000000815250610243565b83856040518463ffffffff1660e01b8152600401610809939291906122d9565b600060405180830381600087803b15801561082357600080fd5b505af11580156103c7573d6000803e3d6000fd5b60006108428261085c565b8015610853575061085383836109b9565b90505b92915050565b60008061089d6040518060400160405280601881526020017f4f564d5f5374617465436f6d6d69746d656e74436861696e0000000000000000815250610243565b6020840151604051639418bddd60e01b81529192506001600160a01b03831691639418bddd916108cf916004016125bc565b60206040518083038186803b1580156108e757600080fd5b505afa1580156108fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091f91906120ca565b1580156109b25750825160208401516040808601519051634d69ee5760e01b81526001600160a01b03851693634d69ee579361096293919290919060040161230b565b60206040518083038186803b15801561097a57600080fd5b505afa15801561098e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b291906120ca565b9392505050565b600080836109fb6040518060400160405280601a81526020017f4f564d5f4c3243726f7373446f6d61696e4d657373656e676572000000000000815250610243565b604051602001610a0c929190612204565b604051602081830303815290604052805190602001206000604051602001610a359291906121da565b604051602081830303815290604052805190602001209050600080610a84602160991b604051602001610a6891906121b9565b60408051601f1981840301815291905260608701518751610b16565b9092509050600182151514610aab5760405162461bcd60e51b815260040161034f90612417565b6000610ab682610b3f565b9050610b0b84604051602001610acc91906121d1565b6040516020818303038152906040526001604051602001610aed9190612270565b60405160208183030381529060405288608001518460400151610bd1565b979650505050505050565b600060606000610b2586610bf5565b9050610b32818686610c25565b9250925050935093915050565b610b47611c64565b6000610b5283610cf8565b90506040518060800160405280610b7c83600081518110610b6f57fe5b6020026020010151610d0b565b8152602001610b9183600181518110610b6f57fe5b8152602001610bb383600281518110610ba657fe5b6020026020010151610d12565b8152602001610bc883600381518110610ba657fe5b90529392505050565b600080610bdd86610bf5565b9050610beb81868686610e0b565b9695505050505050565b60608180519060200120604051602001610c0f91906121d1565b6040516020818303038152906040529050919050565b600060606000610c3485610e31565b90506000806000610c46848a89610f08565b81519295509093509150158080610c5a5750815b610cab576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b600081610cc75760405180602001604052806000815250610ce6565b610ce6866001870381518110610cd957fe5b60200260200101516112ab565b919b919a509098505050505050505050565b6060610856610d06836112c7565b6112ec565b6000610856825b6000602182600001511115610d6e576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6000806000610d7c85611462565b919450925090506000816001811115610d9157fe5b14610de3576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b602080860151840180519091841015610beb5760208490036101000a90049695505050505050565b6000806000610e1b878686610c25565b91509150818015610b0b5750610b0b868261178b565b60606000610e3e83610cf8565b90506000815167ffffffffffffffff81118015610e5a57600080fd5b50604051908082528060200260200182016040528015610e9457816020015b610e81611c8b565b815260200190600190039081610e795790505b50905060005b8251811015610f00576000610ec1848381518110610eb457fe5b60200260200101516117a1565b90506040518060400160405280828152602001610edd83610cf8565b815250838381518110610eec57fe5b602090810291909101015250600101610e9a565b509392505050565b60006060818080610f1887611830565b905085600080610f26611c8b565b60005b8c51811015611283578c8181518110610f3e57fe5b6020026020010151915082840193506001870196508360001415610fb257815180516020909101208514610fad576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b611079565b81515160201161101957815180516020909101208514610fad576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b84611027836000015161192d565b14611079576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b602082015151601114156110e857855184141561109557611283565b60008685815181106110a357fe5b602001015160f81c60f81b60f81c9050600083602001518260ff16815181106110c857fe5b602002602001015190506110db81611959565b965060019450505061127b565b6002826020015151141561122e5760006111018361198f565b905060008160008151811061111257fe5b016020015160f81c90506001811660020360006111328460ff84166119ad565b905060006111408b8a6119ad565b9050600061114e83836119de565b905060ff851660021480611165575060ff85166003145b156111975780835114801561117a5750808251145b1561118457988901985b50600160ff1b9950611283945050505050565b60ff851615806111aa575060ff85166001145b156111f757806111c75750600160ff1b9950611283945050505050565b6111e888602001516001815181106111db57fe5b6020026020010151611959565b9a50975061127b945050505050565b60405162461bcd60e51b815260040180806020018281038252602681526020018061264e6026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b600101610f29565b50600160ff1b84148661129687866119ad565b909e909d50909b509950505050505050505050565b60208101518051606091610856916000198101908110610eb457fe5b6112cf611ca5565b506040805180820190915281518152602082810190820152919050565b60606000806112fa84611462565b9193509091506001905081600181111561131057fe5b14611362576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b611383611ca5565b81526020019060019003908161137b5790505090506000835b865181101561145757602082106113e45760405162461bcd60e51b815260040180806020018281038252602a815260200180612624602a913960400191505060405180910390fd5b6000806114106040518060400160405280858c60000151038152602001858c6020015101815250611462565b509150915060405180604001604052808383018152602001848b602001510181525085858151811061143e57fe5b602090810291909101015260019390930192010161139c565b508152949350505050565b6000806000808460000151116114bf576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f81116114e4576000600160009450945094505050611784565b60b78111611559578551607f198201908110611547576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b60019550935060009250611784915050565b60bf811161163d57855160b61982019081106115bc576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111611628576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b60019091019550935060009250611784915050565b60f781116116b157855160bf1982019081106116a0576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b600195509350849250611784915050565b855160f619820190811061170c576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111611771576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b6001918201965094509250611784915050565b9193909250565b8051602091820120825192909101919091201490565b606060008060006117b185611462565b9194509250905060008160018111156117c657fe5b14611818576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b61182785602001518484611a44565b95945050505050565b60606000825160020267ffffffffffffffff8111801561184f57600080fd5b506040519080825280601f01601f19166020018201604052801561187a576020820181803683370190505b50905060005b835181101561192657600484828151811061189757fe5b602001015160f81c60f81b6001600160f81b031916901c8282600202815181106118bd57fe5b60200101906001600160f81b031916908160001a90535060108482815181106118e257fe5b016020015160f81c816118f157fe5b0660f81b82826002026001018151811061190757fe5b60200101906001600160f81b031916908160001a905350600101611880565b5092915050565b60006020825110156119445750602081015161031a565b81806020019051602081101561031557600080fd5b6000606060208360000151101561197a5761197383611af2565b9050611986565b611983836117a1565b90505b6109b28161192d565b60606108566119a88360200151600081518110610eb457fe5b611830565b606081835103600014156119d05750604080516020810190915260008152610856565b610853838384865103611afd565b6000805b8084511180156119f25750808351115b8015611a375750828181518110611a0557fe5b602001015160f81c60f81b6001600160f81b031916848281518110611a2657fe5b01602001516001600160f81b031916145b15610853576001016119e2565b606060008267ffffffffffffffff81118015611a5f57600080fd5b506040519080825280601f01601f191660200182016040528015611a8a576020820181803683370190505b509050805160001415611a9e5790506109b2565b8484016020820160005b60208604811015611ac9578251825260209283019290910190600101611aa8565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b606061085682611c4e565b60608182601f011015611b48576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b828284011015611b90576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b81830184511015611bdc576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b606082158015611bfb5760405191506000825260208201604052611c45565b6040519150601f8416801560200281840101858101878315602002848b0101015b81831015611c34578051835260209283019201611c1c565b5050858452601f01601f1916604052505b50949350505050565b6060610856826020015160008460000151611a44565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060608152602001606081525090565b604051806040016040528060008152602001600081525090565b600067ffffffffffffffff831115611cd357fe5b611ce6601f8401601f19166020016125cf565b9050828152838383011115611cfa57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b038116811461031a57600080fd5b600082601f830112611d38578081fd5b61085383833560208501611cbf565b600060a08284031215611d58578081fd5b60405160a0810167ffffffffffffffff8282108183111715611d7657fe5b81604052829350843583526020850135602084015260408501356040840152606085013560608401526080850135915080821115611db357600080fd5b50611dc085828601611d28565b6080830152505092915050565b600060408284031215611dde578081fd5b6040516040810167ffffffffffffffff8282108183111715611dfc57fe5b8160405282935084358352602091508185013581811115611e1c57600080fd5b8501601f81018713611e2d57600080fd5b803582811115611e3957fe5b8381029250611e498484016125cf565b8181528481019083860185850187018b1015611e6457600080fd5b600095505b83861015611e87578035835260019590950194918601918601611e69565b5080868801525050505050505092915050565b803563ffffffff8116811461031a57600080fd5b600060208284031215611ebf578081fd5b61085382611d11565b600080600080600060a08688031215611edf578081fd5b611ee886611d11565b9450611ef660208701611d11565b9350604086013567ffffffffffffffff80821115611f12578283fd5b611f1e89838a01611d28565b9450606088013593506080880135915080821115611f3a578283fd5b9087019060a0828a031215611f4d578283fd5b611f5760a06125cf565b82358152602083013582811115611f6c578485fd5b611f788b828601611d47565b602083015250604083013582811115611f8f578485fd5b611f9b8b828601611dcd565b604083015250606083013582811115611fb2578485fd5b611fbe8b828601611d28565b606083015250608083013582811115611fd5578485fd5b611fe18b828601611d28565b6080830152508093505050509295509295909350565b600080600080600060a0868803121561200e578081fd5b61201786611d11565b945061202560208701611d11565b9350604086013567ffffffffffffffff811115612040578182fd5b61204c88828901611d28565b9350506060860135915061206260808701611e9a565b90509295509295909350565b600080600060608486031215612082578283fd5b61208b84611d11565b9250602084013567ffffffffffffffff8111156120a6578283fd5b6120b286828701611d28565b9250506120c160408501611e9a565b90509250925092565b6000602082840312156120db578081fd5b81518015158114610853578182fd5b6000602082840312156120fb578081fd5b5035919050565b600060208284031215612113578081fd5b813567ffffffffffffffff811115612129578182fd5b8201601f81018413612139578182fd5b61214884823560208401611cbf565b949350505050565b600081518084526121688160208601602086016125f3565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261214860a0850182612150565b60609190911b6001600160601b031916815260140190565b90815260200190565b918252602082015260400190565b600082516121fa8184602087016125f3565b9190910192915050565b600083516122168184602088016125f3565b60609390931b6001600160601b0319169190920190815260140192915050565b600084516122488184602089016125f3565b60609490941b6001600160601b03191691909301908152601481019190915260340192915050565b60f89190911b6001600160f81b031916815260010190565b6001600160a01b0391909116815260200190565b6001600160a01b038581168252841660208201526080604082018190526000906122c890830185612150565b905082606083015295945050505050565b600060018060a01b0385168252836020830152606060408301526118276060830184612150565b901515815260200190565b60008482526020606081840152612325606084018661217c565b838103604085015260408101855182528286015160408484015281815180845260608501915085830194508693505b808410156123745784518252938501936001939093019290850190612354565b509998505050505050505050565b6000602082526108536020830184612150565b6020808252601f908201527f78446f6d61696e4d65737361676553656e646572206973206e6f742073657400604082015260600190565b6020808252602b908201527f50726f7669646564206d6573736167652068617320616c72656164792062656560408201526a37103932b1b2b4bb32b21760a91b606082015260800190565b6020808252604d908201527f4d6573736167652070617373696e67207072656465706c6f7920686173206e6f60408201527f74206265656e20696e697469616c697a6564206f7220696e76616c696420707260608201526c37b7b310383937bb34b232b21760991b608082015260a00190565b6020808252602b908201527f50726f7669646564206d65737361676520686173206e6f7420616c726561647960408201526a103132b2b71039b2b73a1760a91b606082015260800190565b60208082526036908201527f4f6e6c79204f564d5f4c324d65737361676552656c617965722063616e2072656040820152753630bc90261916ba3796a6189036b2b9b9b0b3b2b99760511b606082015260800190565b60208082526027908201527f50726f7669646564206d65737361676520636f756c64206e6f742062652076656040820152663934b334b2b21760c91b606082015260800190565b6020808252602a908201527f4c3143726f7373446f6d61696e4d657373656e67657220616c72656164792069604082015269373a34b0b634bd32b21760b11b606082015260800190565b600060208252610853602083018461217c565b60405181810167ffffffffffffffff811182821017156125eb57fe5b604052919050565b60005b8381101561260e5781810151838201526020016125f6565b8381111561261d576000848401525b5050505056fe50726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e52656365697665642061206e6f6465207769746820616e20756e6b6e6f776e20707265666978a2646970667358221220a662a5b81fc96637d5eb204496c3361c9a88ba50adf515314202446c37fc10ad64736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"FailedRelayedMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"_xDomainCalldataHash\",\"type\":\"bytes32\"}],\"name\":\"MessageAllowed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"_xDomainCalldataHash\",\"type\":\"bytes32\"}],\"name\":\"MessageBlocked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_xDomainCalldataHash\",\"type\":\"bytes32\"}],\"name\":\"allowMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_xDomainCalldataHash\",\"type\":\"bytes32\"}],\"name\":\"blockMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"blockedMessages\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"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\"},{\"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\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_target\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_message\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_queueIndex\",\"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\":\"\",\"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\":\"successfulMessages\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"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\":{\"allowMessage(bytes32)\":{\"params\":{\"_xDomainCalldataHash\":\"Hash of the message to block.\"}},\"blockMessage(bytes32)\":{\"params\":{\"_xDomainCalldataHash\":\"Hash of the message to block.\"}},\"initialize(address)\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"paused()\":{\"details\":\"Returns true if the contract is paused, and false otherwise.\"},\"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.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"replayMessage(address,address,bytes,uint256,uint32)\":{\"params\":{\"_gasLimit\":\"Gas limit for the provided message.\",\"_message\":\"Message to send to the target.\",\"_queueIndex\":\"CTC Queue index for the message to replay.\",\"_sender\":\"Original sender address.\",\"_target\":\"Target contract address.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"sendMessage(address,bytes,uint32)\":{\"params\":{\"_gasLimit\":\"Gas limit for the provided message.\",\"_message\":\"Message to send to the target.\",\"_target\":\"Target contract address.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"OVM_L1CrossDomainMessenger\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"allowMessage(bytes32)\":{\"notice\":\"Allow a message.\"},\"blockMessage(bytes32)\":{\"notice\":\"Block a message.\"},\"constructor\":{\"notice\":\"This contract is intended to be behind a delegate proxy. We pass the zero address to the address resolver just to satisfy the constructor. We still need to set this value in initialize().\"},\"pause()\":{\"notice\":\"Pause relaying.\"},\"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.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"sendMessage(address,bytes,uint32)\":{\"notice\":\"Sends a cross domain message to the target messenger.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol\":\"OVM_L1CrossDomainMessenger\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/Initializable.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal initializer {\\n __Context_init_unchained();\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal initializer {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xb419e68addcb82ecda3ad3974b0d2db76435ce9b08435a04d5b119a0c5d45ea5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n// solhint-disable-next-line compiler-version\\npragma solidity >=0.4.24 <0.8.0;\\n\\nimport \\\"../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n */\\nabstract contract Initializable {\\n\\n /**\\n * @dev Indicates that the contract has been initialized.\\n */\\n bool private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Modifier to protect an initializer function from being invoked twice.\\n */\\n modifier initializer() {\\n require(_initializing || _isConstructor() || !_initialized, \\\"Initializable: contract is already initialized\\\");\\n\\n bool isTopLevelCall = !_initializing;\\n if (isTopLevelCall) {\\n _initializing = true;\\n _initialized = true;\\n }\\n\\n _;\\n\\n if (isTopLevelCall) {\\n _initializing = false;\\n }\\n }\\n\\n /// @dev Returns true if and only if the function is running in the constructor\\n function _isConstructor() private view returns (bool) {\\n return !AddressUpgradeable.isContract(address(this));\\n }\\n}\\n\",\"keccak256\":\"0xd8e4eb08dcc1d1860fb347ba5ffd595242b9a1b66d49a47f2b4cb51c3f35017e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.2 <0.8.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { size := extcodesize(account) }\\n return size > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\n (bool success, ) = recipient.call{ value: amount }(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain`call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: value }(data);\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfc5ea91fa9ceb1961023b2a6c978b902888c52b90847ac7813fe3b79524165f6\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\nimport \\\"../proxy/Initializable.sol\\\";\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal initializer {\\n __Context_init_unchained();\\n }\\n\\n function __Context_init_unchained() internal initializer {\\n }\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0xbbf8a21b9a66c48d45ff771b8563c6df19ba451d63dfb8380a865c1e1f29d1a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"./ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which allows children to implement an emergency stop\\n * mechanism that can be triggered by an authorized account.\\n *\\n * This module is used through inheritance. It will make available the\\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\\n * the functions of your contract. Note that they will not be pausable by\\n * simply including this module, only once the modifiers are put in place.\\n */\\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\\n /**\\n * @dev Emitted when the pause is triggered by `account`.\\n */\\n event Paused(address account);\\n\\n /**\\n * @dev Emitted when the pause is lifted by `account`.\\n */\\n event Unpaused(address account);\\n\\n bool private _paused;\\n\\n /**\\n * @dev Initializes the contract in unpaused state.\\n */\\n function __Pausable_init() internal initializer {\\n __Context_init_unchained();\\n __Pausable_init_unchained();\\n }\\n\\n function __Pausable_init_unchained() internal initializer {\\n _paused = false;\\n }\\n\\n /**\\n * @dev Returns true if the contract is paused, and false otherwise.\\n */\\n function paused() public view virtual returns (bool) {\\n return _paused;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is not paused.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n modifier whenNotPaused() {\\n require(!paused(), \\\"Pausable: paused\\\");\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is paused.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n modifier whenPaused() {\\n require(paused(), \\\"Pausable: not paused\\\");\\n _;\\n }\\n\\n /**\\n * @dev Triggers stopped state.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n function _pause() internal virtual whenNotPaused {\\n _paused = true;\\n emit Paused(_msgSender());\\n }\\n\\n /**\\n * @dev Returns to normal state.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n function _unpause() internal virtual whenPaused {\\n _paused = false;\\n emit Unpaused(_msgSender());\\n }\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x73bef0a5dec3efde8183c4858d90f683ed2771656c4329647b4d5b0f89498fd5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\nimport \\\"../proxy/Initializable.sol\\\";\\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 ReentrancyGuardUpgradeable is Initializable {\\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 function __ReentrancyGuard_init() internal initializer {\\n __ReentrancyGuard_init_unchained();\\n }\\n\\n function __ReentrancyGuard_init_unchained() internal initializer {\\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 uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x46034cd5cca740f636345c8f7aebae0f78adfd4b70e31e6f888cccbe1086586e\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/bridge/messaging/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_AddressResolver } from \\\"../../../libraries/resolver/Lib_AddressResolver.sol\\\";\\nimport { Lib_OVMCodec } from \\\"../../../libraries/codec/Lib_OVMCodec.sol\\\";\\nimport { Lib_AddressManager } from \\\"../../../libraries/resolver/Lib_AddressManager.sol\\\";\\nimport { Lib_SecureMerkleTrie } from \\\"../../../libraries/trie/Lib_SecureMerkleTrie.sol\\\";\\nimport { Lib_PredeployAddresses } from \\\"../../../libraries/constants/Lib_PredeployAddresses.sol\\\";\\nimport { Lib_CrossDomainUtils } from \\\"../../../libraries/bridge/Lib_CrossDomainUtils.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_L1CrossDomainMessenger } from \\\"../../../iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol\\\";\\nimport { iOVM_CanonicalTransactionChain } from \\\"../../../iOVM/chain/iOVM_CanonicalTransactionChain.sol\\\";\\nimport { iOVM_StateCommitmentChain } from \\\"../../../iOVM/chain/iOVM_StateCommitmentChain.sol\\\";\\n\\n/* External Imports */\\nimport { OwnableUpgradeable } from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport { PausableUpgradeable } from \\\"@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol\\\";\\nimport { ReentrancyGuardUpgradeable } from \\\"@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol\\\";\\n\\n/**\\n * @title OVM_L1CrossDomainMessenger\\n * @dev The L1 Cross Domain Messenger contract sends messages from L1 to L2, and relays messages\\n * from L2 onto L1. In the event that a message sent from L1 to L2 is rejected for exceeding the L2\\n * epoch gas limit, it can be resubmitted via this contract's replay function.\\n *\\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_L1CrossDomainMessenger is\\n iOVM_L1CrossDomainMessenger,\\n Lib_AddressResolver,\\n OwnableUpgradeable,\\n PausableUpgradeable,\\n ReentrancyGuardUpgradeable\\n{\\n\\n /**********\\n * Events *\\n **********/\\n\\n event MessageBlocked(\\n bytes32 indexed _xDomainCalldataHash\\n );\\n\\n event MessageAllowed(\\n bytes32 indexed _xDomainCalldataHash\\n );\\n\\n /*************\\n * Constants *\\n *************/\\n\\n // The default x-domain message sender being set to a non-zero value makes\\n // deployment a bit more expensive, but in exchange the refund on every call to\\n // `relayMessage` by the L1 and L2 messengers will be higher.\\n address internal constant DEFAULT_XDOMAIN_SENDER = 0x000000000000000000000000000000000000dEaD;\\n\\n /**********************\\n * Contract Variables *\\n **********************/\\n\\n mapping (bytes32 => bool) public blockedMessages;\\n mapping (bytes32 => bool) public relayedMessages;\\n mapping (bytes32 => bool) public successfulMessages;\\n\\n address internal xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * This contract is intended to be behind a delegate proxy.\\n * We pass the zero address to the address resolver just to satisfy the constructor.\\n * We still need to set this value in initialize().\\n */\\n constructor()\\n Lib_AddressResolver(address(0))\\n {}\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Modifier to enforce that, if configured, only the OVM_L2MessageRelayer contract may\\n * 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 * @param _libAddressManager Address of the Address Manager.\\n */\\n function initialize(\\n address _libAddressManager\\n )\\n public\\n initializer\\n {\\n require(\\n address(libAddressManager) == address(0),\\n \\\"L1CrossDomainMessenger already intialized.\\\"\\n );\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\\n\\n // Initialize upgradable OZ contracts\\n __Context_init_unchained(); // Context is a dependency for both Ownable and Pausable\\n __Ownable_init_unchained();\\n __Pausable_init_unchained();\\n __ReentrancyGuard_init_unchained();\\n }\\n\\n /**\\n * Pause relaying.\\n */\\n function pause()\\n external\\n onlyOwner\\n {\\n _pause();\\n }\\n\\n /**\\n * Block a message.\\n * @param _xDomainCalldataHash Hash of the message to block.\\n */\\n function blockMessage(\\n bytes32 _xDomainCalldataHash\\n )\\n external\\n onlyOwner\\n {\\n blockedMessages[_xDomainCalldataHash] = true;\\n emit MessageBlocked(_xDomainCalldataHash);\\n }\\n\\n /**\\n * Allow a message.\\n * @param _xDomainCalldataHash Hash of the message to block.\\n */\\n function allowMessage(\\n bytes32 _xDomainCalldataHash\\n )\\n external\\n onlyOwner\\n {\\n blockedMessages[_xDomainCalldataHash] = false;\\n emit MessageAllowed(_xDomainCalldataHash);\\n }\\n\\n function xDomainMessageSender()\\n public\\n override\\n view\\n returns (\\n address\\n )\\n {\\n require(xDomainMsgSender != DEFAULT_XDOMAIN_SENDER, \\\"xDomainMessageSender is not set\\\");\\n return xDomainMsgSender;\\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 memory _message,\\n uint32 _gasLimit\\n )\\n override\\n public\\n {\\n address ovmCanonicalTransactionChain = resolve(\\\"OVM_CanonicalTransactionChain\\\");\\n // Use the CTC queue length as nonce\\n uint40 nonce = iOVM_CanonicalTransactionChain(ovmCanonicalTransactionChain).getQueueLength();\\n\\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\\n _target,\\n msg.sender,\\n _message,\\n nonce\\n );\\n\\n address l2CrossDomainMessenger = resolve(\\\"OVM_L2CrossDomainMessenger\\\");\\n _sendXDomainMessage(ovmCanonicalTransactionChain, l2CrossDomainMessenger, xDomainCalldata, _gasLimit);\\n emit SentMessage(xDomainCalldata);\\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 whenNotPaused\\n {\\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\\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 require(\\n blockedMessages[xDomainCalldataHash] == false,\\n \\\"Provided message has been blocked.\\\"\\n );\\n\\n xDomainMsgSender = _sender;\\n (bool success, ) = _target.call(_message);\\n xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\\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 } else {\\n emit FailedRelayedMessage(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 _queueIndex,\\n uint32 _gasLimit\\n )\\n override\\n public\\n {\\n // Verify that the message is in the queue:\\n address canonicalTransactionChain = resolve(\\\"OVM_CanonicalTransactionChain\\\");\\n Lib_OVMCodec.QueueElement memory element = iOVM_CanonicalTransactionChain(canonicalTransactionChain).getQueueElement(_queueIndex);\\n\\n address l2CrossDomainMessenger = resolve(\\\"OVM_L2CrossDomainMessenger\\\");\\n // Compute the transactionHash\\n bytes32 transactionHash = keccak256(\\n abi.encode(\\n address(this),\\n l2CrossDomainMessenger,\\n _gasLimit,\\n _message\\n )\\n );\\n\\n require(\\n transactionHash == element.transactionHash,\\n \\\"Provided message has not been enqueued.\\\"\\n );\\n\\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\\n _target,\\n _sender,\\n _message,\\n _queueIndex\\n );\\n\\n _sendXDomainMessage(canonicalTransactionChain, l2CrossDomainMessenger, 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(\\n resolve(\\\"OVM_StateCommitmentChain\\\")\\n );\\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(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER),\\n _proof.stateTrieWitness,\\n _proof.stateRoot\\n );\\n\\n require(\\n exists == true,\\n \\\"Message passing predeploy 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 _canonicalTransactionChain Address of the OVM_CanonicalTransactionChain instance.\\n * @param _l2CrossDomainMessenger Address of the OVM_L2CrossDomainMessenger instance.\\n * @param _message Message to send.\\n * @param _gasLimit OVM gas limit for the message.\\n */\\n function _sendXDomainMessage(\\n address _canonicalTransactionChain,\\n address _l2CrossDomainMessenger,\\n bytes memory _message,\\n uint256 _gasLimit\\n )\\n internal\\n {\\n iOVM_CanonicalTransactionChain(_canonicalTransactionChain).enqueue(\\n _l2CrossDomainMessenger,\\n _gasLimit,\\n _message\\n );\\n }\\n}\\n\",\"keccak256\":\"0x627ab8efc23a85497fccbbf465890b88cadb12326299295ec4c567ddea9a7a7e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_CrossDomainMessenger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/**\\n * @title iOVM_CrossDomainMessenger\\n */\\ninterface iOVM_CrossDomainMessenger {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event SentMessage(bytes message);\\n event RelayedMessage(bytes32 msgHash);\\n event FailedRelayedMessage(bytes32 msgHash);\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n function xDomainMessageSender() external view returns (address);\\n\\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\":\"0x03dd576abe8e562cca646dd59b5c038291dffa9a5e43e4e3765d38cf1406fa62\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/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 { iOVM_CrossDomainMessenger } from \\\"./iOVM_CrossDomainMessenger.sol\\\";\\n\\n/**\\n * @title iOVM_L1CrossDomainMessenger\\n */\\ninterface iOVM_L1CrossDomainMessenger is iOVM_CrossDomainMessenger {\\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 _queueIndex CTC Queue index for the message to replay.\\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 _queueIndex,\\n uint32 _gasLimit\\n ) external;\\n}\\n\",\"keccak256\":\"0xd278237bb588a45208d8ed57c7766386cddd1dc1e4f31867c9cb356939dfd49a\",\"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 * 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\",\"keccak256\":\"0x180b9c347e20f1a6efa553b0f2b9a59aebceda92a7484ae6fca4da2bf1d960c3\",\"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/bridge/Lib_CrossDomainUtils.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\\\";\\n\\n/**\\n * @title Lib_CrossDomainUtils\\n */\\nlibrary Lib_CrossDomainUtils {\\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 encodeXDomainCalldata(\\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\",\"keccak256\":\"0x019940ce688f689f30ce43da1f58dc6d6742ad9bcb6cccaaf7c6bb0a16c48f9f\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_PredeployAddresses\\n */\\nlibrary Lib_PredeployAddresses {\\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\\n address internal constant ECDSA_CONTRACT_ACCOUNT = 0x4200000000000000000000000000000000000003;\\n address internal constant SEQUENCER_ENTRYPOINT = 0x4200000000000000000000000000000000000005;\\n address payable internal constant OVM_ETH = 0x4200000000000000000000000000000000000006;\\n address internal constant L2_CROSS_DOMAIN_MESSENGER = 0x4200000000000000000000000000000000000007;\\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\\n address internal constant EXECUTION_MANAGER_WRAPPER = 0x420000000000000000000000000000000000000B;\\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\\n address internal constant ERC1820_REGISTRY = 0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24;\\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\\n}\\n\",\"keccak256\":\"0x798dd3fe47c172880978c8e4d35573b25d5135be29a77584e9fac45845748695\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 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, _key, 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 != pathRemainder.length) {\\n // Our extension node is not identical to the remainder.\\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 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 path may include\\n * additional nodes (e.g., it comes directly from a proof) and we can't resize in-memory\\n * arrays without costly duplication.\\n * @param _key Full original key.\\n * @param _keyRemainder Portion of the initial key that must be inserted 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 _key,\\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 // Reference: https://github.com/ethereumjs/merkle-patricia-tree/blob/c0a10395aab37d42c175a47114ebfcbd7efcf059/src/baseTrie.ts#L294-L313\\n bool matchLeaf = false;\\n if (lastNodeType == NodeType.LeafNode) {\\n uint256 l = 0;\\n if (_path.length > 0) {\\n for (uint256 i = 0; i < _path.length - 1; i++) {\\n if (_getNodeType(_path[i]) == NodeType.BranchNode) {\\n l++;\\n } else {\\n l += _getNodeKey(_path[i]).length;\\n }\\n }\\n }\\n\\n if (\\n _getSharedNibbleLength(\\n _getNodeKey(lastNode),\\n Lib_BytesUtils.slice(Lib_BytesUtils.toNibbles(_key), l)\\n ) == _getNodeKey(lastNode).length\\n && keyRemainder.length == 0\\n ) {\\n matchLeaf = true;\\n }\\n }\\n\\n if (matchLeaf) {\\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 = _editExtensionNodeValue(currentNode, 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 * Creates a new extension node with the same key but a different value.\\n * @param _node Extension node to copy and modify.\\n * @param _value New value for the extension node.\\n * @return New node with the same key and different value.\\n */\\n function _editExtensionNodeValue(\\n TrieNode memory _node,\\n bytes memory _value\\n )\\n private\\n pure\\n returns (\\n TrieNode memory\\n )\\n {\\n bytes[] memory raw = new bytes[](2);\\n bytes memory key = _addHexPrefix(_getNodeKey(_node), false);\\n raw[0] = Lib_RLPWriter.writeBytes(Lib_BytesUtils.fromNibbles(key));\\n if (_value.length < 32) {\\n raw[1] = _value;\\n } else {\\n raw[1] = Lib_RLPWriter.writeBytes(_value);\\n }\\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 abi.encodePacked(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\":\"0x4bb09d0b4f965b57cdc6b3ace49967bcfe7f2580fa0b7863dfe288081247d876\",\"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 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\":\"0xbbdd600165307d2131340599afa9dc0991f8f63727ba3a834bca5a3d7f501da8\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405260cc80546001600160a01b03191661dead17905534801561002457600080fd5b50600080546001600160a01b0319169055613310806100446000396000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c8063715018a6116100a2578063b1b1b20911610071578063b1b1b209146101d7578063c4d66de8146101ea578063c6b94ab0146101fd578063d7fd19dd14610210578063f2fde38b146102235761010b565b8063715018a6146101ac57806381ada46c146101b45780638456cb59146101c75780638da5cb5b146101cf5761010b565b8063461a4478116100de578063461a4478146101765780635c975abb146101895780636e296e4514610191578063706ceab6146101995761010b565b80630ecf2eea1461011057806321d800ec14610125578063299ca4781461014e5780633dbb202b14610163575b600080fd5b61012361011e366004612bef565b610236565b005b610138610133366004612bef565b6102db565b6040516101459190612eb5565b60405180910390f35b6101566102f0565b6040516101459190612e05565b610123610171366004612b73565b6102ff565b610156610184366004612c07565b61045e565b61013861053c565b610156610545565b6101236101a7366004612afc565b61058e565b610123610711565b6101236101c2366004612bef565b6107bd565b61012361085f565b6101566108cb565b6101386101e5366004612bef565b6108da565b6101236101f83660046129b3565b6108ef565b61013861020b366004612bef565b610a1d565b61012361021e3660046129cd565b610a32565b6101236102313660046129b3565b610d70565b61023e610e73565b6001600160a01b031661024f6108cb565b6001600160a01b031614610298576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b600081815260c96020526040808220805460ff191660011790555182917ff52508d5339edf0d7e5060a416df98db067af561bdc60872d29c0439eaa13a0291a250565b60ca6020526000908152604090205460ff1681565b6000546001600160a01b031681565b600061033f6040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e00000081525061045e565b90506000816001600160a01b031663b8f770056040518163ffffffff1660e01b815260040160206040518083038186803b15801561037c57600080fd5b505afa158015610390573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103b49190612cb3565b905060006103cb8633878564ffffffffff16610e77565b9050600061040a6040518060400160405280601a81526020017927ab26afa61921b937b9b9a237b6b0b4b726b2b9b9b2b733b2b960311b81525061045e565b905061041e8482848863ffffffff16610ec4565b7f0ee9ffdb2334d78de97ffb066b23a352a4d35180cefb36589d663fbb1eb6f3268260405161044d9190612f37565b60405180910390a150505050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156104be5781810151838201526020016104a6565b50505050905090810190601f1680156104eb5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561050857600080fd5b505afa15801561051c573d6000803e3d6000fd5b505050506040513d602081101561053257600080fd5b505190505b919050565b60655460ff1690565b60cc546000906001600160a01b031661dead141561057e5760405162461bcd60e51b815260040161057590612f4a565b60405180910390fd5b5060cc546001600160a01b031690565b60006105ce6040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e00000081525061045e565b90506000816001600160a01b0316632a7f18be856040518263ffffffff1660e01b81526004016105fe9190612d4e565b60606040518083038186803b15801561061657600080fd5b505afa15801561062a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064e9190612c55565b9050600061068d6040518060400160405280601a81526020017927ab26afa61921b937b9b9a237b6b0b4b726b2b9b9b2b733b2b960311b81525061045e565b90506000308286896040516020016106a89493929190612e56565b604051602081830303815290604052805190602001209050826000015181146106e35760405162461bcd60e51b815260040161057590613168565b60006106f18a8a8a8a610e77565b90506107058584838963ffffffff16610ec4565b50505050505050505050565b610719610e73565b6001600160a01b031661072a6108cb565b6001600160a01b031614610773576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b6033546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3603380546001600160a01b0319169055565b6107c5610e73565b6001600160a01b03166107d66108cb565b6001600160a01b03161461081f576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b600081815260c96020526040808220805460ff191690555182917f52c8a2680a9f4cc0ad0bf88f32096eadbebf0646ea611d93a0ce6a29a024040591a250565b610867610e73565b6001600160a01b03166108786108cb565b6001600160a01b0316146108c1576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b6108c9610f2c565b565b6033546001600160a01b031690565b60cb6020526000908152604090205460ff1681565b600054600160a81b900460ff168061090a575061090a610fcc565b8061091f5750600054600160a01b900460ff16155b61095a5760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff16158015610991576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b6000546001600160a01b0316156109ba5760405162461bcd60e51b81526004016105759061311e565b600080546001600160a01b0384166001600160a01b03199182161790915560cc805490911661dead1790556109ed610fdd565b6109f5611096565b6109fd6111a6565b610a05611268565b8015610a19576000805460ff60a81b191690555b5050565b60c96020526000908152604090205460ff1681565b60026097541415610a8a576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260975560408051808201909152601481527327ab26afa61926b2b9b9b0b3b2a932b630bcb2b960611b6020820152600090610ac69061045e565b90506001600160a01b03811615610aff57336001600160a01b03821614610aff5760405162461bcd60e51b815260040161057590613081565b610b0761053c565b15610b4c576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6000610b5a87878787610e77565b9050610b668184611325565b1515600114610b875760405162461bcd60e51b8152600401610575906130d7565b8051602080830191909120600081815260cb90925260409091205460ff1615610bc25760405162461bcd60e51b815260040161057590612f81565b600081815260c9602052604090205460ff1615610bf15760405162461bcd60e51b81526004016105759061303f565b60cc80546001600160a01b0319166001600160a01b03898116919091179091556040516000918a1690610c25908990612d65565b6000604051808303816000865af19150503d8060008114610c62576040519150601f19603f3d011682016040523d82523d6000602084013e610c67565b606091505b505060cc80546001600160a01b03191661dead179055905080151560011415610ce057600082815260cb602052604090819020805460ff19166001179055517f4641df4a962071e12719d8c8c8e5ac7fc4d97b927346a3d7a335b1f7517e133c90610cd3908490612d4e565b60405180910390a1610d18565b7f99d0e048484baa1b1540b1367cb128acd7ab2946d1ed91ec10e3c85e4bf51b8f82604051610d0f9190612d4e565b60405180910390a15b6000833343604051602001610d2f93929190612db3565b60408051601f198184030181529181528151602092830120600090815260ca9092529020805460ff1916600190811790915560975550505050505050505050565b610d78610e73565b6001600160a01b0316610d896108cb565b6001600160a01b031614610dd2576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b6001600160a01b038116610e175760405162461bcd60e51b81526004018080602001828103825260268152602001806132176026913960400191505060405180910390fd5b6033546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3603380546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b606084848484604051602401610e909493929190612e19565b60408051601f198184030181529190526020810180516001600160e01b031663cbd4ece960e01b1790529050949350505050565b60405163037f703f60e51b81526001600160a01b03851690636fee07e090610ef490869085908790600401612e8e565b600060405180830381600087803b158015610f0e57600080fd5b505af1158015610f22573d6000803e3d6000fd5b5050505050505050565b610f3461053c565b15610f79576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610faf610e73565b604080516001600160a01b039092168252519081900360200190a1565b6000610fd73061134a565b15905090565b600054600160a81b900460ff1680610ff85750610ff8610fcc565b8061100d5750600054600160a01b900460ff16155b6110485760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff1615801561107f576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b8015611093576000805460ff60a81b191690555b50565b600054600160a81b900460ff16806110b157506110b1610fcc565b806110c65750600054600160a01b900460ff16155b6111015760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff16158015611138576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b6000611142610e73565b603380546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3508015611093576000805460ff60a81b1916905550565b600054600160a81b900460ff16806111c157506111c1610fcc565b806111d65750600054600160a01b900460ff16155b6112115760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff16158015611248576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b6065805460ff191690558015611093576000805460ff60a81b1916905550565b600054600160a81b900460ff16806112835750611283610fcc565b806112985750600054600160a01b900460ff16155b6112d35760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff1615801561130a576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b60016097558015611093576000805460ff60a81b1916905550565b600061133082611350565b8015611341575061134183836114ad565b90505b92915050565b3b151590565b6000806113916040518060400160405280601881526020017f4f564d5f5374617465436f6d6d69746d656e74436861696e000000000000000081525061045e565b6020840151604051639418bddd60e01b81529192506001600160a01b03831691639418bddd916113c3916004016131af565b60206040518083038186803b1580156113db57600080fd5b505afa1580156113ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114139190612bcf565b1580156114a65750825160208401516040808601519051634d69ee5760e01b81526001600160a01b03851693634d69ee5793611456939192909190600401612ec0565b60206040518083038186803b15801561146e57600080fd5b505afa158015611482573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a69190612bcf565b9392505050565b600080836114ec6040518060400160405280601a81526020017927ab26afa61921b937b9b9a237b6b0b4b726b2b9b9b2b733b2b960311b81525061045e565b6040516020016114fd929190612d81565b604051602081830303815290604052805190602001206000604051602001611526929190612d57565b604051602081830303815290604052805190602001209050600080611575602160991b6040516020016115599190612d36565b60408051601f1981840301815291905260608701518751611607565b909250905060018215151461159c5760405162461bcd60e51b815260040161057590612fcc565b60006115a782611630565b90506115fc846040516020016115bd9190612d4e565b60405160208183030381529060405260016040516020016115de9190612ded565b604051602081830303815290604052886080015184604001516116c2565b979650505050505050565b600060606000611616866116e6565b9050611623818686611716565b9250925050935093915050565b611638612754565b6000611643836117e9565b9050604051806080016040528061166d8360008151811061166057fe5b60200260200101516117fc565b81526020016116828360018151811061166057fe5b81526020016116a48360028151811061169757fe5b6020026020010151611803565b81526020016116b98360038151811061169757fe5b90529392505050565b6000806116ce866116e6565b90506116dc818686866118fc565b9695505050505050565b606081805190602001206040516020016117009190612d4e565b6040516020818303038152906040529050919050565b60006060600061172585611922565b90506000806000611737848a896119f9565b8151929550909350915015808061174b5750815b61179c576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b6000816117b857604051806020016040528060008152506117d7565b6117d78660018703815181106117ca57fe5b6020026020010151611d9f565b919b919a509098505050505050505050565b60606113446117f783611dbb565b611de0565b6000611344825b600060218260000151111561185f576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b600080600061186d85611f56565b91945092509050600081600181111561188257fe5b146118d4576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6020808601518401805190918410156116dc5760208490036101000a90049695505050505050565b600080600061190c878686611716565b915091508180156115fc57506115fc868261227f565b6060600061192f836117e9565b90506000815167ffffffffffffffff8111801561194b57600080fd5b5060405190808252806020026020018201604052801561198557816020015b61197261277b565b81526020019060019003908161196a5790505b50905060005b82518110156119f15760006119b28483815181106119a557fe5b6020026020010151612295565b905060405180604001604052808281526020016119ce836117e9565b8152508383815181106119dd57fe5b60209081029190910101525060010161198b565b509392505050565b60006060818080611a0987612324565b905085600080611a1761277b565b60005b8c51811015611d77578c8181518110611a2f57fe5b6020026020010151915082840193506001870196508360001415611aa357815180516020909101208514611a9e576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b611b6a565b815151602011611b0a57815180516020909101208514611a9e576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b84611b188360000151612421565b14611b6a576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b60208201515160111415611bd9578551841415611b8657611d77565b6000868581518110611b9457fe5b602001015160f81c60f81b60f81c9050600083602001518260ff1681518110611bb957fe5b60200260200101519050611bcc8161244d565b9650600194505050611d6f565b60028260200151511415611d22576000611bf283612483565b9050600081600081518110611c0357fe5b016020015160f81c9050600181166002036000611c238460ff84166124a1565b90506000611c318b8a6124a1565b90506000611c3f83836124ce565b905060ff851660021480611c56575060ff85166003145b15611c8857808351148015611c6b5750808251145b15611c7557988901985b50600160ff1b9950611d77945050505050565b60ff85161580611c9b575060ff85166001145b15611ceb5782518114611cbb5750600160ff1b9950611d77945050505050565b611cdc8860200151600181518110611ccf57fe5b602002602001015161244d565b9a509750611d6f945050505050565b60405162461bcd60e51b81526004018080602001828103825260268152602001806132956026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b600101611a1a565b50600160ff1b841486611d8a87866124a1565b909e909d50909b509950505050505050505050565b602081015180516060916113449160001981019081106119a557fe5b611dc3612795565b506040805180820190915281518152602082810190820152919050565b6060600080611dee84611f56565b91935090915060019050816001811115611e0457fe5b14611e56576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b611e77612795565b815260200190600190039081611e6f5790505090506000835b8651811015611f4b5760208210611ed85760405162461bcd60e51b815260040180806020018281038252602a81526020018061323d602a913960400191505060405180910390fd5b600080611f046040518060400160405280858c60000151038152602001858c6020015101815250611f56565b509150915060405180604001604052808383018152602001848b6020015101815250858581518110611f3257fe5b6020908102919091010152600193909301920101611e90565b508152949350505050565b600080600080846000015111611fb3576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f8111611fd8576000600160009450945094505050612278565b60b7811161204d578551607f19820190811061203b576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b60019550935060009250612278915050565b60bf811161213157855160b61982019081106120b0576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a600185015104905080820188600001511161211c576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b60019091019550935060009250612278915050565b60f781116121a557855160bf198201908110612194576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b600195509350849250612278915050565b855160f6198201908110612200576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111612265576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b6001918201965094509250612278915050565b9193909250565b8051602091820120825192909101919091201490565b606060008060006122a585611f56565b9194509250905060008160018111156122ba57fe5b1461230c576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b61231b85602001518484612534565b95945050505050565b60606000825160020267ffffffffffffffff8111801561234357600080fd5b506040519080825280601f01601f19166020018201604052801561236e576020820181803683370190505b50905060005b835181101561241a57600484828151811061238b57fe5b602001015160f81c60f81b6001600160f81b031916901c8282600202815181106123b157fe5b60200101906001600160f81b031916908160001a90535060108482815181106123d657fe5b016020015160f81c816123e557fe5b0660f81b8282600202600101815181106123fb57fe5b60200101906001600160f81b031916908160001a905350600101612374565b5092915050565b600060208251101561243857506020810151610537565b81806020019051602081101561053257600080fd5b6000606060208360000151101561246e57612467836125e2565b905061247a565b61247783612295565b90505b6114a681612421565b606061134461249c83602001516000815181106119a557fe5b612324565b6060825182106124c05750604080516020810190915260008152611344565b6113418383848651036125ed565b6000805b8084511180156124e25750808351115b801561252757508281815181106124f557fe5b602001015160f81c60f81b6001600160f81b03191684828151811061251657fe5b01602001516001600160f81b031916145b15611341576001016124d2565b606060008267ffffffffffffffff8111801561254f57600080fd5b506040519080825280601f01601f19166020018201604052801561257a576020820181803683370190505b50905080516000141561258e5790506114a6565b8484016020820160005b602086048110156125b9578251825260209283019290910190600101612598565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b60606113448261273e565b60608182601f011015612638576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b828284011015612680576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b818301845110156126cc576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b6060821580156126eb5760405191506000825260208201604052612735565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561272457805183526020928301920161270c565b5050858452601f01601f1916604052505b50949350505050565b6060611344826020015160008460000151612534565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060608152602001606081525090565b604051806040016040528060008152602001600081525090565b600067ffffffffffffffff8311156127c357fe5b6127d6601f8401601f19166020016131c2565b90508281528383830111156127ea57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b038116811461053757600080fd5b600082601f830112612828578081fd5b611341838335602085016127af565b600060a08284031215612848578081fd5b60405160a0810167ffffffffffffffff828210818311171561286657fe5b816040528293508435835260208501356020840152604085013560408401526060850135606084015260808501359150808211156128a357600080fd5b506128b085828601612818565b6080830152505092915050565b6000604082840312156128ce578081fd5b6040516040810167ffffffffffffffff82821081831117156128ec57fe5b816040528293508435835260209150818501358181111561290c57600080fd5b8501601f8101871361291d57600080fd5b80358281111561292957fe5b83810292506129398484016131c2565b8181528481019083860185850187018b101561295457600080fd5b600095505b83861015612977578035835260019590950194918601918601612959565b5080868801525050505050505092915050565b803563ffffffff8116811461053757600080fd5b805164ffffffffff8116811461053757600080fd5b6000602082840312156129c4578081fd5b61134182612801565b600080600080600060a086880312156129e4578081fd5b6129ed86612801565b94506129fb60208701612801565b9350604086013567ffffffffffffffff80821115612a17578283fd5b612a2389838a01612818565b9450606088013593506080880135915080821115612a3f578283fd5b9087019060a0828a031215612a52578283fd5b612a5c60a06131c2565b82358152602083013582811115612a71578485fd5b612a7d8b828601612837565b602083015250604083013582811115612a94578485fd5b612aa08b8286016128bd565b604083015250606083013582811115612ab7578485fd5b612ac38b828601612818565b606083015250608083013582811115612ada578485fd5b612ae68b828601612818565b6080830152508093505050509295509295909350565b600080600080600060a08688031215612b13578081fd5b612b1c86612801565b9450612b2a60208701612801565b9350604086013567ffffffffffffffff811115612b45578182fd5b612b5188828901612818565b93505060608601359150612b676080870161298a565b90509295509295909350565b600080600060608486031215612b87578283fd5b612b9084612801565b9250602084013567ffffffffffffffff811115612bab578283fd5b612bb786828701612818565b925050612bc66040850161298a565b90509250925092565b600060208284031215612be0578081fd5b81518015158114611341578182fd5b600060208284031215612c00578081fd5b5035919050565b600060208284031215612c18578081fd5b813567ffffffffffffffff811115612c2e578182fd5b8201601f81018413612c3e578182fd5b612c4d848235602084016127af565b949350505050565b600060608284031215612c66578081fd5b6040516060810181811067ffffffffffffffff82111715612c8357fe5b60405282518152612c966020840161299e565b6020820152612ca76040840161299e565b60408201529392505050565b600060208284031215612cc4578081fd5b6113418261299e565b60008151808452612ce58160208601602086016131e6565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a06080850152612c4d60a0850182612ccd565b60609190911b6001600160601b031916815260140190565b90815260200190565b918252602082015260400190565b60008251612d778184602087016131e6565b9190910192915050565b60008351612d938184602088016131e6565b60609390931b6001600160601b0319169190920190815260140192915050565b60008451612dc58184602089016131e6565b60609490941b6001600160601b03191691909301908152601481019190915260340192915050565b60f89190911b6001600160f81b031916815260010190565b6001600160a01b0391909116815260200190565b6001600160a01b03858116825284166020820152608060408201819052600090612e4590830185612ccd565b905082606083015295945050505050565b6001600160a01b0385811682528416602082015263ffffffff831660408201526080606082018190526000906116dc90830184612ccd565b600060018060a01b03851682528360208301526060604083015261231b6060830184612ccd565b901515815260200190565b60008482526020606081840152612eda6060840186612cf9565b838103604085015260408101855182528286015160408484015281815180845260608501915085830194508693505b80841015612f295784518252938501936001939093019290850190612f09565b509998505050505050505050565b6000602082526113416020830184612ccd565b6020808252601f908201527f78446f6d61696e4d65737361676553656e646572206973206e6f742073657400604082015260600190565b6020808252602b908201527f50726f7669646564206d6573736167652068617320616c72656164792062656560408201526a37103932b1b2b4bb32b21760a91b606082015260800190565b6020808252604d908201527f4d6573736167652070617373696e67207072656465706c6f7920686173206e6f60408201527f74206265656e20696e697469616c697a6564206f7220696e76616c696420707260608201526c37b7b310383937bb34b232b21760991b608082015260a00190565b60208082526022908201527f50726f7669646564206d65737361676520686173206265656e20626c6f636b65604082015261321760f11b606082015260800190565b60208082526036908201527f4f6e6c79204f564d5f4c324d65737361676552656c617965722063616e2072656040820152753630bc90261916ba3796a6189036b2b9b9b0b3b2b99760511b606082015260800190565b60208082526027908201527f50726f7669646564206d65737361676520636f756c64206e6f742062652076656040820152663934b334b2b21760c91b606082015260800190565b6020808252602a908201527f4c3143726f7373446f6d61696e4d657373656e67657220616c72656164792069604082015269373a34b0b634bd32b21760b11b606082015260800190565b60208082526027908201527f50726f7669646564206d65737361676520686173206e6f74206265656e20656e60408201526638bab2bab2b21760c91b606082015260800190565b6000602082526113416020830184612cf9565b60405181810167ffffffffffffffff811182821017156131de57fe5b604052919050565b60005b838110156132015781810151838201526020016131e9565b83811115613210576000848401525b5050505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737350726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a656452656365697665642061206e6f6465207769746820616e20756e6b6e6f776e207072656669784f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a26469706673582212203a1cd12f46684c95bb11e17fac1702e7dc0fea4c9f70f060e2b6070b1731d33764736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061010b5760003560e01c8063715018a6116100a2578063b1b1b20911610071578063b1b1b209146101d7578063c4d66de8146101ea578063c6b94ab0146101fd578063d7fd19dd14610210578063f2fde38b146102235761010b565b8063715018a6146101ac57806381ada46c146101b45780638456cb59146101c75780638da5cb5b146101cf5761010b565b8063461a4478116100de578063461a4478146101765780635c975abb146101895780636e296e4514610191578063706ceab6146101995761010b565b80630ecf2eea1461011057806321d800ec14610125578063299ca4781461014e5780633dbb202b14610163575b600080fd5b61012361011e366004612bef565b610236565b005b610138610133366004612bef565b6102db565b6040516101459190612eb5565b60405180910390f35b6101566102f0565b6040516101459190612e05565b610123610171366004612b73565b6102ff565b610156610184366004612c07565b61045e565b61013861053c565b610156610545565b6101236101a7366004612afc565b61058e565b610123610711565b6101236101c2366004612bef565b6107bd565b61012361085f565b6101566108cb565b6101386101e5366004612bef565b6108da565b6101236101f83660046129b3565b6108ef565b61013861020b366004612bef565b610a1d565b61012361021e3660046129cd565b610a32565b6101236102313660046129b3565b610d70565b61023e610e73565b6001600160a01b031661024f6108cb565b6001600160a01b031614610298576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b600081815260c96020526040808220805460ff191660011790555182917ff52508d5339edf0d7e5060a416df98db067af561bdc60872d29c0439eaa13a0291a250565b60ca6020526000908152604090205460ff1681565b6000546001600160a01b031681565b600061033f6040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e00000081525061045e565b90506000816001600160a01b031663b8f770056040518163ffffffff1660e01b815260040160206040518083038186803b15801561037c57600080fd5b505afa158015610390573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103b49190612cb3565b905060006103cb8633878564ffffffffff16610e77565b9050600061040a6040518060400160405280601a81526020017927ab26afa61921b937b9b9a237b6b0b4b726b2b9b9b2b733b2b960311b81525061045e565b905061041e8482848863ffffffff16610ec4565b7f0ee9ffdb2334d78de97ffb066b23a352a4d35180cefb36589d663fbb1eb6f3268260405161044d9190612f37565b60405180910390a150505050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156104be5781810151838201526020016104a6565b50505050905090810190601f1680156104eb5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561050857600080fd5b505afa15801561051c573d6000803e3d6000fd5b505050506040513d602081101561053257600080fd5b505190505b919050565b60655460ff1690565b60cc546000906001600160a01b031661dead141561057e5760405162461bcd60e51b815260040161057590612f4a565b60405180910390fd5b5060cc546001600160a01b031690565b60006105ce6040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e00000081525061045e565b90506000816001600160a01b0316632a7f18be856040518263ffffffff1660e01b81526004016105fe9190612d4e565b60606040518083038186803b15801561061657600080fd5b505afa15801561062a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064e9190612c55565b9050600061068d6040518060400160405280601a81526020017927ab26afa61921b937b9b9a237b6b0b4b726b2b9b9b2b733b2b960311b81525061045e565b90506000308286896040516020016106a89493929190612e56565b604051602081830303815290604052805190602001209050826000015181146106e35760405162461bcd60e51b815260040161057590613168565b60006106f18a8a8a8a610e77565b90506107058584838963ffffffff16610ec4565b50505050505050505050565b610719610e73565b6001600160a01b031661072a6108cb565b6001600160a01b031614610773576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b6033546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3603380546001600160a01b0319169055565b6107c5610e73565b6001600160a01b03166107d66108cb565b6001600160a01b03161461081f576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b600081815260c96020526040808220805460ff191690555182917f52c8a2680a9f4cc0ad0bf88f32096eadbebf0646ea611d93a0ce6a29a024040591a250565b610867610e73565b6001600160a01b03166108786108cb565b6001600160a01b0316146108c1576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b6108c9610f2c565b565b6033546001600160a01b031690565b60cb6020526000908152604090205460ff1681565b600054600160a81b900460ff168061090a575061090a610fcc565b8061091f5750600054600160a01b900460ff16155b61095a5760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff16158015610991576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b6000546001600160a01b0316156109ba5760405162461bcd60e51b81526004016105759061311e565b600080546001600160a01b0384166001600160a01b03199182161790915560cc805490911661dead1790556109ed610fdd565b6109f5611096565b6109fd6111a6565b610a05611268565b8015610a19576000805460ff60a81b191690555b5050565b60c96020526000908152604090205460ff1681565b60026097541415610a8a576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260975560408051808201909152601481527327ab26afa61926b2b9b9b0b3b2a932b630bcb2b960611b6020820152600090610ac69061045e565b90506001600160a01b03811615610aff57336001600160a01b03821614610aff5760405162461bcd60e51b815260040161057590613081565b610b0761053c565b15610b4c576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6000610b5a87878787610e77565b9050610b668184611325565b1515600114610b875760405162461bcd60e51b8152600401610575906130d7565b8051602080830191909120600081815260cb90925260409091205460ff1615610bc25760405162461bcd60e51b815260040161057590612f81565b600081815260c9602052604090205460ff1615610bf15760405162461bcd60e51b81526004016105759061303f565b60cc80546001600160a01b0319166001600160a01b03898116919091179091556040516000918a1690610c25908990612d65565b6000604051808303816000865af19150503d8060008114610c62576040519150601f19603f3d011682016040523d82523d6000602084013e610c67565b606091505b505060cc80546001600160a01b03191661dead179055905080151560011415610ce057600082815260cb602052604090819020805460ff19166001179055517f4641df4a962071e12719d8c8c8e5ac7fc4d97b927346a3d7a335b1f7517e133c90610cd3908490612d4e565b60405180910390a1610d18565b7f99d0e048484baa1b1540b1367cb128acd7ab2946d1ed91ec10e3c85e4bf51b8f82604051610d0f9190612d4e565b60405180910390a15b6000833343604051602001610d2f93929190612db3565b60408051601f198184030181529181528151602092830120600090815260ca9092529020805460ff1916600190811790915560975550505050505050505050565b610d78610e73565b6001600160a01b0316610d896108cb565b6001600160a01b031614610dd2576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b6001600160a01b038116610e175760405162461bcd60e51b81526004018080602001828103825260268152602001806132176026913960400191505060405180910390fd5b6033546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3603380546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b606084848484604051602401610e909493929190612e19565b60408051601f198184030181529190526020810180516001600160e01b031663cbd4ece960e01b1790529050949350505050565b60405163037f703f60e51b81526001600160a01b03851690636fee07e090610ef490869085908790600401612e8e565b600060405180830381600087803b158015610f0e57600080fd5b505af1158015610f22573d6000803e3d6000fd5b5050505050505050565b610f3461053c565b15610f79576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610faf610e73565b604080516001600160a01b039092168252519081900360200190a1565b6000610fd73061134a565b15905090565b600054600160a81b900460ff1680610ff85750610ff8610fcc565b8061100d5750600054600160a01b900460ff16155b6110485760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff1615801561107f576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b8015611093576000805460ff60a81b191690555b50565b600054600160a81b900460ff16806110b157506110b1610fcc565b806110c65750600054600160a01b900460ff16155b6111015760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff16158015611138576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b6000611142610e73565b603380546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3508015611093576000805460ff60a81b1916905550565b600054600160a81b900460ff16806111c157506111c1610fcc565b806111d65750600054600160a01b900460ff16155b6112115760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff16158015611248576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b6065805460ff191690558015611093576000805460ff60a81b1916905550565b600054600160a81b900460ff16806112835750611283610fcc565b806112985750600054600160a01b900460ff16155b6112d35760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff1615801561130a576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b60016097558015611093576000805460ff60a81b1916905550565b600061133082611350565b8015611341575061134183836114ad565b90505b92915050565b3b151590565b6000806113916040518060400160405280601881526020017f4f564d5f5374617465436f6d6d69746d656e74436861696e000000000000000081525061045e565b6020840151604051639418bddd60e01b81529192506001600160a01b03831691639418bddd916113c3916004016131af565b60206040518083038186803b1580156113db57600080fd5b505afa1580156113ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114139190612bcf565b1580156114a65750825160208401516040808601519051634d69ee5760e01b81526001600160a01b03851693634d69ee5793611456939192909190600401612ec0565b60206040518083038186803b15801561146e57600080fd5b505afa158015611482573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a69190612bcf565b9392505050565b600080836114ec6040518060400160405280601a81526020017927ab26afa61921b937b9b9a237b6b0b4b726b2b9b9b2b733b2b960311b81525061045e565b6040516020016114fd929190612d81565b604051602081830303815290604052805190602001206000604051602001611526929190612d57565b604051602081830303815290604052805190602001209050600080611575602160991b6040516020016115599190612d36565b60408051601f1981840301815291905260608701518751611607565b909250905060018215151461159c5760405162461bcd60e51b815260040161057590612fcc565b60006115a782611630565b90506115fc846040516020016115bd9190612d4e565b60405160208183030381529060405260016040516020016115de9190612ded565b604051602081830303815290604052886080015184604001516116c2565b979650505050505050565b600060606000611616866116e6565b9050611623818686611716565b9250925050935093915050565b611638612754565b6000611643836117e9565b9050604051806080016040528061166d8360008151811061166057fe5b60200260200101516117fc565b81526020016116828360018151811061166057fe5b81526020016116a48360028151811061169757fe5b6020026020010151611803565b81526020016116b98360038151811061169757fe5b90529392505050565b6000806116ce866116e6565b90506116dc818686866118fc565b9695505050505050565b606081805190602001206040516020016117009190612d4e565b6040516020818303038152906040529050919050565b60006060600061172585611922565b90506000806000611737848a896119f9565b8151929550909350915015808061174b5750815b61179c576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b6000816117b857604051806020016040528060008152506117d7565b6117d78660018703815181106117ca57fe5b6020026020010151611d9f565b919b919a509098505050505050505050565b60606113446117f783611dbb565b611de0565b6000611344825b600060218260000151111561185f576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b600080600061186d85611f56565b91945092509050600081600181111561188257fe5b146118d4576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6020808601518401805190918410156116dc5760208490036101000a90049695505050505050565b600080600061190c878686611716565b915091508180156115fc57506115fc868261227f565b6060600061192f836117e9565b90506000815167ffffffffffffffff8111801561194b57600080fd5b5060405190808252806020026020018201604052801561198557816020015b61197261277b565b81526020019060019003908161196a5790505b50905060005b82518110156119f15760006119b28483815181106119a557fe5b6020026020010151612295565b905060405180604001604052808281526020016119ce836117e9565b8152508383815181106119dd57fe5b60209081029190910101525060010161198b565b509392505050565b60006060818080611a0987612324565b905085600080611a1761277b565b60005b8c51811015611d77578c8181518110611a2f57fe5b6020026020010151915082840193506001870196508360001415611aa357815180516020909101208514611a9e576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b611b6a565b815151602011611b0a57815180516020909101208514611a9e576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b84611b188360000151612421565b14611b6a576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b60208201515160111415611bd9578551841415611b8657611d77565b6000868581518110611b9457fe5b602001015160f81c60f81b60f81c9050600083602001518260ff1681518110611bb957fe5b60200260200101519050611bcc8161244d565b9650600194505050611d6f565b60028260200151511415611d22576000611bf283612483565b9050600081600081518110611c0357fe5b016020015160f81c9050600181166002036000611c238460ff84166124a1565b90506000611c318b8a6124a1565b90506000611c3f83836124ce565b905060ff851660021480611c56575060ff85166003145b15611c8857808351148015611c6b5750808251145b15611c7557988901985b50600160ff1b9950611d77945050505050565b60ff85161580611c9b575060ff85166001145b15611ceb5782518114611cbb5750600160ff1b9950611d77945050505050565b611cdc8860200151600181518110611ccf57fe5b602002602001015161244d565b9a509750611d6f945050505050565b60405162461bcd60e51b81526004018080602001828103825260268152602001806132956026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b600101611a1a565b50600160ff1b841486611d8a87866124a1565b909e909d50909b509950505050505050505050565b602081015180516060916113449160001981019081106119a557fe5b611dc3612795565b506040805180820190915281518152602082810190820152919050565b6060600080611dee84611f56565b91935090915060019050816001811115611e0457fe5b14611e56576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b611e77612795565b815260200190600190039081611e6f5790505090506000835b8651811015611f4b5760208210611ed85760405162461bcd60e51b815260040180806020018281038252602a81526020018061323d602a913960400191505060405180910390fd5b600080611f046040518060400160405280858c60000151038152602001858c6020015101815250611f56565b509150915060405180604001604052808383018152602001848b6020015101815250858581518110611f3257fe5b6020908102919091010152600193909301920101611e90565b508152949350505050565b600080600080846000015111611fb3576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f8111611fd8576000600160009450945094505050612278565b60b7811161204d578551607f19820190811061203b576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b60019550935060009250612278915050565b60bf811161213157855160b61982019081106120b0576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a600185015104905080820188600001511161211c576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b60019091019550935060009250612278915050565b60f781116121a557855160bf198201908110612194576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b600195509350849250612278915050565b855160f6198201908110612200576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111612265576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b6001918201965094509250612278915050565b9193909250565b8051602091820120825192909101919091201490565b606060008060006122a585611f56565b9194509250905060008160018111156122ba57fe5b1461230c576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b61231b85602001518484612534565b95945050505050565b60606000825160020267ffffffffffffffff8111801561234357600080fd5b506040519080825280601f01601f19166020018201604052801561236e576020820181803683370190505b50905060005b835181101561241a57600484828151811061238b57fe5b602001015160f81c60f81b6001600160f81b031916901c8282600202815181106123b157fe5b60200101906001600160f81b031916908160001a90535060108482815181106123d657fe5b016020015160f81c816123e557fe5b0660f81b8282600202600101815181106123fb57fe5b60200101906001600160f81b031916908160001a905350600101612374565b5092915050565b600060208251101561243857506020810151610537565b81806020019051602081101561053257600080fd5b6000606060208360000151101561246e57612467836125e2565b905061247a565b61247783612295565b90505b6114a681612421565b606061134461249c83602001516000815181106119a557fe5b612324565b6060825182106124c05750604080516020810190915260008152611344565b6113418383848651036125ed565b6000805b8084511180156124e25750808351115b801561252757508281815181106124f557fe5b602001015160f81c60f81b6001600160f81b03191684828151811061251657fe5b01602001516001600160f81b031916145b15611341576001016124d2565b606060008267ffffffffffffffff8111801561254f57600080fd5b506040519080825280601f01601f19166020018201604052801561257a576020820181803683370190505b50905080516000141561258e5790506114a6565b8484016020820160005b602086048110156125b9578251825260209283019290910190600101612598565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b60606113448261273e565b60608182601f011015612638576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b828284011015612680576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b818301845110156126cc576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b6060821580156126eb5760405191506000825260208201604052612735565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561272457805183526020928301920161270c565b5050858452601f01601f1916604052505b50949350505050565b6060611344826020015160008460000151612534565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060608152602001606081525090565b604051806040016040528060008152602001600081525090565b600067ffffffffffffffff8311156127c357fe5b6127d6601f8401601f19166020016131c2565b90508281528383830111156127ea57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b038116811461053757600080fd5b600082601f830112612828578081fd5b611341838335602085016127af565b600060a08284031215612848578081fd5b60405160a0810167ffffffffffffffff828210818311171561286657fe5b816040528293508435835260208501356020840152604085013560408401526060850135606084015260808501359150808211156128a357600080fd5b506128b085828601612818565b6080830152505092915050565b6000604082840312156128ce578081fd5b6040516040810167ffffffffffffffff82821081831117156128ec57fe5b816040528293508435835260209150818501358181111561290c57600080fd5b8501601f8101871361291d57600080fd5b80358281111561292957fe5b83810292506129398484016131c2565b8181528481019083860185850187018b101561295457600080fd5b600095505b83861015612977578035835260019590950194918601918601612959565b5080868801525050505050505092915050565b803563ffffffff8116811461053757600080fd5b805164ffffffffff8116811461053757600080fd5b6000602082840312156129c4578081fd5b61134182612801565b600080600080600060a086880312156129e4578081fd5b6129ed86612801565b94506129fb60208701612801565b9350604086013567ffffffffffffffff80821115612a17578283fd5b612a2389838a01612818565b9450606088013593506080880135915080821115612a3f578283fd5b9087019060a0828a031215612a52578283fd5b612a5c60a06131c2565b82358152602083013582811115612a71578485fd5b612a7d8b828601612837565b602083015250604083013582811115612a94578485fd5b612aa08b8286016128bd565b604083015250606083013582811115612ab7578485fd5b612ac38b828601612818565b606083015250608083013582811115612ada578485fd5b612ae68b828601612818565b6080830152508093505050509295509295909350565b600080600080600060a08688031215612b13578081fd5b612b1c86612801565b9450612b2a60208701612801565b9350604086013567ffffffffffffffff811115612b45578182fd5b612b5188828901612818565b93505060608601359150612b676080870161298a565b90509295509295909350565b600080600060608486031215612b87578283fd5b612b9084612801565b9250602084013567ffffffffffffffff811115612bab578283fd5b612bb786828701612818565b925050612bc66040850161298a565b90509250925092565b600060208284031215612be0578081fd5b81518015158114611341578182fd5b600060208284031215612c00578081fd5b5035919050565b600060208284031215612c18578081fd5b813567ffffffffffffffff811115612c2e578182fd5b8201601f81018413612c3e578182fd5b612c4d848235602084016127af565b949350505050565b600060608284031215612c66578081fd5b6040516060810181811067ffffffffffffffff82111715612c8357fe5b60405282518152612c966020840161299e565b6020820152612ca76040840161299e565b60408201529392505050565b600060208284031215612cc4578081fd5b6113418261299e565b60008151808452612ce58160208601602086016131e6565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a06080850152612c4d60a0850182612ccd565b60609190911b6001600160601b031916815260140190565b90815260200190565b918252602082015260400190565b60008251612d778184602087016131e6565b9190910192915050565b60008351612d938184602088016131e6565b60609390931b6001600160601b0319169190920190815260140192915050565b60008451612dc58184602089016131e6565b60609490941b6001600160601b03191691909301908152601481019190915260340192915050565b60f89190911b6001600160f81b031916815260010190565b6001600160a01b0391909116815260200190565b6001600160a01b03858116825284166020820152608060408201819052600090612e4590830185612ccd565b905082606083015295945050505050565b6001600160a01b0385811682528416602082015263ffffffff831660408201526080606082018190526000906116dc90830184612ccd565b600060018060a01b03851682528360208301526060604083015261231b6060830184612ccd565b901515815260200190565b60008482526020606081840152612eda6060840186612cf9565b838103604085015260408101855182528286015160408484015281815180845260608501915085830194508693505b80841015612f295784518252938501936001939093019290850190612f09565b509998505050505050505050565b6000602082526113416020830184612ccd565b6020808252601f908201527f78446f6d61696e4d65737361676553656e646572206973206e6f742073657400604082015260600190565b6020808252602b908201527f50726f7669646564206d6573736167652068617320616c72656164792062656560408201526a37103932b1b2b4bb32b21760a91b606082015260800190565b6020808252604d908201527f4d6573736167652070617373696e67207072656465706c6f7920686173206e6f60408201527f74206265656e20696e697469616c697a6564206f7220696e76616c696420707260608201526c37b7b310383937bb34b232b21760991b608082015260a00190565b60208082526022908201527f50726f7669646564206d65737361676520686173206265656e20626c6f636b65604082015261321760f11b606082015260800190565b60208082526036908201527f4f6e6c79204f564d5f4c324d65737361676552656c617965722063616e2072656040820152753630bc90261916ba3796a6189036b2b9b9b0b3b2b99760511b606082015260800190565b60208082526027908201527f50726f7669646564206d65737361676520636f756c64206e6f742062652076656040820152663934b334b2b21760c91b606082015260800190565b6020808252602a908201527f4c3143726f7373446f6d61696e4d657373656e67657220616c72656164792069604082015269373a34b0b634bd32b21760b11b606082015260800190565b60208082526027908201527f50726f7669646564206d65737361676520686173206e6f74206265656e20656e60408201526638bab2bab2b21760c91b606082015260800190565b6000602082526113416020830184612cf9565b60405181810167ffffffffffffffff811182821017156131de57fe5b604052919050565b60005b838110156132015781810151838201526020016131e9565b83811115613210576000848401525b5050505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737350726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a656452656365697665642061206e6f6465207769746820616e20756e6b6e6f776e207072656669784f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a26469706673582212203a1cd12f46684c95bb11e17fac1702e7dc0fea4c9f70f060e2b6070b1731d33764736f6c63430007060033", "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": { + "allowMessage(bytes32)": { + "params": { + "_xDomainCalldataHash": "Hash of the message to block." + } + }, + "blockMessage(bytes32)": { + "params": { + "_xDomainCalldataHash": "Hash of the message to block." + } + }, "initialize(address)": { "params": { "_libAddressManager": "Address of the Address Manager." } }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "paused()": { + "details": "Returns true if the contract is paused, and false otherwise." + }, "relayMessage(address,address,bytes,uint256,(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),bytes,bytes))": { "params": { "_message": "Message to send to the target.", @@ -368,11 +521,14 @@ "_target": "Target contract address." } }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner." + }, "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.", + "_queueIndex": "CTC Queue index for the message to replay.", "_sender": "Original sender address.", "_target": "Target contract address." } @@ -391,6 +547,9 @@ "_message": "Message to send to the target.", "_target": "Target contract address." } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." } }, "title": "OVM_L1CrossDomainMessenger", @@ -399,8 +558,17 @@ "userdoc": { "kind": "user", "methods": { + "allowMessage(bytes32)": { + "notice": "Allow a message." + }, + "blockMessage(bytes32)": { + "notice": "Block a message." + }, "constructor": { - "notice": "Pass a default zero address to the address resolver. This will be updated when initialized." + "notice": "This contract is intended to be behind a delegate proxy. We pass the zero address to the address resolver just to satisfy the constructor. We still need to set this value in initialize()." + }, + "pause()": { + "notice": "Pause relaying." }, "relayMessage(address,address,bytes,uint256,(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),bytes,bytes))": { "notice": "Relays a cross domain message to a contract." @@ -420,60 +588,116 @@ "storageLayout": { "storage": [ { - "astId": 571, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", - "label": "_status", + "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_uint256" + "type": "t_contract(Lib_AddressManager)15296" }, { - "astId": 619, + "astId": 137, "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", - "label": "relayedMessages", + "label": "_initialized", + "offset": 20, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 140, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "_initializing", + "offset": 21, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 484, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "__gap", "offset": 0, "slot": "1", - "type": "t_mapping(t_bytes32,t_bool)" + "type": "t_array(t_uint256)50_storage" }, { - "astId": 623, + "astId": 10, "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", - "label": "successfulMessages", + "label": "_owner", "offset": 0, - "slot": "2", - "type": "t_mapping(t_bytes32,t_bool)" + "slot": "51", + "type": "t_address" }, { - "astId": 627, + "astId": 129, "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", - "label": "sentMessages", + "label": "__gap", "offset": 0, - "slot": "3", - "type": "t_mapping(t_bytes32,t_bool)" + "slot": "52", + "type": "t_array(t_uint256)49_storage" }, { - "astId": 629, + "astId": 506, "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", - "label": "messageNonce", + "label": "_paused", + "offset": 0, + "slot": "101", + "type": "t_bool" + }, + { + "astId": 597, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 612, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "_status", "offset": 0, - "slot": "4", + "slot": "151", "type": "t_uint256" }, { - "astId": 632, + "astId": 655, "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", - "label": "xDomainMsgSender", + "label": "__gap", "offset": 0, - "slot": "5", - "type": "t_address" + "slot": "152", + "type": "t_array(t_uint256)49_storage" }, { - "astId": 12055, + "astId": 2756, "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", - "label": "libAddressManager", + "label": "blockedMessages", + "offset": 0, + "slot": "201", + "type": "t_mapping(t_bytes32,t_bool)" + }, + { + "astId": 2760, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "relayedMessages", + "offset": 0, + "slot": "202", + "type": "t_mapping(t_bytes32,t_bool)" + }, + { + "astId": 2764, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "successfulMessages", "offset": 0, - "slot": "6", - "type": "t_contract(Lib_AddressManager)12048" + "slot": "203", + "type": "t_mapping(t_bytes32,t_bool)" + }, + { + "astId": 2767, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "xDomainMsgSender", + "offset": 0, + "slot": "204", + "type": "t_address" } ], "types": { @@ -482,6 +706,18 @@ "label": "address", "numberOfBytes": "20" }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, "t_bool": { "encoding": "inplace", "label": "bool", @@ -492,7 +728,7 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(Lib_AddressManager)12048": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" diff --git a/packages/contracts/deployments/goerli/OVM_L1MultiMessageRelayer.json b/packages/contracts/deployments/goerli/OVM_L1MultiMessageRelayer.json index 8ce0f27457d5..00fb083e702a 100644 --- a/packages/contracts/deployments/goerli/OVM_L1MultiMessageRelayer.json +++ b/packages/contracts/deployments/goerli/OVM_L1MultiMessageRelayer.json @@ -1,5 +1,5 @@ { - "address": "0x737557d97f7f2ccb0263C4b55f0D735D52c2D385", + "address": "0x2545fa928d5d278cA75Fd47306e4a89096ff6403", "abi": [ { "inputs": [ @@ -151,29 +151,29 @@ "type": "function" } ], - "transactionHash": "0x4980c4690dc98b1cf4e24b20fc822b96a70e062195daeb603abaca93e5344003", + "transactionHash": "0x62f921dfdac5fbe1ad9dba8d0edcf8564ce4819b420bb46d8dacc9b8e39b18ef", "receipt": { "to": null, - "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", - "contractAddress": "0x737557d97f7f2ccb0263C4b55f0D735D52c2D385", - "transactionIndex": 2, - "gasUsed": "606489", + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0x2545fa928d5d278cA75Fd47306e4a89096ff6403", + "transactionIndex": 1, + "gasUsed": "606477", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x0df30adfabcfa2a632c8bc3fbd23be38c9ae56ca684651653924bac5734e5bd4", - "transactionHash": "0x4980c4690dc98b1cf4e24b20fc822b96a70e062195daeb603abaca93e5344003", + "blockHash": "0x697b506a762e3af14203eea47c21a5cd63451825a978a45130c6747c4fc07672", + "transactionHash": "0x62f921dfdac5fbe1ad9dba8d0edcf8564ce4819b420bb46d8dacc9b8e39b18ef", "logs": [], - "blockNumber": 4694125, - "cumulativeGasUsed": "1039312", + "blockNumber": 4974851, + "cumulativeGasUsed": "693033", "status": 1, "byzantium": true }, "args": [ - "0xE3d08F0D900A2D53cB794cf82d7127764BcC3092" + "0xA4346c8c120DdCE2c5447e68790625F10Bb4d47A" ], - "solcInputHash": "dde656dd41f49cad9eac9bc7065fd6a7", - "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\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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\"}},\"constructor\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}}},\"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\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1MultiMessageRelayer.sol\":\"OVM_L1MultiMessageRelayer\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1MultiMessageRelayer.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_L1CrossDomainMessenger } from \\\"../../../iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol\\\";\\nimport { iOVM_L1MultiMessageRelayer } from \\\"../../../iOVM/bridge/messaging/iOVM_L1MultiMessageRelayer.sol\\\";\\n\\n/* Library Imports */\\nimport { Lib_AddressResolver } from \\\"../../../libraries/resolver/Lib_AddressResolver.sol\\\";\\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\\n /**\\n * @param _libAddressManager Address of the Address Manager.\\n */\\n constructor(\\n address _libAddressManager\\n )\\n Lib_AddressResolver(_libAddressManager)\\n {}\\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 /********************\\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(\\n L2ToL1Message[] calldata _messages\\n ) \\n override\\n external\\n onlyBatchRelayer\\n {\\n iOVM_L1CrossDomainMessenger messenger = iOVM_L1CrossDomainMessenger(\\n resolve(\\\"Proxy__OVM_L1CrossDomainMessenger\\\")\\n );\\n\\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\":\"0xe698b8dbdcecd055ee77cc553963f966faebcdefbed1e586f7fd603fa816d9c6\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/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\\n event SentMessage(bytes message);\\n event RelayedMessage(bytes32 msgHash);\\n event FailedRelayedMessage(bytes32 msgHash);\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n function xDomainMessageSender() external view returns (address);\\n\\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\":\"0x89981ed48e99d6939cc6cdef827d484fa3e2292d66c0ba5056c7050cb6282d7e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/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/messaging/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/messaging/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\":\"0x8bc1fb2a33dcac59ec307195f8b8358d1ae2ab021c70a1589038b366d1b949d7\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x2ce671a0e004df88b136bea5a3c59d0732cea8887c8496da1d509e0200b03d7d\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xa5195afe32fb2cf104d156e8f4bd39df1ec79bf6ba232097b9e8e0ee14fbc298\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50604051610a22380380610a2283398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b610991806100916000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806316e9cd9b14610046578063299ca4781461005b578063461a447814610079575b600080fd5b61005961005436600461057d565b61008c565b005b6100636101ea565b60405161007091906106db565b60405180910390f35b6100636100873660046105ec565b6101f9565b6100ca6040518060400160405280601981526020017f4f564d5f4c3242617463684d65737361676552656c61796572000000000000008152506101f9565b6001600160a01b0316336001600160a01b0316146101035760405162461bcd60e51b81526004016100fa906107d7565b60405180910390fd5b600061012660405180606001604052806021815260200161093b602191396101f9565b905060005b828110156101e457600084848381811061014157fe5b9050602002810190610153919061085a565b61015c9061089d565b8051602082015160408084015160608501516080860151925163d7fd19dd60e01b81529596506001600160a01b0389169563d7fd19dd956101a5959094909392916004016106ef565b600060405180830381600087803b1580156101bf57600080fd5b505af11580156101d3573d6000803e3d6000fd5b50506001909301925061012b915050565b50505050565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610259578181015183820152602001610241565b50505050905090810190601f1680156102865780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102a357600080fd5b505afa1580156102b7573d6000803e3d6000fd5b505050506040513d60208110156102cd57600080fd5b505190505b919050565b600067ffffffffffffffff8311156102eb57fe5b6102fe601f8401601f1916602001610879565b905082815283838301111561031257600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102d257600080fd5b600082601f830112610350578081fd5b61035f838335602085016102d7565b9392505050565b600060a08284031215610377578081fd5b60405160a0810167ffffffffffffffff828210818311171561039557fe5b816040528293508435835260208501356020840152604085013560408401526060850135606084015260808501359150808211156103d257600080fd5b506103df85828601610340565b6080830152505092915050565b6000604082840312156103fd578081fd5b6040516040810167ffffffffffffffff828210818311171561041b57fe5b816040528293508435835260209150818501358181111561043b57600080fd5b8501601f8101871361044c57600080fd5b80358281111561045857fe5b8381029250610468848401610879565b8181528481019083860185850187018b101561048357600080fd5b600095505b838610156104a6578035835260019590950194918601918601610488565b5080868801525050505050505092915050565b600060a082840312156104ca578081fd5b6104d460a0610879565b905081358152602082013567ffffffffffffffff808211156104f557600080fd5b61050185838601610366565b6020840152604084013591508082111561051a57600080fd5b610526858386016103ec565b6040840152606084013591508082111561053f57600080fd5b61054b85838601610340565b6060840152608084013591508082111561056457600080fd5b5061057184828501610340565b60808301525092915050565b6000806020838503121561058f578182fd5b823567ffffffffffffffff808211156105a6578384fd5b818501915085601f8301126105b9578384fd5b8135818111156105c7578485fd5b86602080830285010111156105da578485fd5b60209290920196919550909350505050565b6000602082840312156105fd578081fd5b813567ffffffffffffffff811115610613578182fd5b8201601f81018413610623578182fd5b610632848235602084016102d7565b949350505050565b60008151808452815b8181101561065f57602081850181015186830182015201610643565b818111156106705782602083870101525b50601f01601f19169290920160200192915050565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b808310156106d057845182529383019360019290920191908301906106b0565b509695505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0386811682528516602082015260a06040820181905260009061071b9083018661063a565b846060840152828103608084015283518152602084015160a06020830152805160a0830152602081015160c0830152604081015160e083015260608101516101008301526080810151905060a061012083015261077c61014083018261063a565b9050604085015182820360408401526107958282610685565b915050606085015182820360608401526107af828261063a565b915050608085015182820360808401526107c9828261063a565b9a9950505050505050505050565b60208082526057908201527f4f564d5f4c314d756c74694d65737361676552656c617965723a2046756e637460408201527f696f6e2063616e206f6e6c792062652063616c6c656420627920746865204f5660608201527f4d5f4c3242617463684d65737361676552656c61796572000000000000000000608082015260a00190565b60008235609e1983360301811261086f578182fd5b9190910192915050565b60405181810167ffffffffffffffff8111828210171561089557fe5b604052919050565b600060a082360312156108ae578081fd5b60405160a0810167ffffffffffffffff82821081831117156108cc57fe5b816040526108d985610329565b83526108e760208601610329565b602084015260408501359150808211156108ff578384fd5b61090b36838701610340565b604084015260608501356060840152608085013591508082111561092d578384fd5b50610571368286016104b956fe50726f78795f5f4f564d5f4c3143726f7373446f6d61696e4d657373656e676572a264697066735822122054e57719bdaae865a83549e03668e0558acc8a0d1d5ba65034f61a02d9a35c6264736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c806316e9cd9b14610046578063299ca4781461005b578063461a447814610079575b600080fd5b61005961005436600461057d565b61008c565b005b6100636101ea565b60405161007091906106db565b60405180910390f35b6100636100873660046105ec565b6101f9565b6100ca6040518060400160405280601981526020017f4f564d5f4c3242617463684d65737361676552656c61796572000000000000008152506101f9565b6001600160a01b0316336001600160a01b0316146101035760405162461bcd60e51b81526004016100fa906107d7565b60405180910390fd5b600061012660405180606001604052806021815260200161093b602191396101f9565b905060005b828110156101e457600084848381811061014157fe5b9050602002810190610153919061085a565b61015c9061089d565b8051602082015160408084015160608501516080860151925163d7fd19dd60e01b81529596506001600160a01b0389169563d7fd19dd956101a5959094909392916004016106ef565b600060405180830381600087803b1580156101bf57600080fd5b505af11580156101d3573d6000803e3d6000fd5b50506001909301925061012b915050565b50505050565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610259578181015183820152602001610241565b50505050905090810190601f1680156102865780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102a357600080fd5b505afa1580156102b7573d6000803e3d6000fd5b505050506040513d60208110156102cd57600080fd5b505190505b919050565b600067ffffffffffffffff8311156102eb57fe5b6102fe601f8401601f1916602001610879565b905082815283838301111561031257600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102d257600080fd5b600082601f830112610350578081fd5b61035f838335602085016102d7565b9392505050565b600060a08284031215610377578081fd5b60405160a0810167ffffffffffffffff828210818311171561039557fe5b816040528293508435835260208501356020840152604085013560408401526060850135606084015260808501359150808211156103d257600080fd5b506103df85828601610340565b6080830152505092915050565b6000604082840312156103fd578081fd5b6040516040810167ffffffffffffffff828210818311171561041b57fe5b816040528293508435835260209150818501358181111561043b57600080fd5b8501601f8101871361044c57600080fd5b80358281111561045857fe5b8381029250610468848401610879565b8181528481019083860185850187018b101561048357600080fd5b600095505b838610156104a6578035835260019590950194918601918601610488565b5080868801525050505050505092915050565b600060a082840312156104ca578081fd5b6104d460a0610879565b905081358152602082013567ffffffffffffffff808211156104f557600080fd5b61050185838601610366565b6020840152604084013591508082111561051a57600080fd5b610526858386016103ec565b6040840152606084013591508082111561053f57600080fd5b61054b85838601610340565b6060840152608084013591508082111561056457600080fd5b5061057184828501610340565b60808301525092915050565b6000806020838503121561058f578182fd5b823567ffffffffffffffff808211156105a6578384fd5b818501915085601f8301126105b9578384fd5b8135818111156105c7578485fd5b86602080830285010111156105da578485fd5b60209290920196919550909350505050565b6000602082840312156105fd578081fd5b813567ffffffffffffffff811115610613578182fd5b8201601f81018413610623578182fd5b610632848235602084016102d7565b949350505050565b60008151808452815b8181101561065f57602081850181015186830182015201610643565b818111156106705782602083870101525b50601f01601f19169290920160200192915050565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b808310156106d057845182529383019360019290920191908301906106b0565b509695505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0386811682528516602082015260a06040820181905260009061071b9083018661063a565b846060840152828103608084015283518152602084015160a06020830152805160a0830152602081015160c0830152604081015160e083015260608101516101008301526080810151905060a061012083015261077c61014083018261063a565b9050604085015182820360408401526107958282610685565b915050606085015182820360608401526107af828261063a565b915050608085015182820360808401526107c9828261063a565b9a9950505050505050505050565b60208082526057908201527f4f564d5f4c314d756c74694d65737361676552656c617965723a2046756e637460408201527f696f6e2063616e206f6e6c792062652063616c6c656420627920746865204f5660608201527f4d5f4c3242617463684d65737361676552656c61796572000000000000000000608082015260a00190565b60008235609e1983360301811261086f578182fd5b9190910192915050565b60405181810167ffffffffffffffff8111828210171561089557fe5b604052919050565b600060a082360312156108ae578081fd5b60405160a0810167ffffffffffffffff82821081831117156108cc57fe5b816040526108d985610329565b83526108e760208601610329565b602084015260408501359150808211156108ff578384fd5b61090b36838701610340565b604084015260608501356060840152608085013591508082111561092d578384fd5b50610571368286016104b956fe50726f78795f5f4f564d5f4c3143726f7373446f6d61696e4d657373656e676572a264697066735822122054e57719bdaae865a83549e03668e0558acc8a0d1d5ba65034f61a02d9a35c6264736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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\"}},\"constructor\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}}},\"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\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1MultiMessageRelayer.sol\":\"OVM_L1MultiMessageRelayer\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1MultiMessageRelayer.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_L1CrossDomainMessenger } from \\\"../../../iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol\\\";\\nimport { iOVM_L1MultiMessageRelayer } from \\\"../../../iOVM/bridge/messaging/iOVM_L1MultiMessageRelayer.sol\\\";\\n\\n/* Library Imports */\\nimport { Lib_AddressResolver } from \\\"../../../libraries/resolver/Lib_AddressResolver.sol\\\";\\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\\n /**\\n * @param _libAddressManager Address of the Address Manager.\\n */\\n constructor(\\n address _libAddressManager\\n )\\n Lib_AddressResolver(_libAddressManager)\\n {}\\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 /********************\\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(\\n L2ToL1Message[] calldata _messages\\n ) \\n override\\n external\\n onlyBatchRelayer\\n {\\n iOVM_L1CrossDomainMessenger messenger = iOVM_L1CrossDomainMessenger(\\n resolve(\\\"Proxy__OVM_L1CrossDomainMessenger\\\")\\n );\\n\\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\":\"0xe698b8dbdcecd055ee77cc553963f966faebcdefbed1e586f7fd603fa816d9c6\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_CrossDomainMessenger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/**\\n * @title iOVM_CrossDomainMessenger\\n */\\ninterface iOVM_CrossDomainMessenger {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event SentMessage(bytes message);\\n event RelayedMessage(bytes32 msgHash);\\n event FailedRelayedMessage(bytes32 msgHash);\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n function xDomainMessageSender() external view returns (address);\\n\\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\":\"0x03dd576abe8e562cca646dd59b5c038291dffa9a5e43e4e3765d38cf1406fa62\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/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 { iOVM_CrossDomainMessenger } from \\\"./iOVM_CrossDomainMessenger.sol\\\";\\n\\n/**\\n * @title iOVM_L1CrossDomainMessenger\\n */\\ninterface iOVM_L1CrossDomainMessenger is iOVM_CrossDomainMessenger {\\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 _queueIndex CTC Queue index for the message to replay.\\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 _queueIndex,\\n uint32 _gasLimit\\n ) external;\\n}\\n\",\"keccak256\":\"0xd278237bb588a45208d8ed57c7766386cddd1dc1e4f31867c9cb356939dfd49a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/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/messaging/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\":\"0x8bc1fb2a33dcac59ec307195f8b8358d1ae2ab021c70a1589038b366d1b949d7\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50604051610a22380380610a2283398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b610991806100916000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806316e9cd9b14610046578063299ca4781461005b578063461a447814610079575b600080fd5b61005961005436600461057d565b61008c565b005b6100636101ea565b60405161007091906106db565b60405180910390f35b6100636100873660046105ec565b6101f9565b6100ca6040518060400160405280601981526020017f4f564d5f4c3242617463684d65737361676552656c61796572000000000000008152506101f9565b6001600160a01b0316336001600160a01b0316146101035760405162461bcd60e51b81526004016100fa906107d7565b60405180910390fd5b600061012660405180606001604052806021815260200161093b602191396101f9565b905060005b828110156101e457600084848381811061014157fe5b9050602002810190610153919061085a565b61015c9061089d565b8051602082015160408084015160608501516080860151925163d7fd19dd60e01b81529596506001600160a01b0389169563d7fd19dd956101a5959094909392916004016106ef565b600060405180830381600087803b1580156101bf57600080fd5b505af11580156101d3573d6000803e3d6000fd5b50506001909301925061012b915050565b50505050565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610259578181015183820152602001610241565b50505050905090810190601f1680156102865780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102a357600080fd5b505afa1580156102b7573d6000803e3d6000fd5b505050506040513d60208110156102cd57600080fd5b505190505b919050565b600067ffffffffffffffff8311156102eb57fe5b6102fe601f8401601f1916602001610879565b905082815283838301111561031257600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102d257600080fd5b600082601f830112610350578081fd5b61035f838335602085016102d7565b9392505050565b600060a08284031215610377578081fd5b60405160a0810167ffffffffffffffff828210818311171561039557fe5b816040528293508435835260208501356020840152604085013560408401526060850135606084015260808501359150808211156103d257600080fd5b506103df85828601610340565b6080830152505092915050565b6000604082840312156103fd578081fd5b6040516040810167ffffffffffffffff828210818311171561041b57fe5b816040528293508435835260209150818501358181111561043b57600080fd5b8501601f8101871361044c57600080fd5b80358281111561045857fe5b8381029250610468848401610879565b8181528481019083860185850187018b101561048357600080fd5b600095505b838610156104a6578035835260019590950194918601918601610488565b5080868801525050505050505092915050565b600060a082840312156104ca578081fd5b6104d460a0610879565b905081358152602082013567ffffffffffffffff808211156104f557600080fd5b61050185838601610366565b6020840152604084013591508082111561051a57600080fd5b610526858386016103ec565b6040840152606084013591508082111561053f57600080fd5b61054b85838601610340565b6060840152608084013591508082111561056457600080fd5b5061057184828501610340565b60808301525092915050565b6000806020838503121561058f578182fd5b823567ffffffffffffffff808211156105a6578384fd5b818501915085601f8301126105b9578384fd5b8135818111156105c7578485fd5b86602080830285010111156105da578485fd5b60209290920196919550909350505050565b6000602082840312156105fd578081fd5b813567ffffffffffffffff811115610613578182fd5b8201601f81018413610623578182fd5b610632848235602084016102d7565b949350505050565b60008151808452815b8181101561065f57602081850181015186830182015201610643565b818111156106705782602083870101525b50601f01601f19169290920160200192915050565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b808310156106d057845182529383019360019290920191908301906106b0565b509695505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0386811682528516602082015260a06040820181905260009061071b9083018661063a565b846060840152828103608084015283518152602084015160a06020830152805160a0830152602081015160c0830152604081015160e083015260608101516101008301526080810151905060a061012083015261077c61014083018261063a565b9050604085015182820360408401526107958282610685565b915050606085015182820360608401526107af828261063a565b915050608085015182820360808401526107c9828261063a565b9a9950505050505050505050565b60208082526057908201527f4f564d5f4c314d756c74694d65737361676552656c617965723a2046756e637460408201527f696f6e2063616e206f6e6c792062652063616c6c656420627920746865204f5660608201527f4d5f4c3242617463684d65737361676552656c61796572000000000000000000608082015260a00190565b60008235609e1983360301811261086f578182fd5b9190910192915050565b60405181810167ffffffffffffffff8111828210171561089557fe5b604052919050565b600060a082360312156108ae578081fd5b60405160a0810167ffffffffffffffff82821081831117156108cc57fe5b816040526108d985610329565b83526108e760208601610329565b602084015260408501359150808211156108ff578384fd5b61090b36838701610340565b604084015260608501356060840152608085013591508082111561092d578384fd5b50610571368286016104b956fe50726f78795f5f4f564d5f4c3143726f7373446f6d61696e4d657373656e676572a2646970667358221220ca6bebf589e0e196a7eecc58e0f8a7270f00ec6d1a5d6a61d75748f6e061f36f64736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c806316e9cd9b14610046578063299ca4781461005b578063461a447814610079575b600080fd5b61005961005436600461057d565b61008c565b005b6100636101ea565b60405161007091906106db565b60405180910390f35b6100636100873660046105ec565b6101f9565b6100ca6040518060400160405280601981526020017f4f564d5f4c3242617463684d65737361676552656c61796572000000000000008152506101f9565b6001600160a01b0316336001600160a01b0316146101035760405162461bcd60e51b81526004016100fa906107d7565b60405180910390fd5b600061012660405180606001604052806021815260200161093b602191396101f9565b905060005b828110156101e457600084848381811061014157fe5b9050602002810190610153919061085a565b61015c9061089d565b8051602082015160408084015160608501516080860151925163d7fd19dd60e01b81529596506001600160a01b0389169563d7fd19dd956101a5959094909392916004016106ef565b600060405180830381600087803b1580156101bf57600080fd5b505af11580156101d3573d6000803e3d6000fd5b50506001909301925061012b915050565b50505050565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610259578181015183820152602001610241565b50505050905090810190601f1680156102865780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102a357600080fd5b505afa1580156102b7573d6000803e3d6000fd5b505050506040513d60208110156102cd57600080fd5b505190505b919050565b600067ffffffffffffffff8311156102eb57fe5b6102fe601f8401601f1916602001610879565b905082815283838301111561031257600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102d257600080fd5b600082601f830112610350578081fd5b61035f838335602085016102d7565b9392505050565b600060a08284031215610377578081fd5b60405160a0810167ffffffffffffffff828210818311171561039557fe5b816040528293508435835260208501356020840152604085013560408401526060850135606084015260808501359150808211156103d257600080fd5b506103df85828601610340565b6080830152505092915050565b6000604082840312156103fd578081fd5b6040516040810167ffffffffffffffff828210818311171561041b57fe5b816040528293508435835260209150818501358181111561043b57600080fd5b8501601f8101871361044c57600080fd5b80358281111561045857fe5b8381029250610468848401610879565b8181528481019083860185850187018b101561048357600080fd5b600095505b838610156104a6578035835260019590950194918601918601610488565b5080868801525050505050505092915050565b600060a082840312156104ca578081fd5b6104d460a0610879565b905081358152602082013567ffffffffffffffff808211156104f557600080fd5b61050185838601610366565b6020840152604084013591508082111561051a57600080fd5b610526858386016103ec565b6040840152606084013591508082111561053f57600080fd5b61054b85838601610340565b6060840152608084013591508082111561056457600080fd5b5061057184828501610340565b60808301525092915050565b6000806020838503121561058f578182fd5b823567ffffffffffffffff808211156105a6578384fd5b818501915085601f8301126105b9578384fd5b8135818111156105c7578485fd5b86602080830285010111156105da578485fd5b60209290920196919550909350505050565b6000602082840312156105fd578081fd5b813567ffffffffffffffff811115610613578182fd5b8201601f81018413610623578182fd5b610632848235602084016102d7565b949350505050565b60008151808452815b8181101561065f57602081850181015186830182015201610643565b818111156106705782602083870101525b50601f01601f19169290920160200192915050565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b808310156106d057845182529383019360019290920191908301906106b0565b509695505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0386811682528516602082015260a06040820181905260009061071b9083018661063a565b846060840152828103608084015283518152602084015160a06020830152805160a0830152602081015160c0830152604081015160e083015260608101516101008301526080810151905060a061012083015261077c61014083018261063a565b9050604085015182820360408401526107958282610685565b915050606085015182820360608401526107af828261063a565b915050608085015182820360808401526107c9828261063a565b9a9950505050505050505050565b60208082526057908201527f4f564d5f4c314d756c74694d65737361676552656c617965723a2046756e637460408201527f696f6e2063616e206f6e6c792062652063616c6c656420627920746865204f5660608201527f4d5f4c3242617463684d65737361676552656c61796572000000000000000000608082015260a00190565b60008235609e1983360301811261086f578182fd5b9190910192915050565b60405181810167ffffffffffffffff8111828210171561089557fe5b604052919050565b600060a082360312156108ae578081fd5b60405160a0810167ffffffffffffffff82821081831117156108cc57fe5b816040526108d985610329565b83526108e760208601610329565b602084015260408501359150808211156108ff578384fd5b61090b36838701610340565b604084015260608501356060840152608085013591508082111561092d578384fd5b50610571368286016104b956fe50726f78795f5f4f564d5f4c3143726f7373446f6d61696e4d657373656e676572a2646970667358221220ca6bebf589e0e196a7eecc58e0f8a7270f00ec6d1a5d6a61d75748f6e061f36f64736f6c63430007060033", "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", @@ -215,16 +215,16 @@ "storageLayout": { "storage": [ { - "astId": 12055, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1MultiMessageRelayer.sol:OVM_L1MultiMessageRelayer", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12048" + "type": "t_contract(Lib_AddressManager)15296" } ], "types": { - "t_contract(Lib_AddressManager)12048": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" diff --git a/packages/contracts/deployments/goerli/OVM_StateCommitmentChain.json b/packages/contracts/deployments/goerli/OVM_StateCommitmentChain.json index 41eeda6cca39..ea086ae7b695 100644 --- a/packages/contracts/deployments/goerli/OVM_StateCommitmentChain.json +++ b/packages/contracts/deployments/goerli/OVM_StateCommitmentChain.json @@ -1,5 +1,5 @@ { - "address": "0x5c3e321947C99698027108351ee736823Bd157D8", + "address": "0x9bA5E286934F0A29fb2f8421f60d3eE8A853447C", "abi": [ { "inputs": [ @@ -361,31 +361,31 @@ "type": "function" } ], - "transactionHash": "0xf44aee1847653102e234b3e1acdcc3ec12b328f99e68a9b6fbe90045f4b5c846", + "transactionHash": "0x3cc649a1e1ce83a8cbf284af523a1d37fee159cab32e8460ed6b26fbf204cabb", "receipt": { "to": null, - "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", - "contractAddress": "0x5c3e321947C99698027108351ee736823Bd157D8", - "transactionIndex": 0, - "gasUsed": "1630165", + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0x9bA5E286934F0A29fb2f8421f60d3eE8A853447C", + "transactionIndex": 1, + "gasUsed": "1630153", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x6a15b236bd608f28fb33fcaef422933c3bcf9ae108a761d68d1a2f03e2c1ae85", - "transactionHash": "0xf44aee1847653102e234b3e1acdcc3ec12b328f99e68a9b6fbe90045f4b5c846", + "blockHash": "0x269314df322a6518006daad733fefe9de7147622ad6a400bb6b32ba87eda1496", + "transactionHash": "0x3cc649a1e1ce83a8cbf284af523a1d37fee159cab32e8460ed6b26fbf204cabb", "logs": [], - "blockNumber": 4694101, - "cumulativeGasUsed": "1630165", + "blockNumber": 4974824, + "cumulativeGasUsed": "1667416", "status": 1, "byzantium": true }, "args": [ - "0xE3d08F0D900A2D53cB794cf82d7127764BcC3092", - 30, - 999999999 + "0xA4346c8c120DdCE2c5447e68790625F10Bb4d47A", + 60, + 15769999 ], - "solcInputHash": "dde656dd41f49cad9eac9bc7065fd6a7", - "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\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"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/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@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\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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 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_Proposer\\\");\\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 // For efficiency reasons getMerkleRoot modifies the `_batch` argument in place\\n // while calculating the root hash therefore any arguments passed to it must not\\n // be used again afterwards\\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\":\"0x5b72c845f856a06c978880d3cb2db40dafebaebf399df100c6ac832eaf41d7bd\",\"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 * 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\":\"0x2d7973a0ad84c23ec62624d3f1e3aeb198cc72686ff1e6cfa17155556b320c94\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x2ce671a0e004df88b136bea5a3c59d0732cea8887c8496da1d509e0200b03d7d\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xa5195afe32fb2cf104d156e8f4bd39df1ec79bf6ba232097b9e8e0ee14fbc298\",\"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 * Note that the _elements argument is modified, therefore it must not be used again afterwards\\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 pure\\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 == 1) {\\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 (uint256 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\":\"0xa78edb9fbd34712771a1ebff05bc5e1abec7fc1e9a1bfb709d183099b44fa62a\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50604051611bee380380611bee83398101604081905261002f9161005b565b600080546001600160a01b0319166001600160a01b03949094169390931790925560015560025561009c565b60008060006060848603121561006f578283fd5b83516001600160a01b0381168114610085578384fd5b602085015160409095015190969495509392505050565b611b43806100ab6000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80638ca5cbb9116100715780638ca5cbb91461012f5780639418bddd14610144578063b8e189ac14610157578063c17b291b1461016a578063cfdf677e14610172578063e561dddc1461017a576100b4565b8063299ca478146100b9578063461a4478146100d75780634d69ee57146100ea5780637aa63a861461010a5780637ad168a01461011f57806381eb62ef14610127575b600080fd5b6100c1610182565b6040516100ce919061159f565b60405180910390f35b6100c16100e53660046114e3565b610191565b6100fd6100f8366004611431565b61026f565b6040516100ce91906115b3565b6101126102e2565b6040516100ce91906115be565b6101126102fb565b610112610314565b61014261013d366004611390565b61031a565b005b6100fd610152366004611531565b61052e565b610142610165366004611531565b61057e565b610112610636565b6100c161063c565b610112610664565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156101f15781810151838201526020016101d9565b50505050905090810190601f16801561021e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561023b57600080fd5b505afa15801561024f573d6000803e3d6000fd5b505050506040513d602081101561026557600080fd5b505190505b919050565b600061027a836106de565b61029f5760405162461bcd60e51b815260040161029690611749565b60405180910390fd5b6102bc836020015185846000015185602001518760400151610776565b6102d85760405162461bcd60e51b8152600401610296906116b5565b5060019392505050565b6000806102ed6108fb565b5064ffffffffff1691505090565b6000806103066108fb565b64ffffffffff169250505090565b60025481565b6103226102e2565b81146103405760405162461bcd60e51b8152600401610296906116ec565b6103706040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b815250610191565b6001600160a01b03166302ad4d2a336040518263ffffffff1660e01b815260040161039b919061159f565b60206040518083038186803b1580156103b357600080fd5b505afa1580156103c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103eb91906113d3565b6104075760405162461bcd60e51b8152600401610296906118bb565b60008251116104285760405162461bcd60e51b815260040161029690611878565b6104666040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e000000815250610191565b6001600160a01b0316637aa63a866040518163ffffffff1660e01b815260040160206040518083038186803b15801561049e57600080fd5b505afa1580156104b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d69190611419565b82516104e06102e2565b0111156104ff5760405162461bcd60e51b815260040161029690611646565b61052a8242336040516020016105169291906119a1565b604051602081830303815290604052610990565b5050565b60008082608001518060200190518101906105499190611564565b509050806105695760405162461bcd60e51b815260040161029690611833565b4261057682600154610b31565b119392505050565b6105b06040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b815250610191565b6001600160a01b0316336001600160a01b0316146105e05760405162461bcd60e51b8152600401610296906117d6565b6105e9816106de565b6106055760405162461bcd60e51b815260040161029690611749565b61060e8161052e565b61062a5760405162461bcd60e51b815260040161029690611778565b61063381610b92565b50565b60015481565b600061065f604051806060016040528060258152602001611ab560259139610191565b905090565b600061066e61063c565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156106a657600080fd5b505afa1580156106ba573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065f9190611419565b60006106e861063c565b8251604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a91610716916004016115be565b60206040518083038186803b15801561072e57600080fd5b505afa158015610742573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107669190611419565b61076f83610d0a565b1492915050565b60008082116107b65760405162461bcd60e51b8152600401808060200182810382526037815260200180611a316037913960400191505060405180910390fd5b8184106107f45760405162461bcd60e51b81526004018080602001828103825260248152602001806119dd6024913960400191505060405180910390fd5b6107fd82610d50565b83511461083b5760405162461bcd60e51b815260040180806020018281038252604d815260200180611a68604d913960600191505060405180910390fd5b8460005b84518110156108ee57856001166001141561089d5784818151811061086057fe5b60200260200101518260405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091506108e2565b818582815181106108aa57fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c950161083f565b5090951495945050505050565b600080600061090861063c565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b15801561094057600080fd5b505afa158015610954573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097891906113f3565b64ffffffffff602882901c16935060501c9150509091565b60006109bf6040518060400160405280600c81526020016b27ab26afa83937b837b9b2b960a11b815250610191565b90506000806109cc6108fb565b9092509050336001600160a01b03841614156109e9575042610a13565b426002548264ffffffffff160110610a135760405162461bcd60e51b81526004016102969061190a565b60006040518060a00160405280610a28610664565b8152602001610a3688610de6565b8152602001875181526020018464ffffffffff16815260200186815250905080600001517f16be4c5129a4e03cf3350262e181dc02ddfb4a6008d925368c0899fcd97ca9c58260200151836040015184606001518560800151604051610a9f94939291906115dd565b60405180910390a2610aaf61063c565b6001600160a01b0316632015276c610ac683610d0a565b610ada84604001518560600151018661121a565b6040518363ffffffff1660e01b8152600401610af79291906115c7565b600060405180830381600087803b158015610b1157600080fd5b505af1158015610b25573d6000803e3d6000fd5b50505050505050505050565b600082820183811015610b8b576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b610b9a61063c565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610bd257600080fd5b505afa158015610be6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0a9190611419565b815110610c295760405162461bcd60e51b815260040161029690611973565b610c32816106de565b610c4e5760405162461bcd60e51b815260040161029690611749565b610c5661063c565b6001600160a01b031663167fd6818260000151610c788460600151600061121a565b6040518363ffffffff1660e01b8152600401610c959291906115c7565b600060405180830381600087803b158015610caf57600080fd5b505af1158015610cc3573d6000803e3d6000fd5b5050505080600001517f8747b69ce8fdb31c3b9b0a67bd8049ad8c1a69ea417b69b12174068abd9cbd648260200151604051610cff91906115be565b60405180910390a250565b60008160200151826040015183606001518460800151604051602001610d3394939291906115dd565b604051602081830303815290604052805190602001209050919050565b6000808211610d905760405162461bcd60e51b8152600401808060200182810382526030815260200180611a016030913960400191505060405180910390fd5b8160011415610da15750600061026a565b81600060805b60018110610dd1576000196001821b01811b831615610dc95791821c91908101905b60011c610da7565b506001811b8414610b8b576001019392505050565b600080825111610e275760405162461bcd60e51b8152600401808060200182810382526034815260200180611ada6034913960400191505060405180910390fd5b815160011415610e4d5781600081518110610e3e57fe5b6020026020010151905061026a565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b60018411156111f65750506002820460018084161460005b82811015611172578a816002028151811061111957fe5b602002602001015196508a816002026001018151811061113557fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061115f57fe5b6020908102919091010152600101611102565b5080156111d55789600185038151811061118857fe5b6020026020010151955087836010811061119e57fe5b602002015160001b945085602088015284604088015286805190602001208a83815181106111c857fe5b6020026020010181815250505b806111e15760006111e4565b60015b60ff16820193506001909201916110ea565b8960008151811061120357fe5b602002602001015198505050505050505050919050565b602890811b91909117901b90565b600067ffffffffffffffff83111561123c57fe5b61124f601f8401601f19166020016119b8565b905082815283838301111561126357600080fd5b828260208301376000602084830101529392505050565b600082601f83011261128a578081fd5b8135602067ffffffffffffffff8211156112a057fe5b8082026112ae8282016119b8565b8381528281019086840183880185018910156112c8578687fd5b8693505b858410156112ea5780358352600193909301929184019184016112cc565b50979650505050505050565b600060a08284031215611307578081fd5b60405160a0810167ffffffffffffffff828210818311171561132557fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561136257600080fd5b508301601f8101851361137457600080fd5b61138385823560208401611228565b6080830152505092915050565b600080604083850312156113a2578182fd5b823567ffffffffffffffff8111156113b8578283fd5b6113c48582860161127a565b95602094909401359450505050565b6000602082840312156113e4578081fd5b81518015158114610b8b578182fd5b600060208284031215611404578081fd5b815164ffffffffff1981168114610b8b578182fd5b60006020828403121561142a578081fd5b5051919050565b600080600060608486031215611445578081fd5b83359250602084013567ffffffffffffffff80821115611463578283fd5b61146f878388016112f6565b93506040860135915080821115611484578283fd5b9085019060408288031215611497578283fd5b6040516040810181811083821117156114ac57fe5b604052823581526020830135828111156114c4578485fd5b6114d08982860161127a565b6020830152508093505050509250925092565b6000602082840312156114f4578081fd5b813567ffffffffffffffff81111561150a578182fd5b8201601f8101841361151a578182fd5b61152984823560208401611228565b949350505050565b600060208284031215611542578081fd5b813567ffffffffffffffff811115611558578182fd5b611529848285016112f6565b60008060408385031215611576578182fd5b825160208401519092506001600160a01b0381168114611594578182fd5b809150509250929050565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b91825264ffffffffff1916602082015260400190565b600085825260208581840152846040840152608060608401528351806080850152825b8181101561161c5785810183015185820160a001528201611600565b8181111561162d578360a083870101525b50601f01601f19169290920160a0019695505050505050565b60208082526049908201527f4e756d626572206f6620737461746520726f6f74732063616e6e6f742065786360408201527f65656420746865206e756d626572206f662063616e6f6e6963616c207472616e60608201526839b0b1ba34b7b7399760b91b608082015260a00190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b602080825260409082018190527f537461746520626174636865732063616e206f6e6c792062652064656c657465908201527f642077697468696e207468652066726175642070726f6f662077696e646f772e606082015260800190565b6020808252603b908201527f537461746520626174636865732063616e206f6e6c792062652064656c65746560408201527f6420627920746865204f564d5f467261756456657269666965722e0000000000606082015260800190565b60208082526025908201527f4261746368206865616465722074696d657374616d702063616e6e6f74206265604082015264207a65726f60d81b606082015260800190565b60208082526023908201527f43616e6e6f74207375626d697420616e20656d7074792073746174652062617460408201526231b41760e91b606082015260800190565b6020808252602f908201527f50726f706f73657220646f6573206e6f74206861766520656e6f75676820636f60408201526e1b1b185d195c985b081c1bdcdd1959608a1b606082015260800190565b60208082526043908201527f43616e6e6f74207075626c69736820737461746520726f6f747320776974686960408201527f6e207468652073657175656e636572207075626c69636174696f6e2077696e6460608201526237bb9760e91b608082015260a00190565b60208082526014908201527324b73b30b634b2103130ba31b41034b73232bc1760611b604082015260600190565b9182526001600160a01b0316602082015260400190565b60405181810167ffffffffffffffff811182821017156119d457fe5b60405291905056fe4c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4f564d5f436861696e53746f72616765436f6e7461696e65723a5343433a626174636865734c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea26469706673582212209a79aee928c48a8e868127cc94d1fe1eb4eea95e98e6709cd65bda19d650209064736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80638ca5cbb9116100715780638ca5cbb91461012f5780639418bddd14610144578063b8e189ac14610157578063c17b291b1461016a578063cfdf677e14610172578063e561dddc1461017a576100b4565b8063299ca478146100b9578063461a4478146100d75780634d69ee57146100ea5780637aa63a861461010a5780637ad168a01461011f57806381eb62ef14610127575b600080fd5b6100c1610182565b6040516100ce919061159f565b60405180910390f35b6100c16100e53660046114e3565b610191565b6100fd6100f8366004611431565b61026f565b6040516100ce91906115b3565b6101126102e2565b6040516100ce91906115be565b6101126102fb565b610112610314565b61014261013d366004611390565b61031a565b005b6100fd610152366004611531565b61052e565b610142610165366004611531565b61057e565b610112610636565b6100c161063c565b610112610664565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156101f15781810151838201526020016101d9565b50505050905090810190601f16801561021e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561023b57600080fd5b505afa15801561024f573d6000803e3d6000fd5b505050506040513d602081101561026557600080fd5b505190505b919050565b600061027a836106de565b61029f5760405162461bcd60e51b815260040161029690611749565b60405180910390fd5b6102bc836020015185846000015185602001518760400151610776565b6102d85760405162461bcd60e51b8152600401610296906116b5565b5060019392505050565b6000806102ed6108fb565b5064ffffffffff1691505090565b6000806103066108fb565b64ffffffffff169250505090565b60025481565b6103226102e2565b81146103405760405162461bcd60e51b8152600401610296906116ec565b6103706040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b815250610191565b6001600160a01b03166302ad4d2a336040518263ffffffff1660e01b815260040161039b919061159f565b60206040518083038186803b1580156103b357600080fd5b505afa1580156103c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103eb91906113d3565b6104075760405162461bcd60e51b8152600401610296906118bb565b60008251116104285760405162461bcd60e51b815260040161029690611878565b6104666040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e000000815250610191565b6001600160a01b0316637aa63a866040518163ffffffff1660e01b815260040160206040518083038186803b15801561049e57600080fd5b505afa1580156104b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d69190611419565b82516104e06102e2565b0111156104ff5760405162461bcd60e51b815260040161029690611646565b61052a8242336040516020016105169291906119a1565b604051602081830303815290604052610990565b5050565b60008082608001518060200190518101906105499190611564565b509050806105695760405162461bcd60e51b815260040161029690611833565b4261057682600154610b31565b119392505050565b6105b06040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b815250610191565b6001600160a01b0316336001600160a01b0316146105e05760405162461bcd60e51b8152600401610296906117d6565b6105e9816106de565b6106055760405162461bcd60e51b815260040161029690611749565b61060e8161052e565b61062a5760405162461bcd60e51b815260040161029690611778565b61063381610b92565b50565b60015481565b600061065f604051806060016040528060258152602001611ab560259139610191565b905090565b600061066e61063c565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156106a657600080fd5b505afa1580156106ba573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065f9190611419565b60006106e861063c565b8251604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a91610716916004016115be565b60206040518083038186803b15801561072e57600080fd5b505afa158015610742573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107669190611419565b61076f83610d0a565b1492915050565b60008082116107b65760405162461bcd60e51b8152600401808060200182810382526037815260200180611a316037913960400191505060405180910390fd5b8184106107f45760405162461bcd60e51b81526004018080602001828103825260248152602001806119dd6024913960400191505060405180910390fd5b6107fd82610d50565b83511461083b5760405162461bcd60e51b815260040180806020018281038252604d815260200180611a68604d913960600191505060405180910390fd5b8460005b84518110156108ee57856001166001141561089d5784818151811061086057fe5b60200260200101518260405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091506108e2565b818582815181106108aa57fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c950161083f565b5090951495945050505050565b600080600061090861063c565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b15801561094057600080fd5b505afa158015610954573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097891906113f3565b64ffffffffff602882901c16935060501c9150509091565b60006109bf6040518060400160405280600c81526020016b27ab26afa83937b837b9b2b960a11b815250610191565b90506000806109cc6108fb565b9092509050336001600160a01b03841614156109e9575042610a13565b426002548264ffffffffff160110610a135760405162461bcd60e51b81526004016102969061190a565b60006040518060a00160405280610a28610664565b8152602001610a3688610de6565b8152602001875181526020018464ffffffffff16815260200186815250905080600001517f16be4c5129a4e03cf3350262e181dc02ddfb4a6008d925368c0899fcd97ca9c58260200151836040015184606001518560800151604051610a9f94939291906115dd565b60405180910390a2610aaf61063c565b6001600160a01b0316632015276c610ac683610d0a565b610ada84604001518560600151018661121a565b6040518363ffffffff1660e01b8152600401610af79291906115c7565b600060405180830381600087803b158015610b1157600080fd5b505af1158015610b25573d6000803e3d6000fd5b50505050505050505050565b600082820183811015610b8b576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b610b9a61063c565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610bd257600080fd5b505afa158015610be6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0a9190611419565b815110610c295760405162461bcd60e51b815260040161029690611973565b610c32816106de565b610c4e5760405162461bcd60e51b815260040161029690611749565b610c5661063c565b6001600160a01b031663167fd6818260000151610c788460600151600061121a565b6040518363ffffffff1660e01b8152600401610c959291906115c7565b600060405180830381600087803b158015610caf57600080fd5b505af1158015610cc3573d6000803e3d6000fd5b5050505080600001517f8747b69ce8fdb31c3b9b0a67bd8049ad8c1a69ea417b69b12174068abd9cbd648260200151604051610cff91906115be565b60405180910390a250565b60008160200151826040015183606001518460800151604051602001610d3394939291906115dd565b604051602081830303815290604052805190602001209050919050565b6000808211610d905760405162461bcd60e51b8152600401808060200182810382526030815260200180611a016030913960400191505060405180910390fd5b8160011415610da15750600061026a565b81600060805b60018110610dd1576000196001821b01811b831615610dc95791821c91908101905b60011c610da7565b506001811b8414610b8b576001019392505050565b600080825111610e275760405162461bcd60e51b8152600401808060200182810382526034815260200180611ada6034913960400191505060405180910390fd5b815160011415610e4d5781600081518110610e3e57fe5b6020026020010151905061026a565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b60018411156111f65750506002820460018084161460005b82811015611172578a816002028151811061111957fe5b602002602001015196508a816002026001018151811061113557fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061115f57fe5b6020908102919091010152600101611102565b5080156111d55789600185038151811061118857fe5b6020026020010151955087836010811061119e57fe5b602002015160001b945085602088015284604088015286805190602001208a83815181106111c857fe5b6020026020010181815250505b806111e15760006111e4565b60015b60ff16820193506001909201916110ea565b8960008151811061120357fe5b602002602001015198505050505050505050919050565b602890811b91909117901b90565b600067ffffffffffffffff83111561123c57fe5b61124f601f8401601f19166020016119b8565b905082815283838301111561126357600080fd5b828260208301376000602084830101529392505050565b600082601f83011261128a578081fd5b8135602067ffffffffffffffff8211156112a057fe5b8082026112ae8282016119b8565b8381528281019086840183880185018910156112c8578687fd5b8693505b858410156112ea5780358352600193909301929184019184016112cc565b50979650505050505050565b600060a08284031215611307578081fd5b60405160a0810167ffffffffffffffff828210818311171561132557fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561136257600080fd5b508301601f8101851361137457600080fd5b61138385823560208401611228565b6080830152505092915050565b600080604083850312156113a2578182fd5b823567ffffffffffffffff8111156113b8578283fd5b6113c48582860161127a565b95602094909401359450505050565b6000602082840312156113e4578081fd5b81518015158114610b8b578182fd5b600060208284031215611404578081fd5b815164ffffffffff1981168114610b8b578182fd5b60006020828403121561142a578081fd5b5051919050565b600080600060608486031215611445578081fd5b83359250602084013567ffffffffffffffff80821115611463578283fd5b61146f878388016112f6565b93506040860135915080821115611484578283fd5b9085019060408288031215611497578283fd5b6040516040810181811083821117156114ac57fe5b604052823581526020830135828111156114c4578485fd5b6114d08982860161127a565b6020830152508093505050509250925092565b6000602082840312156114f4578081fd5b813567ffffffffffffffff81111561150a578182fd5b8201601f8101841361151a578182fd5b61152984823560208401611228565b949350505050565b600060208284031215611542578081fd5b813567ffffffffffffffff811115611558578182fd5b611529848285016112f6565b60008060408385031215611576578182fd5b825160208401519092506001600160a01b0381168114611594578182fd5b809150509250929050565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b91825264ffffffffff1916602082015260400190565b600085825260208581840152846040840152608060608401528351806080850152825b8181101561161c5785810183015185820160a001528201611600565b8181111561162d578360a083870101525b50601f01601f19169290920160a0019695505050505050565b60208082526049908201527f4e756d626572206f6620737461746520726f6f74732063616e6e6f742065786360408201527f65656420746865206e756d626572206f662063616e6f6e6963616c207472616e60608201526839b0b1ba34b7b7399760b91b608082015260a00190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b602080825260409082018190527f537461746520626174636865732063616e206f6e6c792062652064656c657465908201527f642077697468696e207468652066726175642070726f6f662077696e646f772e606082015260800190565b6020808252603b908201527f537461746520626174636865732063616e206f6e6c792062652064656c65746560408201527f6420627920746865204f564d5f467261756456657269666965722e0000000000606082015260800190565b60208082526025908201527f4261746368206865616465722074696d657374616d702063616e6e6f74206265604082015264207a65726f60d81b606082015260800190565b60208082526023908201527f43616e6e6f74207375626d697420616e20656d7074792073746174652062617460408201526231b41760e91b606082015260800190565b6020808252602f908201527f50726f706f73657220646f6573206e6f74206861766520656e6f75676820636f60408201526e1b1b185d195c985b081c1bdcdd1959608a1b606082015260800190565b60208082526043908201527f43616e6e6f74207075626c69736820737461746520726f6f747320776974686960408201527f6e207468652073657175656e636572207075626c69636174696f6e2077696e6460608201526237bb9760e91b608082015260a00190565b60208082526014908201527324b73b30b634b2103130ba31b41034b73232bc1760611b604082015260600190565b9182526001600160a01b0316602082015260400190565b60405181810167ffffffffffffffff811182821017156119d457fe5b60405291905056fe4c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4f564d5f436861696e53746f72616765436f6e7461696e65723a5343433a626174636865734c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea26469706673582212209a79aee928c48a8e868127cc94d1fe1eb4eea95e98e6709cd65bda19d650209064736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"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/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@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\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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 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_Proposer\\\");\\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 // For efficiency reasons getMerkleRoot modifies the `_batch` argument in place\\n // while calculating the root hash therefore any arguments passed to it must not\\n // be used again afterwards\\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\":\"0x12cc020811ca6a41cbad48c2e6b812c1eeaca1dde65e09b4b51a1891e0872d92\",\"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 * 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\",\"keccak256\":\"0x180b9c347e20f1a6efa553b0f2b9a59aebceda92a7484ae6fca4da2bf1d960c3\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"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 * Note that the _elements argument is modified, therefore it must not be used again afterwards\\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 pure\\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 == 1) {\\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 (uint256 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\":\"0xa78edb9fbd34712771a1ebff05bc5e1abec7fc1e9a1bfb709d183099b44fa62a\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50604051611bee380380611bee83398101604081905261002f9161005b565b600080546001600160a01b0319166001600160a01b03949094169390931790925560015560025561009c565b60008060006060848603121561006f578283fd5b83516001600160a01b0381168114610085578384fd5b602085015160409095015190969495509392505050565b611b43806100ab6000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80638ca5cbb9116100715780638ca5cbb91461012f5780639418bddd14610144578063b8e189ac14610157578063c17b291b1461016a578063cfdf677e14610172578063e561dddc1461017a576100b4565b8063299ca478146100b9578063461a4478146100d75780634d69ee57146100ea5780637aa63a861461010a5780637ad168a01461011f57806381eb62ef14610127575b600080fd5b6100c1610182565b6040516100ce919061159f565b60405180910390f35b6100c16100e53660046114e3565b610191565b6100fd6100f8366004611431565b61026f565b6040516100ce91906115b3565b6101126102e2565b6040516100ce91906115be565b6101126102fb565b610112610314565b61014261013d366004611390565b61031a565b005b6100fd610152366004611531565b61052e565b610142610165366004611531565b61057e565b610112610636565b6100c161063c565b610112610664565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156101f15781810151838201526020016101d9565b50505050905090810190601f16801561021e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561023b57600080fd5b505afa15801561024f573d6000803e3d6000fd5b505050506040513d602081101561026557600080fd5b505190505b919050565b600061027a836106de565b61029f5760405162461bcd60e51b815260040161029690611749565b60405180910390fd5b6102bc836020015185846000015185602001518760400151610776565b6102d85760405162461bcd60e51b8152600401610296906116b5565b5060019392505050565b6000806102ed6108fb565b5064ffffffffff1691505090565b6000806103066108fb565b64ffffffffff169250505090565b60025481565b6103226102e2565b81146103405760405162461bcd60e51b8152600401610296906116ec565b6103706040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b815250610191565b6001600160a01b03166302ad4d2a336040518263ffffffff1660e01b815260040161039b919061159f565b60206040518083038186803b1580156103b357600080fd5b505afa1580156103c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103eb91906113d3565b6104075760405162461bcd60e51b8152600401610296906118bb565b60008251116104285760405162461bcd60e51b815260040161029690611878565b6104666040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e000000815250610191565b6001600160a01b0316637aa63a866040518163ffffffff1660e01b815260040160206040518083038186803b15801561049e57600080fd5b505afa1580156104b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d69190611419565b82516104e06102e2565b0111156104ff5760405162461bcd60e51b815260040161029690611646565b61052a8242336040516020016105169291906119a1565b604051602081830303815290604052610990565b5050565b60008082608001518060200190518101906105499190611564565b509050806105695760405162461bcd60e51b815260040161029690611833565b4261057682600154610b31565b119392505050565b6105b06040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b815250610191565b6001600160a01b0316336001600160a01b0316146105e05760405162461bcd60e51b8152600401610296906117d6565b6105e9816106de565b6106055760405162461bcd60e51b815260040161029690611749565b61060e8161052e565b61062a5760405162461bcd60e51b815260040161029690611778565b61063381610b92565b50565b60015481565b600061065f604051806060016040528060258152602001611a6860259139610191565b905090565b600061066e61063c565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156106a657600080fd5b505afa1580156106ba573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065f9190611419565b60006106e861063c565b8251604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a91610716916004016115be565b60206040518083038186803b15801561072e57600080fd5b505afa158015610742573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107669190611419565b61076f83610d0a565b1492915050565b60008082116107b65760405162461bcd60e51b8152600401808060200182810382526037815260200180611a316037913960400191505060405180910390fd5b8184106107f45760405162461bcd60e51b81526004018080602001828103825260248152602001806119dd6024913960400191505060405180910390fd5b6107fd82610d50565b83511461083b5760405162461bcd60e51b815260040180806020018281038252604d815260200180611a8d604d913960600191505060405180910390fd5b8460005b84518110156108ee57856001166001141561089d5784818151811061086057fe5b60200260200101518260405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091506108e2565b818582815181106108aa57fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c950161083f565b5090951495945050505050565b600080600061090861063c565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b15801561094057600080fd5b505afa158015610954573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097891906113f3565b64ffffffffff602882901c16935060501c9150509091565b60006109bf6040518060400160405280600c81526020016b27ab26afa83937b837b9b2b960a11b815250610191565b90506000806109cc6108fb565b9092509050336001600160a01b03841614156109e9575042610a13565b426002548264ffffffffff160110610a135760405162461bcd60e51b81526004016102969061190a565b60006040518060a00160405280610a28610664565b8152602001610a3688610de6565b8152602001875181526020018464ffffffffff16815260200186815250905080600001517f16be4c5129a4e03cf3350262e181dc02ddfb4a6008d925368c0899fcd97ca9c58260200151836040015184606001518560800151604051610a9f94939291906115dd565b60405180910390a2610aaf61063c565b6001600160a01b0316632015276c610ac683610d0a565b610ada84604001518560600151018661121a565b6040518363ffffffff1660e01b8152600401610af79291906115c7565b600060405180830381600087803b158015610b1157600080fd5b505af1158015610b25573d6000803e3d6000fd5b50505050505050505050565b600082820183811015610b8b576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b610b9a61063c565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610bd257600080fd5b505afa158015610be6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0a9190611419565b815110610c295760405162461bcd60e51b815260040161029690611973565b610c32816106de565b610c4e5760405162461bcd60e51b815260040161029690611749565b610c5661063c565b6001600160a01b031663167fd6818260000151610c788460600151600061121a565b6040518363ffffffff1660e01b8152600401610c959291906115c7565b600060405180830381600087803b158015610caf57600080fd5b505af1158015610cc3573d6000803e3d6000fd5b5050505080600001517f8747b69ce8fdb31c3b9b0a67bd8049ad8c1a69ea417b69b12174068abd9cbd648260200151604051610cff91906115be565b60405180910390a250565b60008160200151826040015183606001518460800151604051602001610d3394939291906115dd565b604051602081830303815290604052805190602001209050919050565b6000808211610d905760405162461bcd60e51b8152600401808060200182810382526030815260200180611a016030913960400191505060405180910390fd5b8160011415610da15750600061026a565b81600060805b60018110610dd1576000196001821b01811b831615610dc95791821c91908101905b60011c610da7565b506001811b8414610b8b576001019392505050565b600080825111610e275760405162461bcd60e51b8152600401808060200182810382526034815260200180611ada6034913960400191505060405180910390fd5b815160011415610e4d5781600081518110610e3e57fe5b6020026020010151905061026a565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b60018411156111f65750506002820460018084161460005b82811015611172578a816002028151811061111957fe5b602002602001015196508a816002026001018151811061113557fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061115f57fe5b6020908102919091010152600101611102565b5080156111d55789600185038151811061118857fe5b6020026020010151955087836010811061119e57fe5b602002015160001b945085602088015284604088015286805190602001208a83815181106111c857fe5b6020026020010181815250505b806111e15760006111e4565b60015b60ff16820193506001909201916110ea565b8960008151811061120357fe5b602002602001015198505050505050505050919050565b602890811b91909117901b90565b600067ffffffffffffffff83111561123c57fe5b61124f601f8401601f19166020016119b8565b905082815283838301111561126357600080fd5b828260208301376000602084830101529392505050565b600082601f83011261128a578081fd5b8135602067ffffffffffffffff8211156112a057fe5b8082026112ae8282016119b8565b8381528281019086840183880185018910156112c8578687fd5b8693505b858410156112ea5780358352600193909301929184019184016112cc565b50979650505050505050565b600060a08284031215611307578081fd5b60405160a0810167ffffffffffffffff828210818311171561132557fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561136257600080fd5b508301601f8101851361137457600080fd5b61138385823560208401611228565b6080830152505092915050565b600080604083850312156113a2578182fd5b823567ffffffffffffffff8111156113b8578283fd5b6113c48582860161127a565b95602094909401359450505050565b6000602082840312156113e4578081fd5b81518015158114610b8b578182fd5b600060208284031215611404578081fd5b815164ffffffffff1981168114610b8b578182fd5b60006020828403121561142a578081fd5b5051919050565b600080600060608486031215611445578081fd5b83359250602084013567ffffffffffffffff80821115611463578283fd5b61146f878388016112f6565b93506040860135915080821115611484578283fd5b9085019060408288031215611497578283fd5b6040516040810181811083821117156114ac57fe5b604052823581526020830135828111156114c4578485fd5b6114d08982860161127a565b6020830152508093505050509250925092565b6000602082840312156114f4578081fd5b813567ffffffffffffffff81111561150a578182fd5b8201601f8101841361151a578182fd5b61152984823560208401611228565b949350505050565b600060208284031215611542578081fd5b813567ffffffffffffffff811115611558578182fd5b611529848285016112f6565b60008060408385031215611576578182fd5b825160208401519092506001600160a01b0381168114611594578182fd5b809150509250929050565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b91825264ffffffffff1916602082015260400190565b600085825260208581840152846040840152608060608401528351806080850152825b8181101561161c5785810183015185820160a001528201611600565b8181111561162d578360a083870101525b50601f01601f19169290920160a0019695505050505050565b60208082526049908201527f4e756d626572206f6620737461746520726f6f74732063616e6e6f742065786360408201527f65656420746865206e756d626572206f662063616e6f6e6963616c207472616e60608201526839b0b1ba34b7b7399760b91b608082015260a00190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b602080825260409082018190527f537461746520626174636865732063616e206f6e6c792062652064656c657465908201527f642077697468696e207468652066726175642070726f6f662077696e646f772e606082015260800190565b6020808252603b908201527f537461746520626174636865732063616e206f6e6c792062652064656c65746560408201527f6420627920746865204f564d5f467261756456657269666965722e0000000000606082015260800190565b60208082526025908201527f4261746368206865616465722074696d657374616d702063616e6e6f74206265604082015264207a65726f60d81b606082015260800190565b60208082526023908201527f43616e6e6f74207375626d697420616e20656d7074792073746174652062617460408201526231b41760e91b606082015260800190565b6020808252602f908201527f50726f706f73657220646f6573206e6f74206861766520656e6f75676820636f60408201526e1b1b185d195c985b081c1bdcdd1959608a1b606082015260800190565b60208082526043908201527f43616e6e6f74207075626c69736820737461746520726f6f747320776974686960408201527f6e207468652073657175656e636572207075626c69636174696f6e2077696e6460608201526237bb9760e91b608082015260a00190565b60208082526014908201527324b73b30b634b2103130ba31b41034b73232bc1760611b604082015260600190565b9182526001600160a01b0316602082015260400190565b60405181810167ffffffffffffffff811182821017156119d457fe5b60405291905056fe4c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4f564d5f436861696e53746f72616765436f6e7461696e65722d5343432d626174636865734c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea2646970667358221220fe58eec60e1130e9f94565e6ea97ae3f590e96eeda1a972687d27ab93f7f7df464736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80638ca5cbb9116100715780638ca5cbb91461012f5780639418bddd14610144578063b8e189ac14610157578063c17b291b1461016a578063cfdf677e14610172578063e561dddc1461017a576100b4565b8063299ca478146100b9578063461a4478146100d75780634d69ee57146100ea5780637aa63a861461010a5780637ad168a01461011f57806381eb62ef14610127575b600080fd5b6100c1610182565b6040516100ce919061159f565b60405180910390f35b6100c16100e53660046114e3565b610191565b6100fd6100f8366004611431565b61026f565b6040516100ce91906115b3565b6101126102e2565b6040516100ce91906115be565b6101126102fb565b610112610314565b61014261013d366004611390565b61031a565b005b6100fd610152366004611531565b61052e565b610142610165366004611531565b61057e565b610112610636565b6100c161063c565b610112610664565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156101f15781810151838201526020016101d9565b50505050905090810190601f16801561021e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561023b57600080fd5b505afa15801561024f573d6000803e3d6000fd5b505050506040513d602081101561026557600080fd5b505190505b919050565b600061027a836106de565b61029f5760405162461bcd60e51b815260040161029690611749565b60405180910390fd5b6102bc836020015185846000015185602001518760400151610776565b6102d85760405162461bcd60e51b8152600401610296906116b5565b5060019392505050565b6000806102ed6108fb565b5064ffffffffff1691505090565b6000806103066108fb565b64ffffffffff169250505090565b60025481565b6103226102e2565b81146103405760405162461bcd60e51b8152600401610296906116ec565b6103706040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b815250610191565b6001600160a01b03166302ad4d2a336040518263ffffffff1660e01b815260040161039b919061159f565b60206040518083038186803b1580156103b357600080fd5b505afa1580156103c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103eb91906113d3565b6104075760405162461bcd60e51b8152600401610296906118bb565b60008251116104285760405162461bcd60e51b815260040161029690611878565b6104666040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e000000815250610191565b6001600160a01b0316637aa63a866040518163ffffffff1660e01b815260040160206040518083038186803b15801561049e57600080fd5b505afa1580156104b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d69190611419565b82516104e06102e2565b0111156104ff5760405162461bcd60e51b815260040161029690611646565b61052a8242336040516020016105169291906119a1565b604051602081830303815290604052610990565b5050565b60008082608001518060200190518101906105499190611564565b509050806105695760405162461bcd60e51b815260040161029690611833565b4261057682600154610b31565b119392505050565b6105b06040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b815250610191565b6001600160a01b0316336001600160a01b0316146105e05760405162461bcd60e51b8152600401610296906117d6565b6105e9816106de565b6106055760405162461bcd60e51b815260040161029690611749565b61060e8161052e565b61062a5760405162461bcd60e51b815260040161029690611778565b61063381610b92565b50565b60015481565b600061065f604051806060016040528060258152602001611a6860259139610191565b905090565b600061066e61063c565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156106a657600080fd5b505afa1580156106ba573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065f9190611419565b60006106e861063c565b8251604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a91610716916004016115be565b60206040518083038186803b15801561072e57600080fd5b505afa158015610742573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107669190611419565b61076f83610d0a565b1492915050565b60008082116107b65760405162461bcd60e51b8152600401808060200182810382526037815260200180611a316037913960400191505060405180910390fd5b8184106107f45760405162461bcd60e51b81526004018080602001828103825260248152602001806119dd6024913960400191505060405180910390fd5b6107fd82610d50565b83511461083b5760405162461bcd60e51b815260040180806020018281038252604d815260200180611a8d604d913960600191505060405180910390fd5b8460005b84518110156108ee57856001166001141561089d5784818151811061086057fe5b60200260200101518260405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091506108e2565b818582815181106108aa57fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c950161083f565b5090951495945050505050565b600080600061090861063c565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b15801561094057600080fd5b505afa158015610954573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097891906113f3565b64ffffffffff602882901c16935060501c9150509091565b60006109bf6040518060400160405280600c81526020016b27ab26afa83937b837b9b2b960a11b815250610191565b90506000806109cc6108fb565b9092509050336001600160a01b03841614156109e9575042610a13565b426002548264ffffffffff160110610a135760405162461bcd60e51b81526004016102969061190a565b60006040518060a00160405280610a28610664565b8152602001610a3688610de6565b8152602001875181526020018464ffffffffff16815260200186815250905080600001517f16be4c5129a4e03cf3350262e181dc02ddfb4a6008d925368c0899fcd97ca9c58260200151836040015184606001518560800151604051610a9f94939291906115dd565b60405180910390a2610aaf61063c565b6001600160a01b0316632015276c610ac683610d0a565b610ada84604001518560600151018661121a565b6040518363ffffffff1660e01b8152600401610af79291906115c7565b600060405180830381600087803b158015610b1157600080fd5b505af1158015610b25573d6000803e3d6000fd5b50505050505050505050565b600082820183811015610b8b576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b610b9a61063c565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610bd257600080fd5b505afa158015610be6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0a9190611419565b815110610c295760405162461bcd60e51b815260040161029690611973565b610c32816106de565b610c4e5760405162461bcd60e51b815260040161029690611749565b610c5661063c565b6001600160a01b031663167fd6818260000151610c788460600151600061121a565b6040518363ffffffff1660e01b8152600401610c959291906115c7565b600060405180830381600087803b158015610caf57600080fd5b505af1158015610cc3573d6000803e3d6000fd5b5050505080600001517f8747b69ce8fdb31c3b9b0a67bd8049ad8c1a69ea417b69b12174068abd9cbd648260200151604051610cff91906115be565b60405180910390a250565b60008160200151826040015183606001518460800151604051602001610d3394939291906115dd565b604051602081830303815290604052805190602001209050919050565b6000808211610d905760405162461bcd60e51b8152600401808060200182810382526030815260200180611a016030913960400191505060405180910390fd5b8160011415610da15750600061026a565b81600060805b60018110610dd1576000196001821b01811b831615610dc95791821c91908101905b60011c610da7565b506001811b8414610b8b576001019392505050565b600080825111610e275760405162461bcd60e51b8152600401808060200182810382526034815260200180611ada6034913960400191505060405180910390fd5b815160011415610e4d5781600081518110610e3e57fe5b6020026020010151905061026a565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b60018411156111f65750506002820460018084161460005b82811015611172578a816002028151811061111957fe5b602002602001015196508a816002026001018151811061113557fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061115f57fe5b6020908102919091010152600101611102565b5080156111d55789600185038151811061118857fe5b6020026020010151955087836010811061119e57fe5b602002015160001b945085602088015284604088015286805190602001208a83815181106111c857fe5b6020026020010181815250505b806111e15760006111e4565b60015b60ff16820193506001909201916110ea565b8960008151811061120357fe5b602002602001015198505050505050505050919050565b602890811b91909117901b90565b600067ffffffffffffffff83111561123c57fe5b61124f601f8401601f19166020016119b8565b905082815283838301111561126357600080fd5b828260208301376000602084830101529392505050565b600082601f83011261128a578081fd5b8135602067ffffffffffffffff8211156112a057fe5b8082026112ae8282016119b8565b8381528281019086840183880185018910156112c8578687fd5b8693505b858410156112ea5780358352600193909301929184019184016112cc565b50979650505050505050565b600060a08284031215611307578081fd5b60405160a0810167ffffffffffffffff828210818311171561132557fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561136257600080fd5b508301601f8101851361137457600080fd5b61138385823560208401611228565b6080830152505092915050565b600080604083850312156113a2578182fd5b823567ffffffffffffffff8111156113b8578283fd5b6113c48582860161127a565b95602094909401359450505050565b6000602082840312156113e4578081fd5b81518015158114610b8b578182fd5b600060208284031215611404578081fd5b815164ffffffffff1981168114610b8b578182fd5b60006020828403121561142a578081fd5b5051919050565b600080600060608486031215611445578081fd5b83359250602084013567ffffffffffffffff80821115611463578283fd5b61146f878388016112f6565b93506040860135915080821115611484578283fd5b9085019060408288031215611497578283fd5b6040516040810181811083821117156114ac57fe5b604052823581526020830135828111156114c4578485fd5b6114d08982860161127a565b6020830152508093505050509250925092565b6000602082840312156114f4578081fd5b813567ffffffffffffffff81111561150a578182fd5b8201601f8101841361151a578182fd5b61152984823560208401611228565b949350505050565b600060208284031215611542578081fd5b813567ffffffffffffffff811115611558578182fd5b611529848285016112f6565b60008060408385031215611576578182fd5b825160208401519092506001600160a01b0381168114611594578182fd5b809150509250929050565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b91825264ffffffffff1916602082015260400190565b600085825260208581840152846040840152608060608401528351806080850152825b8181101561161c5785810183015185820160a001528201611600565b8181111561162d578360a083870101525b50601f01601f19169290920160a0019695505050505050565b60208082526049908201527f4e756d626572206f6620737461746520726f6f74732063616e6e6f742065786360408201527f65656420746865206e756d626572206f662063616e6f6e6963616c207472616e60608201526839b0b1ba34b7b7399760b91b608082015260a00190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b602080825260409082018190527f537461746520626174636865732063616e206f6e6c792062652064656c657465908201527f642077697468696e207468652066726175642070726f6f662077696e646f772e606082015260800190565b6020808252603b908201527f537461746520626174636865732063616e206f6e6c792062652064656c65746560408201527f6420627920746865204f564d5f467261756456657269666965722e0000000000606082015260800190565b60208082526025908201527f4261746368206865616465722074696d657374616d702063616e6e6f74206265604082015264207a65726f60d81b606082015260800190565b60208082526023908201527f43616e6e6f74207375626d697420616e20656d7074792073746174652062617460408201526231b41760e91b606082015260800190565b6020808252602f908201527f50726f706f73657220646f6573206e6f74206861766520656e6f75676820636f60408201526e1b1b185d195c985b081c1bdcdd1959608a1b606082015260800190565b60208082526043908201527f43616e6e6f74207075626c69736820737461746520726f6f747320776974686960408201527f6e207468652073657175656e636572207075626c69636174696f6e2077696e6460608201526237bb9760e91b608082015260a00190565b60208082526014908201527324b73b30b634b2103130ba31b41034b73232bc1760611b604082015260600190565b9182526001600160a01b0316602082015260400190565b60405181810167ffffffffffffffff811182821017156119d457fe5b60405291905056fe4c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4f564d5f436861696e53746f72616765436f6e7461696e65722d5343432d626174636865734c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea2646970667358221220fe58eec60e1130e9f94565e6ea97ae3f590e96eeda1a972687d27ab93f7f7df464736f6c63430007060033", "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", @@ -489,15 +489,15 @@ "storageLayout": { "storage": [ { - "astId": 12055, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol:OVM_StateCommitmentChain", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12048" + "type": "t_contract(Lib_AddressManager)15296" }, { - "astId": 3924, + "astId": 6159, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol:OVM_StateCommitmentChain", "label": "FRAUD_PROOF_WINDOW", "offset": 0, @@ -505,7 +505,7 @@ "type": "t_uint256" }, { - "astId": 3926, + "astId": 6161, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol:OVM_StateCommitmentChain", "label": "SEQUENCER_PUBLISH_WINDOW", "offset": 0, @@ -514,7 +514,7 @@ } ], "types": { - "t_contract(Lib_AddressManager)12048": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" diff --git a/packages/contracts/deployments/goerli/OVM_StateManagerFactory.json b/packages/contracts/deployments/goerli/OVM_StateManagerFactory.json index 60ed24301637..b93b968bddd4 100644 --- a/packages/contracts/deployments/goerli/OVM_StateManagerFactory.json +++ b/packages/contracts/deployments/goerli/OVM_StateManagerFactory.json @@ -1,5 +1,5 @@ { - "address": "0x8E63CD1CfDBe5d34a7a91B97E0A2AeA23D0e585D", + "address": "0x24C7F0a4a2B926613B31c4cDDA4c0f90c0772f2b", "abi": [ { "inputs": [ @@ -21,27 +21,27 @@ "type": "function" } ], - "transactionHash": "0xd689eba5b8fd84816f3fbe9c3be710705e27741e22403240dace3f0a68a50f55", + "transactionHash": "0x3e5890b8588461dda2a5ba310b5332f9bcf2bbe198c31b0bce4499e062786063", "receipt": { "to": null, - "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", - "contractAddress": "0x8E63CD1CfDBe5d34a7a91B97E0A2AeA23D0e585D", + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0x24C7F0a4a2B926613B31c4cDDA4c0f90c0772f2b", "transactionIndex": 2, "gasUsed": "1170970", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xb974189ddc2d16744bedca25c14ff6d9963b3ca5eb813d432444cc1211b17c57", - "transactionHash": "0xd689eba5b8fd84816f3fbe9c3be710705e27741e22403240dace3f0a68a50f55", + "blockHash": "0xcc668adf1fc0c25bad5baff4b50ba956f82132e709bb07aac80cb83d1d14cc91", + "transactionHash": "0x3e5890b8588461dda2a5ba310b5332f9bcf2bbe198c31b0bce4499e062786063", "logs": [], - "blockNumber": 4694117, - "cumulativeGasUsed": "1355204", + "blockNumber": 4974844, + "cumulativeGasUsed": "1350146", "status": 1, "byzantium": true }, "args": [], - "solcInputHash": "dde656dd41f49cad9eac9bc7065fd6a7", - "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\":\"\",\"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\":{\"_0\":\"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 * 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 * Variables *\\n *************/\\n\\n address override public owner;\\n address override public ovmExecutionManager;\\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 {\\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 *\\n ********************/\\n\\n /**\\n * Checks whether a given address is allowed to modify this contract.\\n * @param _address Address to check.\\n * @return Whether or not the address can modify this contract.\\n */\\n function isAuthenticated(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n bool\\n )\\n {\\n return (_address == owner || _address == ovmExecutionManager);\\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 * 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 for the given address.\\n */\\n function getAccount(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n Lib_OVMCodec.Account memory\\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 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\\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 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\\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 of the account.\\n */\\n function getAccountNonce(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n uint256\\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 Corresponding Ethereum address.\\n */\\n function getAccountEthAddress(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n address\\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 Corresponding storage root.\\n */\\n function getAccountStorageRoot(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n bytes32\\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 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\\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 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\\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 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\\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 uncommitted accounts.\\n */\\n function getTotalUncommittedAccounts()\\n override\\n public\\n view\\n returns (\\n uint256\\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 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\\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 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\\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 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\\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 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\\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 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\\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 uncommitted storage slots.\\n */\\n function getTotalUncommittedContractStorage()\\n override\\n public\\n view\\n returns (\\n uint256\\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 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\\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\":\"0x0df9654f9f958038435c2b2a2c7793b20fa16afe866a69cbed32a371aaa4c78b\",\"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 *\\n ********************/\\n\\n /**\\n * Creates a new OVM_StateManager\\n * @param _owner Owner of the created contract.\\n * @return New OVM_StateManager instance.\\n */\\n function create(\\n address _owner\\n )\\n override\\n public\\n returns (\\n iOVM_StateManager\\n )\\n {\\n return new OVM_StateManager(_owner);\\n }\\n}\\n\",\"keccak256\":\"0xc557f05b8a82eee7b36a389795fe4acc0803bcf5ae33e15e9cba8226e9ab49fc\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xa5195afe32fb2cf104d156e8f4bd39df1ec79bf6ba232097b9e8e0ee14fbc298\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50611437806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80639ed9331814610030575b600080fd5b6100566004803603602081101561004657600080fd5b50356001600160a01b0316610072565b604080516001600160a01b039092168252519081900360200190f35b600081604051610081906100b5565b6001600160a01b03909116815260405190819003602001906000f0801580156100ae573d6000803e3d6000fd5b5092915050565b61133f806100c38339019056fe608060405234801561001057600080fd5b5060405161133f38038061133f83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b6112ae806100916000396000f3fe608060405234801561001057600080fd5b50600436106101f05760003560e01c80638f3b96471161010f578063d126199f116100a2578063e90abb8611610071578063e90abb86146103f9578063fb37b31c1461040c578063fbcbc0f11461041f578063fcf149a21461043f576101f0565b8063d126199f146103b8578063d15d4150146103cb578063d54414c8146103de578063d7bd4a2a146103f1576101f0565b8063c3fd9b25116100de578063c3fd9b2514610377578063c7650bf21461037f578063c8e40fbf14610392578063d0a215f2146103a5576101f0565b80638f3b96471461033657806399056ba914610349578063af37b86414610351578063af3dc01114610364576101f0565b806333f94305116101875780636f3c75af116101565780636f3c75af146102f55780637c8ee703146103085780637e86faa81461031b5780638da5cb5b1461032e576101f0565b806333f94305146102b25780635c17d629146102ba5780636b18e4e8146102cd5780636c87ad20146102e0576101f0565b8063167020d2116101c3578063167020d2146102595780631aaf392f1461026c5780631b208a5a1461028c57806326dc5b121461029f576101f0565b806307a12945146101f55780630ad226791461021e57806311b1f790146102315780631381ba4d14610244575b600080fd5b61020861020336600461101d565b610452565b60405161021591906111c4565b60405180910390f35b61020861022c366004611072565b6104ba565b61020861023f36600461101d565b610517565b61025761025236600461101d565b610573565b005b61020861026736600461101d565b6105d4565b61027f61027a366004611072565b610679565b60405161021591906111cf565b61020861029a36600461101d565b610727565b61027f6102ad36600461101d565b61075e565b61025761077d565b6102576102c836600461109b565b6107c7565b6102576102db36600461101d565b61089a565b6102e8610944565b60405161021591906111b0565b610208610303366004611072565b610953565b6102e861031636600461101d565b61098c565b610208610329366004611072565b6109ad565b6102e86109c3565b6102576103443660046110cd565b6109d2565b61027f610a88565b61020861035f366004611072565b610a8e565b610208610372366004611072565b610ae2565b610257610b2f565b61020861038d366004611072565b610b79565b6102086103a036600461101d565b610c20565b6102576103b3366004611037565b610c40565b61027f6103c636600461101d565b610cb9565b6102086103d936600461101d565b610cd4565b6102086103ec36600461101d565b610d01565b61027f610d16565b610257610407366004611072565b610d1c565b61020861041a36600461101d565b610d77565b61043261042d36600461101d565b610dc3565b604051610215919061122e565b61025761044d36600461101d565b610e37565b6001600160a01b0381166000908152600260205260408120600301547fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4701480156104b257506001600160a01b038216600090815260026020526040902054155b90505b919050565b6001600160a01b038216600090815260046020908152604080832084845290915281205460ff168061050e57506001600160a01b038316600090815260026020526040902060040154600160a01b900460ff165b90505b92915050565b600080546001600160a01b031633148061053b57506001546001600160a01b031633145b6105605760405162461bcd60e51b8152600401610557906111d8565b60405180910390fd5b6104b261056c83610ef8565b6002610f28565b6000546001600160a01b031633148061059657506001546001600160a01b031633145b6105b25760405162461bcd60e51b8152600401610557906111d8565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b03163314806105f857506001546001600160a01b031633145b6106145760405162461bcd60e51b8152600401610557906111d8565b600061061f83610ef8565b9050600260008281526005602052604090205460ff16600381111561064057fe5b1461064f5760009150506104b5565b6000908152600560205260409020805460ff19166003179055505060068054600019019055600190565b6001600160a01b038216600090815260046020908152604080832084845290915281205460ff161580156106cf57506001600160a01b038316600090815260026020526040902060040154600160a01b900460ff165b156106dc57506000610511565b506001600160a01b0391909116600090815260036020908152604080832093835292905220547ffeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef1890565b60008061073383610ef8565b905060025b60008281526005602052604090205460ff16600381111561075557fe5b10159392505050565b6001600160a01b03166000908152600260208190526040909120015490565b6000546001600160a01b03163314806107a057506001546001600160a01b031633145b6107bc5760405162461bcd60e51b8152600401610557906111d8565b600680546001019055565b6000546001600160a01b03163314806107ea57506001546001600160a01b031633145b6108065760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b038316600081815260036020908152604080832086845282528083207ffeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef86189055928252600481528282208583529052205460ff16610895576001600160a01b03831660009081526004602090815260408083208584529091529020805460ff191660011790555b505050565b6000546001600160a01b03163314806108bd57506001546001600160a01b031633145b6108d95760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b031660009081526002602081905260409091207f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421918101919091557fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470600390910155565b6001546001600160a01b031681565b6000806109608484610f8e565b905060025b60008281526005602052604090205460ff16600381111561098257fe5b1015949350505050565b6001600160a01b039081166000908152600260205260409020600401541690565b6000806109ba8484610f8e565b90506003610965565b6000546001600160a01b031681565b6000546001600160a01b03163314806109f557506001546001600160a01b031633145b610a115760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b039182166000908152600260208181526040928390208451815590840151600182015591830151908201556060820151600382015560808201516004909101805460a0909301516001600160a01b0319909316919093161760ff60a01b1916600160a01b91151591909102179055565b60075490565b600080546001600160a01b0316331480610ab257506001546001600160a01b031633145b610ace5760405162461bcd60e51b8152600401610557906111d8565b61050e610adb8484610f8e565b6001610f28565b600080546001600160a01b0316331480610b0657506001546001600160a01b031633145b610b225760405162461bcd60e51b8152600401610557906111d8565b61050e61056c8484610f8e565b6000546001600160a01b0316331480610b5257506001546001600160a01b031633145b610b6e5760405162461bcd60e51b8152600401610557906111d8565b600780546001019055565b600080546001600160a01b0316331480610b9d57506001546001600160a01b031633145b610bb95760405162461bcd60e51b8152600401610557906111d8565b6000610bc58484610f8e565b9050600260008281526005602052604090205460ff166003811115610be657fe5b14610bf5576000915050610511565b6000908152600560205260409020805460ff1916600317905550506007805460001901905550600190565b6001600160a01b0316600090815260026020526040902060030154151590565b6000546001600160a01b0316331480610c6357506001546001600160a01b031633145b610c7f5760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b0392831660009081526002602052604090206004810180546001600160a01b031916939094169290921790925560030155565b6001600160a01b031660009081526002602052604090205490565b600080546001600160a01b03838116911614806104b25750506001546001600160a01b0390811691161490565b600080610d0d83610ef8565b90506003610738565b60065490565b6000546001600160a01b0316331480610d3f57506001546001600160a01b031633145b610d5b5760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b03909116600090815260026020526040902055565b600080546001600160a01b0316331480610d9b57506001546001600160a01b031633145b610db75760405162461bcd60e51b8152600401610557906111d8565b6104b2610adb83610ef8565b610dcb610fc1565b506001600160a01b03908116600090815260026020818152604092839020835160c08101855281548152600182015492810192909252918201549281019290925260038101546060830152600401549182166080820152600160a01b90910460ff16151560a082015290565b6000546001600160a01b0316331480610e5a57506001546001600160a01b031633145b610e765760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b03166000908152600260208190526040909120600181557f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421918101919091557fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4706003820155600401805460ff60a01b1916600160a01b179055565b600081604051602001610f0b9190611171565b604051602081830303815290604052805190602001209050919050565b600080826003811115610f3757fe5b60008581526005602052604090205460ff166003811115610f5457fe5b101590508061050e576000848152600560205260409020805484919060ff19166001836003811115610f8257fe5b02179055509392505050565b60008282604051602001610fa392919061118e565b60405160208183030381529060405280519060200120905092915050565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a081019190915290565b80356001600160a01b03811681146104b557600080fd5b803580151581146104b557600080fd5b60006020828403121561102e578081fd5b61050e82610ff6565b60008060006060848603121561104b578182fd5b61105484610ff6565b925061106260208501610ff6565b9150604084013590509250925092565b60008060408385031215611084578182fd5b61108d83610ff6565b946020939093013593505050565b6000806000606084860312156110af578283fd5b6110b884610ff6565b95602085013595506040909401359392505050565b60008082840360e08112156110e0578283fd5b6110e984610ff6565b925060c0601f19820112156110fc578182fd5b5060405160c0810181811067ffffffffffffffff8211171561111a57fe5b80604052506020840135815260408401356020820152606084013560408201526080840135606082015261115060a08501610ff6565b608082015261116160c0850161100d565b60a0820152809150509250929050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b60609290921b6bffffffffffffffffffffffff19168252601482015260340190565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b60208082526036908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c65642062792061604082015275757468656e746963617465642061646472657373657360501b606082015260800190565b815181526020808301519082015260408083015190820152606080830151908201526080808301516001600160a01b03169082015260a09182015115159181019190915260c0019056fea26469706673582212205bac84845119d44a384d804ab40cf5b8661877b394d879fd05cdd049485222d964736f6c63430007060033a264697066735822122049d6bdb64f1e5e1bffb7aba87ce3a0db62412188b801b3e899b8b558b75755a364736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80639ed9331814610030575b600080fd5b6100566004803603602081101561004657600080fd5b50356001600160a01b0316610072565b604080516001600160a01b039092168252519081900360200190f35b600081604051610081906100b5565b6001600160a01b03909116815260405190819003602001906000f0801580156100ae573d6000803e3d6000fd5b5092915050565b61133f806100c38339019056fe608060405234801561001057600080fd5b5060405161133f38038061133f83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b6112ae806100916000396000f3fe608060405234801561001057600080fd5b50600436106101f05760003560e01c80638f3b96471161010f578063d126199f116100a2578063e90abb8611610071578063e90abb86146103f9578063fb37b31c1461040c578063fbcbc0f11461041f578063fcf149a21461043f576101f0565b8063d126199f146103b8578063d15d4150146103cb578063d54414c8146103de578063d7bd4a2a146103f1576101f0565b8063c3fd9b25116100de578063c3fd9b2514610377578063c7650bf21461037f578063c8e40fbf14610392578063d0a215f2146103a5576101f0565b80638f3b96471461033657806399056ba914610349578063af37b86414610351578063af3dc01114610364576101f0565b806333f94305116101875780636f3c75af116101565780636f3c75af146102f55780637c8ee703146103085780637e86faa81461031b5780638da5cb5b1461032e576101f0565b806333f94305146102b25780635c17d629146102ba5780636b18e4e8146102cd5780636c87ad20146102e0576101f0565b8063167020d2116101c3578063167020d2146102595780631aaf392f1461026c5780631b208a5a1461028c57806326dc5b121461029f576101f0565b806307a12945146101f55780630ad226791461021e57806311b1f790146102315780631381ba4d14610244575b600080fd5b61020861020336600461101d565b610452565b60405161021591906111c4565b60405180910390f35b61020861022c366004611072565b6104ba565b61020861023f36600461101d565b610517565b61025761025236600461101d565b610573565b005b61020861026736600461101d565b6105d4565b61027f61027a366004611072565b610679565b60405161021591906111cf565b61020861029a36600461101d565b610727565b61027f6102ad36600461101d565b61075e565b61025761077d565b6102576102c836600461109b565b6107c7565b6102576102db36600461101d565b61089a565b6102e8610944565b60405161021591906111b0565b610208610303366004611072565b610953565b6102e861031636600461101d565b61098c565b610208610329366004611072565b6109ad565b6102e86109c3565b6102576103443660046110cd565b6109d2565b61027f610a88565b61020861035f366004611072565b610a8e565b610208610372366004611072565b610ae2565b610257610b2f565b61020861038d366004611072565b610b79565b6102086103a036600461101d565b610c20565b6102576103b3366004611037565b610c40565b61027f6103c636600461101d565b610cb9565b6102086103d936600461101d565b610cd4565b6102086103ec36600461101d565b610d01565b61027f610d16565b610257610407366004611072565b610d1c565b61020861041a36600461101d565b610d77565b61043261042d36600461101d565b610dc3565b604051610215919061122e565b61025761044d36600461101d565b610e37565b6001600160a01b0381166000908152600260205260408120600301547fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4701480156104b257506001600160a01b038216600090815260026020526040902054155b90505b919050565b6001600160a01b038216600090815260046020908152604080832084845290915281205460ff168061050e57506001600160a01b038316600090815260026020526040902060040154600160a01b900460ff165b90505b92915050565b600080546001600160a01b031633148061053b57506001546001600160a01b031633145b6105605760405162461bcd60e51b8152600401610557906111d8565b60405180910390fd5b6104b261056c83610ef8565b6002610f28565b6000546001600160a01b031633148061059657506001546001600160a01b031633145b6105b25760405162461bcd60e51b8152600401610557906111d8565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b03163314806105f857506001546001600160a01b031633145b6106145760405162461bcd60e51b8152600401610557906111d8565b600061061f83610ef8565b9050600260008281526005602052604090205460ff16600381111561064057fe5b1461064f5760009150506104b5565b6000908152600560205260409020805460ff19166003179055505060068054600019019055600190565b6001600160a01b038216600090815260046020908152604080832084845290915281205460ff161580156106cf57506001600160a01b038316600090815260026020526040902060040154600160a01b900460ff165b156106dc57506000610511565b506001600160a01b0391909116600090815260036020908152604080832093835292905220547ffeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef1890565b60008061073383610ef8565b905060025b60008281526005602052604090205460ff16600381111561075557fe5b10159392505050565b6001600160a01b03166000908152600260208190526040909120015490565b6000546001600160a01b03163314806107a057506001546001600160a01b031633145b6107bc5760405162461bcd60e51b8152600401610557906111d8565b600680546001019055565b6000546001600160a01b03163314806107ea57506001546001600160a01b031633145b6108065760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b038316600081815260036020908152604080832086845282528083207ffeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef86189055928252600481528282208583529052205460ff16610895576001600160a01b03831660009081526004602090815260408083208584529091529020805460ff191660011790555b505050565b6000546001600160a01b03163314806108bd57506001546001600160a01b031633145b6108d95760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b031660009081526002602081905260409091207f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421918101919091557fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470600390910155565b6001546001600160a01b031681565b6000806109608484610f8e565b905060025b60008281526005602052604090205460ff16600381111561098257fe5b1015949350505050565b6001600160a01b039081166000908152600260205260409020600401541690565b6000806109ba8484610f8e565b90506003610965565b6000546001600160a01b031681565b6000546001600160a01b03163314806109f557506001546001600160a01b031633145b610a115760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b039182166000908152600260208181526040928390208451815590840151600182015591830151908201556060820151600382015560808201516004909101805460a0909301516001600160a01b0319909316919093161760ff60a01b1916600160a01b91151591909102179055565b60075490565b600080546001600160a01b0316331480610ab257506001546001600160a01b031633145b610ace5760405162461bcd60e51b8152600401610557906111d8565b61050e610adb8484610f8e565b6001610f28565b600080546001600160a01b0316331480610b0657506001546001600160a01b031633145b610b225760405162461bcd60e51b8152600401610557906111d8565b61050e61056c8484610f8e565b6000546001600160a01b0316331480610b5257506001546001600160a01b031633145b610b6e5760405162461bcd60e51b8152600401610557906111d8565b600780546001019055565b600080546001600160a01b0316331480610b9d57506001546001600160a01b031633145b610bb95760405162461bcd60e51b8152600401610557906111d8565b6000610bc58484610f8e565b9050600260008281526005602052604090205460ff166003811115610be657fe5b14610bf5576000915050610511565b6000908152600560205260409020805460ff1916600317905550506007805460001901905550600190565b6001600160a01b0316600090815260026020526040902060030154151590565b6000546001600160a01b0316331480610c6357506001546001600160a01b031633145b610c7f5760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b0392831660009081526002602052604090206004810180546001600160a01b031916939094169290921790925560030155565b6001600160a01b031660009081526002602052604090205490565b600080546001600160a01b03838116911614806104b25750506001546001600160a01b0390811691161490565b600080610d0d83610ef8565b90506003610738565b60065490565b6000546001600160a01b0316331480610d3f57506001546001600160a01b031633145b610d5b5760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b03909116600090815260026020526040902055565b600080546001600160a01b0316331480610d9b57506001546001600160a01b031633145b610db75760405162461bcd60e51b8152600401610557906111d8565b6104b2610adb83610ef8565b610dcb610fc1565b506001600160a01b03908116600090815260026020818152604092839020835160c08101855281548152600182015492810192909252918201549281019290925260038101546060830152600401549182166080820152600160a01b90910460ff16151560a082015290565b6000546001600160a01b0316331480610e5a57506001546001600160a01b031633145b610e765760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b03166000908152600260208190526040909120600181557f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421918101919091557fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4706003820155600401805460ff60a01b1916600160a01b179055565b600081604051602001610f0b9190611171565b604051602081830303815290604052805190602001209050919050565b600080826003811115610f3757fe5b60008581526005602052604090205460ff166003811115610f5457fe5b101590508061050e576000848152600560205260409020805484919060ff19166001836003811115610f8257fe5b02179055509392505050565b60008282604051602001610fa392919061118e565b60405160208183030381529060405280519060200120905092915050565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a081019190915290565b80356001600160a01b03811681146104b557600080fd5b803580151581146104b557600080fd5b60006020828403121561102e578081fd5b61050e82610ff6565b60008060006060848603121561104b578182fd5b61105484610ff6565b925061106260208501610ff6565b9150604084013590509250925092565b60008060408385031215611084578182fd5b61108d83610ff6565b946020939093013593505050565b6000806000606084860312156110af578283fd5b6110b884610ff6565b95602085013595506040909401359392505050565b60008082840360e08112156110e0578283fd5b6110e984610ff6565b925060c0601f19820112156110fc578182fd5b5060405160c0810181811067ffffffffffffffff8211171561111a57fe5b80604052506020840135815260408401356020820152606084013560408201526080840135606082015261115060a08501610ff6565b608082015261116160c0850161100d565b60a0820152809150509250929050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b60609290921b6bffffffffffffffffffffffff19168252601482015260340190565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b60208082526036908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c65642062792061604082015275757468656e746963617465642061646472657373657360501b606082015260800190565b815181526020808301519082015260408083015190820152606080830151908201526080808301516001600160a01b03169082015260a09182015115159181019190915260c0019056fea26469706673582212205bac84845119d44a384d804ab40cf5b8661877b394d879fd05cdd049485222d964736f6c63430007060033a264697066735822122049d6bdb64f1e5e1bffb7aba87ce3a0db62412188b801b3e899b8b558b75755a364736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"\",\"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\":{\"_0\":\"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 * 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 * Variables *\\n *************/\\n\\n address override public owner;\\n address override public ovmExecutionManager;\\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 {\\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 *\\n ********************/\\n\\n /**\\n * Checks whether a given address is allowed to modify this contract.\\n * @param _address Address to check.\\n * @return Whether or not the address can modify this contract.\\n */\\n function isAuthenticated(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n bool\\n )\\n {\\n return (_address == owner || _address == ovmExecutionManager);\\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 * 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 for the given address.\\n */\\n function getAccount(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n Lib_OVMCodec.Account memory\\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 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\\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 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\\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 of the account.\\n */\\n function getAccountNonce(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n uint256\\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 Corresponding Ethereum address.\\n */\\n function getAccountEthAddress(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n address\\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 Corresponding storage root.\\n */\\n function getAccountStorageRoot(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n bytes32\\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 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\\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 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\\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 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\\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 uncommitted accounts.\\n */\\n function getTotalUncommittedAccounts()\\n override\\n public\\n view\\n returns (\\n uint256\\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 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\\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 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\\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 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\\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 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\\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 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\\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 uncommitted storage slots.\\n */\\n function getTotalUncommittedContractStorage()\\n override\\n public\\n view\\n returns (\\n uint256\\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 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\\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\":\"0x0df9654f9f958038435c2b2a2c7793b20fa16afe866a69cbed32a371aaa4c78b\",\"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 *\\n ********************/\\n\\n /**\\n * Creates a new OVM_StateManager\\n * @param _owner Owner of the created contract.\\n * @return New OVM_StateManager instance.\\n */\\n function create(\\n address _owner\\n )\\n override\\n public\\n returns (\\n iOVM_StateManager\\n )\\n {\\n return new OVM_StateManager(_owner);\\n }\\n}\\n\",\"keccak256\":\"0xc557f05b8a82eee7b36a389795fe4acc0803bcf5ae33e15e9cba8226e9ab49fc\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50611437806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80639ed9331814610030575b600080fd5b6100566004803603602081101561004657600080fd5b50356001600160a01b0316610072565b604080516001600160a01b039092168252519081900360200190f35b600081604051610081906100b5565b6001600160a01b03909116815260405190819003602001906000f0801580156100ae573d6000803e3d6000fd5b5092915050565b61133f806100c38339019056fe608060405234801561001057600080fd5b5060405161133f38038061133f83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b6112ae806100916000396000f3fe608060405234801561001057600080fd5b50600436106101f05760003560e01c80638f3b96471161010f578063d126199f116100a2578063e90abb8611610071578063e90abb86146103f9578063fb37b31c1461040c578063fbcbc0f11461041f578063fcf149a21461043f576101f0565b8063d126199f146103b8578063d15d4150146103cb578063d54414c8146103de578063d7bd4a2a146103f1576101f0565b8063c3fd9b25116100de578063c3fd9b2514610377578063c7650bf21461037f578063c8e40fbf14610392578063d0a215f2146103a5576101f0565b80638f3b96471461033657806399056ba914610349578063af37b86414610351578063af3dc01114610364576101f0565b806333f94305116101875780636f3c75af116101565780636f3c75af146102f55780637c8ee703146103085780637e86faa81461031b5780638da5cb5b1461032e576101f0565b806333f94305146102b25780635c17d629146102ba5780636b18e4e8146102cd5780636c87ad20146102e0576101f0565b8063167020d2116101c3578063167020d2146102595780631aaf392f1461026c5780631b208a5a1461028c57806326dc5b121461029f576101f0565b806307a12945146101f55780630ad226791461021e57806311b1f790146102315780631381ba4d14610244575b600080fd5b61020861020336600461101d565b610452565b60405161021591906111c4565b60405180910390f35b61020861022c366004611072565b6104ba565b61020861023f36600461101d565b610517565b61025761025236600461101d565b610573565b005b61020861026736600461101d565b6105d4565b61027f61027a366004611072565b610679565b60405161021591906111cf565b61020861029a36600461101d565b610727565b61027f6102ad36600461101d565b61075e565b61025761077d565b6102576102c836600461109b565b6107c7565b6102576102db36600461101d565b61089a565b6102e8610944565b60405161021591906111b0565b610208610303366004611072565b610953565b6102e861031636600461101d565b61098c565b610208610329366004611072565b6109ad565b6102e86109c3565b6102576103443660046110cd565b6109d2565b61027f610a88565b61020861035f366004611072565b610a8e565b610208610372366004611072565b610ae2565b610257610b2f565b61020861038d366004611072565b610b79565b6102086103a036600461101d565b610c20565b6102576103b3366004611037565b610c40565b61027f6103c636600461101d565b610cb9565b6102086103d936600461101d565b610cd4565b6102086103ec36600461101d565b610d01565b61027f610d16565b610257610407366004611072565b610d1c565b61020861041a36600461101d565b610d77565b61043261042d36600461101d565b610dc3565b604051610215919061122e565b61025761044d36600461101d565b610e37565b6001600160a01b0381166000908152600260205260408120600301547fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4701480156104b257506001600160a01b038216600090815260026020526040902054155b90505b919050565b6001600160a01b038216600090815260046020908152604080832084845290915281205460ff168061050e57506001600160a01b038316600090815260026020526040902060040154600160a01b900460ff165b90505b92915050565b600080546001600160a01b031633148061053b57506001546001600160a01b031633145b6105605760405162461bcd60e51b8152600401610557906111d8565b60405180910390fd5b6104b261056c83610ef8565b6002610f28565b6000546001600160a01b031633148061059657506001546001600160a01b031633145b6105b25760405162461bcd60e51b8152600401610557906111d8565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b03163314806105f857506001546001600160a01b031633145b6106145760405162461bcd60e51b8152600401610557906111d8565b600061061f83610ef8565b9050600260008281526005602052604090205460ff16600381111561064057fe5b1461064f5760009150506104b5565b6000908152600560205260409020805460ff19166003179055505060068054600019019055600190565b6001600160a01b038216600090815260046020908152604080832084845290915281205460ff161580156106cf57506001600160a01b038316600090815260026020526040902060040154600160a01b900460ff165b156106dc57506000610511565b506001600160a01b0391909116600090815260036020908152604080832093835292905220547ffeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef1890565b60008061073383610ef8565b905060025b60008281526005602052604090205460ff16600381111561075557fe5b10159392505050565b6001600160a01b03166000908152600260208190526040909120015490565b6000546001600160a01b03163314806107a057506001546001600160a01b031633145b6107bc5760405162461bcd60e51b8152600401610557906111d8565b600680546001019055565b6000546001600160a01b03163314806107ea57506001546001600160a01b031633145b6108065760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b038316600081815260036020908152604080832086845282528083207ffeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef86189055928252600481528282208583529052205460ff16610895576001600160a01b03831660009081526004602090815260408083208584529091529020805460ff191660011790555b505050565b6000546001600160a01b03163314806108bd57506001546001600160a01b031633145b6108d95760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b031660009081526002602081905260409091207f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421918101919091557fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470600390910155565b6001546001600160a01b031681565b6000806109608484610f8e565b905060025b60008281526005602052604090205460ff16600381111561098257fe5b1015949350505050565b6001600160a01b039081166000908152600260205260409020600401541690565b6000806109ba8484610f8e565b90506003610965565b6000546001600160a01b031681565b6000546001600160a01b03163314806109f557506001546001600160a01b031633145b610a115760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b039182166000908152600260208181526040928390208451815590840151600182015591830151908201556060820151600382015560808201516004909101805460a0909301516001600160a01b0319909316919093161760ff60a01b1916600160a01b91151591909102179055565b60075490565b600080546001600160a01b0316331480610ab257506001546001600160a01b031633145b610ace5760405162461bcd60e51b8152600401610557906111d8565b61050e610adb8484610f8e565b6001610f28565b600080546001600160a01b0316331480610b0657506001546001600160a01b031633145b610b225760405162461bcd60e51b8152600401610557906111d8565b61050e61056c8484610f8e565b6000546001600160a01b0316331480610b5257506001546001600160a01b031633145b610b6e5760405162461bcd60e51b8152600401610557906111d8565b600780546001019055565b600080546001600160a01b0316331480610b9d57506001546001600160a01b031633145b610bb95760405162461bcd60e51b8152600401610557906111d8565b6000610bc58484610f8e565b9050600260008281526005602052604090205460ff166003811115610be657fe5b14610bf5576000915050610511565b6000908152600560205260409020805460ff1916600317905550506007805460001901905550600190565b6001600160a01b0316600090815260026020526040902060030154151590565b6000546001600160a01b0316331480610c6357506001546001600160a01b031633145b610c7f5760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b0392831660009081526002602052604090206004810180546001600160a01b031916939094169290921790925560030155565b6001600160a01b031660009081526002602052604090205490565b600080546001600160a01b03838116911614806104b25750506001546001600160a01b0390811691161490565b600080610d0d83610ef8565b90506003610738565b60065490565b6000546001600160a01b0316331480610d3f57506001546001600160a01b031633145b610d5b5760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b03909116600090815260026020526040902055565b600080546001600160a01b0316331480610d9b57506001546001600160a01b031633145b610db75760405162461bcd60e51b8152600401610557906111d8565b6104b2610adb83610ef8565b610dcb610fc1565b506001600160a01b03908116600090815260026020818152604092839020835160c08101855281548152600182015492810192909252918201549281019290925260038101546060830152600401549182166080820152600160a01b90910460ff16151560a082015290565b6000546001600160a01b0316331480610e5a57506001546001600160a01b031633145b610e765760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b03166000908152600260208190526040909120600181557f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421918101919091557fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4706003820155600401805460ff60a01b1916600160a01b179055565b600081604051602001610f0b9190611171565b604051602081830303815290604052805190602001209050919050565b600080826003811115610f3757fe5b60008581526005602052604090205460ff166003811115610f5457fe5b101590508061050e576000848152600560205260409020805484919060ff19166001836003811115610f8257fe5b02179055509392505050565b60008282604051602001610fa392919061118e565b60405160208183030381529060405280519060200120905092915050565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a081019190915290565b80356001600160a01b03811681146104b557600080fd5b803580151581146104b557600080fd5b60006020828403121561102e578081fd5b61050e82610ff6565b60008060006060848603121561104b578182fd5b61105484610ff6565b925061106260208501610ff6565b9150604084013590509250925092565b60008060408385031215611084578182fd5b61108d83610ff6565b946020939093013593505050565b6000806000606084860312156110af578283fd5b6110b884610ff6565b95602085013595506040909401359392505050565b60008082840360e08112156110e0578283fd5b6110e984610ff6565b925060c0601f19820112156110fc578182fd5b5060405160c0810181811067ffffffffffffffff8211171561111a57fe5b80604052506020840135815260408401356020820152606084013560408201526080840135606082015261115060a08501610ff6565b608082015261116160c0850161100d565b60a0820152809150509250929050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b60609290921b6bffffffffffffffffffffffff19168252601482015260340190565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b60208082526036908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c65642062792061604082015275757468656e746963617465642061646472657373657360501b606082015260800190565b815181526020808301519082015260408083015190820152606080830151908201526080808301516001600160a01b03169082015260a09182015115159181019190915260c0019056fea2646970667358221220831108797bd578e5207b0f7717657875894fce501cf25b4109f65121461461ca64736f6c63430007060033a2646970667358221220c3b6fe114c6da51f019d7729cc2ec959a0decd1375f627f7e6327030359bac6264736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80639ed9331814610030575b600080fd5b6100566004803603602081101561004657600080fd5b50356001600160a01b0316610072565b604080516001600160a01b039092168252519081900360200190f35b600081604051610081906100b5565b6001600160a01b03909116815260405190819003602001906000f0801580156100ae573d6000803e3d6000fd5b5092915050565b61133f806100c38339019056fe608060405234801561001057600080fd5b5060405161133f38038061133f83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b6112ae806100916000396000f3fe608060405234801561001057600080fd5b50600436106101f05760003560e01c80638f3b96471161010f578063d126199f116100a2578063e90abb8611610071578063e90abb86146103f9578063fb37b31c1461040c578063fbcbc0f11461041f578063fcf149a21461043f576101f0565b8063d126199f146103b8578063d15d4150146103cb578063d54414c8146103de578063d7bd4a2a146103f1576101f0565b8063c3fd9b25116100de578063c3fd9b2514610377578063c7650bf21461037f578063c8e40fbf14610392578063d0a215f2146103a5576101f0565b80638f3b96471461033657806399056ba914610349578063af37b86414610351578063af3dc01114610364576101f0565b806333f94305116101875780636f3c75af116101565780636f3c75af146102f55780637c8ee703146103085780637e86faa81461031b5780638da5cb5b1461032e576101f0565b806333f94305146102b25780635c17d629146102ba5780636b18e4e8146102cd5780636c87ad20146102e0576101f0565b8063167020d2116101c3578063167020d2146102595780631aaf392f1461026c5780631b208a5a1461028c57806326dc5b121461029f576101f0565b806307a12945146101f55780630ad226791461021e57806311b1f790146102315780631381ba4d14610244575b600080fd5b61020861020336600461101d565b610452565b60405161021591906111c4565b60405180910390f35b61020861022c366004611072565b6104ba565b61020861023f36600461101d565b610517565b61025761025236600461101d565b610573565b005b61020861026736600461101d565b6105d4565b61027f61027a366004611072565b610679565b60405161021591906111cf565b61020861029a36600461101d565b610727565b61027f6102ad36600461101d565b61075e565b61025761077d565b6102576102c836600461109b565b6107c7565b6102576102db36600461101d565b61089a565b6102e8610944565b60405161021591906111b0565b610208610303366004611072565b610953565b6102e861031636600461101d565b61098c565b610208610329366004611072565b6109ad565b6102e86109c3565b6102576103443660046110cd565b6109d2565b61027f610a88565b61020861035f366004611072565b610a8e565b610208610372366004611072565b610ae2565b610257610b2f565b61020861038d366004611072565b610b79565b6102086103a036600461101d565b610c20565b6102576103b3366004611037565b610c40565b61027f6103c636600461101d565b610cb9565b6102086103d936600461101d565b610cd4565b6102086103ec36600461101d565b610d01565b61027f610d16565b610257610407366004611072565b610d1c565b61020861041a36600461101d565b610d77565b61043261042d36600461101d565b610dc3565b604051610215919061122e565b61025761044d36600461101d565b610e37565b6001600160a01b0381166000908152600260205260408120600301547fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4701480156104b257506001600160a01b038216600090815260026020526040902054155b90505b919050565b6001600160a01b038216600090815260046020908152604080832084845290915281205460ff168061050e57506001600160a01b038316600090815260026020526040902060040154600160a01b900460ff165b90505b92915050565b600080546001600160a01b031633148061053b57506001546001600160a01b031633145b6105605760405162461bcd60e51b8152600401610557906111d8565b60405180910390fd5b6104b261056c83610ef8565b6002610f28565b6000546001600160a01b031633148061059657506001546001600160a01b031633145b6105b25760405162461bcd60e51b8152600401610557906111d8565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b03163314806105f857506001546001600160a01b031633145b6106145760405162461bcd60e51b8152600401610557906111d8565b600061061f83610ef8565b9050600260008281526005602052604090205460ff16600381111561064057fe5b1461064f5760009150506104b5565b6000908152600560205260409020805460ff19166003179055505060068054600019019055600190565b6001600160a01b038216600090815260046020908152604080832084845290915281205460ff161580156106cf57506001600160a01b038316600090815260026020526040902060040154600160a01b900460ff165b156106dc57506000610511565b506001600160a01b0391909116600090815260036020908152604080832093835292905220547ffeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef1890565b60008061073383610ef8565b905060025b60008281526005602052604090205460ff16600381111561075557fe5b10159392505050565b6001600160a01b03166000908152600260208190526040909120015490565b6000546001600160a01b03163314806107a057506001546001600160a01b031633145b6107bc5760405162461bcd60e51b8152600401610557906111d8565b600680546001019055565b6000546001600160a01b03163314806107ea57506001546001600160a01b031633145b6108065760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b038316600081815260036020908152604080832086845282528083207ffeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef86189055928252600481528282208583529052205460ff16610895576001600160a01b03831660009081526004602090815260408083208584529091529020805460ff191660011790555b505050565b6000546001600160a01b03163314806108bd57506001546001600160a01b031633145b6108d95760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b031660009081526002602081905260409091207f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421918101919091557fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470600390910155565b6001546001600160a01b031681565b6000806109608484610f8e565b905060025b60008281526005602052604090205460ff16600381111561098257fe5b1015949350505050565b6001600160a01b039081166000908152600260205260409020600401541690565b6000806109ba8484610f8e565b90506003610965565b6000546001600160a01b031681565b6000546001600160a01b03163314806109f557506001546001600160a01b031633145b610a115760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b039182166000908152600260208181526040928390208451815590840151600182015591830151908201556060820151600382015560808201516004909101805460a0909301516001600160a01b0319909316919093161760ff60a01b1916600160a01b91151591909102179055565b60075490565b600080546001600160a01b0316331480610ab257506001546001600160a01b031633145b610ace5760405162461bcd60e51b8152600401610557906111d8565b61050e610adb8484610f8e565b6001610f28565b600080546001600160a01b0316331480610b0657506001546001600160a01b031633145b610b225760405162461bcd60e51b8152600401610557906111d8565b61050e61056c8484610f8e565b6000546001600160a01b0316331480610b5257506001546001600160a01b031633145b610b6e5760405162461bcd60e51b8152600401610557906111d8565b600780546001019055565b600080546001600160a01b0316331480610b9d57506001546001600160a01b031633145b610bb95760405162461bcd60e51b8152600401610557906111d8565b6000610bc58484610f8e565b9050600260008281526005602052604090205460ff166003811115610be657fe5b14610bf5576000915050610511565b6000908152600560205260409020805460ff1916600317905550506007805460001901905550600190565b6001600160a01b0316600090815260026020526040902060030154151590565b6000546001600160a01b0316331480610c6357506001546001600160a01b031633145b610c7f5760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b0392831660009081526002602052604090206004810180546001600160a01b031916939094169290921790925560030155565b6001600160a01b031660009081526002602052604090205490565b600080546001600160a01b03838116911614806104b25750506001546001600160a01b0390811691161490565b600080610d0d83610ef8565b90506003610738565b60065490565b6000546001600160a01b0316331480610d3f57506001546001600160a01b031633145b610d5b5760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b03909116600090815260026020526040902055565b600080546001600160a01b0316331480610d9b57506001546001600160a01b031633145b610db75760405162461bcd60e51b8152600401610557906111d8565b6104b2610adb83610ef8565b610dcb610fc1565b506001600160a01b03908116600090815260026020818152604092839020835160c08101855281548152600182015492810192909252918201549281019290925260038101546060830152600401549182166080820152600160a01b90910460ff16151560a082015290565b6000546001600160a01b0316331480610e5a57506001546001600160a01b031633145b610e765760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b03166000908152600260208190526040909120600181557f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421918101919091557fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4706003820155600401805460ff60a01b1916600160a01b179055565b600081604051602001610f0b9190611171565b604051602081830303815290604052805190602001209050919050565b600080826003811115610f3757fe5b60008581526005602052604090205460ff166003811115610f5457fe5b101590508061050e576000848152600560205260409020805484919060ff19166001836003811115610f8257fe5b02179055509392505050565b60008282604051602001610fa392919061118e565b60405160208183030381529060405280519060200120905092915050565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a081019190915290565b80356001600160a01b03811681146104b557600080fd5b803580151581146104b557600080fd5b60006020828403121561102e578081fd5b61050e82610ff6565b60008060006060848603121561104b578182fd5b61105484610ff6565b925061106260208501610ff6565b9150604084013590509250925092565b60008060408385031215611084578182fd5b61108d83610ff6565b946020939093013593505050565b6000806000606084860312156110af578283fd5b6110b884610ff6565b95602085013595506040909401359392505050565b60008082840360e08112156110e0578283fd5b6110e984610ff6565b925060c0601f19820112156110fc578182fd5b5060405160c0810181811067ffffffffffffffff8211171561111a57fe5b80604052506020840135815260408401356020820152606084013560408201526080840135606082015261115060a08501610ff6565b608082015261116160c0850161100d565b60a0820152809150509250929050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b60609290921b6bffffffffffffffffffffffff19168252601482015260340190565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b60208082526036908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c65642062792061604082015275757468656e746963617465642061646472657373657360501b606082015260800190565b815181526020808301519082015260408083015190820152606080830151908201526080808301516001600160a01b03169082015260a09182015115159181019190915260c0019056fea2646970667358221220831108797bd578e5207b0f7717657875894fce501cf25b4109f65121461461ca64736f6c63430007060033a2646970667358221220c3b6fe114c6da51f019d7729cc2ec959a0decd1375f627f7e6327030359bac6264736f6c63430007060033", "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", diff --git a/packages/contracts/deployments/goerli/OVM_StateTransitionerFactory.json b/packages/contracts/deployments/goerli/OVM_StateTransitionerFactory.json index 6b841b9de7f1..b8e79edd72c1 100644 --- a/packages/contracts/deployments/goerli/OVM_StateTransitionerFactory.json +++ b/packages/contracts/deployments/goerli/OVM_StateTransitionerFactory.json @@ -1,5 +1,5 @@ { - "address": "0x543021950Af9250443EEdc681755e0bdBd3Fc81d", + "address": "0x703303Ce2d92Ef95F17a622E3d538390251165E8", "abi": [ { "inputs": [ @@ -79,29 +79,29 @@ "type": "function" } ], - "transactionHash": "0xa0d4c463ca8c4e28f45f626748821c6ee6ea8c1bfa3177994122a305513d981a", + "transactionHash": "0x877850cd35176b91dd82cdfe82fdbb34cbaf02e52974cccdf4a04f8474576311", "receipt": { "to": null, - "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", - "contractAddress": "0x543021950Af9250443EEdc681755e0bdBd3Fc81d", - "transactionIndex": 2, - "gasUsed": "4129040", + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0x703303Ce2d92Ef95F17a622E3d538390251165E8", + "transactionIndex": 5, + "gasUsed": "4209012", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xa51e77d2c41ef20f84a04f6744fdab9d62baa0e0455d7c0ceec6bfacbe379ed2", - "transactionHash": "0xa0d4c463ca8c4e28f45f626748821c6ee6ea8c1bfa3177994122a305513d981a", + "blockHash": "0xdc19f7c1dc083a0b57e75958cc2646c4b12f293fc7b6d4a90ffc42b4b92834d8", + "transactionHash": "0x877850cd35176b91dd82cdfe82fdbb34cbaf02e52974cccdf4a04f8474576311", "logs": [], - "blockNumber": 4694120, - "cumulativeGasUsed": "4262813", + "blockNumber": 4974848, + "cumulativeGasUsed": "4613615", "status": 1, "byzantium": true }, "args": [ - "0xE3d08F0D900A2D53cB794cf82d7127764BcC3092" + "0xA4346c8c120DdCE2c5447e68790625F10Bb4d47A" ], - "solcInputHash": "dde656dd41f49cad9eac9bc7065fd6a7", - "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\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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\":{\"_0\":\"New OVM_StateTransitioner instance.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}}},\"title\":\"OVM_StateTransitionerFactory\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"create(address,uint256,bytes32,bytes32)\":{\"notice\":\"Creates a new OVM_StateTransitioner\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"}},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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 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 // Prevent the Execution Manager from calling this SM again.\\n ovmStateManager.setExecutionManager(address(0));\\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\":\"0xc363807221625338a396c52a4bc3b7439e63972ac87521670c47745641e91fa6\",\"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 /***************\\n * Constructor *\\n ***************/\\n\\n constructor(\\n address _libAddressManager\\n )\\n Lib_AddressResolver(_libAddressManager)\\n {}\\n\\n\\n /********************\\n * Public Functions *\\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 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\\n )\\n {\\n require(\\n msg.sender == resolve(\\\"OVM_FraudVerifier\\\"),\\n \\\"Create can only be done by the OVM_FraudVerifier.\\\"\\n );\\n\\n return new OVM_StateTransitioner(\\n _libAddressManager,\\n _stateTransitionIndex,\\n _preStateRoot,\\n _transactionHash\\n );\\n }\\n}\\n\",\"keccak256\":\"0x65ef11334a2d6931b6d3a85e7b29c39c774d19443e7040e132a58be505e3b52c\",\"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 OUT_OF_GAS,\\n INTENTIONAL_REVERT,\\n EXCEEDS_NUISANCE_GAS,\\n INVALID_STATE_ACCESS,\\n UNSAFE_BYTECODE,\\n CREATE_COLLISION,\\n STATIC_VIOLATION,\\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 }\\n\\n\\n /************************************\\n * Transaction Execution Entrypoint *\\n ************************************/\\n\\n function run(\\n Lib_OVMCodec.Transaction calldata _transaction,\\n address _txStateManager\\n ) external returns (bytes memory);\\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, bytes memory _revertdata);\\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract, bytes memory _revertdata);\\n\\n\\n /*******************************\\n * Account Abstraction Opcodes *\\n ******************************/\\n\\n function ovmGETNONCE() external returns (uint256 _nonce);\\n function ovmINCREMENTNONCE() 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 Context *\\n ***************************************/\\n\\n function getMaxTransactionGasLimit() external view returns (uint _maxTransactionGasLimit);\\n}\\n\",\"keccak256\":\"0xf023d5d6fc6a03bd52f7a57af6e21076de77e8925d065bb79db062e73e43b684\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x2ce671a0e004df88b136bea5a3c59d0732cea8887c8496da1d509e0200b03d7d\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 abi.encodePacked(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\":\"0x161f65220b8c5cf295232f8c58c2744fbc898bf77da5f9d9c5b2dd673dafc6f6\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xa5195afe32fb2cf104d156e8f4bd39df1ec79bf6ba232097b9e8e0ee14fbc298\",\"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 *\\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 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\\n )\\n {\\n bytes memory code;\\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 Full code of the contract.\\n */\\n function getCode(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes memory\\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 Size of the contract's code in bytes.\\n */\\n function getCodeSize(\\n address _address\\n )\\n internal\\n view\\n returns (\\n uint256\\n )\\n {\\n uint256 codeSize;\\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 Hash of the contract's code.\\n */\\n function getCodeHash(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n bytes32 codeHash;\\n assembly {\\n codeHash := extcodehash(_address)\\n }\\n\\n return codeHash;\\n }\\n\\n /**\\n * Creates a contract with some given initialization code.\\n * @param _code Contract initialization code.\\n * @return Address of the created contract.\\n */\\n function createContract(\\n bytes memory _code\\n )\\n internal\\n returns (\\n address\\n )\\n {\\n address created;\\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 to be generated by CREATE.\\n */\\n function getAddressForCREATE(\\n address _creator,\\n uint256 _nonce\\n )\\n internal\\n pure\\n returns (\\n 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 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 (\\n address\\n )\\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\":\"0xf29a67d78e61cb472d524b779b32cfcb39a587f4096500d5419e6425ed367d49\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506040516149b93803806149b98339818101604052602081101561003357600080fd5b5051600080546001600160a01b039092166001600160a01b0319909216919091179055614954806100656000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806322d1470214610046578063299ca4781461009a578063461a4478146100a2575b600080fd5b61007e6004803603608081101561005c57600080fd5b506001600160a01b038135169060208101359060408101359060600135610148565b604080516001600160a01b039092168252519081900360200190f35b61007e610229565b61007e600480360360208110156100b857600080fd5b8101906020810181356401000000008111156100d357600080fd5b8201836020820111156100e557600080fd5b8035906020019184600183028401116401000000008311171561010757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610238945050505050565b600061017c6040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b815250610238565b6001600160a01b0316336001600160a01b0316146101cb5760405162461bcd60e51b81526004018080602001828103825260318152602001806148ee6031913960400191505060405180910390fd5b848484846040516101db90610314565b80856001600160a01b03168152602001848152602001838152602001828152602001945050505050604051809103906000f08015801561021f573d6000803e3d6000fd5b5095945050505050565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610298578181015183820152602001610280565b50505050905090810190601f1680156102c55780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102e257600080fd5b505afa1580156102f6573d6000803e3d6000fd5b505050506040513d602081101561030c57600080fd5b505192915050565b6145cc806103228339019056fe60806040523480156200001157600080fd5b50604051620045cc380380620045cc833981016040819052620000349162000232565b600080546001600160a01b0319166001600160a01b038616179055600583905560028290556003829055600681905560408051808201909152601781527f4f564d5f53746174654d616e61676572466163746f72790000000000000000006020820152620000a29062000150565b6001600160a01b0316639ed93318306040518263ffffffff1660e01b8152600401620000cf919062000299565b602060405180830381600087803b158015620000ea57600080fd5b505af1158015620000ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000125919062000273565b600180546001600160a01b0319166001600160a01b039290921691909117905550620002c692505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015620001b257818101518382015260200162000198565b50505050905090810190601f168015620001e05780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b158015620001fe57600080fd5b505afa15801562000213573d6000803e3d6000fd5b505050506040513d60208110156200022a57600080fd5b505192915050565b6000806000806080858703121562000248578384fd5b84516200025581620002ad565b60208601516040870151606090970151919890975090945092505050565b60006020828403121562000285578081fd5b81516200029281620002ad565b9392505050565b6001600160a01b0391909116815260200190565b6001600160a01b0381168114620002c357600080fd5b50565b6142f680620002d66000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063845fe7a31161008c578063b2fa1c9e11610066578063b2fa1c9e14610185578063b52805711461019a578063b9194310146101a2578063c1c618b8146101b5576100cf565b8063845fe7a314610155578063a244316a14610168578063b1c9fe6e14610170576100cf565b8063299ca478146100d45780632e1ac36c146100f25780632eb1375814610107578063461a44781461011a578063732f960b1461012d578063805e9d3014610140575b600080fd5b6100dc6101bd565b6040516100e99190613c74565b60405180910390f35b6101056101003660046138d0565b6101cc565b005b610105610115366004613910565b610565565b6100dc6101283660046139f8565b6108a1565b61010561013b366004613abc565b61097f565b610148610c6f565b6040516100e99190613bcd565b6101056101633660046138d0565b610c75565b610105610fa1565b610178611128565b6040516100e99190613d26565b61018d611131565b6040516100e99190613d1b565b6100dc61114c565b6101056101b0366004613871565b61115b565b610148611475565b6000546001600160a01b031681565b60018060045460ff1660028111156101e057fe5b146102065760405162461bcd60e51b81526004016101fd90614077565b60405180910390fd5b60025460065460005a6001546040516363b285f960e11b81529192506001600160a01b03169063c7650bf290610242908a908a90600401613c88565b602060405180830381600087803b15801561025c57600080fd5b505af1158015610270573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610294919061395d565b15156001146102b55760405162461bcd60e51b81526004016101fd90613e22565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f1906102e6908b90600401613c74565b60c06040518083038186803b1580156102fe57600080fd5b505afa158015610312573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103369190613a3d565b600154604051631aaf392f60e01b81529192506000916001600160a01b0390911690631aaf392f9061036e908c908c90600401613c88565b60206040518083038186803b15801561038657600080fd5b505afa15801561039a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103be9190613977565b90506103ff886040516020016103d49190613bcd565b6040516020818303038152906040526103f46103ef8461147b565b6114c4565b89856040015161152e565b6040808401919091526001549051638f3b964760e01b81526001600160a01b0390911690638f3b964790610439908c908690600401613cc2565b600060405180830381600087803b15801561045357600080fd5b505af1158015610467573d6000803e3d6000fd5b505050507f3e3ed1a676a2754a041b49bf752e0f167c8753495e36c320fe01d1ef7476253c898960405161049c929190613c88565b60405180910390a1505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561054357600080fd5b505af1158015610557573d6000803e3d6000fd5b505050505050505050505050565b60018060045460ff16600281111561057957fe5b146105965760405162461bcd60e51b81526004016101fd90614077565b60025460065460005a9050600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156105ef57600080fd5b505afa158015610603573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106279190613977565b156106445760405162461bcd60e51b81526004016101fd90613f03565b600154604051630b38106960e11b81526001600160a01b039091169063167020d290610674908990600401613c74565b602060405180830381600087803b15801561068e57600080fd5b505af11580156106a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c6919061395d565b15156001146106e75760405162461bcd60e51b81526004016101fd90613fbd565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f190610718908a90600401613c74565b60c06040518083038186803b15801561073057600080fd5b505afa158015610744573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107689190613a3d565b90506107a78760405160200161077e9190613bb0565b60405160208183030381529060405261079e61079984611554565b611594565b8860035461152e565b6003556040517fcec9ef675d775706a02b43afe48af52c5019bc50f99582e3208c6ff55d59c008906107da908990613c74565b60405180910390a15060005a8203905061081a6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561088057600080fd5b505af1158015610894573d6000803e3d6000fd5b5050505050505050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156109015781810151838201526020016108e9565b50505050905090810190601f16801561092e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561094b57600080fd5b505afa15801561095f573d6000803e3d6000fd5b505050506040513d602081101561097557600080fd5b505190505b919050565b60008060045460ff16600281111561099357fe5b146109b05760405162461bcd60e51b81526004016101fd90614077565b60025460065460005a90506006546109c78661169d565b146109e45760405162461bcd60e51b81526004016101fd906140c8565b6103e88560a0015161040802816109f757fe5b04620186a0015a1015610a1c5760405162461bcd60e51b81526004016101fd90613f60565b6000610a536040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b8152506108a1565b600154604051631381ba4d60e01b81529192506001600160a01b031690631381ba4d90610a84908490600401613c74565b600060405180830381600087803b158015610a9e57600080fd5b505af1158015610ab2573d6000803e3d6000fd5b5050600154604051639be3ad6760e01b81526001600160a01b038086169450639be3ad679350610ae9928b9291169060040161415c565b600060405180830381600087803b158015610b0357600080fd5b505af1158015610b17573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b3f919081019061398f565b50600154604051631381ba4d60e01b81526001600160a01b0390911690631381ba4d90610b7190600090600401613c74565b600060405180830381600087803b158015610b8b57600080fd5b505af1158015610b9f573d6000803e3d6000fd5b50506004805460ff191660011790555060009150505a82039050610be96040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b158015610c4f57600080fd5b505af1158015610c63573d6000803e3d6000fd5b50505050505050505050565b60025490565b60008060045460ff166002811115610c8957fe5b14610ca65760405162461bcd60e51b81526004016101fd90614077565b60025460065460005a600154604051630ad2267960e01b81529192506001600160a01b031690630ad2267990610ce2908a908a90600401613c88565b60206040518083038186803b158015610cfa57600080fd5b505afa158015610d0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d32919061395d565b15610d4f5760405162461bcd60e51b81526004016101fd90613d3a565b60015460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf90610d7f908a90600401613c74565b60206040518083038186803b158015610d9757600080fd5b505afa158015610dab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcf919061395d565b1515600114610df05760405162461bcd60e51b81526004016101fd906140ff565b60015460405163136e2d8960e11b81526000916001600160a01b0316906326dc5b1290610e21908b90600401613c74565b60206040518083038186803b158015610e3957600080fd5b505afa158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e719190613977565b905060007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421821415610ea557506000610f02565b600080610ed28a604051602001610ebc9190613bcd565b6040516020818303038152906040528a866116b6565b909250905060018215151415610efa57610ef3610eee826116df565b6116f2565b9250610eff565b600092505b50505b600154604051635c17d62960e01b81526001600160a01b0390911690635c17d62990610f36908c908c908690600401613ca1565b600060405180830381600087803b158015610f5057600080fd5b505af1158015610f64573d6000803e3d6000fd5b50505050505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b60018060045460ff166002811115610fb557fe5b14610fd25760405162461bcd60e51b81526004016101fd90614077565b600160009054906101000a90046001600160a01b03166001600160a01b031663d7bd4a2a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561102057600080fd5b505afa158015611034573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110589190613977565b156110755760405162461bcd60e51b81526004016101fd90613dc5565b600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156110c357600080fd5b505afa1580156110d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110fb9190613977565b156111185760405162461bcd60e51b81526004016101fd9061401a565b506004805460ff19166002179055565b60045460ff1681565b6000600260045460ff16600281111561114657fe5b14905090565b6001546001600160a01b031681565b60008060045460ff16600281111561116f57fe5b1461118c5760405162461bcd60e51b81526004016101fd90614077565b60025460065460005a60015460405163c8e40fbf60e01b81529192506001600160a01b03169063c8e40fbf906111c6908a90600401613c74565b60206040518083038186803b1580156111de57600080fd5b505afa1580156111f2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611216919061395d565b1580156112a057506001546040516307a1294560e01b81526001600160a01b03909116906307a129459061124e908a90600401613c74565b60206040518083038186803b15801561126657600080fd5b505afa15801561127a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129e919061395d565b155b6112bc5760405162461bcd60e51b81526004016101fd90613d7f565b6000806112eb896040516020016112d39190613bb0565b604051602081830303815290604052886002546116b6565b90925090506001821515141561140c57600061130682611721565b606081015190915089907fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470141561133f5750600061136a565b816060015161134d826117b3565b1461136a5760405162461bcd60e51b81526004016101fd90613e80565b6001546040805160c08101825284518152602080860151908201528482015181830152606080860151908201526001600160a01b038481166080830152600060a08301529151638f3b964760e01b81529190921691638f3b9647916113d3918f91600401613cc2565b600060405180830381600087803b1580156113ed57600080fd5b505af1158015611401573d6000803e3d6000fd5b50505050505061143c565b600154604051630d631c9d60e31b81526001600160a01b0390911690636b18e4e890610f36908c90600401613c74565b505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b60035490565b6060806000805b6020811085821a15161561149c5760019182019101611482565b5060405191506040820160405283600882021b60208301528060200382525080915050919050565b606080825160011480156114ec57506080836000815181106114e257fe5b016020015160f81c105b156114f8575081611528565b611504835160806117b7565b83604051602001611516929190613bd6565b60405160208183030381529060405290505b92915050565b60008061153a86611906565b905061154881868686611936565b9150505b949350505050565b61155c61378f565b604051806080016040528083600001518152602001836020015181526020018360400151815260200183606001518152509050919050565b60408051600480825260a0820190925260609160009190816020015b60608152602001906001900390816115b057505083519091506115d6906103ef9061147b565b816000815181106115e357fe5b60200260200101819052506116016103ef846020015160001b61147b565b8160018151811061160e57fe5b602002602001018190525061164583604001516040516020016116319190613bcd565b6040516020818303038152906040526114c4565b8160028151811061165257fe5b602002602001018190525061167583606001516040516020016116319190613bcd565b8160038151811061168257fe5b6020026020010181905250611696816119d1565b9392505050565b60006116a882611a15565b805190602001209050919050565b6000606060006116c586611906565b90506116d2818686611a50565b9250925050935093915050565b60606115286116ed83611b23565b611b48565b600080600060208451111561170857602061170b565b83515b6020858101519190036008021c92505050919050565b61172961378f565b600061173483611bd7565b9050604051806080016040528061175e8360008151811061175157fe5b6020026020010151611bea565b81526020016117738360018151811061175157fe5b81526020016117958360028151811061178857fe5b6020026020010151611bf1565b81526020016117aa8360038151811061178857fe5b90529392505050565b3f90565b6060806038841015611811576040805160018082528183019092529060208201818036833701905050905082840160f81b816000815181106117f557fe5b60200101906001600160f81b031916908160001a905350611696565b600060015b80868161181f57fe5b04156118345760019091019061010002611816565b816001016001600160401b038111801561184d57600080fd5b506040519080825280601f01601f191660200182016040528015611878576020820181803683370190505b50925084820160370160f81b8360008151811061189157fe5b60200101906001600160f81b031916908160001a905350600190505b8181116118fd576101008183036101000a87816118c657fe5b04816118ce57fe5b0660f81b8382815181106118de57fe5b60200101906001600160f81b031916908160001a9053506001016118ad565b50509392505050565b606081805190602001206040516020016119209190613bcd565b6040516020818303038152906040529050919050565b6040805180820190915260018152600160ff1b60209091015260007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42182141561198a576119838585611ceb565b905061154c565b600061199584611d0f565b90506000806119a5838987611de5565b509150915060006119b88484848b612188565b90506119c4818a6124a0565b9998505050505050505050565b606060006119de836125f9565b90506119ec815160c06117b7565b816040516020016119fe929190613bd6565b604051602081830303815290604052915050919050565b6060816000015182602001518360400151846060015185608001518660a001518760c001516040516020016119209796959493929190613c05565b600060606000611a5f85611d0f565b90506000806000611a71848a89611de5565b81519295509093509150158080611a855750815b611ad6576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b600081611af25760405180602001604052806000815250611b11565b611b11866001870381518110611b0457fe5b6020026020010151612702565b919b919a509098505050505050505050565b611b2b6137b6565b506040805180820190915281518152602082810190820152919050565b60606000806000611b588561271e565b919450925090506000816001811115611b6d57fe5b14611bbf576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b611bce85602001518484612a47565b95945050505050565b6060611528611be583611b23565b612af4565b6000611528825b6000602182600001511115611c4d576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6000806000611c5b8561271e565b919450925090506000816001811115611c7057fe5b14611cc2576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b602080860151840180519091841015611ce15760208490036101000a90045b9695505050505050565b6000611cff611cf984612c6a565b83612d66565b5180516020909101209392505050565b60606000611d1c83611bd7565b9050600081516001600160401b0381118015611d3757600080fd5b50604051908082528060200260200182016040528015611d7157816020015b611d5e6137d0565b815260200190600190039081611d565790505b50905060005b8251811015611ddd576000611d9e848381518110611d9157fe5b6020026020010151611b48565b90506040518060400160405280828152602001611dba83611bd7565b815250838381518110611dc957fe5b602090810291909101015250600101611d77565b509392505050565b60006060818080611df587612c6a565b905085600080611e036137d0565b60005b8c51811015612160578c8181518110611e1b57fe5b6020026020010151915082840193506001870196508360001415611e8f57815180516020909101208514611e8a576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b611f56565b815151602011611ef657815180516020909101208514611e8a576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b84611f048360000151612dfa565b14611f56576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b60208201515160111415611fc5578551841415611f7257612160565b6000868581518110611f8057fe5b602001015160f81c60f81b60f81c9050600083602001518260ff1681518110611fa557fe5b60200260200101519050611fb881612e26565b9650600194505050612158565b6002826020015151141561210b576000611fde83612e5c565b9050600081600081518110611fef57fe5b016020015160f81c905060018116600203600061200f8460ff8416612e7a565b9050600061201d8b8a612e7a565b9050600061202b8383612eab565b905060ff851660021480612042575060ff85166003145b15612074578083511480156120575750808251145b1561206157988901985b50600160ff1b9950612160945050505050565b60ff85161580612087575060ff85166001145b156120d457806120a45750600160ff1b9950612160945050505050565b6120c588602001516001815181106120b857fe5b6020026020010151612e26565b9a509750612158945050505050565b60405162461bcd60e51b815260040180806020018281038252602681526020018061429b6026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b600101611e06565b50600160ff1b8414866121738786612e7a565b909e909d50909b509950505050505050505050565b6060600083905060008660018703815181106121a057fe5b6020026020010151905060006121b582612f11565b6040805160038082526080820190925291925060009190816020015b6121d96137d0565b8152602001906001900390816121d157905050905060008451600014801561220c5750600283600281111561220a57fe5b145b156122425761222361221d85612fe7565b88612d66565b82828151811061222f57fe5b6020908102919091010152600101612483565b600083600281111561225057fe5b14156122b6578451612285576122668488612ffa565b82828151811061227257fe5b60209081029190910101526001016122b1565b8382828151811061229257fe5b602002602001018190525060018101905061222361221d866001612e7a565b612483565b60006122c185612fe7565b905060006122cf8288612eab565b905080156123305760006122e583600084613045565b90506122f9816122f48c613195565b6131d6565b85858151811061230557fe5b60200260200101819052506001840193506123208383612e7a565b925061232c8883612e7a565b9750505b600061233a61321a565b905082516000141561235f576123588161235389612702565b612ffa565b90506123f7565b60008360008151811061236e57fe5b016020015160f81c9050612383846001612e7a565b9350600287600281111561239357fe5b14156123ce5760006123ad856123a88b612702565b612d66565b90506123c683836123c18460000151613195565b6132a7565b9250506123f5565b8351156123e45760006123ad856122f48b612702565b6123f282826123c18b612702565b91505b505b875161242c57612407818b612ffa565b90508085858151811061241657fe5b602002602001018190525060018401935061247f565b612437886001612e7a565b97508085858151811061244657fe5b6020026020010181905250600184019350612461888b612d66565b85858151811061246d57fe5b60200260200101819052506001840193505b5050505b6124928a60018b038484613300565b9a9950505050505050505050565b6000806124ac83612c6a565b90506124b66137d0565b84516000906060905b80156125e4578760018203815181106124d457fe5b602002602001015193506124e784612f11565b925060028360028111156124f757fe5b141561252257600061250885612fe7565b905061251a8660008351895103613045565b9550506125ce565b600183600281111561253057fe5b141561257057600061254185612fe7565b90506125538660008351895103613045565b83519096501561256a5761256781846131d6565b94505b506125ce565b600083600281111561257e57fe5b14156125ce578151156125ce5760008560018751038151811061259d57fe5b602001015160f81c60f81b60f81c90506125bd8660006001895103613045565b95506125ca8582856132a7565b9450505b83516125d990613195565b9150600019016124bf565b50509051805160209091012095945050505050565b606081516000141561261a575060408051600081526020810190915261097a565b6000805b835181101561264d5783818151811061263357fe5b60200260200101515182019150808060010191505061261e565b6000826001600160401b038111801561266557600080fd5b506040519080825280601f01601f191660200182016040528015612690576020820181803683370190505b50600092509050602081015b85518310156126f95760008684815181106126b357fe5b6020026020010151905060006020820190506126d1838284516133e2565b8785815181106126dd57fe5b602002602001015151830192505050828060010193505061269c565b50949350505050565b60208101518051606091611528916000198101908110611d9157fe5b60008060008084600001511161277b576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f81116127a0576000600160009450945094505050612a40565b60b78111612815578551607f198201908110612803576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b60019550935060009250612a40915050565b60bf81116128f957855160b6198201908110612878576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a60018501510490508082018860000151116128e4576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b60019091019550935060009250612a40915050565b60f7811161296d57855160bf19820190811061295c576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b600195509350849250612a40915050565b855160f61982019081106129c8576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111612a2d576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b6001918201965094509250612a40915050565b9193909250565b60606000826001600160401b0381118015612a6157600080fd5b506040519080825280601f01601f191660200182016040528015612a8c576020820181803683370190505b509050805160001415612aa0579050611696565b8484016020820160005b60208604811015612acb578251825260209283019290910190600101612aaa565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b6060600080612b028461271e565b91935090915060019050816001811115612b1857fe5b14612b6a576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b612b8b6137b6565b815260200190600190039081612b835790505090506000835b8651811015612c5f5760208210612bec5760405162461bcd60e51b815260040180806020018281038252602a815260200180614271602a913960400191505060405180910390fd5b600080612c186040518060400160405280858c60000151038152602001858c602001510181525061271e565b509150915060405180604001604052808383018152602001848b6020015101815250858581518110612c4657fe5b6020908102919091010152600193909301920101612ba4565b508152949350505050565b6060600082516002026001600160401b0381118015612c8857600080fd5b506040519080825280601f01601f191660200182016040528015612cb3576020820181803683370190505b50905060005b8351811015612d5f576004848281518110612cd057fe5b602001015160f81c60f81b6001600160f81b031916901c828260020281518110612cf657fe5b60200101906001600160f81b031916908160001a9053506010848281518110612d1b57fe5b016020015160f81c81612d2a57fe5b0660f81b828260020260010181518110612d4057fe5b60200101906001600160f81b031916908160001a905350600101612cb9565b5092915050565b612d6e6137d0565b60408051600280825260608201909252600091816020015b6060815260200190600190039081612d865790505090506000612daa856001613426565b9050612db86103ef8261357d565b82600081518110612dc557fe5b6020026020010181905250612dd9846114c4565b82600181518110612de657fe5b6020026020010181905250611bce8261364d565b6000602082511015612e115750602081015161097a565b81806020019051602081101561097557600080fd5b60006060602083600001511015612e4757612e408361367c565b9050612e53565b612e5083611b48565b90505b61169681612dfa565b6060611528612e758360200151600081518110611d9157fe5b612c6a565b60608183510360001415612e9d5750604080516020810190915260008152611528565b611696838384865103613045565b6000805b808451118015612ebf5750808351115b8015612f045750828181518110612ed257fe5b602001015160f81c60f81b6001600160f81b031916848281518110612ef357fe5b01602001516001600160f81b031916145b1561169657600101612eaf565b60208101515160009060111415612f2a5750600061097a565b60028260200151511415612fa6576000612f4383612e5c565b9050600081600081518110612f5457fe5b016020015160f81c90506002811480612f70575060ff81166003145b15612f805760029250505061097a565b60ff81161580612f93575060ff81166001145b15612fa35760019250505061097a565b50505b6040805162461bcd60e51b8152602060048201526011602482015270496e76616c6964206e6f6465207479706560781b604482015290519081900360640190fd5b6060611528612ff583612e5c565b613687565b6130026137d0565b600061300d836114c4565b905061301881611b23565b60208501518051600019810190811061302d57fe5b602002602001018190525061154c84602001516136d0565b60608182601f011015613090576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b8282840110156130d8576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b81830184511015613124576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b60608215801561314357604051915060008252602082016040526126f9565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561317c578051835260209283019201613164565b5050858452601f01601f19166040525050949350505050565b60606020825110156131a857508061097a565b818051906020012060405160200180828152602001915050604051602081830303815290604052905061097a565b6131de6137d0565b60408051600280825260608201909252600091816020015b60608152602001906001900390816131f65790505090506000612daa856000613426565b6132226137d0565b6040805160118082526102408201909252600091816020015b606081526020019060019003908161323b57905050905060005b815181101561329757604051806040016040528060018152602001600160ff1b81525082828151811061328457fe5b6020908102919091010152600101613255565b506132a18161364d565b91505090565b6132af6137d0565b600060208351106132c8576132c3836114c4565b6132ca565b825b90506132d581611b23565b85602001518560ff16815181106132e857fe5b6020026020010181905250611bce85602001516136d0565b606060008285016001600160401b038111801561331c57600080fd5b5060405190808252806020026020018201604052801561335657816020015b6133436137d0565b81526020019060019003908161333b5790505b50905060005b858110156133975786818151811061337057fe5b602002602001015182828151811061338457fe5b602090810291909101015260010161335c565b5060005b838110156133d8578481815181106133af57fe5b602002602001015182878301815181106133c557fe5b602090810291909101015260010161339b565b5095945050505050565b8282825b60208110613405578151835260209283019290910190601f19016133e6565b905182516020929092036101000a6000190180199091169116179052505050565b6060600082613436576000613439565b60025b90506000600285518161344857fe5b06905060008160020360ff166001600160401b038111801561346957600080fd5b506040519080825280601f01601f191660200182016040528015613494576020820181803683370190505b50905081830160f81b816000815181106134aa57fe5b60200101906001600160f81b031916908160001a90535080866040516020018083805190602001908083835b602083106134f55780518252601f1990920191602091820191016134d6565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b6020831061353d5780518252601f19909201916020918201910161351e565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052935050505092915050565b60606000600283518161358c57fe5b046001600160401b03811180156135a257600080fd5b506040519080825280601f01601f1916602001820160405280156135cd576020820181803683370190505b50905060005b8151811015612d5f578381600202600101815181106135ee57fe5b602001015160f81c60f81b600485836002028151811061360a57fe5b602001015160f81c60f81b6001600160f81b031916901b1782828151811061362e57fe5b60200101906001600160f81b031916908160001a9053506001016135d3565b6136556137d0565b6000613660836119d1565b905060405180604001604052808281526020016117aa83611bd7565b606061152882613779565b606060028260008151811061369857fe5b016020015160f81c816136a757fe5b0660ff16600014156136c5576136be826002612e7a565b905061097a565b6136be826001612e7a565b6136d86137d0565b600082516001600160401b03811180156136f157600080fd5b5060405190808252806020026020018201604052801561372557816020015b60608152602001906001900390816137105790505b50905060005b835181101561376f5761375084828151811061374357fe5b602002602001015161367c565b82828151811061375c57fe5b602090810291909101015260010161372b565b506116968161364d565b6060611528826020015160008460000151612a47565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060008152602001600081525090565b604051806040016040528060608152602001606081525090565b60006137fd6137f884614207565b6141e4565b905082815283838301111561381157600080fd5b828260208301376000602084830101529392505050565b803561097a81614258565b8051801515811461097a57600080fd5b600082601f830112613853578081fd5b611696838335602085016137ea565b80356002811061097a57600080fd5b600080600060608486031215613885578283fd5b833561389081614258565b925060208401356138a081614258565b915060408401356001600160401b038111156138ba578182fd5b6138c686828701613843565b9150509250925092565b6000806000606084860312156138e4578283fd5b83356138ef81614258565b92506020840135915060408401356001600160401b038111156138ba578182fd5b60008060408385031215613922578182fd5b823561392d81614258565b915060208301356001600160401b03811115613947578182fd5b61395385828601613843565b9150509250929050565b60006020828403121561396e578081fd5b61169682613833565b600060208284031215613988578081fd5b5051919050565b6000602082840312156139a0578081fd5b81516001600160401b038111156139b5578182fd5b8201601f810184136139c5578182fd5b80516139d36137f882614207565b8181528560208385010111156139e7578384fd5b611bce826020830160208601614228565b600060208284031215613a09578081fd5b81356001600160401b03811115613a1e578182fd5b8201601f81018413613a2e578182fd5b61154c848235602084016137ea565b600060c08284031215613a4e578081fd5b60405160c081018181106001600160401b0382111715613a6a57fe5b8060405250825181526020830151602082015260408301516040820152606083015160608201526080830151613a9f81614258565b6080820152613ab060a08401613833565b60a08201529392505050565b600060208284031215613acd578081fd5b81356001600160401b0380821115613ae3578283fd5b9083019060e08286031215613af6578283fd5b613b0060e06141e4565b8235815260208301356020820152613b1a60408401613862565b6040820152613b2b60608401613828565b6060820152613b3c60808401613828565b608082015260a083013560a082015260c083013582811115613b5c578485fd5b613b6887828601613843565b60c08301525095945050505050565b6001600160a01b03169052565b60008151808452613b9c816020860160208601614228565b601f01601f19169290920160200192915050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b90815260200190565b60008351613be8818460208801614228565b835190830190613bfc818360208801614228565b01949350505050565b600088825287602083015260028710613c1a57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b166055840152508360698301528251613c61816089850160208701614228565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b600060e08201905060018060a01b038085168352835160208401526020840151604084015260408401516060840152606084015160808401528060808501511660a08401525060a0830151151560c08301529392505050565b901515815260200190565b6020810160038310613d3457fe5b91905290565b60208082526025908201527f53746f7261676520736c6f742068617320616c7265616479206265656e20707260408201526437bb32b71760d91b606082015260800190565b60208082526026908201527f4163636f756e742073746174652068617320616c7265616479206265656e20706040820152653937bb32b71760d11b606082015260800190565b6020808252603e908201527f416c6c206163636f756e7473206d75737420626520636f6d6d6974746564206260408201527f65666f726520636f6d706c6574696e672061207472616e736974696f6e2e0000606082015260800190565b602080825260409082018190527f53746f7261676520736c6f742076616c7565207761736e2774206368616e6765908201527f64206f722068617320616c7265616479206265656e20636f6d6d69747465642e606082015260800190565b6020808252605b908201527f4f564d5f53746174655472616e736974696f6e65723a2050726f76696465642060408201527f4c3120636f6e747261637420636f6465206861736820646f6573206e6f74206d60608201527f61746368204c3220636f6e747261637420636f646520686173682e0000000000608082015260a00190565b6020808252603f908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d6d697474696e67206163636f756e74207374617465732e00606082015260800190565b60208082526038908201527f4e6f7420656e6f7567682067617320746f2065786563757465207472616e736160408201527f6374696f6e2064657465726d696e6973746963616c6c792e0000000000000000606082015260800190565b6020808252603b908201527f4163636f756e74207374617465207761736e2774206368616e676564206f722060408201527f68617320616c7265616479206265656e20636f6d6d69747465642e0000000000606082015260800190565b6020808252603d908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d706c6574696e672061207472616e736974696f6e2e000000606082015260800190565b60208082526031908201527f46756e6374696f6e206d7573742062652063616c6c656420647572696e67207460408201527034329031b7b93932b1ba10383430b9b29760791b606082015260800190565b6020808252601d908201527f496e76616c6964207472616e73616374696f6e2070726f76696465642e000000604082015260600190565b60208082526038908201527f436f6e7472616374206d757374206265207665726966696564206265666f726560408201527f2070726f76696e6720612073746f7261676520736c6f742e0000000000000000606082015260800190565b600060408252835160408301526020840151606083015260408401516002811061418257fe5b60808381019190915260608501516001600160a01b031660a08401528401516141ae60c0840182613b77565b5060a084015160e083015260c084015160e06101008401526141d4610120840182613b84565b9150506116966020830184613b77565b6040518181016001600160401b03811182821017156141ff57fe5b604052919050565b60006001600160401b0382111561421a57fe5b50601f01601f191660200190565b60005b8381101561424357818101518382015260200161422b565b83811115614252576000848401525b50505050565b6001600160a01b038116811461426d57600080fd5b5056fe50726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e52656365697665642061206e6f6465207769746820616e20756e6b6e6f776e20707265666978a2646970667358221220ce5bdf188c3574b3ab8fd8d954100f14bc36e9cb42e1ca798a8f556d7ace41f564736f6c634300070600334372656174652063616e206f6e6c7920626520646f6e6520627920746865204f564d5f467261756456657269666965722ea26469706673582212200d398ad651c22ef8f9239e5104dc8b8e30dec6c479966de4f2382a136a81db4864736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c806322d1470214610046578063299ca4781461009a578063461a4478146100a2575b600080fd5b61007e6004803603608081101561005c57600080fd5b506001600160a01b038135169060208101359060408101359060600135610148565b604080516001600160a01b039092168252519081900360200190f35b61007e610229565b61007e600480360360208110156100b857600080fd5b8101906020810181356401000000008111156100d357600080fd5b8201836020820111156100e557600080fd5b8035906020019184600183028401116401000000008311171561010757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610238945050505050565b600061017c6040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b815250610238565b6001600160a01b0316336001600160a01b0316146101cb5760405162461bcd60e51b81526004018080602001828103825260318152602001806148ee6031913960400191505060405180910390fd5b848484846040516101db90610314565b80856001600160a01b03168152602001848152602001838152602001828152602001945050505050604051809103906000f08015801561021f573d6000803e3d6000fd5b5095945050505050565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610298578181015183820152602001610280565b50505050905090810190601f1680156102c55780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102e257600080fd5b505afa1580156102f6573d6000803e3d6000fd5b505050506040513d602081101561030c57600080fd5b505192915050565b6145cc806103228339019056fe60806040523480156200001157600080fd5b50604051620045cc380380620045cc833981016040819052620000349162000232565b600080546001600160a01b0319166001600160a01b038616179055600583905560028290556003829055600681905560408051808201909152601781527f4f564d5f53746174654d616e61676572466163746f72790000000000000000006020820152620000a29062000150565b6001600160a01b0316639ed93318306040518263ffffffff1660e01b8152600401620000cf919062000299565b602060405180830381600087803b158015620000ea57600080fd5b505af1158015620000ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000125919062000273565b600180546001600160a01b0319166001600160a01b039290921691909117905550620002c692505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015620001b257818101518382015260200162000198565b50505050905090810190601f168015620001e05780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b158015620001fe57600080fd5b505afa15801562000213573d6000803e3d6000fd5b505050506040513d60208110156200022a57600080fd5b505192915050565b6000806000806080858703121562000248578384fd5b84516200025581620002ad565b60208601516040870151606090970151919890975090945092505050565b60006020828403121562000285578081fd5b81516200029281620002ad565b9392505050565b6001600160a01b0391909116815260200190565b6001600160a01b0381168114620002c357600080fd5b50565b6142f680620002d66000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063845fe7a31161008c578063b2fa1c9e11610066578063b2fa1c9e14610185578063b52805711461019a578063b9194310146101a2578063c1c618b8146101b5576100cf565b8063845fe7a314610155578063a244316a14610168578063b1c9fe6e14610170576100cf565b8063299ca478146100d45780632e1ac36c146100f25780632eb1375814610107578063461a44781461011a578063732f960b1461012d578063805e9d3014610140575b600080fd5b6100dc6101bd565b6040516100e99190613c74565b60405180910390f35b6101056101003660046138d0565b6101cc565b005b610105610115366004613910565b610565565b6100dc6101283660046139f8565b6108a1565b61010561013b366004613abc565b61097f565b610148610c6f565b6040516100e99190613bcd565b6101056101633660046138d0565b610c75565b610105610fa1565b610178611128565b6040516100e99190613d26565b61018d611131565b6040516100e99190613d1b565b6100dc61114c565b6101056101b0366004613871565b61115b565b610148611475565b6000546001600160a01b031681565b60018060045460ff1660028111156101e057fe5b146102065760405162461bcd60e51b81526004016101fd90614077565b60405180910390fd5b60025460065460005a6001546040516363b285f960e11b81529192506001600160a01b03169063c7650bf290610242908a908a90600401613c88565b602060405180830381600087803b15801561025c57600080fd5b505af1158015610270573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610294919061395d565b15156001146102b55760405162461bcd60e51b81526004016101fd90613e22565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f1906102e6908b90600401613c74565b60c06040518083038186803b1580156102fe57600080fd5b505afa158015610312573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103369190613a3d565b600154604051631aaf392f60e01b81529192506000916001600160a01b0390911690631aaf392f9061036e908c908c90600401613c88565b60206040518083038186803b15801561038657600080fd5b505afa15801561039a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103be9190613977565b90506103ff886040516020016103d49190613bcd565b6040516020818303038152906040526103f46103ef8461147b565b6114c4565b89856040015161152e565b6040808401919091526001549051638f3b964760e01b81526001600160a01b0390911690638f3b964790610439908c908690600401613cc2565b600060405180830381600087803b15801561045357600080fd5b505af1158015610467573d6000803e3d6000fd5b505050507f3e3ed1a676a2754a041b49bf752e0f167c8753495e36c320fe01d1ef7476253c898960405161049c929190613c88565b60405180910390a1505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561054357600080fd5b505af1158015610557573d6000803e3d6000fd5b505050505050505050505050565b60018060045460ff16600281111561057957fe5b146105965760405162461bcd60e51b81526004016101fd90614077565b60025460065460005a9050600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156105ef57600080fd5b505afa158015610603573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106279190613977565b156106445760405162461bcd60e51b81526004016101fd90613f03565b600154604051630b38106960e11b81526001600160a01b039091169063167020d290610674908990600401613c74565b602060405180830381600087803b15801561068e57600080fd5b505af11580156106a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c6919061395d565b15156001146106e75760405162461bcd60e51b81526004016101fd90613fbd565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f190610718908a90600401613c74565b60c06040518083038186803b15801561073057600080fd5b505afa158015610744573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107689190613a3d565b90506107a78760405160200161077e9190613bb0565b60405160208183030381529060405261079e61079984611554565b611594565b8860035461152e565b6003556040517fcec9ef675d775706a02b43afe48af52c5019bc50f99582e3208c6ff55d59c008906107da908990613c74565b60405180910390a15060005a8203905061081a6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561088057600080fd5b505af1158015610894573d6000803e3d6000fd5b5050505050505050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156109015781810151838201526020016108e9565b50505050905090810190601f16801561092e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561094b57600080fd5b505afa15801561095f573d6000803e3d6000fd5b505050506040513d602081101561097557600080fd5b505190505b919050565b60008060045460ff16600281111561099357fe5b146109b05760405162461bcd60e51b81526004016101fd90614077565b60025460065460005a90506006546109c78661169d565b146109e45760405162461bcd60e51b81526004016101fd906140c8565b6103e88560a0015161040802816109f757fe5b04620186a0015a1015610a1c5760405162461bcd60e51b81526004016101fd90613f60565b6000610a536040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b8152506108a1565b600154604051631381ba4d60e01b81529192506001600160a01b031690631381ba4d90610a84908490600401613c74565b600060405180830381600087803b158015610a9e57600080fd5b505af1158015610ab2573d6000803e3d6000fd5b5050600154604051639be3ad6760e01b81526001600160a01b038086169450639be3ad679350610ae9928b9291169060040161415c565b600060405180830381600087803b158015610b0357600080fd5b505af1158015610b17573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b3f919081019061398f565b50600154604051631381ba4d60e01b81526001600160a01b0390911690631381ba4d90610b7190600090600401613c74565b600060405180830381600087803b158015610b8b57600080fd5b505af1158015610b9f573d6000803e3d6000fd5b50506004805460ff191660011790555060009150505a82039050610be96040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b158015610c4f57600080fd5b505af1158015610c63573d6000803e3d6000fd5b50505050505050505050565b60025490565b60008060045460ff166002811115610c8957fe5b14610ca65760405162461bcd60e51b81526004016101fd90614077565b60025460065460005a600154604051630ad2267960e01b81529192506001600160a01b031690630ad2267990610ce2908a908a90600401613c88565b60206040518083038186803b158015610cfa57600080fd5b505afa158015610d0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d32919061395d565b15610d4f5760405162461bcd60e51b81526004016101fd90613d3a565b60015460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf90610d7f908a90600401613c74565b60206040518083038186803b158015610d9757600080fd5b505afa158015610dab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcf919061395d565b1515600114610df05760405162461bcd60e51b81526004016101fd906140ff565b60015460405163136e2d8960e11b81526000916001600160a01b0316906326dc5b1290610e21908b90600401613c74565b60206040518083038186803b158015610e3957600080fd5b505afa158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e719190613977565b905060007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421821415610ea557506000610f02565b600080610ed28a604051602001610ebc9190613bcd565b6040516020818303038152906040528a866116b6565b909250905060018215151415610efa57610ef3610eee826116df565b6116f2565b9250610eff565b600092505b50505b600154604051635c17d62960e01b81526001600160a01b0390911690635c17d62990610f36908c908c908690600401613ca1565b600060405180830381600087803b158015610f5057600080fd5b505af1158015610f64573d6000803e3d6000fd5b50505050505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b60018060045460ff166002811115610fb557fe5b14610fd25760405162461bcd60e51b81526004016101fd90614077565b600160009054906101000a90046001600160a01b03166001600160a01b031663d7bd4a2a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561102057600080fd5b505afa158015611034573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110589190613977565b156110755760405162461bcd60e51b81526004016101fd90613dc5565b600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156110c357600080fd5b505afa1580156110d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110fb9190613977565b156111185760405162461bcd60e51b81526004016101fd9061401a565b506004805460ff19166002179055565b60045460ff1681565b6000600260045460ff16600281111561114657fe5b14905090565b6001546001600160a01b031681565b60008060045460ff16600281111561116f57fe5b1461118c5760405162461bcd60e51b81526004016101fd90614077565b60025460065460005a60015460405163c8e40fbf60e01b81529192506001600160a01b03169063c8e40fbf906111c6908a90600401613c74565b60206040518083038186803b1580156111de57600080fd5b505afa1580156111f2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611216919061395d565b1580156112a057506001546040516307a1294560e01b81526001600160a01b03909116906307a129459061124e908a90600401613c74565b60206040518083038186803b15801561126657600080fd5b505afa15801561127a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129e919061395d565b155b6112bc5760405162461bcd60e51b81526004016101fd90613d7f565b6000806112eb896040516020016112d39190613bb0565b604051602081830303815290604052886002546116b6565b90925090506001821515141561140c57600061130682611721565b606081015190915089907fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470141561133f5750600061136a565b816060015161134d826117b3565b1461136a5760405162461bcd60e51b81526004016101fd90613e80565b6001546040805160c08101825284518152602080860151908201528482015181830152606080860151908201526001600160a01b038481166080830152600060a08301529151638f3b964760e01b81529190921691638f3b9647916113d3918f91600401613cc2565b600060405180830381600087803b1580156113ed57600080fd5b505af1158015611401573d6000803e3d6000fd5b50505050505061143c565b600154604051630d631c9d60e31b81526001600160a01b0390911690636b18e4e890610f36908c90600401613c74565b505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b60035490565b6060806000805b6020811085821a15161561149c5760019182019101611482565b5060405191506040820160405283600882021b60208301528060200382525080915050919050565b606080825160011480156114ec57506080836000815181106114e257fe5b016020015160f81c105b156114f8575081611528565b611504835160806117b7565b83604051602001611516929190613bd6565b60405160208183030381529060405290505b92915050565b60008061153a86611906565b905061154881868686611936565b9150505b949350505050565b61155c61378f565b604051806080016040528083600001518152602001836020015181526020018360400151815260200183606001518152509050919050565b60408051600480825260a0820190925260609160009190816020015b60608152602001906001900390816115b057505083519091506115d6906103ef9061147b565b816000815181106115e357fe5b60200260200101819052506116016103ef846020015160001b61147b565b8160018151811061160e57fe5b602002602001018190525061164583604001516040516020016116319190613bcd565b6040516020818303038152906040526114c4565b8160028151811061165257fe5b602002602001018190525061167583606001516040516020016116319190613bcd565b8160038151811061168257fe5b6020026020010181905250611696816119d1565b9392505050565b60006116a882611a15565b805190602001209050919050565b6000606060006116c586611906565b90506116d2818686611a50565b9250925050935093915050565b60606115286116ed83611b23565b611b48565b600080600060208451111561170857602061170b565b83515b6020858101519190036008021c92505050919050565b61172961378f565b600061173483611bd7565b9050604051806080016040528061175e8360008151811061175157fe5b6020026020010151611bea565b81526020016117738360018151811061175157fe5b81526020016117958360028151811061178857fe5b6020026020010151611bf1565b81526020016117aa8360038151811061178857fe5b90529392505050565b3f90565b6060806038841015611811576040805160018082528183019092529060208201818036833701905050905082840160f81b816000815181106117f557fe5b60200101906001600160f81b031916908160001a905350611696565b600060015b80868161181f57fe5b04156118345760019091019061010002611816565b816001016001600160401b038111801561184d57600080fd5b506040519080825280601f01601f191660200182016040528015611878576020820181803683370190505b50925084820160370160f81b8360008151811061189157fe5b60200101906001600160f81b031916908160001a905350600190505b8181116118fd576101008183036101000a87816118c657fe5b04816118ce57fe5b0660f81b8382815181106118de57fe5b60200101906001600160f81b031916908160001a9053506001016118ad565b50509392505050565b606081805190602001206040516020016119209190613bcd565b6040516020818303038152906040529050919050565b6040805180820190915260018152600160ff1b60209091015260007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42182141561198a576119838585611ceb565b905061154c565b600061199584611d0f565b90506000806119a5838987611de5565b509150915060006119b88484848b612188565b90506119c4818a6124a0565b9998505050505050505050565b606060006119de836125f9565b90506119ec815160c06117b7565b816040516020016119fe929190613bd6565b604051602081830303815290604052915050919050565b6060816000015182602001518360400151846060015185608001518660a001518760c001516040516020016119209796959493929190613c05565b600060606000611a5f85611d0f565b90506000806000611a71848a89611de5565b81519295509093509150158080611a855750815b611ad6576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b600081611af25760405180602001604052806000815250611b11565b611b11866001870381518110611b0457fe5b6020026020010151612702565b919b919a509098505050505050505050565b611b2b6137b6565b506040805180820190915281518152602082810190820152919050565b60606000806000611b588561271e565b919450925090506000816001811115611b6d57fe5b14611bbf576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b611bce85602001518484612a47565b95945050505050565b6060611528611be583611b23565b612af4565b6000611528825b6000602182600001511115611c4d576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6000806000611c5b8561271e565b919450925090506000816001811115611c7057fe5b14611cc2576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b602080860151840180519091841015611ce15760208490036101000a90045b9695505050505050565b6000611cff611cf984612c6a565b83612d66565b5180516020909101209392505050565b60606000611d1c83611bd7565b9050600081516001600160401b0381118015611d3757600080fd5b50604051908082528060200260200182016040528015611d7157816020015b611d5e6137d0565b815260200190600190039081611d565790505b50905060005b8251811015611ddd576000611d9e848381518110611d9157fe5b6020026020010151611b48565b90506040518060400160405280828152602001611dba83611bd7565b815250838381518110611dc957fe5b602090810291909101015250600101611d77565b509392505050565b60006060818080611df587612c6a565b905085600080611e036137d0565b60005b8c51811015612160578c8181518110611e1b57fe5b6020026020010151915082840193506001870196508360001415611e8f57815180516020909101208514611e8a576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b611f56565b815151602011611ef657815180516020909101208514611e8a576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b84611f048360000151612dfa565b14611f56576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b60208201515160111415611fc5578551841415611f7257612160565b6000868581518110611f8057fe5b602001015160f81c60f81b60f81c9050600083602001518260ff1681518110611fa557fe5b60200260200101519050611fb881612e26565b9650600194505050612158565b6002826020015151141561210b576000611fde83612e5c565b9050600081600081518110611fef57fe5b016020015160f81c905060018116600203600061200f8460ff8416612e7a565b9050600061201d8b8a612e7a565b9050600061202b8383612eab565b905060ff851660021480612042575060ff85166003145b15612074578083511480156120575750808251145b1561206157988901985b50600160ff1b9950612160945050505050565b60ff85161580612087575060ff85166001145b156120d457806120a45750600160ff1b9950612160945050505050565b6120c588602001516001815181106120b857fe5b6020026020010151612e26565b9a509750612158945050505050565b60405162461bcd60e51b815260040180806020018281038252602681526020018061429b6026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b600101611e06565b50600160ff1b8414866121738786612e7a565b909e909d50909b509950505050505050505050565b6060600083905060008660018703815181106121a057fe5b6020026020010151905060006121b582612f11565b6040805160038082526080820190925291925060009190816020015b6121d96137d0565b8152602001906001900390816121d157905050905060008451600014801561220c5750600283600281111561220a57fe5b145b156122425761222361221d85612fe7565b88612d66565b82828151811061222f57fe5b6020908102919091010152600101612483565b600083600281111561225057fe5b14156122b6578451612285576122668488612ffa565b82828151811061227257fe5b60209081029190910101526001016122b1565b8382828151811061229257fe5b602002602001018190525060018101905061222361221d866001612e7a565b612483565b60006122c185612fe7565b905060006122cf8288612eab565b905080156123305760006122e583600084613045565b90506122f9816122f48c613195565b6131d6565b85858151811061230557fe5b60200260200101819052506001840193506123208383612e7a565b925061232c8883612e7a565b9750505b600061233a61321a565b905082516000141561235f576123588161235389612702565b612ffa565b90506123f7565b60008360008151811061236e57fe5b016020015160f81c9050612383846001612e7a565b9350600287600281111561239357fe5b14156123ce5760006123ad856123a88b612702565b612d66565b90506123c683836123c18460000151613195565b6132a7565b9250506123f5565b8351156123e45760006123ad856122f48b612702565b6123f282826123c18b612702565b91505b505b875161242c57612407818b612ffa565b90508085858151811061241657fe5b602002602001018190525060018401935061247f565b612437886001612e7a565b97508085858151811061244657fe5b6020026020010181905250600184019350612461888b612d66565b85858151811061246d57fe5b60200260200101819052506001840193505b5050505b6124928a60018b038484613300565b9a9950505050505050505050565b6000806124ac83612c6a565b90506124b66137d0565b84516000906060905b80156125e4578760018203815181106124d457fe5b602002602001015193506124e784612f11565b925060028360028111156124f757fe5b141561252257600061250885612fe7565b905061251a8660008351895103613045565b9550506125ce565b600183600281111561253057fe5b141561257057600061254185612fe7565b90506125538660008351895103613045565b83519096501561256a5761256781846131d6565b94505b506125ce565b600083600281111561257e57fe5b14156125ce578151156125ce5760008560018751038151811061259d57fe5b602001015160f81c60f81b60f81c90506125bd8660006001895103613045565b95506125ca8582856132a7565b9450505b83516125d990613195565b9150600019016124bf565b50509051805160209091012095945050505050565b606081516000141561261a575060408051600081526020810190915261097a565b6000805b835181101561264d5783818151811061263357fe5b60200260200101515182019150808060010191505061261e565b6000826001600160401b038111801561266557600080fd5b506040519080825280601f01601f191660200182016040528015612690576020820181803683370190505b50600092509050602081015b85518310156126f95760008684815181106126b357fe5b6020026020010151905060006020820190506126d1838284516133e2565b8785815181106126dd57fe5b602002602001015151830192505050828060010193505061269c565b50949350505050565b60208101518051606091611528916000198101908110611d9157fe5b60008060008084600001511161277b576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f81116127a0576000600160009450945094505050612a40565b60b78111612815578551607f198201908110612803576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b60019550935060009250612a40915050565b60bf81116128f957855160b6198201908110612878576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a60018501510490508082018860000151116128e4576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b60019091019550935060009250612a40915050565b60f7811161296d57855160bf19820190811061295c576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b600195509350849250612a40915050565b855160f61982019081106129c8576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111612a2d576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b6001918201965094509250612a40915050565b9193909250565b60606000826001600160401b0381118015612a6157600080fd5b506040519080825280601f01601f191660200182016040528015612a8c576020820181803683370190505b509050805160001415612aa0579050611696565b8484016020820160005b60208604811015612acb578251825260209283019290910190600101612aaa565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b6060600080612b028461271e565b91935090915060019050816001811115612b1857fe5b14612b6a576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b612b8b6137b6565b815260200190600190039081612b835790505090506000835b8651811015612c5f5760208210612bec5760405162461bcd60e51b815260040180806020018281038252602a815260200180614271602a913960400191505060405180910390fd5b600080612c186040518060400160405280858c60000151038152602001858c602001510181525061271e565b509150915060405180604001604052808383018152602001848b6020015101815250858581518110612c4657fe5b6020908102919091010152600193909301920101612ba4565b508152949350505050565b6060600082516002026001600160401b0381118015612c8857600080fd5b506040519080825280601f01601f191660200182016040528015612cb3576020820181803683370190505b50905060005b8351811015612d5f576004848281518110612cd057fe5b602001015160f81c60f81b6001600160f81b031916901c828260020281518110612cf657fe5b60200101906001600160f81b031916908160001a9053506010848281518110612d1b57fe5b016020015160f81c81612d2a57fe5b0660f81b828260020260010181518110612d4057fe5b60200101906001600160f81b031916908160001a905350600101612cb9565b5092915050565b612d6e6137d0565b60408051600280825260608201909252600091816020015b6060815260200190600190039081612d865790505090506000612daa856001613426565b9050612db86103ef8261357d565b82600081518110612dc557fe5b6020026020010181905250612dd9846114c4565b82600181518110612de657fe5b6020026020010181905250611bce8261364d565b6000602082511015612e115750602081015161097a565b81806020019051602081101561097557600080fd5b60006060602083600001511015612e4757612e408361367c565b9050612e53565b612e5083611b48565b90505b61169681612dfa565b6060611528612e758360200151600081518110611d9157fe5b612c6a565b60608183510360001415612e9d5750604080516020810190915260008152611528565b611696838384865103613045565b6000805b808451118015612ebf5750808351115b8015612f045750828181518110612ed257fe5b602001015160f81c60f81b6001600160f81b031916848281518110612ef357fe5b01602001516001600160f81b031916145b1561169657600101612eaf565b60208101515160009060111415612f2a5750600061097a565b60028260200151511415612fa6576000612f4383612e5c565b9050600081600081518110612f5457fe5b016020015160f81c90506002811480612f70575060ff81166003145b15612f805760029250505061097a565b60ff81161580612f93575060ff81166001145b15612fa35760019250505061097a565b50505b6040805162461bcd60e51b8152602060048201526011602482015270496e76616c6964206e6f6465207479706560781b604482015290519081900360640190fd5b6060611528612ff583612e5c565b613687565b6130026137d0565b600061300d836114c4565b905061301881611b23565b60208501518051600019810190811061302d57fe5b602002602001018190525061154c84602001516136d0565b60608182601f011015613090576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b8282840110156130d8576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b81830184511015613124576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b60608215801561314357604051915060008252602082016040526126f9565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561317c578051835260209283019201613164565b5050858452601f01601f19166040525050949350505050565b60606020825110156131a857508061097a565b818051906020012060405160200180828152602001915050604051602081830303815290604052905061097a565b6131de6137d0565b60408051600280825260608201909252600091816020015b60608152602001906001900390816131f65790505090506000612daa856000613426565b6132226137d0565b6040805160118082526102408201909252600091816020015b606081526020019060019003908161323b57905050905060005b815181101561329757604051806040016040528060018152602001600160ff1b81525082828151811061328457fe5b6020908102919091010152600101613255565b506132a18161364d565b91505090565b6132af6137d0565b600060208351106132c8576132c3836114c4565b6132ca565b825b90506132d581611b23565b85602001518560ff16815181106132e857fe5b6020026020010181905250611bce85602001516136d0565b606060008285016001600160401b038111801561331c57600080fd5b5060405190808252806020026020018201604052801561335657816020015b6133436137d0565b81526020019060019003908161333b5790505b50905060005b858110156133975786818151811061337057fe5b602002602001015182828151811061338457fe5b602090810291909101015260010161335c565b5060005b838110156133d8578481815181106133af57fe5b602002602001015182878301815181106133c557fe5b602090810291909101015260010161339b565b5095945050505050565b8282825b60208110613405578151835260209283019290910190601f19016133e6565b905182516020929092036101000a6000190180199091169116179052505050565b6060600082613436576000613439565b60025b90506000600285518161344857fe5b06905060008160020360ff166001600160401b038111801561346957600080fd5b506040519080825280601f01601f191660200182016040528015613494576020820181803683370190505b50905081830160f81b816000815181106134aa57fe5b60200101906001600160f81b031916908160001a90535080866040516020018083805190602001908083835b602083106134f55780518252601f1990920191602091820191016134d6565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b6020831061353d5780518252601f19909201916020918201910161351e565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052935050505092915050565b60606000600283518161358c57fe5b046001600160401b03811180156135a257600080fd5b506040519080825280601f01601f1916602001820160405280156135cd576020820181803683370190505b50905060005b8151811015612d5f578381600202600101815181106135ee57fe5b602001015160f81c60f81b600485836002028151811061360a57fe5b602001015160f81c60f81b6001600160f81b031916901b1782828151811061362e57fe5b60200101906001600160f81b031916908160001a9053506001016135d3565b6136556137d0565b6000613660836119d1565b905060405180604001604052808281526020016117aa83611bd7565b606061152882613779565b606060028260008151811061369857fe5b016020015160f81c816136a757fe5b0660ff16600014156136c5576136be826002612e7a565b905061097a565b6136be826001612e7a565b6136d86137d0565b600082516001600160401b03811180156136f157600080fd5b5060405190808252806020026020018201604052801561372557816020015b60608152602001906001900390816137105790505b50905060005b835181101561376f5761375084828151811061374357fe5b602002602001015161367c565b82828151811061375c57fe5b602090810291909101015260010161372b565b506116968161364d565b6060611528826020015160008460000151612a47565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060008152602001600081525090565b604051806040016040528060608152602001606081525090565b60006137fd6137f884614207565b6141e4565b905082815283838301111561381157600080fd5b828260208301376000602084830101529392505050565b803561097a81614258565b8051801515811461097a57600080fd5b600082601f830112613853578081fd5b611696838335602085016137ea565b80356002811061097a57600080fd5b600080600060608486031215613885578283fd5b833561389081614258565b925060208401356138a081614258565b915060408401356001600160401b038111156138ba578182fd5b6138c686828701613843565b9150509250925092565b6000806000606084860312156138e4578283fd5b83356138ef81614258565b92506020840135915060408401356001600160401b038111156138ba578182fd5b60008060408385031215613922578182fd5b823561392d81614258565b915060208301356001600160401b03811115613947578182fd5b61395385828601613843565b9150509250929050565b60006020828403121561396e578081fd5b61169682613833565b600060208284031215613988578081fd5b5051919050565b6000602082840312156139a0578081fd5b81516001600160401b038111156139b5578182fd5b8201601f810184136139c5578182fd5b80516139d36137f882614207565b8181528560208385010111156139e7578384fd5b611bce826020830160208601614228565b600060208284031215613a09578081fd5b81356001600160401b03811115613a1e578182fd5b8201601f81018413613a2e578182fd5b61154c848235602084016137ea565b600060c08284031215613a4e578081fd5b60405160c081018181106001600160401b0382111715613a6a57fe5b8060405250825181526020830151602082015260408301516040820152606083015160608201526080830151613a9f81614258565b6080820152613ab060a08401613833565b60a08201529392505050565b600060208284031215613acd578081fd5b81356001600160401b0380821115613ae3578283fd5b9083019060e08286031215613af6578283fd5b613b0060e06141e4565b8235815260208301356020820152613b1a60408401613862565b6040820152613b2b60608401613828565b6060820152613b3c60808401613828565b608082015260a083013560a082015260c083013582811115613b5c578485fd5b613b6887828601613843565b60c08301525095945050505050565b6001600160a01b03169052565b60008151808452613b9c816020860160208601614228565b601f01601f19169290920160200192915050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b90815260200190565b60008351613be8818460208801614228565b835190830190613bfc818360208801614228565b01949350505050565b600088825287602083015260028710613c1a57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b166055840152508360698301528251613c61816089850160208701614228565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b600060e08201905060018060a01b038085168352835160208401526020840151604084015260408401516060840152606084015160808401528060808501511660a08401525060a0830151151560c08301529392505050565b901515815260200190565b6020810160038310613d3457fe5b91905290565b60208082526025908201527f53746f7261676520736c6f742068617320616c7265616479206265656e20707260408201526437bb32b71760d91b606082015260800190565b60208082526026908201527f4163636f756e742073746174652068617320616c7265616479206265656e20706040820152653937bb32b71760d11b606082015260800190565b6020808252603e908201527f416c6c206163636f756e7473206d75737420626520636f6d6d6974746564206260408201527f65666f726520636f6d706c6574696e672061207472616e736974696f6e2e0000606082015260800190565b602080825260409082018190527f53746f7261676520736c6f742076616c7565207761736e2774206368616e6765908201527f64206f722068617320616c7265616479206265656e20636f6d6d69747465642e606082015260800190565b6020808252605b908201527f4f564d5f53746174655472616e736974696f6e65723a2050726f76696465642060408201527f4c3120636f6e747261637420636f6465206861736820646f6573206e6f74206d60608201527f61746368204c3220636f6e747261637420636f646520686173682e0000000000608082015260a00190565b6020808252603f908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d6d697474696e67206163636f756e74207374617465732e00606082015260800190565b60208082526038908201527f4e6f7420656e6f7567682067617320746f2065786563757465207472616e736160408201527f6374696f6e2064657465726d696e6973746963616c6c792e0000000000000000606082015260800190565b6020808252603b908201527f4163636f756e74207374617465207761736e2774206368616e676564206f722060408201527f68617320616c7265616479206265656e20636f6d6d69747465642e0000000000606082015260800190565b6020808252603d908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d706c6574696e672061207472616e736974696f6e2e000000606082015260800190565b60208082526031908201527f46756e6374696f6e206d7573742062652063616c6c656420647572696e67207460408201527034329031b7b93932b1ba10383430b9b29760791b606082015260800190565b6020808252601d908201527f496e76616c6964207472616e73616374696f6e2070726f76696465642e000000604082015260600190565b60208082526038908201527f436f6e7472616374206d757374206265207665726966696564206265666f726560408201527f2070726f76696e6720612073746f7261676520736c6f742e0000000000000000606082015260800190565b600060408252835160408301526020840151606083015260408401516002811061418257fe5b60808381019190915260608501516001600160a01b031660a08401528401516141ae60c0840182613b77565b5060a084015160e083015260c084015160e06101008401526141d4610120840182613b84565b9150506116966020830184613b77565b6040518181016001600160401b03811182821017156141ff57fe5b604052919050565b60006001600160401b0382111561421a57fe5b50601f01601f191660200190565b60005b8381101561424357818101518382015260200161422b565b83811115614252576000848401525b50505050565b6001600160a01b038116811461426d57600080fd5b5056fe50726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e52656365697665642061206e6f6465207769746820616e20756e6b6e6f776e20707265666978a2646970667358221220ce5bdf188c3574b3ab8fd8d954100f14bc36e9cb42e1ca798a8f556d7ace41f564736f6c634300070600334372656174652063616e206f6e6c7920626520646f6e6520627920746865204f564d5f467261756456657269666965722ea26469706673582212200d398ad651c22ef8f9239e5104dc8b8e30dec6c479966de4f2382a136a81db4864736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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\":{\"_0\":\"New OVM_StateTransitioner instance.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}}},\"title\":\"OVM_StateTransitionerFactory\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"create(address,uint256,bytes32,bytes32)\":{\"notice\":\"Creates a new OVM_StateTransitioner\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"}},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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 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 external\\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 external\\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 external\\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 external\\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 external\\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 external\\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 // Prevent the Execution Manager from calling this SM again.\\n ovmStateManager.setExecutionManager(address(0));\\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 external\\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 external\\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 external\\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\":\"0x53231f64d413623b2b8c4ba1b596c9cbbe4712c9b406a42198aeaa8387a293d9\",\"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 /***************\\n * Constructor *\\n ***************/\\n\\n constructor(\\n address _libAddressManager\\n )\\n Lib_AddressResolver(_libAddressManager)\\n {}\\n\\n\\n /********************\\n * Public Functions *\\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 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\\n )\\n {\\n require(\\n msg.sender == resolve(\\\"OVM_FraudVerifier\\\"),\\n \\\"Create can only be done by the OVM_FraudVerifier.\\\"\\n );\\n\\n return new OVM_StateTransitioner(\\n _libAddressManager,\\n _stateTransitionIndex,\\n _preStateRoot,\\n _transactionHash\\n );\\n }\\n}\\n\",\"keccak256\":\"0x65ef11334a2d6931b6d3a85e7b29c39c774d19443e7040e132a58be505e3b52c\",\"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 OUT_OF_GAS,\\n INTENTIONAL_REVERT,\\n EXCEEDS_NUISANCE_GAS,\\n INVALID_STATE_ACCESS,\\n UNSAFE_BYTECODE,\\n CREATE_COLLISION,\\n STATIC_VIOLATION,\\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 enum MessageType {\\n ovmCALL,\\n ovmSTATICCALL,\\n ovmDELEGATECALL,\\n ovmCREATE,\\n ovmCREATE2\\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 uint256 ovmCALLVALUE;\\n bool isStatic;\\n }\\n\\n struct MessageRecord {\\n uint256 nuisanceGasLeft;\\n }\\n\\n\\n /************************************\\n * Transaction Execution Entrypoint *\\n ************************************/\\n\\n function run(\\n Lib_OVMCodec.Transaction calldata _transaction,\\n address _txStateManager\\n ) external returns (bytes memory);\\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 ovmCALLVALUE() external view returns (uint _callValue);\\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, bytes memory _revertdata);\\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract, bytes memory _revertdata);\\n\\n\\n /*******************************\\n * Account Abstraction Opcodes *\\n ******************************/\\n\\n function ovmGETNONCE() external returns (uint256 _nonce);\\n function ovmINCREMENTNONCE() external;\\n function ovmCREATEEOA(bytes32 _messageHash, uint8 _v, bytes32 _r, bytes32 _s) external;\\n\\n\\n /****************************\\n * Contract Calling Opcodes *\\n ****************************/\\n\\n // Valueless ovmCALL for maintaining backwards compatibility with legacy OVM bytecode.\\n function ovmCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\\n function ovmCALL(uint256 _gasLimit, address _address, uint256 _value, 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 * ETH Value Opcodes *\\n *********************/\\n\\n function ovmBALANCE(address _contract) external returns (uint256 _balance);\\n function ovmSELFBALANCE() external returns (uint256 _balance);\\n\\n\\n /***************************************\\n * Public Functions: Execution Context *\\n ***************************************/\\n\\n function getMaxTransactionGasLimit() external view returns (uint _maxTransactionGasLimit);\\n}\\n\",\"keccak256\":\"0x87a056425696719488dbd06adbbf89280d86651e75e1f77d9e96b0632c8634cc\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 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, _key, 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 != pathRemainder.length) {\\n // Our extension node is not identical to the remainder.\\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 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 path may include\\n * additional nodes (e.g., it comes directly from a proof) and we can't resize in-memory\\n * arrays without costly duplication.\\n * @param _key Full original key.\\n * @param _keyRemainder Portion of the initial key that must be inserted 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 _key,\\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 // Reference: https://github.com/ethereumjs/merkle-patricia-tree/blob/c0a10395aab37d42c175a47114ebfcbd7efcf059/src/baseTrie.ts#L294-L313\\n bool matchLeaf = false;\\n if (lastNodeType == NodeType.LeafNode) {\\n uint256 l = 0;\\n if (_path.length > 0) {\\n for (uint256 i = 0; i < _path.length - 1; i++) {\\n if (_getNodeType(_path[i]) == NodeType.BranchNode) {\\n l++;\\n } else {\\n l += _getNodeKey(_path[i]).length;\\n }\\n }\\n }\\n\\n if (\\n _getSharedNibbleLength(\\n _getNodeKey(lastNode),\\n Lib_BytesUtils.slice(Lib_BytesUtils.toNibbles(_key), l)\\n ) == _getNodeKey(lastNode).length\\n && keyRemainder.length == 0\\n ) {\\n matchLeaf = true;\\n }\\n }\\n\\n if (matchLeaf) {\\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 = _editExtensionNodeValue(currentNode, 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 * Creates a new extension node with the same key but a different value.\\n * @param _node Extension node to copy and modify.\\n * @param _value New value for the extension node.\\n * @return New node with the same key and different value.\\n */\\n function _editExtensionNodeValue(\\n TrieNode memory _node,\\n bytes memory _value\\n )\\n private\\n pure\\n returns (\\n TrieNode memory\\n )\\n {\\n bytes[] memory raw = new bytes[](2);\\n bytes memory key = _addHexPrefix(_getNodeKey(_node), false);\\n raw[0] = Lib_RLPWriter.writeBytes(Lib_BytesUtils.fromNibbles(key));\\n if (_value.length < 32) {\\n raw[1] = _value;\\n } else {\\n raw[1] = Lib_RLPWriter.writeBytes(_value);\\n }\\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 abi.encodePacked(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\":\"0x4bb09d0b4f965b57cdc6b3ace49967bcfe7f2580fa0b7863dfe288081247d876\",\"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 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\":\"0xbbdd600165307d2131340599afa9dc0991f8f63727ba3a834bca5a3d7f501da8\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"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 *\\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 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\\n )\\n {\\n bytes memory code;\\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 Full code of the contract.\\n */\\n function getCode(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes memory\\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 Size of the contract's code in bytes.\\n */\\n function getCodeSize(\\n address _address\\n )\\n internal\\n view\\n returns (\\n uint256\\n )\\n {\\n uint256 codeSize;\\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 Hash of the contract's code.\\n */\\n function getCodeHash(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n bytes32 codeHash;\\n assembly {\\n codeHash := extcodehash(_address)\\n }\\n\\n return codeHash;\\n }\\n\\n /**\\n * Creates a contract with some given initialization code.\\n * @param _code Contract initialization code.\\n * @return Address of the created contract.\\n */\\n function createContract(\\n bytes memory _code\\n )\\n internal\\n returns (\\n address\\n )\\n {\\n address created;\\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 to be generated by CREATE.\\n */\\n function getAddressForCREATE(\\n address _creator,\\n uint256 _nonce\\n )\\n internal\\n pure\\n returns (\\n 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 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 (\\n address\\n )\\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\":\"0xf29a67d78e61cb472d524b779b32cfcb39a587f4096500d5419e6425ed367d49\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50604051614b2b380380614b2b8339818101604052602081101561003357600080fd5b5051600080546001600160a01b039092166001600160a01b0319909216919091179055614ac6806100656000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806322d1470214610046578063299ca4781461009a578063461a4478146100a2575b600080fd5b61007e6004803603608081101561005c57600080fd5b506001600160a01b038135169060208101359060408101359060600135610148565b604080516001600160a01b039092168252519081900360200190f35b61007e610229565b61007e600480360360208110156100b857600080fd5b8101906020810181356401000000008111156100d357600080fd5b8201836020820111156100e557600080fd5b8035906020019184600183028401116401000000008311171561010757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610238945050505050565b600061017c6040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b815250610238565b6001600160a01b0316336001600160a01b0316146101cb5760405162461bcd60e51b8152600401808060200182810382526031815260200180614a606031913960400191505060405180910390fd5b848484846040516101db90610314565b80856001600160a01b03168152602001848152602001838152602001828152602001945050505050604051809103906000f08015801561021f573d6000803e3d6000fd5b5095945050505050565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610298578181015183820152602001610280565b50505050905090810190601f1680156102c55780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102e257600080fd5b505afa1580156102f6573d6000803e3d6000fd5b505050506040513d602081101561030c57600080fd5b505192915050565b61473e806103228339019056fe60806040523480156200001157600080fd5b506040516200473e3803806200473e833981016040819052620000349162000232565b600080546001600160a01b0319166001600160a01b038616179055600583905560028290556003829055600681905560408051808201909152601781527f4f564d5f53746174654d616e61676572466163746f72790000000000000000006020820152620000a29062000150565b6001600160a01b0316639ed93318306040518263ffffffff1660e01b8152600401620000cf919062000299565b602060405180830381600087803b158015620000ea57600080fd5b505af1158015620000ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000125919062000273565b600180546001600160a01b0319166001600160a01b039290921691909117905550620002c692505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015620001b257818101518382015260200162000198565b50505050905090810190601f168015620001e05780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b158015620001fe57600080fd5b505afa15801562000213573d6000803e3d6000fd5b505050506040513d60208110156200022a57600080fd5b505192915050565b6000806000806080858703121562000248578384fd5b84516200025581620002ad565b60208601516040870151606090970151919890975090945092505050565b60006020828403121562000285578081fd5b81516200029281620002ad565b9392505050565b6001600160a01b0391909116815260200190565b6001600160a01b0381168114620002c357600080fd5b50565b61446880620002d66000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063845fe7a31161008c578063b2fa1c9e11610066578063b2fa1c9e14610185578063b52805711461019a578063b9194310146101a2578063c1c618b8146101b5576100cf565b8063845fe7a314610155578063a244316a14610168578063b1c9fe6e14610170576100cf565b8063299ca478146100d45780632e1ac36c146100f25780632eb1375814610107578063461a44781461011a578063732f960b1461012d578063805e9d3014610140575b600080fd5b6100dc6101bd565b6040516100e99190613de6565b60405180910390f35b610105610100366004613a42565b6101cc565b005b610105610115366004613a82565b610565565b6100dc610128366004613b6a565b6108a1565b61010561013b366004613c2e565b61097f565b610148610c6f565b6040516100e99190613d3f565b610105610163366004613a42565b610c75565b610105610fa1565b610178611128565b6040516100e99190613e98565b61018d611131565b6040516100e99190613e8d565b6100dc61114c565b6101056101b03660046139e3565b61115b565b610148611475565b6000546001600160a01b031681565b60018060045460ff1660028111156101e057fe5b146102065760405162461bcd60e51b81526004016101fd906141e9565b60405180910390fd5b60025460065460005a6001546040516363b285f960e11b81529192506001600160a01b03169063c7650bf290610242908a908a90600401613dfa565b602060405180830381600087803b15801561025c57600080fd5b505af1158015610270573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102949190613acf565b15156001146102b55760405162461bcd60e51b81526004016101fd90613f94565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f1906102e6908b90600401613de6565b60c06040518083038186803b1580156102fe57600080fd5b505afa158015610312573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103369190613baf565b600154604051631aaf392f60e01b81529192506000916001600160a01b0390911690631aaf392f9061036e908c908c90600401613dfa565b60206040518083038186803b15801561038657600080fd5b505afa15801561039a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103be9190613ae9565b90506103ff886040516020016103d49190613d3f565b6040516020818303038152906040526103f46103ef8461147b565b6114c4565b89856040015161152e565b6040808401919091526001549051638f3b964760e01b81526001600160a01b0390911690638f3b964790610439908c908690600401613e34565b600060405180830381600087803b15801561045357600080fd5b505af1158015610467573d6000803e3d6000fd5b505050507f3e3ed1a676a2754a041b49bf752e0f167c8753495e36c320fe01d1ef7476253c898960405161049c929190613dfa565b60405180910390a1505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561054357600080fd5b505af1158015610557573d6000803e3d6000fd5b505050505050505050505050565b60018060045460ff16600281111561057957fe5b146105965760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a9050600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156105ef57600080fd5b505afa158015610603573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106279190613ae9565b156106445760405162461bcd60e51b81526004016101fd90614075565b600154604051630b38106960e11b81526001600160a01b039091169063167020d290610674908990600401613de6565b602060405180830381600087803b15801561068e57600080fd5b505af11580156106a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c69190613acf565b15156001146106e75760405162461bcd60e51b81526004016101fd9061412f565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f190610718908a90600401613de6565b60c06040518083038186803b15801561073057600080fd5b505afa158015610744573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107689190613baf565b90506107a78760405160200161077e9190613d22565b60405160208183030381529060405261079e61079984611554565b611594565b8860035461152e565b6003556040517fcec9ef675d775706a02b43afe48af52c5019bc50f99582e3208c6ff55d59c008906107da908990613de6565b60405180910390a15060005a8203905061081a6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561088057600080fd5b505af1158015610894573d6000803e3d6000fd5b5050505050505050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156109015781810151838201526020016108e9565b50505050905090810190601f16801561092e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561094b57600080fd5b505afa15801561095f573d6000803e3d6000fd5b505050506040513d602081101561097557600080fd5b505190505b919050565b60008060045460ff16600281111561099357fe5b146109b05760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a90506006546109c78661169d565b146109e45760405162461bcd60e51b81526004016101fd9061423a565b6103e88560a0015161040802816109f757fe5b04620186a0015a1015610a1c5760405162461bcd60e51b81526004016101fd906140d2565b6000610a536040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b8152506108a1565b600154604051631381ba4d60e01b81529192506001600160a01b031690631381ba4d90610a84908490600401613de6565b600060405180830381600087803b158015610a9e57600080fd5b505af1158015610ab2573d6000803e3d6000fd5b5050600154604051639be3ad6760e01b81526001600160a01b038086169450639be3ad679350610ae9928b929116906004016142ce565b600060405180830381600087803b158015610b0357600080fd5b505af1158015610b17573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b3f9190810190613b01565b50600154604051631381ba4d60e01b81526001600160a01b0390911690631381ba4d90610b7190600090600401613de6565b600060405180830381600087803b158015610b8b57600080fd5b505af1158015610b9f573d6000803e3d6000fd5b50506004805460ff191660011790555060009150505a82039050610be96040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b158015610c4f57600080fd5b505af1158015610c63573d6000803e3d6000fd5b50505050505050505050565b60025490565b60008060045460ff166002811115610c8957fe5b14610ca65760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a600154604051630ad2267960e01b81529192506001600160a01b031690630ad2267990610ce2908a908a90600401613dfa565b60206040518083038186803b158015610cfa57600080fd5b505afa158015610d0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d329190613acf565b15610d4f5760405162461bcd60e51b81526004016101fd90613eac565b60015460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf90610d7f908a90600401613de6565b60206040518083038186803b158015610d9757600080fd5b505afa158015610dab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcf9190613acf565b1515600114610df05760405162461bcd60e51b81526004016101fd90614271565b60015460405163136e2d8960e11b81526000916001600160a01b0316906326dc5b1290610e21908b90600401613de6565b60206040518083038186803b158015610e3957600080fd5b505afa158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e719190613ae9565b905060007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421821415610ea557506000610f02565b600080610ed28a604051602001610ebc9190613d3f565b6040516020818303038152906040528a866116b6565b909250905060018215151415610efa57610ef3610eee826116df565b6116f2565b9250610eff565b600092505b50505b600154604051635c17d62960e01b81526001600160a01b0390911690635c17d62990610f36908c908c908690600401613e13565b600060405180830381600087803b158015610f5057600080fd5b505af1158015610f64573d6000803e3d6000fd5b50505050505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b60018060045460ff166002811115610fb557fe5b14610fd25760405162461bcd60e51b81526004016101fd906141e9565b600160009054906101000a90046001600160a01b03166001600160a01b031663d7bd4a2a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561102057600080fd5b505afa158015611034573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110589190613ae9565b156110755760405162461bcd60e51b81526004016101fd90613f37565b600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156110c357600080fd5b505afa1580156110d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110fb9190613ae9565b156111185760405162461bcd60e51b81526004016101fd9061418c565b506004805460ff19166002179055565b60045460ff1681565b6000600260045460ff16600281111561114657fe5b14905090565b6001546001600160a01b031681565b60008060045460ff16600281111561116f57fe5b1461118c5760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a60015460405163c8e40fbf60e01b81529192506001600160a01b03169063c8e40fbf906111c6908a90600401613de6565b60206040518083038186803b1580156111de57600080fd5b505afa1580156111f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112169190613acf565b1580156112a057506001546040516307a1294560e01b81526001600160a01b03909116906307a129459061124e908a90600401613de6565b60206040518083038186803b15801561126657600080fd5b505afa15801561127a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129e9190613acf565b155b6112bc5760405162461bcd60e51b81526004016101fd90613ef1565b6000806112eb896040516020016112d39190613d22565b604051602081830303815290604052886002546116b6565b90925090506001821515141561140c57600061130682611721565b606081015190915089907fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470141561133f5750600061136a565b816060015161134d826117b3565b1461136a5760405162461bcd60e51b81526004016101fd90613ff2565b6001546040805160c08101825284518152602080860151908201528482015181830152606080860151908201526001600160a01b038481166080830152600060a08301529151638f3b964760e01b81529190921691638f3b9647916113d3918f91600401613e34565b600060405180830381600087803b1580156113ed57600080fd5b505af1158015611401573d6000803e3d6000fd5b50505050505061143c565b600154604051630d631c9d60e31b81526001600160a01b0390911690636b18e4e890610f36908c90600401613de6565b505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b60035490565b6060806000805b6020811085821a15161561149c5760019182019101611482565b5060405191506040820160405283600882021b60208301528060200382525080915050919050565b606080825160011480156114ec57506080836000815181106114e257fe5b016020015160f81c105b156114f8575081611528565b611504835160806117b7565b83604051602001611516929190613d48565b60405160208183030381529060405290505b92915050565b60008061153a86611906565b905061154881868686611936565b9150505b949350505050565b61155c613901565b604051806080016040528083600001518152602001836020015181526020018360400151815260200183606001518152509050919050565b60408051600480825260a0820190925260609160009190816020015b60608152602001906001900390816115b057505083519091506115d6906103ef9061147b565b816000815181106115e357fe5b60200260200101819052506116016103ef846020015160001b61147b565b8160018151811061160e57fe5b602002602001018190525061164583604001516040516020016116319190613d3f565b6040516020818303038152906040526114c4565b8160028151811061165257fe5b602002602001018190525061167583606001516040516020016116319190613d3f565b8160038151811061168257fe5b6020026020010181905250611696816119d2565b9392505050565b60006116a882611a16565b805190602001209050919050565b6000606060006116c586611906565b90506116d2818686611a51565b9250925050935093915050565b60606115286116ed83611b24565b611b49565b600080600060208451111561170857602061170b565b83515b6020858101519190036008021c92505050919050565b611729613901565b600061173483611bd8565b9050604051806080016040528061175e8360008151811061175157fe5b6020026020010151611beb565b81526020016117738360018151811061175157fe5b81526020016117958360028151811061178857fe5b6020026020010151611bf2565b81526020016117aa8360038151811061178857fe5b90529392505050565b3f90565b6060806038841015611811576040805160018082528183019092529060208201818036833701905050905082840160f81b816000815181106117f557fe5b60200101906001600160f81b031916908160001a905350611696565b600060015b80868161181f57fe5b04156118345760019091019061010002611816565b816001016001600160401b038111801561184d57600080fd5b506040519080825280601f01601f191660200182016040528015611878576020820181803683370190505b50925084820160370160f81b8360008151811061189157fe5b60200101906001600160f81b031916908160001a905350600190505b8181116118fd576101008183036101000a87816118c657fe5b04816118ce57fe5b0660f81b8382815181106118de57fe5b60200101906001600160f81b031916908160001a9053506001016118ad565b50509392505050565b606081805190602001206040516020016119209190613d3f565b6040516020818303038152906040529050919050565b6040805180820190915260018152600160ff1b60209091015260007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42182141561198a576119838585611cec565b905061154c565b600061199584611d10565b90506000806119a5838987611de6565b509150915060006119b984848b858c61218c565b90506119c5818a61256a565b9998505050505050505050565b606060006119df836126c3565b90506119ed815160c06117b7565b816040516020016119ff929190613d48565b604051602081830303815290604052915050919050565b6060816000015182602001518360400151846060015185608001518660a001518760c001516040516020016119209796959493929190613d77565b600060606000611a6085611d10565b90506000806000611a72848a89611de6565b81519295509093509150158080611a865750815b611ad7576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b600081611af35760405180602001604052806000815250611b12565b611b12866001870381518110611b0557fe5b60200260200101516127cc565b919b919a509098505050505050505050565b611b2c613928565b506040805180820190915281518152602082810190820152919050565b60606000806000611b59856127e8565b919450925090506000816001811115611b6e57fe5b14611bc0576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b611bcf85602001518484612b11565b95945050505050565b6060611528611be683611b24565b612bbe565b6000611528825b6000602182600001511115611c4e576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6000806000611c5c856127e8565b919450925090506000816001811115611c7157fe5b14611cc3576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b602080860151840180519091841015611ce25760208490036101000a90045b9695505050505050565b6000611d00611cfa84612d34565b83612e30565b5180516020909101209392505050565b60606000611d1d83611bd8565b9050600081516001600160401b0381118015611d3857600080fd5b50604051908082528060200260200182016040528015611d7257816020015b611d5f613942565b815260200190600190039081611d575790505b50905060005b8251811015611dde576000611d9f848381518110611d9257fe5b6020026020010151611b49565b90506040518060400160405280828152602001611dbb83611bd8565b815250838381518110611dca57fe5b602090810291909101015250600101611d78565b509392505050565b60006060818080611df687612d34565b905085600080611e04613942565b60005b8c51811015612164578c8181518110611e1c57fe5b6020026020010151915082840193506001870196508360001415611e9057815180516020909101208514611e8b576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b611f57565b815151602011611ef757815180516020909101208514611e8b576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b84611f058360000151612ec4565b14611f57576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b60208201515160111415611fc6578551841415611f7357612164565b6000868581518110611f8157fe5b602001015160f81c60f81b60f81c9050600083602001518260ff1681518110611fa657fe5b60200260200101519050611fb981612ef0565b965060019450505061215c565b6002826020015151141561210f576000611fdf83612f26565b9050600081600081518110611ff057fe5b016020015160f81c90506001811660020360006120108460ff8416612f44565b9050600061201e8b8a612f44565b9050600061202c8383612f71565b905060ff851660021480612043575060ff85166003145b15612075578083511480156120585750808251145b1561206257988901985b50600160ff1b9950612164945050505050565b60ff85161580612088575060ff85166001145b156120d857825181146120a85750600160ff1b9950612164945050505050565b6120c988602001516001815181106120bc57fe5b6020026020010151612ef0565b9a50975061215c945050505050565b60405162461bcd60e51b815260040180806020018281038252602681526020018061440d6026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b600101611e07565b50600160ff1b8414866121778786612f44565b909e909d50909b509950505050505050505050565b6060600083905060008760018803815181106121a457fe5b6020026020010151905060006121b982612fd7565b6040805160038082526080820190925291925060009190816020015b6121dd613942565b8152602001906001900390816121d5579050509050600080600284600281111561220357fe5b14156122cd578b51600090156122885760005b60018e51038110156122865760006122408f838151811061223357fe5b6020026020010151612fd7565b600281111561224b57fe5b141561225c5760019091019061227e565b6122788e828151811061226b57fe5b60200260200101516130ad565b51820191505b600101612216565b505b612291866130ad565b516122b561229e886130ad565b6122b06122aa8f612d34565b85612f44565b612f71565b1480156122c157508651155b156122cb57600191505b505b8015612307576122e56122df866130ad565b89612e30565b8383815181106122f157fe5b602002602001018190525060018201915061254b565b600084600281111561231557fe5b141561237e57855161234d5761232b85896130c0565b83838151811061233757fe5b6020026020010181905250600182019150612379565b8483838151811061235a57fe5b60200260200101819052506001820191506122e56122df876001612f44565b61254b565b6000612389866130ad565b905060006123978289612f71565b905080156123f85760006123ad8360008461310b565b90506123c1816123bc8d61325b565b61329c565b8686815181106123cd57fe5b60200260200101819052506001850194506123e88383612f44565b92506123f48983612f44565b9850505b60006124026132e0565b9050825160001415612427576124208161241b8a6127cc565b6130c0565b90506124bf565b60008360008151811061243657fe5b016020015160f81c905061244b846001612f44565b9350600288600281111561245b57fe5b1415612496576000612475856124708c6127cc565b612e30565b905061248e8383612489846000015161325b565b61336d565b9250506124bd565b8351156124ac576000612475856123bc8c6127cc565b6124ba82826124898c6127cc565b91505b505b88516124f4576124cf818c6130c0565b9050808686815181106124de57fe5b6020026020010181905250600185019450612547565b6124ff896001612f44565b98508086868151811061250e57fe5b6020026020010181905250600185019450612529898c612e30565b86868151811061253557fe5b60200260200101819052506001850194505b5050505b61255a8c60018d0385856133c6565b9c9b505050505050505050505050565b60008061257683612d34565b9050612580613942565b84516000906060905b80156126ae5787600182038151811061259e57fe5b602002602001015193506125b184612fd7565b925060028360028111156125c157fe5b14156125ec5760006125d2856130ad565b90506125e4866000835189510361310b565b955050612698565b60018360028111156125fa57fe5b141561263a57600061260b856130ad565b905061261d866000835189510361310b565b8351909650156126345761263185846134a8565b94505b50612698565b600083600281111561264857fe5b1415612698578151156126985760008560018751038151811061266757fe5b602001015160f81c60f81b60f81c9050612687866000600189510361310b565b955061269485828561336d565b9450505b83516126a39061325b565b915060001901612589565b50509051805160209091012095945050505050565b60608151600014156126e4575060408051600081526020810190915261097a565b6000805b8351811015612717578381815181106126fd57fe5b6020026020010151518201915080806001019150506126e8565b6000826001600160401b038111801561272f57600080fd5b506040519080825280601f01601f19166020018201604052801561275a576020820181803683370190505b50600092509050602081015b85518310156127c357600086848151811061277d57fe5b60200260200101519050600060208201905061279b83828451613554565b8785815181106127a757fe5b6020026020010151518301925050508280600101935050612766565b50949350505050565b60208101518051606091611528916000198101908110611d9257fe5b600080600080846000015111612845576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f811161286a576000600160009450945094505050612b0a565b60b781116128df578551607f1982019081106128cd576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b60019550935060009250612b0a915050565b60bf81116129c357855160b6198201908110612942576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a60018501510490508082018860000151116129ae576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b60019091019550935060009250612b0a915050565b60f78111612a3757855160bf198201908110612a26576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b600195509350849250612b0a915050565b855160f6198201908110612a92576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111612af7576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b6001918201965094509250612b0a915050565b9193909250565b60606000826001600160401b0381118015612b2b57600080fd5b506040519080825280601f01601f191660200182016040528015612b56576020820181803683370190505b509050805160001415612b6a579050611696565b8484016020820160005b60208604811015612b95578251825260209283019290910190600101612b74565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b6060600080612bcc846127e8565b91935090915060019050816001811115612be257fe5b14612c34576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b612c55613928565b815260200190600190039081612c4d5790505090506000835b8651811015612d295760208210612cb65760405162461bcd60e51b815260040180806020018281038252602a8152602001806143e3602a913960400191505060405180910390fd5b600080612ce26040518060400160405280858c60000151038152602001858c60200151018152506127e8565b509150915060405180604001604052808383018152602001848b6020015101815250858581518110612d1057fe5b6020908102919091010152600193909301920101612c6e565b508152949350505050565b6060600082516002026001600160401b0381118015612d5257600080fd5b506040519080825280601f01601f191660200182016040528015612d7d576020820181803683370190505b50905060005b8351811015612e29576004848281518110612d9a57fe5b602001015160f81c60f81b6001600160f81b031916901c828260020281518110612dc057fe5b60200101906001600160f81b031916908160001a9053506010848281518110612de557fe5b016020015160f81c81612df457fe5b0660f81b828260020260010181518110612e0a57fe5b60200101906001600160f81b031916908160001a905350600101612d83565b5092915050565b612e38613942565b60408051600280825260608201909252600091816020015b6060815260200190600190039081612e505790505090506000612e74856001613598565b9050612e826103ef826136ef565b82600081518110612e8f57fe5b6020026020010181905250612ea3846114c4565b82600181518110612eb057fe5b6020026020010181905250611bcf826137bf565b6000602082511015612edb5750602081015161097a565b81806020019051602081101561097557600080fd5b60006060602083600001511015612f1157612f0a836137ee565b9050612f1d565b612f1a83611b49565b90505b61169681612ec4565b6060611528612f3f8360200151600081518110611d9257fe5b612d34565b606082518210612f635750604080516020810190915260008152611528565b61169683838486510361310b565b6000805b808451118015612f855750808351115b8015612fca5750828181518110612f9857fe5b602001015160f81c60f81b6001600160f81b031916848281518110612fb957fe5b01602001516001600160f81b031916145b1561169657600101612f75565b60208101515160009060111415612ff05750600061097a565b6002826020015151141561306c57600061300983612f26565b905060008160008151811061301a57fe5b016020015160f81c90506002811480613036575060ff81166003145b156130465760029250505061097a565b60ff81161580613059575060ff81166001145b156130695760019250505061097a565b50505b6040805162461bcd60e51b8152602060048201526011602482015270496e76616c6964206e6f6465207479706560781b604482015290519081900360640190fd5b60606115286130bb83612f26565b6137f9565b6130c8613942565b60006130d3836114c4565b90506130de81611b24565b6020850151805160001981019081106130f357fe5b602002602001018190525061154c8460200151613842565b60608182601f011015613156576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b82828401101561319e576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b818301845110156131ea576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b60608215801561320957604051915060008252602082016040526127c3565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561324257805183526020928301920161322a565b5050858452601f01601f19166040525050949350505050565b606060208251101561326e57508061097a565b818051906020012060405160200180828152602001915050604051602081830303815290604052905061097a565b6132a4613942565b60408051600280825260608201909252600091816020015b60608152602001906001900390816132bc5790505090506000612e74856000613598565b6132e8613942565b6040805160118082526102408201909252600091816020015b606081526020019060019003908161330157905050905060005b815181101561335d57604051806040016040528060018152602001600160ff1b81525082828151811061334a57fe5b602090810291909101015260010161331b565b50613367816137bf565b91505090565b613375613942565b6000602083511061338e57613389836114c4565b613390565b825b905061339b81611b24565b85602001518560ff16815181106133ae57fe5b6020026020010181905250611bcf8560200151613842565b606060008285016001600160401b03811180156133e257600080fd5b5060405190808252806020026020018201604052801561341c57816020015b613409613942565b8152602001906001900390816134015790505b50905060005b8581101561345d5786818151811061343657fe5b602002602001015182828151811061344a57fe5b6020908102919091010152600101613422565b5060005b8381101561349e5784818151811061347557fe5b6020026020010151828783018151811061348b57fe5b6020908102919091010152600101613461565b5095945050505050565b6134b0613942565b60408051600280825260608201909252600091816020015b60608152602001906001900390816134c857905050905060006134f46134ed866130ad565b6000613598565b90506135026103ef826136ef565b8260008151811061350f57fe5b602002602001018190525060208451101561354257838260018151811061353257fe5b602002602001018190525061354b565b612ea3846114c4565b611bcf826137bf565b8282825b60208110613577578151835260209283019290910190601f1901613558565b905182516020929092036101000a6000190180199091169116179052505050565b60606000826135a85760006135ab565b60025b9050600060028551816135ba57fe5b06905060008160020360ff166001600160401b03811180156135db57600080fd5b506040519080825280601f01601f191660200182016040528015613606576020820181803683370190505b50905081830160f81b8160008151811061361c57fe5b60200101906001600160f81b031916908160001a90535080866040516020018083805190602001908083835b602083106136675780518252601f199092019160209182019101613648565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106136af5780518252601f199092019160209182019101613690565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052935050505092915050565b6060600060028351816136fe57fe5b046001600160401b038111801561371457600080fd5b506040519080825280601f01601f19166020018201604052801561373f576020820181803683370190505b50905060005b8151811015612e295783816002026001018151811061376057fe5b602001015160f81c60f81b600485836002028151811061377c57fe5b602001015160f81c60f81b6001600160f81b031916901b178282815181106137a057fe5b60200101906001600160f81b031916908160001a905350600101613745565b6137c7613942565b60006137d2836119d2565b905060405180604001604052808281526020016117aa83611bd8565b6060611528826138eb565b606060028260008151811061380a57fe5b016020015160f81c8161381957fe5b0660ff166000141561383757613830826002612f44565b905061097a565b613830826001612f44565b61384a613942565b600082516001600160401b038111801561386357600080fd5b5060405190808252806020026020018201604052801561389757816020015b60608152602001906001900390816138825790505b50905060005b83518110156138e1576138c28482815181106138b557fe5b60200260200101516137ee565b8282815181106138ce57fe5b602090810291909101015260010161389d565b50611696816137bf565b6060611528826020015160008460000151612b11565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060008152602001600081525090565b604051806040016040528060608152602001606081525090565b600061396f61396a84614379565b614356565b905082815283838301111561398357600080fd5b828260208301376000602084830101529392505050565b803561097a816143ca565b8051801515811461097a57600080fd5b600082601f8301126139c5578081fd5b6116968383356020850161395c565b80356002811061097a57600080fd5b6000806000606084860312156139f7578283fd5b8335613a02816143ca565b92506020840135613a12816143ca565b915060408401356001600160401b03811115613a2c578182fd5b613a38868287016139b5565b9150509250925092565b600080600060608486031215613a56578283fd5b8335613a61816143ca565b92506020840135915060408401356001600160401b03811115613a2c578182fd5b60008060408385031215613a94578182fd5b8235613a9f816143ca565b915060208301356001600160401b03811115613ab9578182fd5b613ac5858286016139b5565b9150509250929050565b600060208284031215613ae0578081fd5b611696826139a5565b600060208284031215613afa578081fd5b5051919050565b600060208284031215613b12578081fd5b81516001600160401b03811115613b27578182fd5b8201601f81018413613b37578182fd5b8051613b4561396a82614379565b818152856020838501011115613b59578384fd5b611bcf82602083016020860161439a565b600060208284031215613b7b578081fd5b81356001600160401b03811115613b90578182fd5b8201601f81018413613ba0578182fd5b61154c8482356020840161395c565b600060c08284031215613bc0578081fd5b60405160c081018181106001600160401b0382111715613bdc57fe5b8060405250825181526020830151602082015260408301516040820152606083015160608201526080830151613c11816143ca565b6080820152613c2260a084016139a5565b60a08201529392505050565b600060208284031215613c3f578081fd5b81356001600160401b0380821115613c55578283fd5b9083019060e08286031215613c68578283fd5b613c7260e0614356565b8235815260208301356020820152613c8c604084016139d4565b6040820152613c9d6060840161399a565b6060820152613cae6080840161399a565b608082015260a083013560a082015260c083013582811115613cce578485fd5b613cda878286016139b5565b60c08301525095945050505050565b6001600160a01b03169052565b60008151808452613d0e81602086016020860161439a565b601f01601f19169290920160200192915050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b90815260200190565b60008351613d5a81846020880161439a565b835190830190613d6e81836020880161439a565b01949350505050565b600088825287602083015260028710613d8c57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b166055840152508360698301528251613dd381608985016020870161439a565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b600060e08201905060018060a01b038085168352835160208401526020840151604084015260408401516060840152606084015160808401528060808501511660a08401525060a0830151151560c08301529392505050565b901515815260200190565b6020810160038310613ea657fe5b91905290565b60208082526025908201527f53746f7261676520736c6f742068617320616c7265616479206265656e20707260408201526437bb32b71760d91b606082015260800190565b60208082526026908201527f4163636f756e742073746174652068617320616c7265616479206265656e20706040820152653937bb32b71760d11b606082015260800190565b6020808252603e908201527f416c6c206163636f756e7473206d75737420626520636f6d6d6974746564206260408201527f65666f726520636f6d706c6574696e672061207472616e736974696f6e2e0000606082015260800190565b602080825260409082018190527f53746f7261676520736c6f742076616c7565207761736e2774206368616e6765908201527f64206f722068617320616c7265616479206265656e20636f6d6d69747465642e606082015260800190565b6020808252605b908201527f4f564d5f53746174655472616e736974696f6e65723a2050726f76696465642060408201527f4c3120636f6e747261637420636f6465206861736820646f6573206e6f74206d60608201527f61746368204c3220636f6e747261637420636f646520686173682e0000000000608082015260a00190565b6020808252603f908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d6d697474696e67206163636f756e74207374617465732e00606082015260800190565b60208082526038908201527f4e6f7420656e6f7567682067617320746f2065786563757465207472616e736160408201527f6374696f6e2064657465726d696e6973746963616c6c792e0000000000000000606082015260800190565b6020808252603b908201527f4163636f756e74207374617465207761736e2774206368616e676564206f722060408201527f68617320616c7265616479206265656e20636f6d6d69747465642e0000000000606082015260800190565b6020808252603d908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d706c6574696e672061207472616e736974696f6e2e000000606082015260800190565b60208082526031908201527f46756e6374696f6e206d7573742062652063616c6c656420647572696e67207460408201527034329031b7b93932b1ba10383430b9b29760791b606082015260800190565b6020808252601d908201527f496e76616c6964207472616e73616374696f6e2070726f76696465642e000000604082015260600190565b60208082526038908201527f436f6e7472616374206d757374206265207665726966696564206265666f726560408201527f2070726f76696e6720612073746f7261676520736c6f742e0000000000000000606082015260800190565b60006040825283516040830152602084015160608301526040840151600281106142f457fe5b60808381019190915260608501516001600160a01b031660a084015284015161432060c0840182613ce9565b5060a084015160e083015260c084015160e0610100840152614346610120840182613cf6565b9150506116966020830184613ce9565b6040518181016001600160401b038111828210171561437157fe5b604052919050565b60006001600160401b0382111561438c57fe5b50601f01601f191660200190565b60005b838110156143b557818101518382015260200161439d565b838111156143c4576000848401525b50505050565b6001600160a01b03811681146143df57600080fd5b5056fe50726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e52656365697665642061206e6f6465207769746820616e20756e6b6e6f776e20707265666978a264697066735822122098623b5d8a4c0fcdf15bfb72801372ca7a0d19e2a81bde8c6eed2b833d19284964736f6c634300070600334372656174652063616e206f6e6c7920626520646f6e6520627920746865204f564d5f467261756456657269666965722ea2646970667358221220dd4b9e8035653bfb395d28bfa466d3d87570bcf75ea8d58973b1d53f4783560f64736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c806322d1470214610046578063299ca4781461009a578063461a4478146100a2575b600080fd5b61007e6004803603608081101561005c57600080fd5b506001600160a01b038135169060208101359060408101359060600135610148565b604080516001600160a01b039092168252519081900360200190f35b61007e610229565b61007e600480360360208110156100b857600080fd5b8101906020810181356401000000008111156100d357600080fd5b8201836020820111156100e557600080fd5b8035906020019184600183028401116401000000008311171561010757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610238945050505050565b600061017c6040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b815250610238565b6001600160a01b0316336001600160a01b0316146101cb5760405162461bcd60e51b8152600401808060200182810382526031815260200180614a606031913960400191505060405180910390fd5b848484846040516101db90610314565b80856001600160a01b03168152602001848152602001838152602001828152602001945050505050604051809103906000f08015801561021f573d6000803e3d6000fd5b5095945050505050565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610298578181015183820152602001610280565b50505050905090810190601f1680156102c55780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102e257600080fd5b505afa1580156102f6573d6000803e3d6000fd5b505050506040513d602081101561030c57600080fd5b505192915050565b61473e806103228339019056fe60806040523480156200001157600080fd5b506040516200473e3803806200473e833981016040819052620000349162000232565b600080546001600160a01b0319166001600160a01b038616179055600583905560028290556003829055600681905560408051808201909152601781527f4f564d5f53746174654d616e61676572466163746f72790000000000000000006020820152620000a29062000150565b6001600160a01b0316639ed93318306040518263ffffffff1660e01b8152600401620000cf919062000299565b602060405180830381600087803b158015620000ea57600080fd5b505af1158015620000ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000125919062000273565b600180546001600160a01b0319166001600160a01b039290921691909117905550620002c692505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015620001b257818101518382015260200162000198565b50505050905090810190601f168015620001e05780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b158015620001fe57600080fd5b505afa15801562000213573d6000803e3d6000fd5b505050506040513d60208110156200022a57600080fd5b505192915050565b6000806000806080858703121562000248578384fd5b84516200025581620002ad565b60208601516040870151606090970151919890975090945092505050565b60006020828403121562000285578081fd5b81516200029281620002ad565b9392505050565b6001600160a01b0391909116815260200190565b6001600160a01b0381168114620002c357600080fd5b50565b61446880620002d66000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063845fe7a31161008c578063b2fa1c9e11610066578063b2fa1c9e14610185578063b52805711461019a578063b9194310146101a2578063c1c618b8146101b5576100cf565b8063845fe7a314610155578063a244316a14610168578063b1c9fe6e14610170576100cf565b8063299ca478146100d45780632e1ac36c146100f25780632eb1375814610107578063461a44781461011a578063732f960b1461012d578063805e9d3014610140575b600080fd5b6100dc6101bd565b6040516100e99190613de6565b60405180910390f35b610105610100366004613a42565b6101cc565b005b610105610115366004613a82565b610565565b6100dc610128366004613b6a565b6108a1565b61010561013b366004613c2e565b61097f565b610148610c6f565b6040516100e99190613d3f565b610105610163366004613a42565b610c75565b610105610fa1565b610178611128565b6040516100e99190613e98565b61018d611131565b6040516100e99190613e8d565b6100dc61114c565b6101056101b03660046139e3565b61115b565b610148611475565b6000546001600160a01b031681565b60018060045460ff1660028111156101e057fe5b146102065760405162461bcd60e51b81526004016101fd906141e9565b60405180910390fd5b60025460065460005a6001546040516363b285f960e11b81529192506001600160a01b03169063c7650bf290610242908a908a90600401613dfa565b602060405180830381600087803b15801561025c57600080fd5b505af1158015610270573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102949190613acf565b15156001146102b55760405162461bcd60e51b81526004016101fd90613f94565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f1906102e6908b90600401613de6565b60c06040518083038186803b1580156102fe57600080fd5b505afa158015610312573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103369190613baf565b600154604051631aaf392f60e01b81529192506000916001600160a01b0390911690631aaf392f9061036e908c908c90600401613dfa565b60206040518083038186803b15801561038657600080fd5b505afa15801561039a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103be9190613ae9565b90506103ff886040516020016103d49190613d3f565b6040516020818303038152906040526103f46103ef8461147b565b6114c4565b89856040015161152e565b6040808401919091526001549051638f3b964760e01b81526001600160a01b0390911690638f3b964790610439908c908690600401613e34565b600060405180830381600087803b15801561045357600080fd5b505af1158015610467573d6000803e3d6000fd5b505050507f3e3ed1a676a2754a041b49bf752e0f167c8753495e36c320fe01d1ef7476253c898960405161049c929190613dfa565b60405180910390a1505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561054357600080fd5b505af1158015610557573d6000803e3d6000fd5b505050505050505050505050565b60018060045460ff16600281111561057957fe5b146105965760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a9050600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156105ef57600080fd5b505afa158015610603573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106279190613ae9565b156106445760405162461bcd60e51b81526004016101fd90614075565b600154604051630b38106960e11b81526001600160a01b039091169063167020d290610674908990600401613de6565b602060405180830381600087803b15801561068e57600080fd5b505af11580156106a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c69190613acf565b15156001146106e75760405162461bcd60e51b81526004016101fd9061412f565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f190610718908a90600401613de6565b60c06040518083038186803b15801561073057600080fd5b505afa158015610744573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107689190613baf565b90506107a78760405160200161077e9190613d22565b60405160208183030381529060405261079e61079984611554565b611594565b8860035461152e565b6003556040517fcec9ef675d775706a02b43afe48af52c5019bc50f99582e3208c6ff55d59c008906107da908990613de6565b60405180910390a15060005a8203905061081a6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561088057600080fd5b505af1158015610894573d6000803e3d6000fd5b5050505050505050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156109015781810151838201526020016108e9565b50505050905090810190601f16801561092e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561094b57600080fd5b505afa15801561095f573d6000803e3d6000fd5b505050506040513d602081101561097557600080fd5b505190505b919050565b60008060045460ff16600281111561099357fe5b146109b05760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a90506006546109c78661169d565b146109e45760405162461bcd60e51b81526004016101fd9061423a565b6103e88560a0015161040802816109f757fe5b04620186a0015a1015610a1c5760405162461bcd60e51b81526004016101fd906140d2565b6000610a536040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b8152506108a1565b600154604051631381ba4d60e01b81529192506001600160a01b031690631381ba4d90610a84908490600401613de6565b600060405180830381600087803b158015610a9e57600080fd5b505af1158015610ab2573d6000803e3d6000fd5b5050600154604051639be3ad6760e01b81526001600160a01b038086169450639be3ad679350610ae9928b929116906004016142ce565b600060405180830381600087803b158015610b0357600080fd5b505af1158015610b17573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b3f9190810190613b01565b50600154604051631381ba4d60e01b81526001600160a01b0390911690631381ba4d90610b7190600090600401613de6565b600060405180830381600087803b158015610b8b57600080fd5b505af1158015610b9f573d6000803e3d6000fd5b50506004805460ff191660011790555060009150505a82039050610be96040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b158015610c4f57600080fd5b505af1158015610c63573d6000803e3d6000fd5b50505050505050505050565b60025490565b60008060045460ff166002811115610c8957fe5b14610ca65760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a600154604051630ad2267960e01b81529192506001600160a01b031690630ad2267990610ce2908a908a90600401613dfa565b60206040518083038186803b158015610cfa57600080fd5b505afa158015610d0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d329190613acf565b15610d4f5760405162461bcd60e51b81526004016101fd90613eac565b60015460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf90610d7f908a90600401613de6565b60206040518083038186803b158015610d9757600080fd5b505afa158015610dab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcf9190613acf565b1515600114610df05760405162461bcd60e51b81526004016101fd90614271565b60015460405163136e2d8960e11b81526000916001600160a01b0316906326dc5b1290610e21908b90600401613de6565b60206040518083038186803b158015610e3957600080fd5b505afa158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e719190613ae9565b905060007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421821415610ea557506000610f02565b600080610ed28a604051602001610ebc9190613d3f565b6040516020818303038152906040528a866116b6565b909250905060018215151415610efa57610ef3610eee826116df565b6116f2565b9250610eff565b600092505b50505b600154604051635c17d62960e01b81526001600160a01b0390911690635c17d62990610f36908c908c908690600401613e13565b600060405180830381600087803b158015610f5057600080fd5b505af1158015610f64573d6000803e3d6000fd5b50505050505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b60018060045460ff166002811115610fb557fe5b14610fd25760405162461bcd60e51b81526004016101fd906141e9565b600160009054906101000a90046001600160a01b03166001600160a01b031663d7bd4a2a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561102057600080fd5b505afa158015611034573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110589190613ae9565b156110755760405162461bcd60e51b81526004016101fd90613f37565b600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156110c357600080fd5b505afa1580156110d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110fb9190613ae9565b156111185760405162461bcd60e51b81526004016101fd9061418c565b506004805460ff19166002179055565b60045460ff1681565b6000600260045460ff16600281111561114657fe5b14905090565b6001546001600160a01b031681565b60008060045460ff16600281111561116f57fe5b1461118c5760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a60015460405163c8e40fbf60e01b81529192506001600160a01b03169063c8e40fbf906111c6908a90600401613de6565b60206040518083038186803b1580156111de57600080fd5b505afa1580156111f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112169190613acf565b1580156112a057506001546040516307a1294560e01b81526001600160a01b03909116906307a129459061124e908a90600401613de6565b60206040518083038186803b15801561126657600080fd5b505afa15801561127a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129e9190613acf565b155b6112bc5760405162461bcd60e51b81526004016101fd90613ef1565b6000806112eb896040516020016112d39190613d22565b604051602081830303815290604052886002546116b6565b90925090506001821515141561140c57600061130682611721565b606081015190915089907fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470141561133f5750600061136a565b816060015161134d826117b3565b1461136a5760405162461bcd60e51b81526004016101fd90613ff2565b6001546040805160c08101825284518152602080860151908201528482015181830152606080860151908201526001600160a01b038481166080830152600060a08301529151638f3b964760e01b81529190921691638f3b9647916113d3918f91600401613e34565b600060405180830381600087803b1580156113ed57600080fd5b505af1158015611401573d6000803e3d6000fd5b50505050505061143c565b600154604051630d631c9d60e31b81526001600160a01b0390911690636b18e4e890610f36908c90600401613de6565b505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b60035490565b6060806000805b6020811085821a15161561149c5760019182019101611482565b5060405191506040820160405283600882021b60208301528060200382525080915050919050565b606080825160011480156114ec57506080836000815181106114e257fe5b016020015160f81c105b156114f8575081611528565b611504835160806117b7565b83604051602001611516929190613d48565b60405160208183030381529060405290505b92915050565b60008061153a86611906565b905061154881868686611936565b9150505b949350505050565b61155c613901565b604051806080016040528083600001518152602001836020015181526020018360400151815260200183606001518152509050919050565b60408051600480825260a0820190925260609160009190816020015b60608152602001906001900390816115b057505083519091506115d6906103ef9061147b565b816000815181106115e357fe5b60200260200101819052506116016103ef846020015160001b61147b565b8160018151811061160e57fe5b602002602001018190525061164583604001516040516020016116319190613d3f565b6040516020818303038152906040526114c4565b8160028151811061165257fe5b602002602001018190525061167583606001516040516020016116319190613d3f565b8160038151811061168257fe5b6020026020010181905250611696816119d2565b9392505050565b60006116a882611a16565b805190602001209050919050565b6000606060006116c586611906565b90506116d2818686611a51565b9250925050935093915050565b60606115286116ed83611b24565b611b49565b600080600060208451111561170857602061170b565b83515b6020858101519190036008021c92505050919050565b611729613901565b600061173483611bd8565b9050604051806080016040528061175e8360008151811061175157fe5b6020026020010151611beb565b81526020016117738360018151811061175157fe5b81526020016117958360028151811061178857fe5b6020026020010151611bf2565b81526020016117aa8360038151811061178857fe5b90529392505050565b3f90565b6060806038841015611811576040805160018082528183019092529060208201818036833701905050905082840160f81b816000815181106117f557fe5b60200101906001600160f81b031916908160001a905350611696565b600060015b80868161181f57fe5b04156118345760019091019061010002611816565b816001016001600160401b038111801561184d57600080fd5b506040519080825280601f01601f191660200182016040528015611878576020820181803683370190505b50925084820160370160f81b8360008151811061189157fe5b60200101906001600160f81b031916908160001a905350600190505b8181116118fd576101008183036101000a87816118c657fe5b04816118ce57fe5b0660f81b8382815181106118de57fe5b60200101906001600160f81b031916908160001a9053506001016118ad565b50509392505050565b606081805190602001206040516020016119209190613d3f565b6040516020818303038152906040529050919050565b6040805180820190915260018152600160ff1b60209091015260007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42182141561198a576119838585611cec565b905061154c565b600061199584611d10565b90506000806119a5838987611de6565b509150915060006119b984848b858c61218c565b90506119c5818a61256a565b9998505050505050505050565b606060006119df836126c3565b90506119ed815160c06117b7565b816040516020016119ff929190613d48565b604051602081830303815290604052915050919050565b6060816000015182602001518360400151846060015185608001518660a001518760c001516040516020016119209796959493929190613d77565b600060606000611a6085611d10565b90506000806000611a72848a89611de6565b81519295509093509150158080611a865750815b611ad7576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b600081611af35760405180602001604052806000815250611b12565b611b12866001870381518110611b0557fe5b60200260200101516127cc565b919b919a509098505050505050505050565b611b2c613928565b506040805180820190915281518152602082810190820152919050565b60606000806000611b59856127e8565b919450925090506000816001811115611b6e57fe5b14611bc0576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b611bcf85602001518484612b11565b95945050505050565b6060611528611be683611b24565b612bbe565b6000611528825b6000602182600001511115611c4e576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6000806000611c5c856127e8565b919450925090506000816001811115611c7157fe5b14611cc3576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b602080860151840180519091841015611ce25760208490036101000a90045b9695505050505050565b6000611d00611cfa84612d34565b83612e30565b5180516020909101209392505050565b60606000611d1d83611bd8565b9050600081516001600160401b0381118015611d3857600080fd5b50604051908082528060200260200182016040528015611d7257816020015b611d5f613942565b815260200190600190039081611d575790505b50905060005b8251811015611dde576000611d9f848381518110611d9257fe5b6020026020010151611b49565b90506040518060400160405280828152602001611dbb83611bd8565b815250838381518110611dca57fe5b602090810291909101015250600101611d78565b509392505050565b60006060818080611df687612d34565b905085600080611e04613942565b60005b8c51811015612164578c8181518110611e1c57fe5b6020026020010151915082840193506001870196508360001415611e9057815180516020909101208514611e8b576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b611f57565b815151602011611ef757815180516020909101208514611e8b576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b84611f058360000151612ec4565b14611f57576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b60208201515160111415611fc6578551841415611f7357612164565b6000868581518110611f8157fe5b602001015160f81c60f81b60f81c9050600083602001518260ff1681518110611fa657fe5b60200260200101519050611fb981612ef0565b965060019450505061215c565b6002826020015151141561210f576000611fdf83612f26565b9050600081600081518110611ff057fe5b016020015160f81c90506001811660020360006120108460ff8416612f44565b9050600061201e8b8a612f44565b9050600061202c8383612f71565b905060ff851660021480612043575060ff85166003145b15612075578083511480156120585750808251145b1561206257988901985b50600160ff1b9950612164945050505050565b60ff85161580612088575060ff85166001145b156120d857825181146120a85750600160ff1b9950612164945050505050565b6120c988602001516001815181106120bc57fe5b6020026020010151612ef0565b9a50975061215c945050505050565b60405162461bcd60e51b815260040180806020018281038252602681526020018061440d6026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b600101611e07565b50600160ff1b8414866121778786612f44565b909e909d50909b509950505050505050505050565b6060600083905060008760018803815181106121a457fe5b6020026020010151905060006121b982612fd7565b6040805160038082526080820190925291925060009190816020015b6121dd613942565b8152602001906001900390816121d5579050509050600080600284600281111561220357fe5b14156122cd578b51600090156122885760005b60018e51038110156122865760006122408f838151811061223357fe5b6020026020010151612fd7565b600281111561224b57fe5b141561225c5760019091019061227e565b6122788e828151811061226b57fe5b60200260200101516130ad565b51820191505b600101612216565b505b612291866130ad565b516122b561229e886130ad565b6122b06122aa8f612d34565b85612f44565b612f71565b1480156122c157508651155b156122cb57600191505b505b8015612307576122e56122df866130ad565b89612e30565b8383815181106122f157fe5b602002602001018190525060018201915061254b565b600084600281111561231557fe5b141561237e57855161234d5761232b85896130c0565b83838151811061233757fe5b6020026020010181905250600182019150612379565b8483838151811061235a57fe5b60200260200101819052506001820191506122e56122df876001612f44565b61254b565b6000612389866130ad565b905060006123978289612f71565b905080156123f85760006123ad8360008461310b565b90506123c1816123bc8d61325b565b61329c565b8686815181106123cd57fe5b60200260200101819052506001850194506123e88383612f44565b92506123f48983612f44565b9850505b60006124026132e0565b9050825160001415612427576124208161241b8a6127cc565b6130c0565b90506124bf565b60008360008151811061243657fe5b016020015160f81c905061244b846001612f44565b9350600288600281111561245b57fe5b1415612496576000612475856124708c6127cc565b612e30565b905061248e8383612489846000015161325b565b61336d565b9250506124bd565b8351156124ac576000612475856123bc8c6127cc565b6124ba82826124898c6127cc565b91505b505b88516124f4576124cf818c6130c0565b9050808686815181106124de57fe5b6020026020010181905250600185019450612547565b6124ff896001612f44565b98508086868151811061250e57fe5b6020026020010181905250600185019450612529898c612e30565b86868151811061253557fe5b60200260200101819052506001850194505b5050505b61255a8c60018d0385856133c6565b9c9b505050505050505050505050565b60008061257683612d34565b9050612580613942565b84516000906060905b80156126ae5787600182038151811061259e57fe5b602002602001015193506125b184612fd7565b925060028360028111156125c157fe5b14156125ec5760006125d2856130ad565b90506125e4866000835189510361310b565b955050612698565b60018360028111156125fa57fe5b141561263a57600061260b856130ad565b905061261d866000835189510361310b565b8351909650156126345761263185846134a8565b94505b50612698565b600083600281111561264857fe5b1415612698578151156126985760008560018751038151811061266757fe5b602001015160f81c60f81b60f81c9050612687866000600189510361310b565b955061269485828561336d565b9450505b83516126a39061325b565b915060001901612589565b50509051805160209091012095945050505050565b60608151600014156126e4575060408051600081526020810190915261097a565b6000805b8351811015612717578381815181106126fd57fe5b6020026020010151518201915080806001019150506126e8565b6000826001600160401b038111801561272f57600080fd5b506040519080825280601f01601f19166020018201604052801561275a576020820181803683370190505b50600092509050602081015b85518310156127c357600086848151811061277d57fe5b60200260200101519050600060208201905061279b83828451613554565b8785815181106127a757fe5b6020026020010151518301925050508280600101935050612766565b50949350505050565b60208101518051606091611528916000198101908110611d9257fe5b600080600080846000015111612845576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f811161286a576000600160009450945094505050612b0a565b60b781116128df578551607f1982019081106128cd576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b60019550935060009250612b0a915050565b60bf81116129c357855160b6198201908110612942576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a60018501510490508082018860000151116129ae576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b60019091019550935060009250612b0a915050565b60f78111612a3757855160bf198201908110612a26576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b600195509350849250612b0a915050565b855160f6198201908110612a92576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111612af7576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b6001918201965094509250612b0a915050565b9193909250565b60606000826001600160401b0381118015612b2b57600080fd5b506040519080825280601f01601f191660200182016040528015612b56576020820181803683370190505b509050805160001415612b6a579050611696565b8484016020820160005b60208604811015612b95578251825260209283019290910190600101612b74565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b6060600080612bcc846127e8565b91935090915060019050816001811115612be257fe5b14612c34576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b612c55613928565b815260200190600190039081612c4d5790505090506000835b8651811015612d295760208210612cb65760405162461bcd60e51b815260040180806020018281038252602a8152602001806143e3602a913960400191505060405180910390fd5b600080612ce26040518060400160405280858c60000151038152602001858c60200151018152506127e8565b509150915060405180604001604052808383018152602001848b6020015101815250858581518110612d1057fe5b6020908102919091010152600193909301920101612c6e565b508152949350505050565b6060600082516002026001600160401b0381118015612d5257600080fd5b506040519080825280601f01601f191660200182016040528015612d7d576020820181803683370190505b50905060005b8351811015612e29576004848281518110612d9a57fe5b602001015160f81c60f81b6001600160f81b031916901c828260020281518110612dc057fe5b60200101906001600160f81b031916908160001a9053506010848281518110612de557fe5b016020015160f81c81612df457fe5b0660f81b828260020260010181518110612e0a57fe5b60200101906001600160f81b031916908160001a905350600101612d83565b5092915050565b612e38613942565b60408051600280825260608201909252600091816020015b6060815260200190600190039081612e505790505090506000612e74856001613598565b9050612e826103ef826136ef565b82600081518110612e8f57fe5b6020026020010181905250612ea3846114c4565b82600181518110612eb057fe5b6020026020010181905250611bcf826137bf565b6000602082511015612edb5750602081015161097a565b81806020019051602081101561097557600080fd5b60006060602083600001511015612f1157612f0a836137ee565b9050612f1d565b612f1a83611b49565b90505b61169681612ec4565b6060611528612f3f8360200151600081518110611d9257fe5b612d34565b606082518210612f635750604080516020810190915260008152611528565b61169683838486510361310b565b6000805b808451118015612f855750808351115b8015612fca5750828181518110612f9857fe5b602001015160f81c60f81b6001600160f81b031916848281518110612fb957fe5b01602001516001600160f81b031916145b1561169657600101612f75565b60208101515160009060111415612ff05750600061097a565b6002826020015151141561306c57600061300983612f26565b905060008160008151811061301a57fe5b016020015160f81c90506002811480613036575060ff81166003145b156130465760029250505061097a565b60ff81161580613059575060ff81166001145b156130695760019250505061097a565b50505b6040805162461bcd60e51b8152602060048201526011602482015270496e76616c6964206e6f6465207479706560781b604482015290519081900360640190fd5b60606115286130bb83612f26565b6137f9565b6130c8613942565b60006130d3836114c4565b90506130de81611b24565b6020850151805160001981019081106130f357fe5b602002602001018190525061154c8460200151613842565b60608182601f011015613156576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b82828401101561319e576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b818301845110156131ea576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b60608215801561320957604051915060008252602082016040526127c3565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561324257805183526020928301920161322a565b5050858452601f01601f19166040525050949350505050565b606060208251101561326e57508061097a565b818051906020012060405160200180828152602001915050604051602081830303815290604052905061097a565b6132a4613942565b60408051600280825260608201909252600091816020015b60608152602001906001900390816132bc5790505090506000612e74856000613598565b6132e8613942565b6040805160118082526102408201909252600091816020015b606081526020019060019003908161330157905050905060005b815181101561335d57604051806040016040528060018152602001600160ff1b81525082828151811061334a57fe5b602090810291909101015260010161331b565b50613367816137bf565b91505090565b613375613942565b6000602083511061338e57613389836114c4565b613390565b825b905061339b81611b24565b85602001518560ff16815181106133ae57fe5b6020026020010181905250611bcf8560200151613842565b606060008285016001600160401b03811180156133e257600080fd5b5060405190808252806020026020018201604052801561341c57816020015b613409613942565b8152602001906001900390816134015790505b50905060005b8581101561345d5786818151811061343657fe5b602002602001015182828151811061344a57fe5b6020908102919091010152600101613422565b5060005b8381101561349e5784818151811061347557fe5b6020026020010151828783018151811061348b57fe5b6020908102919091010152600101613461565b5095945050505050565b6134b0613942565b60408051600280825260608201909252600091816020015b60608152602001906001900390816134c857905050905060006134f46134ed866130ad565b6000613598565b90506135026103ef826136ef565b8260008151811061350f57fe5b602002602001018190525060208451101561354257838260018151811061353257fe5b602002602001018190525061354b565b612ea3846114c4565b611bcf826137bf565b8282825b60208110613577578151835260209283019290910190601f1901613558565b905182516020929092036101000a6000190180199091169116179052505050565b60606000826135a85760006135ab565b60025b9050600060028551816135ba57fe5b06905060008160020360ff166001600160401b03811180156135db57600080fd5b506040519080825280601f01601f191660200182016040528015613606576020820181803683370190505b50905081830160f81b8160008151811061361c57fe5b60200101906001600160f81b031916908160001a90535080866040516020018083805190602001908083835b602083106136675780518252601f199092019160209182019101613648565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106136af5780518252601f199092019160209182019101613690565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052935050505092915050565b6060600060028351816136fe57fe5b046001600160401b038111801561371457600080fd5b506040519080825280601f01601f19166020018201604052801561373f576020820181803683370190505b50905060005b8151811015612e295783816002026001018151811061376057fe5b602001015160f81c60f81b600485836002028151811061377c57fe5b602001015160f81c60f81b6001600160f81b031916901b178282815181106137a057fe5b60200101906001600160f81b031916908160001a905350600101613745565b6137c7613942565b60006137d2836119d2565b905060405180604001604052808281526020016117aa83611bd8565b6060611528826138eb565b606060028260008151811061380a57fe5b016020015160f81c8161381957fe5b0660ff166000141561383757613830826002612f44565b905061097a565b613830826001612f44565b61384a613942565b600082516001600160401b038111801561386357600080fd5b5060405190808252806020026020018201604052801561389757816020015b60608152602001906001900390816138825790505b50905060005b83518110156138e1576138c28482815181106138b557fe5b60200260200101516137ee565b8282815181106138ce57fe5b602090810291909101015260010161389d565b50611696816137bf565b6060611528826020015160008460000151612b11565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060008152602001600081525090565b604051806040016040528060608152602001606081525090565b600061396f61396a84614379565b614356565b905082815283838301111561398357600080fd5b828260208301376000602084830101529392505050565b803561097a816143ca565b8051801515811461097a57600080fd5b600082601f8301126139c5578081fd5b6116968383356020850161395c565b80356002811061097a57600080fd5b6000806000606084860312156139f7578283fd5b8335613a02816143ca565b92506020840135613a12816143ca565b915060408401356001600160401b03811115613a2c578182fd5b613a38868287016139b5565b9150509250925092565b600080600060608486031215613a56578283fd5b8335613a61816143ca565b92506020840135915060408401356001600160401b03811115613a2c578182fd5b60008060408385031215613a94578182fd5b8235613a9f816143ca565b915060208301356001600160401b03811115613ab9578182fd5b613ac5858286016139b5565b9150509250929050565b600060208284031215613ae0578081fd5b611696826139a5565b600060208284031215613afa578081fd5b5051919050565b600060208284031215613b12578081fd5b81516001600160401b03811115613b27578182fd5b8201601f81018413613b37578182fd5b8051613b4561396a82614379565b818152856020838501011115613b59578384fd5b611bcf82602083016020860161439a565b600060208284031215613b7b578081fd5b81356001600160401b03811115613b90578182fd5b8201601f81018413613ba0578182fd5b61154c8482356020840161395c565b600060c08284031215613bc0578081fd5b60405160c081018181106001600160401b0382111715613bdc57fe5b8060405250825181526020830151602082015260408301516040820152606083015160608201526080830151613c11816143ca565b6080820152613c2260a084016139a5565b60a08201529392505050565b600060208284031215613c3f578081fd5b81356001600160401b0380821115613c55578283fd5b9083019060e08286031215613c68578283fd5b613c7260e0614356565b8235815260208301356020820152613c8c604084016139d4565b6040820152613c9d6060840161399a565b6060820152613cae6080840161399a565b608082015260a083013560a082015260c083013582811115613cce578485fd5b613cda878286016139b5565b60c08301525095945050505050565b6001600160a01b03169052565b60008151808452613d0e81602086016020860161439a565b601f01601f19169290920160200192915050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b90815260200190565b60008351613d5a81846020880161439a565b835190830190613d6e81836020880161439a565b01949350505050565b600088825287602083015260028710613d8c57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b166055840152508360698301528251613dd381608985016020870161439a565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b600060e08201905060018060a01b038085168352835160208401526020840151604084015260408401516060840152606084015160808401528060808501511660a08401525060a0830151151560c08301529392505050565b901515815260200190565b6020810160038310613ea657fe5b91905290565b60208082526025908201527f53746f7261676520736c6f742068617320616c7265616479206265656e20707260408201526437bb32b71760d91b606082015260800190565b60208082526026908201527f4163636f756e742073746174652068617320616c7265616479206265656e20706040820152653937bb32b71760d11b606082015260800190565b6020808252603e908201527f416c6c206163636f756e7473206d75737420626520636f6d6d6974746564206260408201527f65666f726520636f6d706c6574696e672061207472616e736974696f6e2e0000606082015260800190565b602080825260409082018190527f53746f7261676520736c6f742076616c7565207761736e2774206368616e6765908201527f64206f722068617320616c7265616479206265656e20636f6d6d69747465642e606082015260800190565b6020808252605b908201527f4f564d5f53746174655472616e736974696f6e65723a2050726f76696465642060408201527f4c3120636f6e747261637420636f6465206861736820646f6573206e6f74206d60608201527f61746368204c3220636f6e747261637420636f646520686173682e0000000000608082015260a00190565b6020808252603f908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d6d697474696e67206163636f756e74207374617465732e00606082015260800190565b60208082526038908201527f4e6f7420656e6f7567682067617320746f2065786563757465207472616e736160408201527f6374696f6e2064657465726d696e6973746963616c6c792e0000000000000000606082015260800190565b6020808252603b908201527f4163636f756e74207374617465207761736e2774206368616e676564206f722060408201527f68617320616c7265616479206265656e20636f6d6d69747465642e0000000000606082015260800190565b6020808252603d908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d706c6574696e672061207472616e736974696f6e2e000000606082015260800190565b60208082526031908201527f46756e6374696f6e206d7573742062652063616c6c656420647572696e67207460408201527034329031b7b93932b1ba10383430b9b29760791b606082015260800190565b6020808252601d908201527f496e76616c6964207472616e73616374696f6e2070726f76696465642e000000604082015260600190565b60208082526038908201527f436f6e7472616374206d757374206265207665726966696564206265666f726560408201527f2070726f76696e6720612073746f7261676520736c6f742e0000000000000000606082015260800190565b60006040825283516040830152602084015160608301526040840151600281106142f457fe5b60808381019190915260608501516001600160a01b031660a084015284015161432060c0840182613ce9565b5060a084015160e083015260c084015160e0610100840152614346610120840182613cf6565b9150506116966020830184613ce9565b6040518181016001600160401b038111828210171561437157fe5b604052919050565b60006001600160401b0382111561438c57fe5b50601f01601f191660200190565b60005b838110156143b557818101518382015260200161439d565b838111156143c4576000848401525b50505050565b6001600160a01b03811681146143df57600080fd5b5056fe50726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e52656365697665642061206e6f6465207769746820616e20756e6b6e6f776e20707265666978a264697066735822122098623b5d8a4c0fcdf15bfb72801372ca7a0d19e2a81bde8c6eed2b833d19284964736f6c634300070600334372656174652063616e206f6e6c7920626520646f6e6520627920746865204f564d5f467261756456657269666965722ea2646970667358221220dd4b9e8035653bfb395d28bfa466d3d87570bcf75ea8d58973b1d53f4783560f64736f6c63430007060033", "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", @@ -144,16 +144,16 @@ "storageLayout": { "storage": [ { - "astId": 12055, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_StateTransitionerFactory.sol:OVM_StateTransitionerFactory", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12048" + "type": "t_contract(Lib_AddressManager)15296" } ], "types": { - "t_contract(Lib_AddressManager)12048": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" diff --git a/packages/contracts/deployments/goerli/Proxy__OVM_L1CrossDomainMessenger.json b/packages/contracts/deployments/goerli/Proxy__OVM_L1CrossDomainMessenger.json index 52dce9d3c9a2..3e76b14ce8af 100644 --- a/packages/contracts/deployments/goerli/Proxy__OVM_L1CrossDomainMessenger.json +++ b/packages/contracts/deployments/goerli/Proxy__OVM_L1CrossDomainMessenger.json @@ -1,5 +1,5 @@ { - "address": "0xFec83764acDeEc2ac338d4cc1f12bBE3cCDf551E", + "address": "0xa85716330ff84Ab312D5B43F3BfDcC7E650fd88A", "abi": [ { "inputs": [ @@ -22,30 +22,30 @@ "type": "fallback" } ], - "transactionHash": "0xc796492651cfcf9c1e77eabc558db2473ee567fe03e3dbb6c8c7bccdd0a6cea9", + "transactionHash": "0xe0dfa1e88018e5a3c0f0e5219777aa6a922c2eb0b36b342f69de4ce20cb7026f", "receipt": { "to": null, - "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", - "contractAddress": "0xFec83764acDeEc2ac338d4cc1f12bBE3cCDf551E", - "transactionIndex": 6, + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0xa85716330ff84Ab312D5B43F3BfDcC7E650fd88A", + "transactionIndex": 4, "gasUsed": "225024", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xb3e0b0bffed18d30c6a9891532f9ac5f2c4b018603682fc6547b0a166c00e935", - "transactionHash": "0xc796492651cfcf9c1e77eabc558db2473ee567fe03e3dbb6c8c7bccdd0a6cea9", + "blockHash": "0xe5a35d55673493558298878c1a2f2ef3062c461af9822224491db9df2ffe8b21", + "transactionHash": "0xe0dfa1e88018e5a3c0f0e5219777aa6a922c2eb0b36b342f69de4ce20cb7026f", "logs": [], - "blockNumber": 4694109, - "cumulativeGasUsed": "4216864", + "blockNumber": 4974836, + "cumulativeGasUsed": "598352", "status": 1, "byzantium": true }, "args": [ - "0xE3d08F0D900A2D53cB794cf82d7127764BcC3092", + "0xA4346c8c120DdCE2c5447e68790625F10Bb4d47A", "OVM_L1CrossDomainMessenger" ], - "solcInputHash": "dde656dd41f49cad9eac9bc7065fd6a7", - "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\":\"payable\",\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x2ce671a0e004df88b136bea5a3c59d0732cea8887c8496da1d509e0200b03d7d\",\"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 // 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 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 payable\\n {\\n address target = addressManager[address(this)].getAddress(\\n (implementationName[address(this)])\\n );\\n\\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\":\"0xfaecb051b37f1d87d588cafb17a575723cbdf7c3c2079772110f33e747e05027\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506040516104083803806104088339818101604052604081101561003357600080fd5b81516020830180516040519294929383019291908464010000000082111561005a57600080fd5b90830190602082018581111561006f57600080fd5b825164010000000081118282018810171561008957600080fd5b82525081516020918201929091019080838360005b838110156100b657818101518382015260200161009e565b50505050905090810190601f1680156100e35780820380516001836020036101000a031916815260200191505b5060409081523060009081526001602090815282822080546001600160a01b0319166001600160a01b038a16179055818152919020855161012c95509093509085019150610134565b5050506101d5565b828054600181600116156101000203166002900490600052602060002090601f01602090048101928261016a57600085556101b0565b82601f1061018357805160ff19168380011785556101b0565b828001600101855582156101b0579182015b828111156101b0578251825591602001919060010190610195565b506101bc9291506101c0565b5090565b5b808211156101bc57600081556001016101c1565b610224806101e46000396000f3fe60806040818152306000908152600160208181528383205483825293832063bf40fac160e01b909552608490815284546002610100938216159390930260001901169190910460a481905291936001600160a01b039093169263bf40fac192909190819060c490849080156100b55780601f1061008a576101008083540402835291602001916100b5565b820191906000526020600020905b81548152906001019060200180831161009857829003601f168201915b50509250505060206040518083038186803b1580156100d357600080fd5b505afa1580156100e7573d6000803e3d6000fd5b505050506040513d60208110156100fd57600080fd5b505190506001600160a01b0381166101465760405162461bcd60e51b81526004018080602001828103825260238152602001806101cc6023913960400191505060405180910390fd5b600080826001600160a01b03166000366040518083838082843760405192019450600093509091505080830381855af49150503d80600081146101a5576040519150601f19603f3d011682016040523d82523d6000602084013e6101aa565b606091505b509092509050600182151514156101c357805160208201f35b805160208201fdfe5461726765742061646472657373206d75737420626520696e697469616c697a65642ea264697066735822122026d4992ed7562b49b7d3e306977cab94c29f8fb64a137b48d18960cc5ef1341d64736f6c63430007060033", - "deployedBytecode": "0x60806040818152306000908152600160208181528383205483825293832063bf40fac160e01b909552608490815284546002610100938216159390930260001901169190910460a481905291936001600160a01b039093169263bf40fac192909190819060c490849080156100b55780601f1061008a576101008083540402835291602001916100b5565b820191906000526020600020905b81548152906001019060200180831161009857829003601f168201915b50509250505060206040518083038186803b1580156100d357600080fd5b505afa1580156100e7573d6000803e3d6000fd5b505050506040513d60208110156100fd57600080fd5b505190506001600160a01b0381166101465760405162461bcd60e51b81526004018080602001828103825260238152602001806101cc6023913960400191505060405180910390fd5b600080826001600160a01b03166000366040518083838082843760405192019450600093509091505080830381855af49150503d80600081146101a5576040519150601f19603f3d011682016040523d82523d6000602084013e6101aa565b606091505b509092509050600182151514156101c357805160208201f35b805160208201fdfe5461726765742061646472657373206d75737420626520696e697469616c697a65642ea264697066735822122026d4992ed7562b49b7d3e306977cab94c29f8fb64a137b48d18960cc5ef1341d64736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"payable\",\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 // 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 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 payable\\n {\\n address target = addressManager[address(this)].getAddress(\\n (implementationName[address(this)])\\n );\\n\\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\":\"0xfaecb051b37f1d87d588cafb17a575723cbdf7c3c2079772110f33e747e05027\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516104083803806104088339818101604052604081101561003357600080fd5b81516020830180516040519294929383019291908464010000000082111561005a57600080fd5b90830190602082018581111561006f57600080fd5b825164010000000081118282018810171561008957600080fd5b82525081516020918201929091019080838360005b838110156100b657818101518382015260200161009e565b50505050905090810190601f1680156100e35780820380516001836020036101000a031916815260200191505b5060409081523060009081526001602090815282822080546001600160a01b0319166001600160a01b038a16179055818152919020855161012c95509093509085019150610134565b5050506101d5565b828054600181600116156101000203166002900490600052602060002090601f01602090048101928261016a57600085556101b0565b82601f1061018357805160ff19168380011785556101b0565b828001600101855582156101b0579182015b828111156101b0578251825591602001919060010190610195565b506101bc9291506101c0565b5090565b5b808211156101bc57600081556001016101c1565b610224806101e46000396000f3fe60806040818152306000908152600160208181528383205483825293832063bf40fac160e01b909552608490815284546002610100938216159390930260001901169190910460a481905291936001600160a01b039093169263bf40fac192909190819060c490849080156100b55780601f1061008a576101008083540402835291602001916100b5565b820191906000526020600020905b81548152906001019060200180831161009857829003601f168201915b50509250505060206040518083038186803b1580156100d357600080fd5b505afa1580156100e7573d6000803e3d6000fd5b505050506040513d60208110156100fd57600080fd5b505190506001600160a01b0381166101465760405162461bcd60e51b81526004018080602001828103825260238152602001806101cc6023913960400191505060405180910390fd5b600080826001600160a01b03166000366040518083838082843760405192019450600093509091505080830381855af49150503d80600081146101a5576040519150601f19603f3d011682016040523d82523d6000602084013e6101aa565b606091505b509092509050600182151514156101c357805160208201f35b805160208201fdfe5461726765742061646472657373206d75737420626520696e697469616c697a65642ea2646970667358221220d96dd78b72a44c11bfa8efb98d29ee53776a02c67052599da176325fcbf95b6464736f6c63430007060033", + "deployedBytecode": "0x60806040818152306000908152600160208181528383205483825293832063bf40fac160e01b909552608490815284546002610100938216159390930260001901169190910460a481905291936001600160a01b039093169263bf40fac192909190819060c490849080156100b55780601f1061008a576101008083540402835291602001916100b5565b820191906000526020600020905b81548152906001019060200180831161009857829003601f168201915b50509250505060206040518083038186803b1580156100d357600080fd5b505afa1580156100e7573d6000803e3d6000fd5b505050506040513d60208110156100fd57600080fd5b505190506001600160a01b0381166101465760405162461bcd60e51b81526004018080602001828103825260238152602001806101cc6023913960400191505060405180910390fd5b600080826001600160a01b03166000366040518083838082843760405192019450600093509091505080830381855af49150503d80600081146101a5576040519150601f19603f3d011682016040523d82523d6000602084013e6101aa565b606091505b509092509050600182151514156101c357805160208201f35b805160208201fdfe5461726765742061646472657373206d75737420626520696e697469616c697a65642ea2646970667358221220d96dd78b72a44c11bfa8efb98d29ee53776a02c67052599da176325fcbf95b6464736f6c63430007060033", "devdoc": { "kind": "dev", "methods": { @@ -67,7 +67,7 @@ "storageLayout": { "storage": [ { - "astId": 12092, + "astId": 15340, "contract": "contracts/optimistic-ethereum/libraries/resolver/Lib_ResolvedDelegateProxy.sol:Lib_ResolvedDelegateProxy", "label": "implementationName", "offset": 0, @@ -75,12 +75,12 @@ "type": "t_mapping(t_address,t_string_storage)" }, { - "astId": 12096, + "astId": 15344, "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)12048)" + "type": "t_mapping(t_address,t_contract(Lib_AddressManager)15296)" } ], "types": { @@ -89,17 +89,17 @@ "label": "address", "numberOfBytes": "20" }, - "t_contract(Lib_AddressManager)12048": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" }, - "t_mapping(t_address,t_contract(Lib_AddressManager)12048)": { + "t_mapping(t_address,t_contract(Lib_AddressManager)15296)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => contract Lib_AddressManager)", "numberOfBytes": "32", - "value": "t_contract(Lib_AddressManager)12048" + "value": "t_contract(Lib_AddressManager)15296" }, "t_mapping(t_address,t_string_storage)": { "encoding": "mapping", diff --git a/packages/contracts/deployments/goerli/Proxy__OVM_L1StandardBridge.json b/packages/contracts/deployments/goerli/Proxy__OVM_L1StandardBridge.json new file mode 100644 index 000000000000..24435c75cb3b --- /dev/null +++ b/packages/contracts/deployments/goerli/Proxy__OVM_L1StandardBridge.json @@ -0,0 +1,177 @@ +{ + "address": "0x74B6CC2F377fB769cEd6c697bC4C58a9c342E424", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "getImplementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_code", + "type": "bytes" + } + ], + "name": "setCode", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_key", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_value", + "type": "bytes32" + } + ], + "name": "setStorage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x6c7a156e03e06b3369ffb8da5f35098e86a28798fc2e8997bdb4db17fc713810", + "receipt": { + "to": null, + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0x74B6CC2F377fB769cEd6c697bC4C58a9c342E424", + "transactionIndex": 2, + "gasUsed": "471232", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x6c74f528d4d5cde8d499ae33483247f1c262543a5034e637593bc5bf4da42a9f", + "transactionHash": "0x6c7a156e03e06b3369ffb8da5f35098e86a28798fc2e8997bdb4db17fc713810", + "logs": [], + "blockNumber": 4974853, + "cumulativeGasUsed": "560758", + "status": 1, + "byzantium": true + }, + "args": [ + "0x18394B52d3Cb931dfA76F63251919D051953413d" + ], + "solcInputHash": "7531d7762a77038a37e7490a7b4b176f", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"getImplementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_code\",\"type\":\"bytes\"}],\"name\":\"setCode\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_key\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_value\",\"type\":\"bytes32\"}],\"name\":\"setStorage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Basic ChugSplash proxy contract for L1. Very close to being a normal proxy but has added functions `setCode` and `setStorage` for changing the code or storage of the contract. Nifty! Note for future developers: do NOT make anything in this contract 'public' unless you know what you're doing. Anything public can potentially have a function signature that conflicts with a signature attached to the implementation contract. Public functions SHOULD always have the 'proxyCallIfNotOwner' modifier unless there's some *really* good reason not to have that modifier. And there almost certainly is not a good reason to not have that modifier. Beware!\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_owner\":\"Address of the initial contract owner.\"}},\"getImplementation()\":{\"returns\":{\"_0\":\"Implementation address.\"}},\"getOwner()\":{\"returns\":{\"_0\":\"Owner address.\"}},\"setCode(bytes)\":{\"params\":{\"_code\":\"New contract code to run inside this contract.\"}},\"setOwner(address)\":{\"params\":{\"_owner\":\"New owner of the proxy contract.\"}},\"setStorage(bytes32,bytes32)\":{\"params\":{\"_key\":\"Storage key to modify.\",\"_value\":\"New value for the storage key.\"}}},\"title\":\"L1ChugSplashProxy\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getImplementation()\":{\"notice\":\"Queries the implementation address. Can only be called by the owner OR by making an eth_call and setting the \\\"from\\\" address to address(0).\"},\"getOwner()\":{\"notice\":\"Queries the owner of the proxy contract. Can only be called by the owner OR by making an eth_call and setting the \\\"from\\\" address to address(0).\"},\"setCode(bytes)\":{\"notice\":\"Sets the code that should be running behind this proxy. Note that this scheme is a bit different from the standard proxy scheme where one would typically deploy the code separately and then set the implementation address. We're doing it this way because it gives us a lot more freedom on the client side. Can only be triggered by the contract owner.\"},\"setOwner(address)\":{\"notice\":\"Changes the owner of the proxy contract. Only callable by the owner.\"},\"setStorage(bytes32,bytes32)\":{\"notice\":\"Modifies some storage slot within the proxy contract. Gives us a lot of power to perform upgrades in a more transparent way. Only callable by the owner.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/chugsplash/L1ChugSplashProxy.sol\":\"L1ChugSplashProxy\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/chugsplash/L1ChugSplashProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\nimport { iL1ChugSplashDeployer } from \\\"./interfaces/iL1ChugSplashDeployer.sol\\\";\\n\\n/**\\n * @title L1ChugSplashProxy\\n * @dev Basic ChugSplash proxy contract for L1. Very close to being a normal proxy but has added\\n * functions `setCode` and `setStorage` for changing the code or storage of the contract. Nifty!\\n *\\n * Note for future developers: do NOT make anything in this contract 'public' unless you know what\\n * you're doing. Anything public can potentially have a function signature that conflicts with a\\n * signature attached to the implementation contract. Public functions SHOULD always have the\\n * 'proxyCallIfNotOwner' modifier unless there's some *really* good reason not to have that\\n * modifier. And there almost certainly is not a good reason to not have that modifier. Beware!\\n */\\ncontract L1ChugSplashProxy {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n // \\\"Magic\\\" prefix. When prepended to some arbitrary bytecode and used to create a contract, the\\n // appended bytecode will be deployed as given.\\n bytes13 constant internal DEPLOY_CODE_PREFIX = 0x600D380380600D6000396000f3;\\n\\n // bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n bytes32 constant internal IMPLEMENTATION_KEY = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n // bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1)\\n bytes32 constant internal OWNER_KEY = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n \\n /**\\n * @param _owner Address of the initial contract owner.\\n */\\n constructor(\\n address _owner\\n ) {\\n _setOwner(_owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Blocks a function from being called when the parent signals that the system should be paused\\n * via an isUpgrading function.\\n */\\n modifier onlyWhenNotPaused() {\\n address owner = _getOwner();\\n\\n // We do a low-level call because there's no guarantee that the owner actually *is* an\\n // L1ChugSplashDeployer contract and Solidity will throw errors if we do a normal call and\\n // it turns out that it isn't the right type of contract.\\n (bool success, bytes memory returndata) = owner.staticcall(\\n abi.encodeWithSelector(\\n iL1ChugSplashDeployer.isUpgrading.selector\\n )\\n );\\n\\n // If the call was unsuccessful then we assume that there's no \\\"isUpgrading\\\" method and we\\n // can just continue as normal. We also expect that the return value is exactly 32 bytes\\n // long. If this isn't the case then we can safely ignore the result.\\n if (success && returndata.length == 32) {\\n // Although the expected value is a *boolean*, it's safer to decode as a uint256 in the\\n // case that the isUpgrading function returned something other than 0 or 1. But we only\\n // really care about the case where this value is 0 (= false).\\n uint256 ret = abi.decode(returndata, (uint256));\\n require(\\n ret == 0,\\n \\\"L1ChugSplashProxy: system is currently being upgraded\\\"\\n );\\n }\\n\\n _;\\n }\\n\\n /**\\n * Makes a proxy call instead of triggering the given function when the caller is either the\\n * owner or the zero address. Caller can only ever be the zero address if this function is\\n * being called off-chain via eth_call, which is totally fine and can be convenient for\\n * client-side tooling. Avoids situations where the proxy and implementation share a sighash\\n * and the proxy function ends up being called instead of the implementation one.\\n *\\n * Note: msg.sender == address(0) can ONLY be triggered off-chain via eth_call. If there's a\\n * way for someone to send a transaction with msg.sender == address(0) in any real context then\\n * we have much bigger problems. Primary reason to include this additional allowed sender is\\n * because the owner address can be changed dynamically and we do not want clients to have to\\n * keep track of the current owner in order to make an eth_call that doesn't trigger the\\n * proxied contract.\\n */\\n modifier proxyCallIfNotOwner() {\\n if (msg.sender == _getOwner() || msg.sender == address(0)) {\\n _;\\n } else {\\n // This WILL halt the call frame on completion.\\n _doProxyCall();\\n }\\n }\\n\\n\\n /*********************\\n * Fallback Function *\\n *********************/\\n\\n fallback()\\n external\\n payable\\n {\\n // Proxy call by default.\\n _doProxyCall();\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sets the code that should be running behind this proxy. Note that this scheme is a bit\\n * different from the standard proxy scheme where one would typically deploy the code\\n * separately and then set the implementation address. We're doing it this way because it gives\\n * us a lot more freedom on the client side. Can only be triggered by the contract owner.\\n * @param _code New contract code to run inside this contract.\\n */\\n function setCode(\\n bytes memory _code\\n )\\n proxyCallIfNotOwner\\n public\\n {\\n // Get the code hash of the current implementation.\\n address implementation = _getImplementation();\\n\\n // If the code hash matches the new implementation then we return early.\\n if (keccak256(_code) == _getAccountCodeHash(implementation)) {\\n return;\\n }\\n\\n // Create the deploycode by appending the magic prefix.\\n bytes memory deploycode = abi.encodePacked(\\n DEPLOY_CODE_PREFIX,\\n _code\\n );\\n\\n // Deploy the code and set the new implementation address.\\n address newImplementation;\\n assembly {\\n newImplementation := create(0x0, add(deploycode, 0x20), mload(deploycode))\\n }\\n\\n // Check that the code was actually deployed correctly. I'm not sure if you can ever\\n // actually fail this check. Should only happen if the contract creation from above runs\\n // out of gas but this parent execution thread does NOT run out of gas. Seems like we\\n // should be doing this check anyway though.\\n require(\\n _getAccountCodeHash(newImplementation) == keccak256(_code),\\n \\\"L1ChugSplashProxy: code was not correctly deployed.\\\"\\n );\\n\\n _setImplementation(newImplementation);\\n }\\n\\n /**\\n * Modifies some storage slot within the proxy contract. Gives us a lot of power to perform\\n * upgrades in a more transparent way. Only callable by the owner.\\n * @param _key Storage key to modify.\\n * @param _value New value for the storage key.\\n */\\n function setStorage(\\n bytes32 _key,\\n bytes32 _value\\n )\\n proxyCallIfNotOwner\\n public\\n {\\n assembly {\\n sstore(_key, _value)\\n }\\n }\\n\\n /**\\n * Changes the owner of the proxy contract. Only callable by the owner.\\n * @param _owner New owner of the proxy contract.\\n */\\n function setOwner(\\n address _owner\\n )\\n proxyCallIfNotOwner\\n public\\n {\\n _setOwner(_owner);\\n }\\n\\n /**\\n * Queries the owner of the proxy contract. Can only be called by the owner OR by making an\\n * eth_call and setting the \\\"from\\\" address to address(0).\\n * @return Owner address.\\n */\\n function getOwner()\\n proxyCallIfNotOwner\\n public\\n returns (\\n address\\n )\\n {\\n return _getOwner();\\n }\\n\\n /**\\n * Queries the implementation address. Can only be called by the owner OR by making an\\n * eth_call and setting the \\\"from\\\" address to address(0).\\n * @return Implementation address.\\n */\\n function getImplementation()\\n proxyCallIfNotOwner\\n public\\n returns (\\n address\\n )\\n {\\n return _getImplementation();\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Sets the implementation address.\\n * @param _implementation New implementation address.\\n */\\n function _setImplementation(\\n address _implementation\\n )\\n internal\\n {\\n assembly {\\n sstore(IMPLEMENTATION_KEY, _implementation)\\n }\\n }\\n\\n /**\\n * Queries the implementation address.\\n * @return Implementation address.\\n */\\n function _getImplementation()\\n internal\\n view\\n returns (\\n address\\n )\\n {\\n address implementation;\\n assembly {\\n implementation := sload(IMPLEMENTATION_KEY)\\n }\\n return implementation;\\n }\\n\\n /**\\n * Changes the owner of the proxy contract.\\n * @param _owner New owner of the proxy contract.\\n */\\n function _setOwner(\\n address _owner\\n )\\n internal\\n {\\n assembly {\\n sstore(OWNER_KEY, _owner)\\n }\\n }\\n\\n /**\\n * Queries the owner of the proxy contract.\\n * @return Owner address.\\n */\\n function _getOwner()\\n internal\\n view \\n returns (\\n address\\n )\\n {\\n address owner;\\n assembly {\\n owner := sload(OWNER_KEY)\\n }\\n return owner;\\n }\\n\\n /**\\n * Gets the code hash for a given account.\\n * @param _account Address of the account to get a code hash for.\\n * @return Code hash for the account.\\n */\\n function _getAccountCodeHash(\\n address _account\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n bytes32 codeHash;\\n assembly {\\n codeHash := extcodehash(_account)\\n }\\n return codeHash;\\n }\\n\\n /**\\n * Performs the proxy call via a delegatecall.\\n */\\n function _doProxyCall()\\n onlyWhenNotPaused\\n internal\\n {\\n address implementation = _getImplementation();\\n\\n require(\\n implementation != address(0),\\n \\\"L1ChugSplashProxy: implementation is not set yet\\\"\\n );\\n\\n assembly {\\n // Copy calldata into memory at 0x0....calldatasize.\\n calldatacopy(0x0, 0x0, calldatasize())\\n\\n // Perform the delegatecall, make sure to pass all available gas.\\n let success := delegatecall(gas(), implementation, 0x0, calldatasize(), 0x0, 0x0)\\n\\n // Copy returndata into memory at 0x0....returndatasize. Note that this *will*\\n // overwrite the calldata that we just copied into memory but that doesn't really\\n // matter because we'll be returning in a second anyway.\\n returndatacopy(0x0, 0x0, returndatasize())\\n \\n // Success == 0 means a revert. We'll revert too and pass the data up.\\n if iszero(success) {\\n revert(0x0, returndatasize())\\n }\\n\\n // Otherwise we'll just return and pass the data up.\\n return(0x0, returndatasize())\\n }\\n }\\n}\\n\",\"keccak256\":\"0x654af4f1d1aab76467c49fcce992eaf3522040ed806d656d98735c50ac235eeb\",\"license\":\"MIT\"},\"contracts/chugsplash/interfaces/iL1ChugSplashDeployer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title iL1ChugSplashDeployer\\n */\\ninterface iL1ChugSplashDeployer {\\n function isUpgrading()\\n external\\n view\\n returns (\\n bool\\n );\\n}\\n\",\"keccak256\":\"0xdab3ecb1ce03376523cd2f2ce5f991389c388829c56907987da01d99d3fc44c7\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516107983803806107988339818101604052602081101561003357600080fd5b505161003e81610044565b50610068565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610721806100776000396000f3fe60806040526004361061004a5760003560e01c806313af4035146100545780636c5d4ad014610087578063893d20e81461013a5780639b0b0fda1461016b578063aaf10f421461019b575b6100526101b0565b005b34801561006057600080fd5b506100526004803603602081101561007757600080fd5b50356001600160a01b031661036c565b34801561009357600080fd5b50610052600480360360208110156100aa57600080fd5b8101906020810181356401000000008111156100c557600080fd5b8201836020820111156100d757600080fd5b803590602001918460018302840111640100000000831117156100f957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506103af945050505050565b34801561014657600080fd5b5061014f610505565b604080516001600160a01b039092168252519081900360200190f35b34801561017757600080fd5b506100526004803603604081101561018e57600080fd5b508035906020013561054b565b3480156101a757600080fd5b5061014f610589565b60006101ba6105bd565b60408051600481526024810182526020810180516001600160e01b0316635bca393160e11b1781529151815193945060009384936001600160a01b0387169392918291908083835b602083106102215780518252601f199092019160209182019101610202565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114610281576040519150601f19603f3d011682016040523d82523d6000602084013e610286565b606091505b5091509150818015610299575080516020145b156102f85760008180602001905160208110156102b557600080fd5b5051905080156102f65760405162461bcd60e51b81526004018080602001828103825260358152602001806106b76035913960400191505060405180910390fd5b505b60006103026105e2565b90506001600160a01b0381166103495760405162461bcd60e51b81526004018080602001828103825260308152602001806106546030913960400191505060405180910390fd5b3660008037600080366000845af43d6000803e80610366573d6000fd5b503d6000f35b6103746105bd565b6001600160a01b0316336001600160a01b03161480610391575033155b156103a45761039f81610607565b6103ac565b6103ac6101b0565b50565b6103b76105bd565b6001600160a01b0316336001600160a01b031614806103d4575033155b156103a45760006103e36105e2565b90506103ee8161062b565b825160208401201415610401575061039f565b60006c600d380380600d6000396000f360981b83604051602001808372ffffffffffffffffffffffffffffffffffffff19168152600d0182805190602001908083835b602083106104635780518252601f199092019160209182019101610444565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052905060008151602083016000f0905083805190602001206104b88261062b565b146104f45760405162461bcd60e51b81526004018080602001828103825260338152602001806106846033913960400191505060405180910390fd5b6104fd8161062f565b5050506103ac565b600061050f6105bd565b6001600160a01b0316336001600160a01b0316148061052c575033155b15610540576105396105bd565b9050610548565b6105486101b0565b90565b6105536105bd565b6001600160a01b0316336001600160a01b03161480610570575033155b1561057d57808255610585565b6105856101b0565b5050565b60006105936105bd565b6001600160a01b0316336001600160a01b031614806105b0575033155b15610540576105396105e2565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b3f90565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe4c314368756753706c61736850726f78793a20696d706c656d656e746174696f6e206973206e6f7420736574207965744c314368756753706c61736850726f78793a20636f646520776173206e6f7420636f72726563746c79206465706c6f7965642e4c314368756753706c61736850726f78793a2073797374656d2069732063757272656e746c79206265696e67207570677261646564a26469706673582212202e20c1d0062b5a698d49624edce72a713b117e88f4cd70877869b53519c1d1f964736f6c63430007060033", + "deployedBytecode": "0x60806040526004361061004a5760003560e01c806313af4035146100545780636c5d4ad014610087578063893d20e81461013a5780639b0b0fda1461016b578063aaf10f421461019b575b6100526101b0565b005b34801561006057600080fd5b506100526004803603602081101561007757600080fd5b50356001600160a01b031661036c565b34801561009357600080fd5b50610052600480360360208110156100aa57600080fd5b8101906020810181356401000000008111156100c557600080fd5b8201836020820111156100d757600080fd5b803590602001918460018302840111640100000000831117156100f957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506103af945050505050565b34801561014657600080fd5b5061014f610505565b604080516001600160a01b039092168252519081900360200190f35b34801561017757600080fd5b506100526004803603604081101561018e57600080fd5b508035906020013561054b565b3480156101a757600080fd5b5061014f610589565b60006101ba6105bd565b60408051600481526024810182526020810180516001600160e01b0316635bca393160e11b1781529151815193945060009384936001600160a01b0387169392918291908083835b602083106102215780518252601f199092019160209182019101610202565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114610281576040519150601f19603f3d011682016040523d82523d6000602084013e610286565b606091505b5091509150818015610299575080516020145b156102f85760008180602001905160208110156102b557600080fd5b5051905080156102f65760405162461bcd60e51b81526004018080602001828103825260358152602001806106b76035913960400191505060405180910390fd5b505b60006103026105e2565b90506001600160a01b0381166103495760405162461bcd60e51b81526004018080602001828103825260308152602001806106546030913960400191505060405180910390fd5b3660008037600080366000845af43d6000803e80610366573d6000fd5b503d6000f35b6103746105bd565b6001600160a01b0316336001600160a01b03161480610391575033155b156103a45761039f81610607565b6103ac565b6103ac6101b0565b50565b6103b76105bd565b6001600160a01b0316336001600160a01b031614806103d4575033155b156103a45760006103e36105e2565b90506103ee8161062b565b825160208401201415610401575061039f565b60006c600d380380600d6000396000f360981b83604051602001808372ffffffffffffffffffffffffffffffffffffff19168152600d0182805190602001908083835b602083106104635780518252601f199092019160209182019101610444565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052905060008151602083016000f0905083805190602001206104b88261062b565b146104f45760405162461bcd60e51b81526004018080602001828103825260338152602001806106846033913960400191505060405180910390fd5b6104fd8161062f565b5050506103ac565b600061050f6105bd565b6001600160a01b0316336001600160a01b0316148061052c575033155b15610540576105396105bd565b9050610548565b6105486101b0565b90565b6105536105bd565b6001600160a01b0316336001600160a01b03161480610570575033155b1561057d57808255610585565b6105856101b0565b5050565b60006105936105bd565b6001600160a01b0316336001600160a01b031614806105b0575033155b15610540576105396105e2565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b3f90565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe4c314368756753706c61736850726f78793a20696d706c656d656e746174696f6e206973206e6f7420736574207965744c314368756753706c61736850726f78793a20636f646520776173206e6f7420636f72726563746c79206465706c6f7965642e4c314368756753706c61736850726f78793a2073797374656d2069732063757272656e746c79206265696e67207570677261646564a26469706673582212202e20c1d0062b5a698d49624edce72a713b117e88f4cd70877869b53519c1d1f964736f6c63430007060033", + "devdoc": { + "details": "Basic ChugSplash proxy contract for L1. Very close to being a normal proxy but has added functions `setCode` and `setStorage` for changing the code or storage of the contract. Nifty! Note for future developers: do NOT make anything in this contract 'public' unless you know what you're doing. Anything public can potentially have a function signature that conflicts with a signature attached to the implementation contract. Public functions SHOULD always have the 'proxyCallIfNotOwner' modifier unless there's some *really* good reason not to have that modifier. And there almost certainly is not a good reason to not have that modifier. Beware!", + "kind": "dev", + "methods": { + "constructor": { + "params": { + "_owner": "Address of the initial contract owner." + } + }, + "getImplementation()": { + "returns": { + "_0": "Implementation address." + } + }, + "getOwner()": { + "returns": { + "_0": "Owner address." + } + }, + "setCode(bytes)": { + "params": { + "_code": "New contract code to run inside this contract." + } + }, + "setOwner(address)": { + "params": { + "_owner": "New owner of the proxy contract." + } + }, + "setStorage(bytes32,bytes32)": { + "params": { + "_key": "Storage key to modify.", + "_value": "New value for the storage key." + } + } + }, + "title": "L1ChugSplashProxy", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "getImplementation()": { + "notice": "Queries the implementation address. Can only be called by the owner OR by making an eth_call and setting the \"from\" address to address(0)." + }, + "getOwner()": { + "notice": "Queries the owner of the proxy contract. Can only be called by the owner OR by making an eth_call and setting the \"from\" address to address(0)." + }, + "setCode(bytes)": { + "notice": "Sets the code that should be running behind this proxy. Note that this scheme is a bit different from the standard proxy scheme where one would typically deploy the code separately and then set the implementation address. We're doing it this way because it gives us a lot more freedom on the client side. Can only be triggered by the contract owner." + }, + "setOwner(address)": { + "notice": "Changes the owner of the proxy contract. Only callable by the owner." + }, + "setStorage(bytes32,bytes32)": { + "notice": "Modifies some storage slot within the proxy contract. Gives us a lot of power to perform upgrades in a more transparent way. Only callable by the owner." + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/goerli/mockOVM_BondManager.json b/packages/contracts/deployments/goerli/mockOVM_BondManager.json index 013c9656cb3f..4940d828a3d9 100644 --- a/packages/contracts/deployments/goerli/mockOVM_BondManager.json +++ b/packages/contracts/deployments/goerli/mockOVM_BondManager.json @@ -1,5 +1,5 @@ { - "address": "0x35a7735F9f517d071d5cFf89D11Ab4488bc5Df8C", + "address": "0x795F355F75f9B28AEC6cC6A887704191e630065b", "abi": [ { "inputs": [ @@ -173,29 +173,29 @@ "type": "function" } ], - "transactionHash": "0xd3ec4ca65af45c592fff0d78013702b253b1b3c8e1d1c76ccf17180dfa1f32ab", + "transactionHash": "0x3d67b72ee444b30d6677620a5416342f93b0bfe96baf3038e7915a31056b5635", "receipt": { "to": null, - "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", - "contractAddress": "0x35a7735F9f517d071d5cFf89D11Ab4488bc5Df8C", - "transactionIndex": 3, + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0x795F355F75f9B28AEC6cC6A887704191e630065b", + "transactionIndex": 4, "gasUsed": "298498", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x07330e15f5aa83781291ad50e573aa2edc5cb158477fcb8df5e1d0ddbd38415d", - "transactionHash": "0xd3ec4ca65af45c592fff0d78013702b253b1b3c8e1d1c76ccf17180dfa1f32ab", + "blockHash": "0x95ab51b2fda14d0ea98e15b45d8e5552658d3796080cfbd78e9baef2bd7d5fd9", + "transactionHash": "0x3d67b72ee444b30d6677620a5416342f93b0bfe96baf3038e7915a31056b5635", "logs": [], - "blockNumber": 4694104, - "cumulativeGasUsed": "1677808", + "blockNumber": 4974828, + "cumulativeGasUsed": "651309", "status": 1, "byzantium": true }, "args": [ - "0xE3d08F0D900A2D53cB794cf82d7127764BcC3092" + "0xA4346c8c120DdCE2c5447e68790625F10Bb4d47A" ], - "solcInputHash": "dde656dd41f49cad9eac9bc7065fd6a7", - "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\":\"_who\",\"type\":\"address\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"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\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"getGasSpent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_who\",\"type\":\"address\"}],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"startWithdrawal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}}},\"title\":\"mockOVM_BondManager\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/mockOVM/verification/mockOVM_BondManager.sol\":\"mockOVM_BondManager\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x2ce671a0e004df88b136bea5a3c59d0732cea8887c8496da1d509e0200b03d7d\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"license\":\"MIT\"},\"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 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_Proposer\\\");\\n }\\n\\n function getGasSpent(\\n bytes32, // _preStateRoot,\\n address // _who\\n )\\n override\\n public\\n pure\\n returns (\\n uint256\\n )\\n {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0xe649b49573ba5babca407f116e97dc13f24bf677cbcd03824a2eb98a7750c4e8\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506040516104673803806104678339818101604052602081101561003357600080fd5b5051600080546001600160a01b039092166001600160a01b0319909216919091179055610402806100656000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063abfbbe1311610066578063abfbbe1314610207578063bc2f8dd814610239578063c5b6aa2f14610239578063d0e30db014610239578063dc6453dc146102415761009e565b806302ad4d2a146100a35780631e16e92f146100dd5780631e83409a14610117578063299ca4781461013d578063461a447814610161575b600080fd5b6100c9600480360360208110156100b957600080fd5b50356001600160a01b031661027f565b604080519115158252519081900360200190f35b610115600480360360808110156100f357600080fd5b508035906020810135906001600160a01b0360408201351690606001356102c9565b005b6101156004803603602081101561012d57600080fd5b50356001600160a01b03166102cf565b6101456102d2565b604080516001600160a01b039092168252519081900360200190f35b6101456004803603602081101561017757600080fd5b81019060208101813564010000000081111561019257600080fd5b8201836020820111156101a457600080fd5b803590602001918460018302840111640100000000831117156101c657600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506102e1945050505050565b6101156004803603606081101561021d57600080fd5b508035906001600160a01b0360208201351690604001356103bd565b6101156103c2565b61026d6004803603604081101561025757600080fd5b50803590602001356001600160a01b03166103c4565b60408051918252519081900360200190f35b60006102ae6040518060400160405280600c81526020016b27ab26afa83937b837b9b2b960a11b8152506102e1565b6001600160a01b0316826001600160a01b0316149050919050565b50505050565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610341578181015183820152602001610329565b50505050905090810190601f16801561036e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561038b57600080fd5b505afa15801561039f573d6000803e3d6000fd5b505050506040513d60208110156103b557600080fd5b505192915050565b505050565b565b60009291505056fea264697066735822122023ce16ce6de3f7672940d40a33de4b777fbb7eaa3ec117bcace31640220db75d64736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061009e5760003560e01c8063abfbbe1311610066578063abfbbe1314610207578063bc2f8dd814610239578063c5b6aa2f14610239578063d0e30db014610239578063dc6453dc146102415761009e565b806302ad4d2a146100a35780631e16e92f146100dd5780631e83409a14610117578063299ca4781461013d578063461a447814610161575b600080fd5b6100c9600480360360208110156100b957600080fd5b50356001600160a01b031661027f565b604080519115158252519081900360200190f35b610115600480360360808110156100f357600080fd5b508035906020810135906001600160a01b0360408201351690606001356102c9565b005b6101156004803603602081101561012d57600080fd5b50356001600160a01b03166102cf565b6101456102d2565b604080516001600160a01b039092168252519081900360200190f35b6101456004803603602081101561017757600080fd5b81019060208101813564010000000081111561019257600080fd5b8201836020820111156101a457600080fd5b803590602001918460018302840111640100000000831117156101c657600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506102e1945050505050565b6101156004803603606081101561021d57600080fd5b508035906001600160a01b0360208201351690604001356103bd565b6101156103c2565b61026d6004803603604081101561025757600080fd5b50803590602001356001600160a01b03166103c4565b60408051918252519081900360200190f35b60006102ae6040518060400160405280600c81526020016b27ab26afa83937b837b9b2b960a11b8152506102e1565b6001600160a01b0316826001600160a01b0316149050919050565b50505050565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610341578181015183820152602001610329565b50505050905090810190601f16801561036e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561038b57600080fd5b505afa15801561039f573d6000803e3d6000fd5b505050506040513d60208110156103b557600080fd5b505192915050565b505050565b565b60009291505056fea264697066735822122023ce16ce6de3f7672940d40a33de4b777fbb7eaa3ec117bcace31640220db75d64736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"_who\",\"type\":\"address\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"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\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"getGasSpent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_who\",\"type\":\"address\"}],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"startWithdrawal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}}},\"title\":\"mockOVM_BondManager\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/mockOVM/verification/mockOVM_BondManager.sol\":\"mockOVM_BondManager\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"license\":\"MIT\"},\"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 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_Proposer\\\");\\n }\\n\\n function getGasSpent(\\n bytes32, // _preStateRoot,\\n address // _who\\n )\\n override\\n public\\n pure\\n returns (\\n uint256\\n )\\n {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0xe649b49573ba5babca407f116e97dc13f24bf677cbcd03824a2eb98a7750c4e8\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516104673803806104678339818101604052602081101561003357600080fd5b5051600080546001600160a01b039092166001600160a01b0319909216919091179055610402806100656000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063abfbbe1311610066578063abfbbe1314610207578063bc2f8dd814610239578063c5b6aa2f14610239578063d0e30db014610239578063dc6453dc146102415761009e565b806302ad4d2a146100a35780631e16e92f146100dd5780631e83409a14610117578063299ca4781461013d578063461a447814610161575b600080fd5b6100c9600480360360208110156100b957600080fd5b50356001600160a01b031661027f565b604080519115158252519081900360200190f35b610115600480360360808110156100f357600080fd5b508035906020810135906001600160a01b0360408201351690606001356102c9565b005b6101156004803603602081101561012d57600080fd5b50356001600160a01b03166102cf565b6101456102d2565b604080516001600160a01b039092168252519081900360200190f35b6101456004803603602081101561017757600080fd5b81019060208101813564010000000081111561019257600080fd5b8201836020820111156101a457600080fd5b803590602001918460018302840111640100000000831117156101c657600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506102e1945050505050565b6101156004803603606081101561021d57600080fd5b508035906001600160a01b0360208201351690604001356103bd565b6101156103c2565b61026d6004803603604081101561025757600080fd5b50803590602001356001600160a01b03166103c4565b60408051918252519081900360200190f35b60006102ae6040518060400160405280600c81526020016b27ab26afa83937b837b9b2b960a11b8152506102e1565b6001600160a01b0316826001600160a01b0316149050919050565b50505050565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610341578181015183820152602001610329565b50505050905090810190601f16801561036e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561038b57600080fd5b505afa15801561039f573d6000803e3d6000fd5b505050506040513d60208110156103b557600080fd5b505192915050565b505050565b565b60009291505056fea2646970667358221220c19aac7427cb83d5b9d44589a9b54252aad926befab3c327ae2aebfd25184a9464736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061009e5760003560e01c8063abfbbe1311610066578063abfbbe1314610207578063bc2f8dd814610239578063c5b6aa2f14610239578063d0e30db014610239578063dc6453dc146102415761009e565b806302ad4d2a146100a35780631e16e92f146100dd5780631e83409a14610117578063299ca4781461013d578063461a447814610161575b600080fd5b6100c9600480360360208110156100b957600080fd5b50356001600160a01b031661027f565b604080519115158252519081900360200190f35b610115600480360360808110156100f357600080fd5b508035906020810135906001600160a01b0360408201351690606001356102c9565b005b6101156004803603602081101561012d57600080fd5b50356001600160a01b03166102cf565b6101456102d2565b604080516001600160a01b039092168252519081900360200190f35b6101456004803603602081101561017757600080fd5b81019060208101813564010000000081111561019257600080fd5b8201836020820111156101a457600080fd5b803590602001918460018302840111640100000000831117156101c657600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506102e1945050505050565b6101156004803603606081101561021d57600080fd5b508035906001600160a01b0360208201351690604001356103bd565b6101156103c2565b61026d6004803603604081101561025757600080fd5b50803590602001356001600160a01b03166103c4565b60408051918252519081900360200190f35b60006102ae6040518060400160405280600c81526020016b27ab26afa83937b837b9b2b960a11b8152506102e1565b6001600160a01b0316826001600160a01b0316149050919050565b50505050565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610341578181015183820152602001610329565b50505050905090810190601f16801561036e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561038b57600080fd5b505afa15801561039f573d6000803e3d6000fd5b505050506040513d60208110156103b557600080fd5b505192915050565b505050565b565b60009291505056fea2646970667358221220c19aac7427cb83d5b9d44589a9b54252aad926befab3c327ae2aebfd25184a9464736f6c63430007060033", "devdoc": { "kind": "dev", "methods": { @@ -223,16 +223,16 @@ "storageLayout": { "storage": [ { - "astId": 12055, + "astId": 15303, "contract": "contracts/optimistic-ethereum/mockOVM/verification/mockOVM_BondManager.sol:mockOVM_BondManager", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12048" + "type": "t_contract(Lib_AddressManager)15296" } ], "types": { - "t_contract(Lib_AddressManager)12048": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" diff --git a/packages/contracts/deployments/goerli/solcInputs/7531d7762a77038a37e7490a7b4b176f.json b/packages/contracts/deployments/goerli/solcInputs/7531d7762a77038a37e7490a7b4b176f.json new file mode 100644 index 000000000000..e0264142f533 --- /dev/null +++ b/packages/contracts/deployments/goerli/solcInputs/7531d7762a77038a37e7490a7b4b176f.json @@ -0,0 +1,38 @@ +{ + "language": "Solidity", + "sources": { + "contracts/chugsplash/interfaces/iL1ChugSplashDeployer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title iL1ChugSplashDeployer\n */\ninterface iL1ChugSplashDeployer {\n function isUpgrading()\n external\n view\n returns (\n bool\n );\n}\n" + }, + "contracts/chugsplash/L1ChugSplashProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\nimport { iL1ChugSplashDeployer } from \"./interfaces/iL1ChugSplashDeployer.sol\";\n\n/**\n * @title L1ChugSplashProxy\n * @dev Basic ChugSplash proxy contract for L1. Very close to being a normal proxy but has added\n * functions `setCode` and `setStorage` for changing the code or storage of the contract. Nifty!\n *\n * Note for future developers: do NOT make anything in this contract 'public' unless you know what\n * you're doing. Anything public can potentially have a function signature that conflicts with a\n * signature attached to the implementation contract. Public functions SHOULD always have the\n * 'proxyCallIfNotOwner' modifier unless there's some *really* good reason not to have that\n * modifier. And there almost certainly is not a good reason to not have that modifier. Beware!\n */\ncontract L1ChugSplashProxy {\n\n /*************\n * Constants *\n *************/\n\n // \"Magic\" prefix. When prepended to some arbitrary bytecode and used to create a contract, the\n // appended bytecode will be deployed as given.\n bytes13 constant internal DEPLOY_CODE_PREFIX = 0x600D380380600D6000396000f3;\n\n // bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\n bytes32 constant internal IMPLEMENTATION_KEY = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n // bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1)\n bytes32 constant internal OWNER_KEY = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n\n /***************\n * Constructor *\n ***************/\n \n /**\n * @param _owner Address of the initial contract owner.\n */\n constructor(\n address _owner\n ) {\n _setOwner(_owner);\n }\n\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * Blocks a function from being called when the parent signals that the system should be paused\n * via an isUpgrading function.\n */\n modifier onlyWhenNotPaused() {\n address owner = _getOwner();\n\n // We do a low-level call because there's no guarantee that the owner actually *is* an\n // L1ChugSplashDeployer contract and Solidity will throw errors if we do a normal call and\n // it turns out that it isn't the right type of contract.\n (bool success, bytes memory returndata) = owner.staticcall(\n abi.encodeWithSelector(\n iL1ChugSplashDeployer.isUpgrading.selector\n )\n );\n\n // If the call was unsuccessful then we assume that there's no \"isUpgrading\" method and we\n // can just continue as normal. We also expect that the return value is exactly 32 bytes\n // long. If this isn't the case then we can safely ignore the result.\n if (success && returndata.length == 32) {\n // Although the expected value is a *boolean*, it's safer to decode as a uint256 in the\n // case that the isUpgrading function returned something other than 0 or 1. But we only\n // really care about the case where this value is 0 (= false).\n uint256 ret = abi.decode(returndata, (uint256));\n require(\n ret == 0,\n \"L1ChugSplashProxy: system is currently being upgraded\"\n );\n }\n\n _;\n }\n\n /**\n * Makes a proxy call instead of triggering the given function when the caller is either the\n * owner or the zero address. Caller can only ever be the zero address if this function is\n * being called off-chain via eth_call, which is totally fine and can be convenient for\n * client-side tooling. Avoids situations where the proxy and implementation share a sighash\n * and the proxy function ends up being called instead of the implementation one.\n *\n * Note: msg.sender == address(0) can ONLY be triggered off-chain via eth_call. If there's a\n * way for someone to send a transaction with msg.sender == address(0) in any real context then\n * we have much bigger problems. Primary reason to include this additional allowed sender is\n * because the owner address can be changed dynamically and we do not want clients to have to\n * keep track of the current owner in order to make an eth_call that doesn't trigger the\n * proxied contract.\n */\n modifier proxyCallIfNotOwner() {\n if (msg.sender == _getOwner() || msg.sender == address(0)) {\n _;\n } else {\n // This WILL halt the call frame on completion.\n _doProxyCall();\n }\n }\n\n\n /*********************\n * Fallback Function *\n *********************/\n\n fallback()\n external\n payable\n {\n // Proxy call by default.\n _doProxyCall();\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Sets the code that should be running behind this proxy. Note that this scheme is a bit\n * different from the standard proxy scheme where one would typically deploy the code\n * separately and then set the implementation address. We're doing it this way because it gives\n * us a lot more freedom on the client side. Can only be triggered by the contract owner.\n * @param _code New contract code to run inside this contract.\n */\n function setCode(\n bytes memory _code\n )\n proxyCallIfNotOwner\n public\n {\n // Get the code hash of the current implementation.\n address implementation = _getImplementation();\n\n // If the code hash matches the new implementation then we return early.\n if (keccak256(_code) == _getAccountCodeHash(implementation)) {\n return;\n }\n\n // Create the deploycode by appending the magic prefix.\n bytes memory deploycode = abi.encodePacked(\n DEPLOY_CODE_PREFIX,\n _code\n );\n\n // Deploy the code and set the new implementation address.\n address newImplementation;\n assembly {\n newImplementation := create(0x0, add(deploycode, 0x20), mload(deploycode))\n }\n\n // Check that the code was actually deployed correctly. I'm not sure if you can ever\n // actually fail this check. Should only happen if the contract creation from above runs\n // out of gas but this parent execution thread does NOT run out of gas. Seems like we\n // should be doing this check anyway though.\n require(\n _getAccountCodeHash(newImplementation) == keccak256(_code),\n \"L1ChugSplashProxy: code was not correctly deployed.\"\n );\n\n _setImplementation(newImplementation);\n }\n\n /**\n * Modifies some storage slot within the proxy contract. Gives us a lot of power to perform\n * upgrades in a more transparent way. Only callable by the owner.\n * @param _key Storage key to modify.\n * @param _value New value for the storage key.\n */\n function setStorage(\n bytes32 _key,\n bytes32 _value\n )\n proxyCallIfNotOwner\n public\n {\n assembly {\n sstore(_key, _value)\n }\n }\n\n /**\n * Changes the owner of the proxy contract. Only callable by the owner.\n * @param _owner New owner of the proxy contract.\n */\n function setOwner(\n address _owner\n )\n proxyCallIfNotOwner\n public\n {\n _setOwner(_owner);\n }\n\n /**\n * Queries the owner of the proxy contract. Can only be called by the owner OR by making an\n * eth_call and setting the \"from\" address to address(0).\n * @return Owner address.\n */\n function getOwner()\n proxyCallIfNotOwner\n public\n returns (\n address\n )\n {\n return _getOwner();\n }\n\n /**\n * Queries the implementation address. Can only be called by the owner OR by making an\n * eth_call and setting the \"from\" address to address(0).\n * @return Implementation address.\n */\n function getImplementation()\n proxyCallIfNotOwner\n public\n returns (\n address\n )\n {\n return _getImplementation();\n }\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Sets the implementation address.\n * @param _implementation New implementation address.\n */\n function _setImplementation(\n address _implementation\n )\n internal\n {\n assembly {\n sstore(IMPLEMENTATION_KEY, _implementation)\n }\n }\n\n /**\n * Queries the implementation address.\n * @return Implementation address.\n */\n function _getImplementation()\n internal\n view\n returns (\n address\n )\n {\n address implementation;\n assembly {\n implementation := sload(IMPLEMENTATION_KEY)\n }\n return implementation;\n }\n\n /**\n * Changes the owner of the proxy contract.\n * @param _owner New owner of the proxy contract.\n */\n function _setOwner(\n address _owner\n )\n internal\n {\n assembly {\n sstore(OWNER_KEY, _owner)\n }\n }\n\n /**\n * Queries the owner of the proxy contract.\n * @return Owner address.\n */\n function _getOwner()\n internal\n view \n returns (\n address\n )\n {\n address owner;\n assembly {\n owner := sload(OWNER_KEY)\n }\n return owner;\n }\n\n /**\n * Gets the code hash for a given account.\n * @param _account Address of the account to get a code hash for.\n * @return Code hash for the account.\n */\n function _getAccountCodeHash(\n address _account\n )\n internal\n view\n returns (\n bytes32\n )\n {\n bytes32 codeHash;\n assembly {\n codeHash := extcodehash(_account)\n }\n return codeHash;\n }\n\n /**\n * Performs the proxy call via a delegatecall.\n */\n function _doProxyCall()\n onlyWhenNotPaused\n internal\n {\n address implementation = _getImplementation();\n\n require(\n implementation != address(0),\n \"L1ChugSplashProxy: implementation is not set yet\"\n );\n\n assembly {\n // Copy calldata into memory at 0x0....calldatasize.\n calldatacopy(0x0, 0x0, calldatasize())\n\n // Perform the delegatecall, make sure to pass all available gas.\n let success := delegatecall(gas(), implementation, 0x0, calldatasize(), 0x0, 0x0)\n\n // Copy returndata into memory at 0x0....returndatasize. Note that this *will*\n // overwrite the calldata that we just copied into memory but that doesn't really\n // matter because we'll be returning in a second anyway.\n returndatacopy(0x0, 0x0, returndatasize())\n \n // Success == 0 means a revert. We'll revert too and pass the data up.\n if iszero(success) {\n revert(0x0, returndatasize())\n }\n\n // Otherwise we'll just return and pass the data up.\n return(0x0, returndatasize())\n }\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "storageLayout", + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/goerli/solcInputs/ef3f334bac4d7e77d91b457a0d89ab0a.json b/packages/contracts/deployments/goerli/solcInputs/ef3f334bac4d7e77d91b457a0d89ab0a.json new file mode 100644 index 000000000000..dfd91954d94a --- /dev/null +++ b/packages/contracts/deployments/goerli/solcInputs/ef3f334bac4d7e77d91b457a0d89ab0a.json @@ -0,0 +1,338 @@ +{ + "language": "Solidity", + "sources": { + "contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_CrossDomainMessenger.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/**\n * @title iOVM_CrossDomainMessenger\n */\ninterface iOVM_CrossDomainMessenger {\n\n /**********\n * Events *\n **********/\n\n event SentMessage(bytes message);\n event RelayedMessage(bytes32 msgHash);\n event FailedRelayedMessage(bytes32 msgHash);\n\n\n /*************\n * Variables *\n *************/\n\n function xDomainMessageSender() external view returns (address);\n\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/libraries/bridge/OVM_CrossDomainEnabled.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Interface Imports */\nimport { iOVM_CrossDomainMessenger } from \"../../iOVM/bridge/messaging/iOVM_CrossDomainMessenger.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\n /*************\n * Variables *\n *************/\n\n // Messenger contract used to send and recieve messages from the other domain.\n address public messenger;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _messenger Address of the CrossDomainMessenger on the current layer.\n */\n constructor(\n address _messenger\n ) {\n messenger = _messenger;\n }\n\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * 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\n * 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 /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Gets the messenger, usually from storage. This function is exposed in case a child contract\n * 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 iOVM_CrossDomainMessenger\n )\n {\n return iOVM_CrossDomainMessenger(messenger);\n }\n\n /**\n * Sends a message to an account on another domain\n * @param _crossDomainTarget The intended recipient on the destination domain\n * @param _message The data to send to the target (usually calldata to a function with\n * `onlyFromCrossDomainAccount()`)\n * @param _gasLimit The gasLimit for the receipt of the message on the target domain.\n */\n function sendCrossDomainMessage(\n address _crossDomainTarget,\n uint32 _gasLimit,\n bytes memory _message\n )\n internal\n {\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit);\n }\n}\n" + }, + "contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L2StandardBridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Interface Imports */\nimport { iOVM_L1StandardBridge } from \"../../../iOVM/bridge/tokens/iOVM_L1StandardBridge.sol\";\nimport { iOVM_L1ERC20Bridge } from \"../../../iOVM/bridge/tokens/iOVM_L1ERC20Bridge.sol\";\nimport { iOVM_L2ERC20Bridge } from \"../../../iOVM/bridge/tokens/iOVM_L2ERC20Bridge.sol\";\n\n/* Library Imports */\nimport { ERC165Checker } from \"@openzeppelin/contracts/introspection/ERC165Checker.sol\";\nimport { OVM_CrossDomainEnabled } from \"../../../libraries/bridge/OVM_CrossDomainEnabled.sol\";\nimport { Lib_PredeployAddresses } from \"../../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Contract Imports */\nimport { IL2StandardERC20 } from \"../../../libraries/standards/IL2StandardERC20.sol\";\n\n/**\n * @title OVM_L2StandardBridge\n * @dev The L2 Standard bridge is a contract which works together with the L1 Standard bridge to enable\n * ETH and ERC20 transitions between L1 and L2.\n * This contract acts as a minter for new tokens when it hears about deposits into the L1 Standard bridge.\n * This contract also acts as a burner of the tokens intended for withdrawal, informing the L1 bridge to release L1 funds.\n *\n * Compiler used: optimistic-solc\n * Runtime target: OVM\n */\ncontract OVM_L2StandardBridge is iOVM_L2ERC20Bridge, OVM_CrossDomainEnabled {\n\n /********************************\n * External Contract References *\n ********************************/\n\n address public l1TokenBridge;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _l2CrossDomainMessenger Cross-domain messenger used by this contract.\n * @param _l1TokenBridge Address of the L1 bridge deployed to the main chain.\n */\n constructor(\n address _l2CrossDomainMessenger,\n address _l1TokenBridge\n )\n OVM_CrossDomainEnabled(_l2CrossDomainMessenger)\n {\n l1TokenBridge = _l1TokenBridge;\n }\n\n /***************\n * Withdrawing *\n ***************/\n\n /**\n * @inheritdoc iOVM_L2ERC20Bridge\n */\n function withdraw(\n address _l2Token,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n )\n external\n override\n virtual\n {\n _initiateWithdrawal(\n _l2Token,\n msg.sender,\n msg.sender,\n _amount,\n _l1Gas,\n _data\n );\n }\n\n /**\n * @inheritdoc iOVM_L2ERC20Bridge\n */\n function withdrawTo(\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n )\n external\n override\n virtual\n {\n _initiateWithdrawal(\n _l2Token,\n msg.sender,\n _to,\n _amount,\n _l1Gas,\n _data\n );\n }\n\n /**\n * @dev Performs the logic for deposits by storing the token and informing the L2 token Gateway of the deposit.\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _from Account to pull the deposit from on L2.\n * @param _to Account to give the withdrawal to on L1.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function _initiateWithdrawal(\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n )\n internal\n {\n // When a withdrawal is initiated, we burn the withdrawer's funds to prevent subsequent L2 usage\n IL2StandardERC20(_l2Token).burn(msg.sender, _amount);\n\n // Construct calldata for l1TokenBridge.finalizeERC20Withdrawal(_to, _amount)\n address l1Token = IL2StandardERC20(_l2Token).l1Token();\n bytes memory message;\n\n if (_l2Token == Lib_PredeployAddresses.OVM_ETH) {\n message = abi.encodeWithSelector(\n iOVM_L1StandardBridge.finalizeETHWithdrawal.selector,\n _from,\n _to,\n _amount,\n _data\n );\n } else {\n message = abi.encodeWithSelector(\n iOVM_L1ERC20Bridge.finalizeERC20Withdrawal.selector,\n l1Token,\n _l2Token,\n _from,\n _to,\n _amount,\n _data\n );\n }\n\n // Send message up to L1 bridge\n sendCrossDomainMessage(\n l1TokenBridge,\n _l1Gas,\n message\n );\n\n emit WithdrawalInitiated(l1Token, _l2Token, msg.sender, _to, _amount, _data);\n }\n\n /************************************\n * Cross-chain Function: Depositing *\n ************************************/\n\n /**\n * @inheritdoc iOVM_L2ERC20Bridge\n */\n function finalizeDeposit(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n )\n external\n override\n virtual\n onlyFromCrossDomainAccount(l1TokenBridge)\n {\n // Check the target token is compliant and\n // verify the deposited token on L1 matches the L2 deposited token representation here\n if (\n ERC165Checker.supportsInterface(_l2Token, 0x1d1d8b63) &&\n _l1Token == IL2StandardERC20(_l2Token).l1Token()\n ) {\n // When a deposit is finalized, we credit the account on L2 with the same amount of tokens.\n IL2StandardERC20(_l2Token).mint(_to, _amount);\n emit DepositFinalized(_l1Token, _l2Token, _from, _to, _amount, _data);\n } else {\n // Either the L2 token which is being deposited-into disagrees about the correct address\n // of its L1 token, or does not support the correct interface.\n // This should only happen if there is a malicious L2 token, or if a user somehow\n // specified the wrong L2 token address to deposit into.\n // In either case, we stop the process here and construct a withdrawal\n // message so that users can get their funds out in some cases.\n // There is no way to prevent malicious token contracts altogether, but this does limit\n // user error and mitigate some forms of malicious contract behavior.\n bytes memory message = abi.encodeWithSelector(\n iOVM_L1ERC20Bridge.finalizeERC20Withdrawal.selector,\n _l1Token,\n _l2Token,\n _to, // switched the _to and _from here to bounce back the deposit to the sender\n _from,\n _amount,\n _data\n );\n\n // Send message up to L1 bridge\n sendCrossDomainMessage(\n l1TokenBridge,\n 0,\n message\n );\n emit DepositFailed(_l1Token, _l2Token, _from, _to, _amount, _data);\n }\n }\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1StandardBridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0;\npragma experimental ABIEncoderV2;\n\nimport './iOVM_L1ERC20Bridge.sol';\n\n/**\n * @title iOVM_L1StandardBridge\n */\ninterface iOVM_L1StandardBridge is iOVM_L1ERC20Bridge {\n\n /**********\n * Events *\n **********/\n event ETHDepositInitiated (\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n event ETHWithdrawalFinalized (\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n \n /**\n * @dev Deposit an amount of the ETH to the caller's balance on L2.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETH (\n uint32 _l2Gas,\n bytes calldata _data\n )\n external\n payable;\n\n /**\n * @dev Deposit an amount of ETH to a recipient's balance on L2.\n * @param _to L2 address to credit the withdrawal to.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETHTo (\n address _to,\n uint32 _l2Gas,\n bytes calldata _data\n )\n external\n payable;\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 ETH token.\n * Since only the xDomainMessenger can call this function, it will never be called before the withdrawal is finalized.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeETHWithdrawal (\n address _from,\n address _to,\n uint _amount,\n bytes calldata _data\n )\n external;\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1ERC20Bridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0;\npragma experimental ABIEncoderV2;\n\n/**\n * @title iOVM_L1ERC20Bridge\n */\ninterface iOVM_L1ERC20Bridge {\n\n /**********\n * Events *\n **********/\n\n event ERC20DepositInitiated (\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event ERC20WithdrawalFinalized (\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev deposit an amount of the ERC20 to the caller's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _amount Amount of the ERC20 to deposit\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20 (\n address _l1Token,\n address _l2Token,\n uint _amount,\n uint32 _l2Gas,\n bytes calldata _data\n )\n external;\n\n /**\n * @dev deposit an amount of ERC20 to a recipient's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _to L2 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20To (\n address _l1Token,\n address _l2Token,\n address _to,\n uint _amount,\n uint32 _l2Gas,\n bytes calldata _data\n )\n external;\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 _l1Token Address of L1 token to finalizeWithdrawal for.\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Data provided by the sender on L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeERC20Withdrawal (\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint _amount,\n bytes calldata _data\n )\n external;\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L2ERC20Bridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0;\npragma experimental ABIEncoderV2;\n\n/**\n * @title iOVM_L2ERC20Bridge\n */\ninterface iOVM_L2ERC20Bridge {\n\n /**********\n * Events *\n **********/\n\n event WithdrawalInitiated (\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFinalized (\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFailed (\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev initiate a withdraw of some tokens to the caller's account on L1\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdraw (\n address _l2Token,\n uint _amount,\n uint32 _l1Gas,\n bytes calldata _data\n )\n external;\n\n /**\n * @dev initiate a withdraw of some token to a recipient's account on L1.\n * @param _l2Token Address of L2 token where withdrawal is initiated.\n * @param _to L1 adress to credit the withdrawal to.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdrawTo (\n address _l2Token,\n address _to,\n uint _amount,\n uint32 _l1Gas,\n bytes calldata _data\n )\n external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a deposit from L1 to L2, and credits funds to the recipient's balance of this\n * L2 token.\n * This call will fail if it did not originate from a corresponding deposit in OVM_l1TokenGateway.\n * @param _l1Token Address for the l1 token this is called with\n * @param _l2Token Address for the l2 token this is called with\n * @param _from Account to pull the deposit from on L2.\n * @param _to Address to receive the withdrawal at\n * @param _amount Amount of the token to withdraw\n * @param _data Data provider by the sender on L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeDeposit (\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint _amount,\n bytes calldata _data\n )\n external;\n\n}\n" + }, + "@openzeppelin/contracts/introspection/ERC165Checker.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.2 <0.8.0;\n\n/**\n * @dev Library used to query support of an interface declared via {IERC165}.\n *\n * Note that these functions return the actual result of the query: they do not\n * `revert` if an interface is not supported. It is up to the caller to decide\n * what to do in these cases.\n */\nlibrary ERC165Checker {\n // As per the EIP-165 spec, no interface should ever match 0xffffffff\n bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;\n\n /*\n * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7\n */\n bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;\n\n /**\n * @dev Returns true if `account` supports the {IERC165} interface,\n */\n function supportsERC165(address account) internal view returns (bool) {\n // Any contract that implements ERC165 must explicitly indicate support of\n // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid\n return _supportsERC165Interface(account, _INTERFACE_ID_ERC165) &&\n !_supportsERC165Interface(account, _INTERFACE_ID_INVALID);\n }\n\n /**\n * @dev Returns true if `account` supports the interface defined by\n * `interfaceId`. Support for {IERC165} itself is queried automatically.\n *\n * See {IERC165-supportsInterface}.\n */\n function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {\n // query support of both ERC165 as per the spec and support of _interfaceId\n return supportsERC165(account) &&\n _supportsERC165Interface(account, interfaceId);\n }\n\n /**\n * @dev Returns a boolean array where each value corresponds to the\n * interfaces passed in and whether they're supported or not. This allows\n * you to batch check interfaces for a contract where your expectation\n * is that some interfaces may not be supported.\n *\n * See {IERC165-supportsInterface}.\n *\n * _Available since v3.4._\n */\n function getSupportedInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool[] memory) {\n // an array of booleans corresponding to interfaceIds and whether they're supported or not\n bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);\n\n // query support of ERC165 itself\n if (supportsERC165(account)) {\n // query support of each interface in interfaceIds\n for (uint256 i = 0; i < interfaceIds.length; i++) {\n interfaceIdsSupported[i] = _supportsERC165Interface(account, interfaceIds[i]);\n }\n }\n\n return interfaceIdsSupported;\n }\n\n /**\n * @dev Returns true if `account` supports all the interfaces defined in\n * `interfaceIds`. Support for {IERC165} itself is queried automatically.\n *\n * Batch-querying can lead to gas savings by skipping repeated checks for\n * {IERC165} support.\n *\n * See {IERC165-supportsInterface}.\n */\n function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {\n // query support of ERC165 itself\n if (!supportsERC165(account)) {\n return false;\n }\n\n // query support of each interface in _interfaceIds\n for (uint256 i = 0; i < interfaceIds.length; i++) {\n if (!_supportsERC165Interface(account, interfaceIds[i])) {\n return false;\n }\n }\n\n // all interfaces supported\n return true;\n }\n\n /**\n * @notice Query if a contract implements an interface, does not check ERC165 support\n * @param account The address of the contract to query for support of an interface\n * @param interfaceId The interface identifier, as specified in ERC-165\n * @return true if the contract at account indicates support of the interface with\n * identifier interfaceId, false otherwise\n * @dev Assumes that account contains a contract that supports ERC165, otherwise\n * the behavior of this method is undefined. This precondition can be checked\n * with {supportsERC165}.\n * Interface identification is specified in ERC-165.\n */\n function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) {\n // success determines whether the staticcall succeeded and result determines\n // whether the contract at account indicates support of _interfaceId\n (bool success, bool result) = _callERC165SupportsInterface(account, interfaceId);\n\n return (success && result);\n }\n\n /**\n * @notice Calls the function with selector 0x01ffc9a7 (ERC165) and suppresses throw\n * @param account The address of the contract to query for support of an interface\n * @param interfaceId The interface identifier, as specified in ERC-165\n * @return success true if the STATICCALL succeeded, false otherwise\n * @return result true if the STATICCALL succeeded and the contract at account\n * indicates support of the interface with identifier interfaceId, false otherwise\n */\n function _callERC165SupportsInterface(address account, bytes4 interfaceId)\n private\n view\n returns (bool, bool)\n {\n bytes memory encodedParams = abi.encodeWithSelector(_INTERFACE_ID_ERC165, interfaceId);\n (bool success, bytes memory result) = account.staticcall{ gas: 30000 }(encodedParams);\n if (result.length < 32) return (false, false);\n return (success, abi.decode(result, (bool)));\n }\n}\n" + }, + "contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title Lib_PredeployAddresses\n */\nlibrary Lib_PredeployAddresses {\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\n address internal constant ECDSA_CONTRACT_ACCOUNT = 0x4200000000000000000000000000000000000003;\n address internal constant SEQUENCER_ENTRYPOINT = 0x4200000000000000000000000000000000000005;\n address payable internal constant OVM_ETH = 0x4200000000000000000000000000000000000006;\n address internal constant L2_CROSS_DOMAIN_MESSENGER = 0x4200000000000000000000000000000000000007;\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\n address internal constant EXECUTION_MANAGER_WRAPPER = 0x420000000000000000000000000000000000000B;\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\n address internal constant ERC1820_REGISTRY = 0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24;\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\n}\n" + }, + "contracts/optimistic-ethereum/libraries/standards/IL2StandardERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.16 <0.8.0;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IERC165 } from \"@openzeppelin/contracts/introspection/IERC165.sol\";\n\ninterface IL2StandardERC20 is IERC20, IERC165 {\n function l1Token() external returns (address);\n\n function mint(address _to, uint256 _amount) external;\n\n function burn(address _from, uint256 _amount) external;\n\n event Mint(address indexed _account, uint256 _amount);\n event Burn(address indexed _account, uint256 _amount);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" + }, + "@openzeppelin/contracts/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerFeeVault.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Contract Imports */\nimport { OVM_ETH } from \"../predeploys/OVM_ETH.sol\";\nimport { OVM_L2StandardBridge } from \"../bridge/tokens/OVM_L2StandardBridge.sol\";\n\n/**\n * @title OVM_SequencerFeeVault\n * @dev Simple holding contract for fees paid to the Sequencer. Likely to be replaced in the future\n * but \"good enough for now\".\n *\n * Compiler used: optimistic-solc\n * Runtime target: OVM\n */\ncontract OVM_SequencerFeeVault {\n\n /*************\n * Constants *\n *************/\n\n // Minimum ETH balance that can be withdrawn in a single withdrawal.\n uint256 public constant MIN_WITHDRAWAL_AMOUNT = 15 ether;\n\n\n /*************\n * Variables *\n *************/\n\n // Address on L1 that will hold the fees once withdrawn. Dynamically initialized within l2geth.\n address public l1FeeWallet;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _l1FeeWallet Initial address for the L1 wallet that will hold fees once withdrawn.\n * Currently HAS NO EFFECT in production because l2geth will mutate this storage slot during\n * the genesis block. This is ONLY for testing purposes.\n */\n constructor(\n address _l1FeeWallet\n ) {\n l1FeeWallet = _l1FeeWallet;\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n function withdraw()\n public\n {\n uint256 balance = OVM_ETH(Lib_PredeployAddresses.OVM_ETH).balanceOf(address(this));\n\n require(\n balance >= MIN_WITHDRAWAL_AMOUNT,\n \"OVM_SequencerFeeVault: withdrawal amount must be greater than minimum withdrawal amount\"\n );\n\n OVM_L2StandardBridge(Lib_PredeployAddresses.L2_STANDARD_BRIDGE).withdrawTo(\n Lib_PredeployAddresses.OVM_ETH,\n l1FeeWallet,\n balance,\n 0,\n bytes(\"\")\n );\n }\n}\n" + }, + "contracts/optimistic-ethereum/OVM/predeploys/OVM_ETH.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Contract Imports */\nimport { L2StandardERC20 } from \"../../libraries/standards/L2StandardERC20.sol\";\nimport { IWETH9 } from \"../../libraries/standards/IWETH9.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 L2StandardERC20, IWETH9 {\n\n /***************\n * Constructor *\n ***************/\n\n constructor()\n L2StandardERC20(\n Lib_PredeployAddresses.L2_STANDARD_BRIDGE,\n address(0),\n \"Ether\",\n \"ETH\"\n )\n {}\n\n\n /******************************\n * Custom WETH9 Functionality *\n ******************************/\n fallback() external payable {\n deposit();\n }\n\n /**\n * Implements the WETH9 deposit() function as a no-op.\n * WARNING: this function does NOT have to do with cross-chain asset bridging. The\n * relevant deposit and withdraw functions for that use case can be found at L2StandardBridge.sol.\n * This function allows developers to treat OVM_ETH as WETH without any modifications to their code.\n */\n function deposit()\n public\n payable\n override\n {\n // Calling deposit() with nonzero value will send the ETH to this contract address. Once recieved here,\n // We transfer it back by sending to the msg.sender.\n _transfer(address(this), msg.sender, msg.value);\n\n emit Deposit(msg.sender, msg.value);\n }\n\n /**\n * Implements the WETH9 withdraw() function as a no-op.\n * WARNING: this function does NOT have to do with cross-chain asset bridging. The\n * relevant deposit and withdraw functions for that use case can be found at L2StandardBridge.sol.\n * This function allows developers to treat OVM_ETH as WETH without any modifications to their code.\n * @param _wad Amount being withdrawn\n */\n function withdraw(\n uint256 _wad\n )\n external\n override\n {\n // Calling withdraw() with value exceeding the withdrawer's ovmBALANCE should revert, as in WETH9.\n require(balanceOf(msg.sender) >= _wad);\n\n // Other than emitting an event, OVM_ETH already is native ETH, so we don't need to do anything else.\n emit Withdrawal(msg.sender, _wad);\n }\n}\n" + }, + "contracts/optimistic-ethereum/libraries/standards/L2StandardERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.16 <0.8.0;\n\nimport { ERC20 } from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\nimport './IL2StandardERC20.sol';\n\ncontract L2StandardERC20 is IL2StandardERC20, ERC20 {\n address public override l1Token;\n address public l2Bridge;\n\n /**\n * @param _l1Token Address of the corresponding L1 token.\n * @param _name ERC20 name.\n * @param _symbol ERC20 symbol.\n */\n constructor(\n address _l2Bridge,\n address _l1Token,\n string memory _name,\n string memory _symbol\n )\n ERC20(_name, _symbol) {\n l1Token = _l1Token;\n l2Bridge = _l2Bridge;\n }\n\n modifier onlyL2Bridge {\n require(msg.sender == l2Bridge, \"Only L2 Bridge can mint and burn\");\n _;\n }\n\n function supportsInterface(bytes4 _interfaceId) public override pure returns (bool) {\n bytes4 firstSupportedInterface = bytes4(keccak256(\"supportsInterface(bytes4)\")); // ERC165\n bytes4 secondSupportedInterface = IL2StandardERC20.l1Token.selector\n ^ IL2StandardERC20.mint.selector\n ^ IL2StandardERC20.burn.selector;\n return _interfaceId == firstSupportedInterface || _interfaceId == secondSupportedInterface;\n }\n\n function mint(address _to, uint256 _amount) public override onlyL2Bridge {\n _mint(_to, _amount);\n\n emit Mint(_to, _amount);\n }\n\n function burn(address _from, uint256 _amount) public override onlyL2Bridge {\n _burn(_from, _amount);\n\n emit Burn(_from, _amount);\n }\n}\n" + }, + "contracts/optimistic-ethereum/libraries/standards/IWETH9.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity =0.7.6;\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\n/// @title Interface for WETH9. Also contains the non-ERC20 events normally present in the WETH9 implementation.\ninterface IWETH9 is IERC20 {\n event Deposit(address indexed dst, uint256 wad);\n event Withdrawal(address indexed src, uint256 wad);\n\n /// @notice Deposit ether to get wrapped ether\n function deposit() external payable;\n\n /// @notice Withdraw wrapped ether to get ether\n function withdraw(uint256) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\nimport \"../../utils/Context.sol\";\nimport \"./IERC20.sol\";\nimport \"../../math/SafeMath.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin guidelines: functions revert instead\n * of returning `false` on failure. This behavior is nonetheless conventional\n * and does not conflict with the expectations of ERC20 applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20 {\n using SafeMath for uint256;\n\n mapping (address => uint256) private _balances;\n\n mapping (address => mapping (address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n uint8 private _decimals;\n\n /**\n * @dev Sets the values for {name} and {symbol}, initializes {decimals} with\n * a default value of 18.\n *\n * To select a different value for {decimals}, use {_setupDecimals}.\n *\n * All three of these values are immutable: they can only be set once during\n * construction.\n */\n constructor (string memory name_, string memory symbol_) public {\n _name = name_;\n _symbol = symbol_;\n _decimals = 18;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5,05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is\n * called.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual returns (uint8) {\n return _decimals;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, \"ERC20: transfer amount exceeds allowance\"));\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, \"ERC20: decreased allowance below zero\"));\n return true;\n }\n\n /**\n * @dev Moves tokens `amount` from `sender` to `recipient`.\n *\n * This is internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(address sender, address recipient, uint256 amount) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n _balances[sender] = _balances[sender].sub(amount, \"ERC20: transfer amount exceeds balance\");\n _balances[recipient] = _balances[recipient].add(amount);\n emit Transfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply = _totalSupply.add(amount);\n _balances[account] = _balances[account].add(amount);\n emit Transfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n _balances[account] = _balances[account].sub(amount, \"ERC20: burn amount exceeds balance\");\n _totalSupply = _totalSupply.sub(amount);\n emit Transfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Sets {decimals} to a value other than the default one of 18.\n *\n * WARNING: This function should only be called from the constructor. Most\n * applications that interact with token contracts will not expect\n * {decimals} to ever change, and may work incorrectly if it does.\n */\n function _setupDecimals(uint8 decimals_) internal virtual {\n _decimals = decimals_;\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be to transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/*\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with GSN meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address payable) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes memory) {\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n return msg.data;\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" + }, + "@openzeppelin/contracts/token/ERC20/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"../../math/SafeMath.sol\";\nimport \"../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using SafeMath for uint256;\n using Address for address;\n\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n // solhint-disable-next-line max-line-length\n require((value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 newAllowance = token.allowance(address(this), spender).add(value);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 newAllowance = token.allowance(address(this), spender).sub(value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) { // Return data is optional\n // solhint-disable-next-line max-line-length\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.2 <0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n // solhint-disable-next-line no-inline-assembly\n assembly { size := extcodesize(account) }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\n (bool success, ) = recipient.call{ value: amount }(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain`call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.call{ value: value }(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.staticcall(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1StandardBridge.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_L1StandardBridge } from \"../../../iOVM/bridge/tokens/iOVM_L1StandardBridge.sol\";\nimport { iOVM_L1ERC20Bridge } from \"../../../iOVM/bridge/tokens/iOVM_L1ERC20Bridge.sol\";\nimport { iOVM_L2ERC20Bridge } from \"../../../iOVM/bridge/tokens/iOVM_L2ERC20Bridge.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/* Library Imports */\nimport { OVM_CrossDomainEnabled } from \"../../../libraries/bridge/OVM_CrossDomainEnabled.sol\";\nimport { Lib_PredeployAddresses } from \"../../../libraries/constants/Lib_PredeployAddresses.sol\";\nimport { SafeMath } from \"@openzeppelin/contracts/math/SafeMath.sol\";\nimport { Address } from \"@openzeppelin/contracts/utils/Address.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/SafeERC20.sol\";\n\n/**\n * @title OVM_L1StandardBridge\n * @dev The L1 ETH and ERC20 Bridge is a contract which stores deposited L1 funds and standard tokens that are in use on L2.\n * It synchronizes a corresponding L2 Bridge, informing it of deposits, and listening to it for newly finalized withdrawals.\n *\n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_L1StandardBridge is iOVM_L1StandardBridge, OVM_CrossDomainEnabled {\n using SafeMath for uint;\n using SafeERC20 for IERC20;\n\n /********************************\n * External Contract References *\n ********************************/\n\n address public l2TokenBridge;\n\n // Maps L1 token to L2 token to balance of the L1 token deposited\n mapping(address => mapping (address => uint256)) public deposits;\n\n /***************\n * Constructor *\n ***************/\n\n // This contract lives behind a proxy, so the constructor parameters will go unused.\n constructor()\n OVM_CrossDomainEnabled(address(0))\n {}\n\n /******************\n * Initialization *\n ******************/\n\n /**\n * @param _l1messenger L1 Messenger address being used for cross-chain communications.\n * @param _l2TokenBridge L2 standard bridge address.\n */\n function initialize(\n address _l1messenger,\n address _l2TokenBridge\n )\n public\n {\n require(messenger == address(0), \"Contract has already been initialized.\");\n messenger = _l1messenger;\n l2TokenBridge = _l2TokenBridge;\n }\n\n /**************\n * Depositing *\n **************/\n\n /// @dev Modifier requiring sender to be EOA. This check could be bypassed by a malicious contract via initcode, but it takes care of the user error we want to avoid.\n modifier onlyEOA() {\n // Used to stop deposits from contracts (avoid accidentally lost tokens)\n require(!Address.isContract(msg.sender), \"Account not EOA\");\n _;\n }\n\n /**\n * @dev This function can be called with no data\n * to deposit an amount of ETH to the caller's balance on L2.\n * Since the receive function doesn't take data, a conservative\n * default amount is forwarded to L2.\n */\n receive()\n external\n payable\n onlyEOA()\n {\n _initiateETHDeposit(\n msg.sender,\n msg.sender,\n 1_300_000,\n bytes(\"\")\n );\n }\n\n /**\n * @inheritdoc iOVM_L1StandardBridge\n */\n function depositETH(\n uint32 _l2Gas,\n bytes calldata _data\n )\n external\n override\n payable\n onlyEOA()\n {\n _initiateETHDeposit(\n msg.sender,\n msg.sender,\n _l2Gas,\n _data\n );\n }\n\n /**\n * @inheritdoc iOVM_L1StandardBridge\n */\n function depositETHTo(\n address _to,\n uint32 _l2Gas,\n bytes calldata _data\n )\n external\n override\n payable\n {\n _initiateETHDeposit(\n msg.sender,\n _to,\n _l2Gas,\n _data\n );\n }\n\n /**\n * @dev Performs the logic for deposits by storing the ETH and informing the L2 ETH Gateway of the deposit.\n * @param _from Account to pull the deposit from on L1.\n * @param _to Account to give the deposit to on L2.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function _initiateETHDeposit(\n address _from,\n address _to,\n uint32 _l2Gas,\n bytes memory _data\n )\n internal\n {\n // Construct calldata for finalizeDeposit call\n bytes memory message =\n abi.encodeWithSelector(\n iOVM_L2ERC20Bridge.finalizeDeposit.selector,\n address(0),\n Lib_PredeployAddresses.OVM_ETH,\n _from,\n _to,\n msg.value,\n _data\n );\n\n // Send calldata into L2\n sendCrossDomainMessage(\n l2TokenBridge,\n _l2Gas,\n message\n );\n\n emit ETHDepositInitiated(_from, _to, msg.value, _data);\n }\n\n /**\n * @inheritdoc iOVM_L1ERC20Bridge\n */\n function depositERC20(\n address _l1Token,\n address _l2Token,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n )\n external\n override\n virtual\n onlyEOA()\n {\n _initiateERC20Deposit(_l1Token, _l2Token, msg.sender, msg.sender, _amount, _l2Gas, _data);\n }\n\n /**\n * @inheritdoc iOVM_L1ERC20Bridge\n */\n function depositERC20To(\n address _l1Token,\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n )\n external\n override\n virtual\n {\n _initiateERC20Deposit(_l1Token, _l2Token, msg.sender, _to, _amount, _l2Gas, _data);\n }\n\n /**\n * @dev Performs the logic for deposits by informing the L2 Deposited Token\n * contract of the deposit and calling a handler to lock the L1 funds. (e.g. transferFrom)\n *\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\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 * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function _initiateERC20Deposit(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n )\n internal\n {\n // When a deposit is initiated on L1, the L1 Bridge transfers the funds to itself for future withdrawals.\n // safeTransferFrom also checks if the contract has code, so this will fail if _from is an EOA or address(0).\n IERC20(_l1Token).safeTransferFrom(\n _from,\n address(this),\n _amount\n );\n\n // Construct calldata for _l2Token.finalizeDeposit(_to, _amount)\n bytes memory message = abi.encodeWithSelector(\n iOVM_L2ERC20Bridge.finalizeDeposit.selector,\n _l1Token,\n _l2Token,\n _from,\n _to,\n _amount,\n _data\n );\n\n // Send calldata into L2\n sendCrossDomainMessage(\n l2TokenBridge,\n _l2Gas,\n message\n );\n\n deposits[_l1Token][_l2Token] = deposits[_l1Token][_l2Token].add(_amount);\n\n emit ERC20DepositInitiated(_l1Token, _l2Token, _from, _to, _amount, _data);\n }\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @inheritdoc iOVM_L1StandardBridge\n */\n function finalizeETHWithdrawal(\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n )\n external\n override\n onlyFromCrossDomainAccount(l2TokenBridge)\n {\n (bool success, ) = _to.call{value: _amount}(new bytes(0));\n require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');\n\n emit ETHWithdrawalFinalized(_from, _to, _amount, _data);\n }\n\n /**\n * @inheritdoc iOVM_L1ERC20Bridge\n */\n function finalizeERC20Withdrawal(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n )\n external\n override\n onlyFromCrossDomainAccount(l2TokenBridge)\n {\n deposits[_l1Token][_l2Token] = deposits[_l1Token][_l2Token].sub(_amount);\n\n // When a withdrawal is finalized on L1, the L1 Bridge transfers the funds to the withdrawer.\n IERC20(_l1Token).safeTransfer(_to, _amount);\n\n emit ERC20WithdrawalFinalized(_l1Token, _l2Token, _from, _to, _amount, _data);\n }\n\n /*****************************\n * Temporary - Migrating ETH *\n *****************************/\n\n /**\n * @dev Adds ETH balance to the account. This is meant to allow for ETH\n * to be migrated from an old gateway to a new gateway.\n * NOTE: This is left for one upgrade only so we are able to receive the migrated ETH from the old contract\n */\n function donateETH() external payable {}\n}\n" + }, + "contracts/optimistic-ethereum/OVM/predeploys/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/predeploys/iOVM_ECDSAContractAccount.sol\";\n\n/* Library Imports */\nimport { Lib_EIP155Tx } from \"../../libraries/codec/Lib_EIP155Tx.sol\";\nimport { Lib_ExecutionManagerWrapper } from \"../../libraries/wrappers/Lib_ExecutionManagerWrapper.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Contract Imports */\nimport { OVM_ETH } from \"../predeploys/OVM_ETH.sol\";\n\n/* External Imports */\nimport { SafeMath } from \"@openzeppelin/contracts/math/SafeMath.sol\";\nimport { ECDSA } from \"@openzeppelin/contracts/cryptography/ECDSA.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 EIP155 formatted transaction encodings.\n *\n * Compiler used: optimistic-solc\n * Runtime target: OVM\n */\ncontract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount {\n\n /*************\n * Libraries *\n *************/\n\n using Lib_EIP155Tx for Lib_EIP155Tx.EIP155Tx;\n\n\n /*************\n * Constants *\n *************/\n\n // TODO: should be the amount sufficient to cover the gas costs of all of the transactions up\n // to and including the CALL/CREATE which forms the entrypoint of the transaction.\n uint256 constant EXECUTION_VALIDATION_GAS_OVERHEAD = 25000;\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * No-op fallback mirrors behavior of calling an EOA on L1.\n */\n fallback()\n external\n payable\n {\n return;\n }\n\n /**\n * @dev Should return whether the signature provided is valid for the provided data\n * @param hash Hash of the data to be signed\n * @param signature Signature byte array associated with _data\n */\n function isValidSignature(\n bytes32 hash,\n bytes memory signature\n )\n public\n view\n returns (\n bytes4 magicValue\n )\n {\n return ECDSA.recover(hash, signature) == address(this) ?\n this.isValidSignature.selector :\n bytes4(0);\n }\n\n /**\n * Executes a signed transaction.\n * @param _transaction Signed EIP155 transaction.\n * @return Whether or not the call returned (rather than reverted).\n * @return Data returned by the call.\n */\n function execute(\n Lib_EIP155Tx.EIP155Tx memory _transaction\n )\n override\n public\n returns (\n bool,\n bytes memory\n )\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 require(\n _transaction.sender() == Lib_ExecutionManagerWrapper.ovmADDRESS(),\n \"Signature provided for EOA transaction execution is invalid.\"\n );\n\n require(\n _transaction.chainId == Lib_ExecutionManagerWrapper.ovmCHAINID(),\n \"Transaction signed with wrong chain ID\"\n );\n\n // Need to make sure that the transaction nonce is right.\n require(\n _transaction.nonce == Lib_ExecutionManagerWrapper.ovmGETNONCE(),\n \"Transaction nonce does not match the expected nonce.\"\n );\n\n // TEMPORARY: Disable gas checks for mainnet.\n // // Need to make sure that the gas is sufficient to execute the transaction.\n // require(\n // gasleft() >= SafeMath.add(transaction.gasLimit, EXECUTION_VALIDATION_GAS_OVERHEAD),\n // \"Gas is not sufficient to execute the transaction.\"\n // );\n\n // Transfer fee to relayer.\n require(\n OVM_ETH(Lib_PredeployAddresses.OVM_ETH).transfer(\n Lib_PredeployAddresses.SEQUENCER_FEE_WALLET,\n SafeMath.mul(_transaction.gasLimit, _transaction.gasPrice)\n ),\n \"Fee was not transferred to relayer.\"\n );\n\n if (_transaction.isCreate) {\n // TEMPORARY: Disable value transfer for contract creations.\n require(\n _transaction.value == 0,\n \"Value transfer in contract creation not supported.\"\n );\n\n (address created, bytes memory revertdata) = Lib_ExecutionManagerWrapper.ovmCREATE(\n _transaction.data\n );\n\n // Return true if the contract creation succeeded, false w/ revertdata otherwise.\n if (created != address(0)) {\n return (true, abi.encode(created));\n } else {\n return (false, revertdata);\n }\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_ExecutionManagerWrapper.ovmINCREMENTNONCE();\n\n // NOTE: Upgrades are temporarily disabled because users can, in theory, modify their EOA\n // so that they don't have to pay any fees to the sequencer. Function will remain disabled\n // until a robust solution is in place.\n require(\n _transaction.to != Lib_ExecutionManagerWrapper.ovmADDRESS(),\n \"Calls to self are disabled until upgradability is re-enabled.\"\n );\n\n return _transaction.to.call{value: _transaction.value}(_transaction.data);\n }\n }\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/predeploys/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_EIP155Tx } from \"../../libraries/codec/Lib_EIP155Tx.sol\";\n\n/**\n * @title iOVM_ECDSAContractAccount\n */\ninterface iOVM_ECDSAContractAccount {\n\n /********************\n * Public Functions *\n ********************/\n\n function execute(\n Lib_EIP155Tx.EIP155Tx memory _transaction\n )\n external\n returns (\n bool,\n bytes memory\n );\n}\n" + }, + "contracts/optimistic-ethereum/libraries/codec/Lib_EIP155Tx.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\";\n\n/**\n * @title Lib_EIP155Tx\n * @dev A simple library for dealing with the transaction type defined by EIP155:\n * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md\n */\nlibrary Lib_EIP155Tx {\n\n /***********\n * Structs *\n ***********/\n\n // Struct representing an EIP155 transaction. See EIP link above for more information.\n struct EIP155Tx {\n // These fields correspond to the actual RLP-encoded fields specified by EIP155.\n uint256 nonce;\n uint256 gasPrice;\n uint256 gasLimit;\n address to;\n uint256 value;\n bytes data;\n uint8 v;\n bytes32 r;\n bytes32 s;\n\n // Chain ID to associate this transaction with. Used all over the place, seemed easier to\n // set this once when we create the transaction rather than providing it as an input to\n // each function. I don't see a strong need to have a transaction with a mutable chain ID.\n uint256 chainId;\n\n // The ECDSA \"recovery parameter,\" should always be 0 or 1. EIP155 specifies that:\n // `v = {0,1} + CHAIN_ID * 2 + 35`\n // Where `{0,1}` is a stand in for our `recovery_parameter`. Now computing our formula for\n // the recovery parameter:\n // 1. `v = {0,1} + CHAIN_ID * 2 + 35`\n // 2. `v = recovery_parameter + CHAIN_ID * 2 + 35`\n // 3. `v - CHAIN_ID * 2 - 35 = recovery_parameter`\n // So we're left with the final formula:\n // `recovery_parameter = v - CHAIN_ID * 2 - 35`\n // NOTE: This variable is a uint8 because `v` is inherently limited to a uint8. If we\n // didn't use a uint8, then recovery_parameter would always be a negative number for chain\n // IDs greater than 110 (`255 - 110 * 2 - 35 = 0`). So we need to wrap around to support\n // anything larger.\n uint8 recoveryParam;\n\n // Whether or not the transaction is a creation. Necessary because we can't make an address\n // \"nil\". Using the zero address creates a potential conflict if the user did actually\n // intend to send a transaction to the zero address.\n bool isCreate;\n }\n\n // Lets us use nicer syntax.\n using Lib_EIP155Tx for EIP155Tx;\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Decodes an EIP155 transaction and attaches a given Chain ID.\n * Transaction *must* be RLP-encoded.\n * @param _encoded RLP-encoded EIP155 transaction.\n * @param _chainId Chain ID to assocaite with this transaction.\n * @return Parsed transaction.\n */\n function decode(\n bytes memory _encoded,\n uint256 _chainId\n )\n internal\n pure\n returns (\n EIP155Tx memory\n )\n {\n Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_encoded);\n\n // Note formula above about how recoveryParam is computed.\n uint8 v = uint8(Lib_RLPReader.readUint256(decoded[6]));\n uint8 recoveryParam = uint8(v - 2 * _chainId - 35);\n\n // Recovery param being anything other than 0 or 1 indicates that we have the wrong chain\n // ID.\n require(\n recoveryParam < 2,\n \"Lib_EIP155Tx: Transaction signed with wrong chain ID\"\n );\n\n // Creations can be detected by looking at the byte length here.\n bool isCreate = Lib_RLPReader.readBytes(decoded[3]).length == 0;\n\n return EIP155Tx({\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 v: v,\n r: Lib_RLPReader.readBytes32(decoded[7]),\n s: Lib_RLPReader.readBytes32(decoded[8]),\n chainId: _chainId,\n recoveryParam: recoveryParam,\n isCreate: isCreate\n });\n }\n\n /**\n * Encodes an EIP155 transaction into RLP.\n * @param _transaction EIP155 transaction to encode.\n * @param _includeSignature Whether or not to encode the signature.\n * @return RLP-encoded transaction.\n */\n function encode(\n EIP155Tx memory _transaction,\n bool _includeSignature\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\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\n // We write the encoding of empty bytes when the transaction is a creation, *not* the zero\n // address as one might assume.\n if (_transaction.isCreate) {\n raw[3] = Lib_RLPWriter.writeBytes('');\n } else {\n raw[3] = Lib_RLPWriter.writeAddress(_transaction.to);\n }\n\n raw[4] = Lib_RLPWriter.writeUint(_transaction.value);\n raw[5] = Lib_RLPWriter.writeBytes(_transaction.data);\n\n if (_includeSignature) {\n raw[6] = Lib_RLPWriter.writeUint(_transaction.v);\n raw[7] = Lib_RLPWriter.writeBytes32(_transaction.r);\n raw[8] = Lib_RLPWriter.writeBytes32(_transaction.s);\n } else {\n // Chain ID *is* included in the unsigned transaction.\n raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId);\n raw[7] = Lib_RLPWriter.writeBytes('');\n raw[8] = Lib_RLPWriter.writeBytes('');\n }\n\n return Lib_RLPWriter.writeList(raw);\n }\n\n /**\n * Computes the hash of an EIP155 transaction. Assumes that you don't want to include the\n * signature in this hash because that's a very uncommon usecase. If you really want to include\n * the signature, just encode with the signature and take the hash yourself.\n */\n function hash(\n EIP155Tx memory _transaction\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n return keccak256(\n _transaction.encode(false)\n );\n }\n\n /**\n * Computes the sender of an EIP155 transaction.\n * @param _transaction EIP155 transaction to get a sender for.\n * @return Address corresponding to the private key that signed this transaction.\n */\n function sender(\n EIP155Tx memory _transaction\n )\n internal\n pure\n returns (\n address\n )\n {\n return ecrecover(\n _transaction.hash(),\n _transaction.recoveryParam + 27,\n _transaction.r,\n _transaction.s\n );\n }\n}\n" + }, + "contracts/optimistic-ethereum/libraries/wrappers/Lib_ExecutionManagerWrapper.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_ErrorUtils } from \"../utils/Lib_ErrorUtils.sol\";\nimport { Lib_PredeployAddresses } from \"../constants/Lib_PredeployAddresses.sol\";\n\n/**\n * @title Lib_ExecutionManagerWrapper\n * @dev This library acts as a utility for easily calling the OVM_ExecutionManagerWrapper, the\n * predeployed contract which exposes the `kall` builtin. Effectively, this contract allows the\n * user to trigger OVM opcodes by directly calling the OVM_ExecutionManger.\n *\n * Compiler used: solc\n * Runtime target: OVM\n */\nlibrary Lib_ExecutionManagerWrapper {\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Performs a safe ovmCREATE call.\n * @param _bytecode Code for the new contract.\n * @return Address of the created contract.\n */\n function ovmCREATE(\n bytes memory _bytecode\n )\n internal\n returns (\n address,\n bytes memory\n )\n {\n bytes memory returndata = _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmCREATE(bytes)\",\n _bytecode\n )\n );\n\n return abi.decode(returndata, (address, bytes));\n }\n\n /**\n * Performs a safe ovmGETNONCE call.\n * @return Result of calling ovmGETNONCE.\n */\n function ovmGETNONCE()\n internal\n returns (\n uint256\n )\n {\n bytes memory returndata = _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmGETNONCE()\"\n )\n );\n\n return abi.decode(returndata, (uint256));\n }\n\n /**\n * Performs a safe ovmINCREMENTNONCE call.\n */\n function ovmINCREMENTNONCE()\n internal\n {\n _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmINCREMENTNONCE()\"\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 ovmCREATEEOA(\n bytes32 _messageHash,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n )\n internal\n {\n _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\",\n _messageHash,\n _v,\n _r,\n _s\n )\n );\n }\n\n /**\n * Calls the ovmL1TXORIGIN opcode.\n * @return Address that sent this message from L1.\n */\n function ovmL1TXORIGIN()\n internal\n returns (\n address\n )\n {\n bytes memory returndata = _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmL1TXORIGIN()\"\n )\n );\n\n return abi.decode(returndata, (address));\n }\n\n /**\n * Calls the ovmCHAINID opcode.\n * @return Chain ID of the current network.\n */\n function ovmCHAINID()\n internal\n returns (\n uint256\n )\n {\n bytes memory returndata = _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmCHAINID()\"\n )\n );\n\n return abi.decode(returndata, (uint256));\n }\n\n /**\n * Performs a safe ovmADDRESS call.\n * @return Result of calling ovmADDRESS.\n */\n function ovmADDRESS()\n internal\n returns (\n address\n )\n {\n bytes memory returndata = _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmADDRESS()\"\n )\n );\n\n return abi.decode(returndata, (address));\n }\n\n /**\n * Calls the value-enabled ovmCALL opcode.\n * @param _gasLimit Amount of gas to be passed into this call.\n * @param _address Address of the contract to call.\n * @param _value ETH value to pass with the 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 uint256 _value,\n bytes memory _calldata\n )\n internal\n returns (\n bool,\n bytes memory\n )\n {\n bytes memory returndata = _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmCALL(uint256,address,uint256,bytes)\",\n _gasLimit,\n _address,\n _value,\n _calldata\n )\n );\n\n return abi.decode(returndata, (bool, bytes));\n }\n\n /**\n * Calls the ovmBALANCE opcode.\n * @param _address OVM account to query the balance of.\n * @return Balance of the account.\n */\n function ovmBALANCE(\n address _address\n )\n internal\n returns (\n uint256\n )\n {\n bytes memory returndata = _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmBALANCE(address)\",\n _address\n )\n );\n\n return abi.decode(returndata, (uint256));\n }\n\n /**\n * Calls the ovmCALLVALUE opcode.\n * @return Value of the current call frame.\n */\n function ovmCALLVALUE()\n internal\n returns (\n uint256\n )\n {\n bytes memory returndata = _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmCALLVALUE()\"\n )\n );\n\n return abi.decode(returndata, (uint256));\n }\n\n\n /*********************\n * Private Functions *\n *********************/\n\n /**\n * Performs an ovm interaction and the necessary safety checks.\n * @param _calldata Data to send to the OVM_ExecutionManager (encoded with sighash).\n * @return Data sent back by the OVM_ExecutionManager.\n */\n function _callWrapperContract(\n bytes memory _calldata\n )\n private\n returns (\n bytes memory\n )\n {\n (bool success, bytes memory returndata) = Lib_PredeployAddresses.EXECUTION_MANAGER_WRAPPER.delegatecall(_calldata);\n\n if (success == true) {\n return returndata;\n } else {\n assembly {\n revert(add(returndata, 0x20), mload(returndata))\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n // Check the signature length\n if (signature.length != 65) {\n revert(\"ECDSA: invalid signature length\");\n }\n\n // Divide the signature in r, s and v variables\n bytes32 r;\n bytes32 s;\n uint8 v;\n\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n\n return recover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover-bytes32-bytes-} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n require(uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, \"ECDSA: invalid signature 's' value\");\n require(v == 27 || v == 28, \"ECDSA: invalid signature 'v' value\");\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n require(signer != address(0), \"ECDSA: invalid signature\");\n\n return signer;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * replicates the behavior of the\n * https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign[`eth_sign`]\n * JSON-RPC method.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\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 require(\n out == 0 || out == 1,\n \"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\"\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/**\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 The RLP encoded string in bytes.\n */\n function writeBytes(\n bytes memory _in\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n bytes memory encoded;\n\n if (_in.length == 1 && uint8(_in[0]) < 128) {\n encoded = _in;\n } else {\n encoded = abi.encodePacked(_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 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\n )\n {\n bytes memory list = _flatten(_in);\n return abi.encodePacked(_writeLength(list.length, 192), list);\n }\n\n /**\n * RLP encodes a string.\n * @param _in The string to encode.\n * @return The RLP encoded string in bytes.\n */\n function writeString(\n string memory _in\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n return writeBytes(bytes(_in));\n }\n\n /**\n * RLP encodes an address.\n * @param _in The address to encode.\n * @return The RLP encoded address in bytes.\n */\n function writeAddress(\n address _in\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n return writeBytes(abi.encodePacked(_in));\n }\n\n /**\n * RLP encodes a bytes32 value.\n * @param _in The bytes32 to encode.\n * @return _out The RLP encoded bytes32 in bytes.\n */\n function writeBytes32(\n bytes32 _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 The RLP encoded uint256 in bytes.\n */\n function writeUint(\n uint256 _in\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n return writeBytes(_toBinary(_in));\n }\n\n /**\n * RLP encodes a bool.\n * @param _in The bool to encode.\n * @return The RLP encoded bool in bytes.\n */\n function writeBool(\n bool _in\n )\n internal\n pure\n returns (\n bytes memory\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 RLP encoded bytes.\n */\n function _writeLength(\n uint256 _len,\n uint256 _offset\n )\n private\n pure\n returns (\n bytes memory\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 RLP encoded bytes.\n */\n function _toBinary(\n uint256 _x\n )\n private\n pure\n returns (\n bytes memory\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 The flattened byte string.\n */\n function _flatten(\n bytes[] memory _list\n )\n private\n pure\n returns (\n bytes memory\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}\n" + }, + "contracts/optimistic-ethereum/libraries/utils/Lib_ErrorUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/**\n * @title Lib_ErrorUtils\n */\nlibrary Lib_ErrorUtils {\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Encodes an error string into raw solidity-style revert data.\n * (i.e. ascii bytes, prefixed with bytes4(keccak(\"Error(string))\"))\n * Ref: https://docs.soliditylang.org/en/v0.8.2/control-structures.html?highlight=Error(string)#panic-via-assert-and-error-via-require\n * @param _reason Reason for the reversion.\n * @return Standard solidity revert data for the given reason.\n */\n function encodeRevertString(\n string memory _reason\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n return abi.encodeWithSignature(\n \"Error(string)\",\n _reason\n );\n }\n}\n" + }, + "contracts/optimistic-ethereum/OVM/predeploys/OVM_ProxyEOA.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\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\nimport { Lib_ExecutionManagerWrapper } from \"../../libraries/wrappers/Lib_ExecutionManagerWrapper.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: optimistic-solc\n * Runtime target: OVM\n */\ncontract OVM_ProxyEOA {\n\n /**********\n * Events *\n **********/\n\n event Upgraded(\n address indexed implementation\n );\n\n\n /*************\n * Constants *\n *************/\n\n bytes32 constant IMPLEMENTATION_KEY = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; //bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1);\n\n\n /*********************\n * Fallback Function *\n *********************/\n\n fallback()\n external\n payable\n {\n (bool success, bytes memory returndata) = getImplementation().delegatecall(msg.data);\n\n if (success) {\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 // WARNING: We use the deployed bytecode of this contract as a template to create ProxyEOA\n // contracts. As a result, we must *not* perform any constructor logic. Use initialization\n // functions if necessary.\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Changes the implementation address.\n * @param _implementation New implementation address.\n */\n function upgrade(\n address _implementation\n )\n external\n {\n require(\n msg.sender == Lib_ExecutionManagerWrapper.ovmADDRESS(),\n \"EOAs can only upgrade their own EOA implementation.\"\n );\n\n _setImplementation(_implementation);\n emit Upgraded(_implementation);\n }\n\n /**\n * Gets the address of the current implementation.\n * @return Current implementation address.\n */\n function getImplementation()\n public\n view\n returns (\n address\n )\n {\n bytes32 addr32;\n assembly {\n addr32 := sload(IMPLEMENTATION_KEY)\n }\n\n address implementation = Lib_Bytes32Utils.toAddress(addr32);\n if (implementation == address(0)) {\n return Lib_PredeployAddresses.ECDSA_CONTRACT_ACCOUNT;\n } else {\n return implementation;\n }\n }\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n function _setImplementation(\n address _implementation\n )\n internal\n {\n bytes32 addr32 = Lib_Bytes32Utils.fromAddress(_implementation);\n assembly {\n sstore(IMPLEMENTATION_KEY, addr32)\n }\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 /**\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \"true.\"\n * @param _in Input bytes32 value.\n * @return Bytes32 as a boolean.\n */\n function toBool(\n bytes32 _in\n )\n internal\n pure\n returns (\n bool\n )\n {\n return _in != 0;\n }\n\n /**\n * Converts a boolean to a bytes32 value.\n * @param _in Input boolean value.\n * @return Boolean as a bytes32.\n */\n function fromBool(\n bool _in\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n return bytes32(uint256(_in ? 1 : 0));\n }\n\n /**\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\n * @param _in Input bytes32 value.\n * @return Bytes32 as an address.\n */\n function toAddress(\n bytes32 _in\n )\n internal\n pure\n returns (\n address\n )\n {\n return address(uint160(uint256(_in)));\n }\n\n /**\n * Converts an address to a bytes32.\n * @param _in Input address value.\n * @return Address as a bytes32.\n */\n function fromAddress(\n address _in\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n return bytes32(uint256(_in));\n }\n\n /**\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\n * @param _in Input bytes32 value.\n * @return Bytes32 without any leading zeros.\n */\n function removeLeadingZeros(\n bytes32 _in\n )\n internal\n pure\n returns (\n bytes memory\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/OVM/predeploys/OVM_SequencerEntrypoint.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_EIP155Tx } from \"../../libraries/codec/Lib_EIP155Tx.sol\";\nimport { Lib_ExecutionManagerWrapper } from \"../../libraries/wrappers/Lib_ExecutionManagerWrapper.sol\";\nimport { iOVM_ECDSAContractAccount } from \"../../iOVM/predeploys/iOVM_ECDSAContractAccount.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 * Compiler used: optimistic-solc\n * Runtime target: OVM\n */\ncontract OVM_SequencerEntrypoint {\n\n /*************\n * Libraries *\n *************/\n\n using Lib_EIP155Tx for Lib_EIP155Tx.EIP155Tx;\n\n\n /*********************\n * Fallback Function *\n *********************/\n\n /**\n * Expects an RLP-encoded EIP155 transaction as input. See the EIP for a more detailed\n * description of this transaction format:\n * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md\n */\n fallback()\n external\n {\n // We use this twice, so it's more gas efficient to store a copy of it (barely).\n bytes memory encodedTx = msg.data;\n\n // Decode the tx with the correct chain ID.\n Lib_EIP155Tx.EIP155Tx memory transaction = Lib_EIP155Tx.decode(\n encodedTx,\n Lib_ExecutionManagerWrapper.ovmCHAINID()\n );\n\n // Value is computed on the fly. Keep it in the stack to save some gas.\n address target = transaction.sender();\n\n bool isEmptyContract;\n assembly {\n isEmptyContract := iszero(extcodesize(target))\n }\n\n // If the account is empty, deploy the default EOA to that address.\n if (isEmptyContract) {\n Lib_ExecutionManagerWrapper.ovmCREATEEOA(\n transaction.hash(),\n transaction.recoveryParam,\n transaction.r,\n transaction.s\n );\n }\n\n // Forward the transaction over to the EOA.\n (bool success, bytes memory returndata) = target.call(\n abi.encodeWithSelector(iOVM_ECDSAContractAccount.execute.selector, transaction)\n );\n\n if (success) {\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/codec/TestLib_EIP155Tx.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_EIP155Tx } from \"../../optimistic-ethereum/libraries/codec/Lib_EIP155Tx.sol\";\n\n/**\n * @title TestLib_EIP155Tx\n */\ncontract TestLib_EIP155Tx {\n function decode(\n bytes memory _encoded,\n uint256 _chainId\n )\n public\n pure\n returns (\n Lib_EIP155Tx.EIP155Tx memory\n )\n {\n return Lib_EIP155Tx.decode(\n _encoded,\n _chainId\n );\n }\n\n function encode(\n Lib_EIP155Tx.EIP155Tx memory _transaction,\n bool _includeSignature\n )\n public\n pure\n returns (\n bytes memory\n )\n {\n return Lib_EIP155Tx.encode(\n _transaction,\n _includeSignature\n );\n }\n\n function hash(\n Lib_EIP155Tx.EIP155Tx memory _transaction\n )\n public\n pure\n returns (\n bytes32\n )\n {\n return Lib_EIP155Tx.hash(\n _transaction\n );\n }\n\n function sender(\n Lib_EIP155Tx.EIP155Tx memory _transaction\n )\n public\n pure\n returns (\n address\n )\n {\n return Lib_EIP155Tx.sender(\n _transaction\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() {}\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 abi.encodePacked(\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/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 slice(\n bytes memory _bytes,\n uint256 _start,\n uint256 _length\n )\n internal\n pure\n returns (\n bytes memory\n )\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 (\n bytes memory\n )\n {\n if (_start >= _bytes.length) {\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 (\n bytes32\n )\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 (\n bytes32\n )\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 (\n uint256\n )\n {\n return uint256(toBytes32(_bytes));\n }\n\n function toUint24(\n bytes memory _bytes,\n uint256 _start\n )\n internal\n pure\n returns (\n uint24\n )\n {\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(\n bytes memory _bytes,\n uint256 _start\n )\n internal\n pure\n returns (\n uint8\n )\n {\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(\n bytes memory _bytes,\n uint256 _start\n )\n internal\n pure\n returns (\n address\n )\n {\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 (\n bytes memory\n )\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 (\n bytes memory\n )\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 (\n bool\n )\n {\n return keccak256(_bytes) == keccak256(_other);\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 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 external\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 external\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 external\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 external\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 external\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 external\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 // Prevent the Execution Manager from calling this SM again.\n ovmStateManager.setExecutionManager(address(0));\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 external\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 external\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 external\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/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\";\n\n/**\n * @title Lib_OVMCodec\n */\nlibrary Lib_OVMCodec {\n\n /*********\n * Enums *\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 transactionHash;\n uint40 timestamp;\n uint40 blockNumber;\n }\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Encodes a standard OVM transaction.\n * @param _transaction OVM transaction to encode.\n * @return Encoded transaction bytes.\n */\n function encodeTransaction(\n Transaction memory _transaction\n )\n internal\n pure\n returns (\n bytes memory\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 Hashed transaction\n */\n function hashTransaction(\n Transaction memory _transaction\n )\n internal\n pure\n returns (\n bytes32\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 Converted EVM account.\n */\n function toEVMAccount(\n Account memory _in\n )\n internal\n pure\n returns (\n EVMAccount memory\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 RLP-encoded account state.\n */\n function encodeEVMAccount(\n EVMAccount memory _account\n )\n internal\n pure\n returns (\n bytes memory\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 state struct.\n */\n function decodeEVMAccount(\n bytes memory _encoded\n )\n internal\n pure\n returns (\n EVMAccount memory\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 of the header.\n */\n function hashBatchHeader(\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\n )\n internal\n pure\n returns (\n bytes32\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/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 */\nabstract contract Lib_AddressResolver {\n\n /*************\n * Variables *\n *************/\n\n Lib_AddressManager public libAddressManager;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address of the Lib_AddressManager.\n */\n constructor(\n address _libAddressManager\n ) {\n libAddressManager = Lib_AddressManager(_libAddressManager);\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Resolves the address associated with a given name.\n * @param _name Name to resolve an address for.\n * @return Address associated with the given name.\n */\n function resolve(\n string memory _name\n )\n public\n view\n returns (\n address\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 *\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 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\n )\n {\n bytes memory code;\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 Full code of the contract.\n */\n function getCode(\n address _address\n )\n internal\n view\n returns (\n bytes memory\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 Size of the contract's code in bytes.\n */\n function getCodeSize(\n address _address\n )\n internal\n view\n returns (\n uint256\n )\n {\n uint256 codeSize;\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 Hash of the contract's code.\n */\n function getCodeHash(\n address _address\n )\n internal\n view\n returns (\n bytes32\n )\n {\n bytes32 codeHash;\n assembly {\n codeHash := extcodehash(_address)\n }\n\n return codeHash;\n }\n\n /**\n * Creates a contract with some given initialization code.\n * @param _code Contract initialization code.\n * @return Address of the created contract.\n */\n function createContract(\n bytes memory _code\n )\n internal\n returns (\n address\n )\n {\n address created;\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 to be generated by CREATE.\n */\n function getAddressForCREATE(\n address _creator,\n uint256 _nonce\n )\n internal\n pure\n returns (\n 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 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 (\n address\n )\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/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 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_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 OUT_OF_GAS,\n INTENTIONAL_REVERT,\n EXCEEDS_NUISANCE_GAS,\n INVALID_STATE_ACCESS,\n UNSAFE_BYTECODE,\n CREATE_COLLISION,\n STATIC_VIOLATION,\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 enum MessageType {\n ovmCALL,\n ovmSTATICCALL,\n ovmDELEGATECALL,\n ovmCREATE,\n ovmCREATE2\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 uint256 ovmCALLVALUE;\n bool isStatic;\n }\n\n struct MessageRecord {\n uint256 nuisanceGasLeft;\n }\n\n\n /************************************\n * Transaction Execution Entrypoint *\n ************************************/\n\n function run(\n Lib_OVMCodec.Transaction calldata _transaction,\n address _txStateManager\n ) external returns (bytes memory);\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 ovmCALLVALUE() external view returns (uint _callValue);\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, bytes memory _revertdata);\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract, bytes memory _revertdata);\n\n\n /*******************************\n * Account Abstraction Opcodes *\n ******************************/\n\n function ovmGETNONCE() external returns (uint256 _nonce);\n function ovmINCREMENTNONCE() external;\n function ovmCREATEEOA(bytes32 _messageHash, uint8 _v, bytes32 _r, bytes32 _s) external;\n\n\n /****************************\n * Contract Calling Opcodes *\n ****************************/\n\n // Valueless ovmCALL for maintaining backwards compatibility with legacy OVM bytecode.\n function ovmCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\n function ovmCALL(uint256 _gasLimit, address _address, uint256 _value, 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 * ETH Value Opcodes *\n *********************/\n\n function ovmBALANCE(address _contract) external returns (uint256 _balance);\n function ovmSELFBALANCE() external returns (uint256 _balance);\n\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_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/resolver/Lib_AddressManager.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* External Imports */\nimport { Ownable } from \"@openzeppelin/contracts/access/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 indexed _name,\n address _newAddress,\n address _oldAddress\n );\n\n\n /*************\n * Variables *\n *************/\n\n mapping (bytes32 => address) private addresses;\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Changes the address associated with a particular name.\n * @param _name String name to associate an address with.\n * @param _address Address to associate with the name.\n */\n function setAddress(\n string memory _name,\n address _address\n )\n external\n onlyOwner\n {\n bytes32 nameHash = _getNameHash(_name);\n address oldAddress = addresses[nameHash];\n addresses[nameHash] = _address;\n\n emit AddressSet(\n _name,\n _address,\n oldAddress\n );\n }\n\n /**\n * Retrieves the address associated with a given name.\n * @param _name Name to retrieve an address for.\n * @return Address associated with the given name.\n */\n function getAddress(\n string memory _name\n )\n external\n view\n returns (\n address\n )\n {\n return addresses[_getNameHash(_name)];\n }\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Computes the hash of a name.\n * @param _name Name to compute a hash for.\n * @return Hash of the given name.\n */\n function _getNameHash(\n string memory _name\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n return keccak256(abi.encodePacked(_name));\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\nimport \"../utils/Context.sol\";\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor () internal {\n address msgSender = _msgSender();\n _owner = msgSender;\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\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 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, _key, 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 != pathRemainder.length) {\n // Our extension node is not identical to the remainder.\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 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 path may include\n * additional nodes (e.g., it comes directly from a proof) and we can't resize in-memory\n * arrays without costly duplication.\n * @param _key Full original key.\n * @param _keyRemainder Portion of the initial key that must be inserted 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 _key,\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 // Reference: https://github.com/ethereumjs/merkle-patricia-tree/blob/c0a10395aab37d42c175a47114ebfcbd7efcf059/src/baseTrie.ts#L294-L313\n bool matchLeaf = false;\n if (lastNodeType == NodeType.LeafNode) {\n uint256 l = 0;\n if (_path.length > 0) {\n for (uint256 i = 0; i < _path.length - 1; i++) {\n if (_getNodeType(_path[i]) == NodeType.BranchNode) {\n l++;\n } else {\n l += _getNodeKey(_path[i]).length;\n }\n }\n }\n\n if (\n _getSharedNibbleLength(\n _getNodeKey(lastNode),\n Lib_BytesUtils.slice(Lib_BytesUtils.toNibbles(_key), l)\n ) == _getNodeKey(lastNode).length\n && keyRemainder.length == 0\n ) {\n matchLeaf = true;\n }\n }\n\n if (matchLeaf) {\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 = _editExtensionNodeValue(currentNode, 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 * Creates a new extension node with the same key but a different value.\n * @param _node Extension node to copy and modify.\n * @param _value New value for the extension node.\n * @return New node with the same key and different value.\n */\n function _editExtensionNodeValue(\n TrieNode memory _node,\n bytes memory _value\n )\n private\n pure\n returns (\n TrieNode memory\n )\n {\n bytes[] memory raw = new bytes[](2);\n bytes memory key = _addHexPrefix(_getNodeKey(_node), false);\n raw[0] = Lib_RLPWriter.writeBytes(Lib_BytesUtils.fromNibbles(key));\n if (_value.length < 32) {\n raw[1] = _value;\n } else {\n raw[1] = Lib_RLPWriter.writeBytes(_value);\n }\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 abi.encodePacked(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 /***************\n * Constructor *\n ***************/\n\n constructor(\n address _libAddressManager\n )\n Lib_AddressResolver(_libAddressManager)\n {}\n\n\n /********************\n * Public Functions *\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 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\n )\n {\n require(\n msg.sender == resolve(\"OVM_FraudVerifier\"),\n \"Create can only be done by the OVM_FraudVerifier.\"\n );\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 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\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 * 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" + }, + "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 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 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_Proposer\");\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 // For efficiency reasons getMerkleRoot modifies the `_batch` argument in place\n // while calculating the root hash therefore any arguments passed to it must not\n // be used again afterwards\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 * Note that the _elements argument is modified, therefore it must not be used again afterwards\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 pure\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 == 1) {\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 (uint256 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" + }, + "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_Buffer } from \"../../libraries/utils/Lib_Buffer.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 distinct 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_Buffer for Lib_Buffer.Buffer;\n\n\n /*************\n * Variables *\n *************/\n\n string public owner;\n Lib_Buffer.Buffer 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 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 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" + }, + "contracts/optimistic-ethereum/libraries/utils/Lib_Buffer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title Lib_Buffer\n * @dev This library implements a bytes32 storage array with some additional gas-optimized\n * functionality. In particular, it encodes its length as a uint40, and tightly packs this with an\n * overwritable \"extra data\" field so we can store more information with a single SSTORE.\n */\nlibrary Lib_Buffer {\n\n /*************\n * Libraries *\n *************/\n\n using Lib_Buffer for Buffer;\n\n\n /***********\n * Structs *\n ***********/\n\n struct Buffer {\n bytes32 context;\n mapping (uint256 => bytes32) buf;\n }\n\n struct BufferContext {\n // Stores the length of the array. Uint40 is way more elements than we'll ever reasonably\n // need in an array and we get an extra 27 bytes of extra data to play with.\n uint40 length;\n\n // Arbitrary extra data that can be modified whenever the length is updated. Useful for\n // squeezing out some gas optimizations.\n bytes27 extraData;\n }\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 Global extra data.\n */\n function push(\n Buffer storage _self,\n bytes32 _value,\n bytes27 _extraData\n )\n internal\n {\n BufferContext memory ctx = _self.getContext();\n\n _self.buf[ctx.length] = _value;\n\n // Bump the global index and insert our extra data, then save the context.\n ctx.length++;\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 Buffer storage _self,\n bytes32 _value\n )\n internal\n {\n BufferContext memory ctx = _self.getContext();\n\n _self.push(\n _value,\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 Buffer storage _self,\n uint256 _index\n )\n internal\n view\n returns (\n bytes32\n )\n {\n BufferContext memory ctx = _self.getContext();\n\n require(\n _index < ctx.length,\n \"Index out of bounds.\"\n );\n\n return _self.buf[_index];\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 Buffer storage _self,\n uint40 _index,\n bytes27 _extraData\n )\n internal\n {\n BufferContext memory ctx = _self.getContext();\n\n require(\n _index < ctx.length,\n \"Index out of bounds.\"\n );\n\n // Set our length and extra data, save the context.\n ctx.length = _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 Buffer storage _self,\n uint40 _index\n )\n internal\n {\n BufferContext 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 Buffer storage _self\n )\n internal\n view\n returns (\n uint40\n )\n {\n BufferContext memory ctx = _self.getContext();\n return ctx.length;\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 Buffer storage _self,\n bytes27 _extraData\n )\n internal\n {\n BufferContext 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 Buffer storage _self\n )\n internal\n view\n returns (\n bytes27\n )\n {\n BufferContext memory ctx = _self.getContext();\n return ctx.extraData;\n }\n\n /**\n * Sets the current buffer context.\n * @param _self Buffer to access.\n * @param _ctx Current buffer context.\n */\n function setContext(\n Buffer storage _self,\n BufferContext memory _ctx\n )\n internal\n {\n bytes32 context;\n uint40 length = _ctx.length;\n bytes27 extraData = _ctx.extraData;\n assembly {\n context := length\n context := or(context, extraData)\n }\n\n if (_self.context != context) {\n _self.context = context;\n }\n }\n\n /**\n * Retrieves the current buffer context.\n * @param _self Buffer to access.\n * @return Current buffer context.\n */\n function getContext(\n Buffer storage _self\n )\n internal\n view\n returns (\n BufferContext memory\n )\n {\n bytes32 context = _self.context;\n uint40 length;\n bytes27 extraData;\n assembly {\n length := and(context, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\n extraData := and(context, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000)\n }\n\n return BufferContext({\n length: length,\n extraData: extraData\n });\n }\n}\n" + }, + "contracts/test-libraries/utils/TestLib_Buffer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_Buffer } from \"../../optimistic-ethereum/libraries/utils/Lib_Buffer.sol\";\n\n/**\n * @title TestLib_Buffer\n */\ncontract TestLib_Buffer {\n using Lib_Buffer for Lib_Buffer.Buffer;\n\n Lib_Buffer.Buffer 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 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 )\n public\n {\n return buf.deleteElementsAfterInclusive(\n _index\n );\n }\n\n function deleteElementsAfterInclusive(\n uint40 _index,\n bytes27 _extraData\n )\n public\n {\n return buf.deleteElementsAfterInclusive(\n _index,\n _extraData\n );\n }\n\n function getLength()\n public\n view\n returns (\n uint40\n )\n {\n return buf.getLength();\n }\n\n function setExtraData(\n bytes27 _extraData\n )\n public\n {\n return buf.setExtraData(\n _extraData\n );\n }\n\n function getExtraData()\n public\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\";\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/* External Imports */\nimport { Math } from \"@openzeppelin/contracts/math/Math.sol\";\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 = 50000;\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 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 return _getQueueElement(\n _index,\n queue()\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 return _getQueueLength(\n queue()\n );\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 queueRef = queue();\n\n queueRef.push(transactionHash);\n queueRef.push(timestampAndBlockNumber);\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 and subtract 1.\n uint256 queueIndex = queueRef.length() / 2 - 1;\n emit TransactionEnqueued(\n msg.sender,\n _target,\n _gasLimit,\n _data,\n queueIndex,\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 pure\n {\n // TEMPORARY: Disable `appendQueueBatch` for minnet\n revert(\"appendQueueBatch is currently disabled.\");\n\n // _numQueuedTransactions = 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\n require(\n msg.data.length >= nextTransactionPtr,\n \"Not enough BatchContexts provided.\"\n );\n\n // Take a reference to the queue and its length so we don't have to keep resolving it.\n // Length isn't going to change during the course of execution, so it's fine to simply\n // resolve this once at the start. Saves gas.\n iOVM_ChainStorageContainer queueRef = queue();\n uint40 queueLength = _getQueueLength(queueRef);\n\n // Reserve some memory to save gas on hashing later on. This is a relatively safe estimate\n // for the average transaction size that will prevent having to resize this chunk of memory\n // later on. Saves gas.\n bytes memory hashMemory = new bytes((msg.data.length / totalElementsToAppend) * 2);\n\n // Initialize the array of canonical chain leaves that we will append.\n bytes32[] memory leaves = new bytes32[](totalElementsToAppend);\n\n // Each leaf index corresponds to a tx, either sequenced or enqueued.\n uint32 leafIndex = 0;\n\n // Counter for number of sequencer transactions appended so far.\n uint32 numSequencerTransactions = 0;\n\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 for (uint32 i = 0; i < numContexts; i++) {\n BatchContext memory nextContext = _getBatchContext(i);\n\n if (i == 0) {\n // Execute a special check for the first batch.\n _validateFirstBatchContext(nextContext);\n }\n\n // Execute this check on every single batch, including the first one.\n _validateNextBatchContext(\n curContext,\n nextContext,\n nextQueueIndex,\n queueRef\n );\n\n // Now we can update our current context.\n curContext = nextContext;\n\n // Process sequencer transactions first.\n for (uint32 j = 0; j < curContext.numSequencedTransactions; j++) {\n uint256 txDataLength;\n assembly {\n txDataLength := shr(232, calldataload(nextTransactionPtr))\n }\n require(\n txDataLength <= MAX_ROLLUP_TX_SIZE,\n \"Transaction data size exceeds maximum for rollup transaction.\"\n );\n\n leaves[leafIndex] = _getSequencerLeafHash(\n curContext,\n nextTransactionPtr,\n txDataLength,\n hashMemory\n );\n\n nextTransactionPtr += uint40(TX_DATA_HEADER_SIZE + txDataLength);\n numSequencerTransactions++;\n leafIndex++;\n }\n\n // Now process any subsequent queue transactions.\n for (uint32 j = 0; j < curContext.numSubsequentQueueTransactions; j++) {\n require(\n nextQueueIndex < queueLength,\n \"Not enough queued transactions to append.\"\n );\n\n leaves[leafIndex] = _getQueueLeafHash(nextQueueIndex);\n nextQueueIndex++;\n leafIndex++;\n }\n }\n\n _validateFinalBatchContext(\n curContext,\n nextQueueIndex,\n queueLength,\n queueRef\n );\n\n require(\n msg.data.length == 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 blockTimestamp;\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 blockTimestamp = 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 // curContext.numSubsequentQueueTransactions > 0 which means that we've processed at least one queue element.\n // We increment nextQueueIndex after processing each queue element,\n // so the index of the last element we processed is nextQueueIndex - 1.\n Lib_OVMCodec.QueueElement memory lastElement = _getQueueElement(\n nextQueueIndex - 1,\n queueRef\n );\n\n blockTimestamp = lastElement.timestamp;\n blockNumber = lastElement.blockNumber;\n }\n\n // For efficiency reasons getMerkleRoot modifies the `leaves` argument in place\n // while calculating the root hash therefore any arguments passed to it must not\n // be used again afterwards\n _appendBatch(\n Lib_MerkleTree.getMerkleRoot(leaves),\n totalElementsToAppend,\n numQueuedTransactions,\n blockTimestamp,\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 pure\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 * 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 iOVM_ChainStorageContainer _queueRef\n )\n internal\n view\n returns (\n Lib_OVMCodec.QueueElement memory _element\n )\n {\n // The underlying queue data structure stores 2 elements\n // per insertion, so to get the actual desired queue index\n // we need to multiply by 2.\n uint40 trueIndex = uint40(_index * 2);\n bytes32 transactionHash = _queueRef.get(trueIndex);\n bytes32 timestampAndBlockNumber = _queueRef.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 transactionHash: transactionHash,\n timestamp: elementTimestamp,\n blockNumber: elementBlockNumber\n });\n }\n\n /**\n * Retrieves the length of the queue.\n * @return Length of the queue.\n */\n function _getQueueLength(\n iOVM_ChainStorageContainer _queueRef\n )\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.\n return uint40(_queueRef.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 bytes memory _hashMemory\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n // Only allocate more memory if we didn't reserve enough to begin with.\n if (BYTES_TILL_TX_DATA + _txDataLength > _hashMemory.length) {\n _hashMemory = new bytes(BYTES_TILL_TX_DATA + _txDataLength);\n }\n\n uint256 ctxTimestamp = _context.timestamp;\n uint256 ctxBlockNumber = _context.blockNumber;\n\n bytes32 leafHash;\n assembly {\n let chainElementStart := add(_hashMemory, 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 iOVM_ChainStorageContainer batchesRef = batches();\n (uint40 totalElements, uint40 nextQueueIndex,,) = _getBatchExtraData();\n\n Lib_OVMCodec.ChainBatchHeader memory header = Lib_OVMCodec.ChainBatchHeader({\n batchIndex: batchesRef.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 batchesRef.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 have the same context\n // or a later timestamp and block number.\n if (getTotalElements() > 0) {\n (,, uint40 lastTimestamp, uint40 lastBlockNumber) = _getBatchExtraData();\n\n require(\n _firstContext.blockNumber >= lastBlockNumber,\n \"Context block number is lower than last submitted.\"\n );\n\n require(\n _firstContext.timestamp >= lastTimestamp,\n \"Context timestamp is lower than last submitted.\"\n );\n }\n\n // Sequencer cannot submit contexts which are more than the force inclusion period old.\n require(\n _firstContext.timestamp + forceInclusionPeriodSeconds >= block.timestamp,\n \"Context timestamp too far in the past.\"\n );\n\n require(\n _firstContext.blockNumber + forceInclusionPeriodBlocks >= block.number,\n \"Context block number too far in the past.\"\n );\n }\n\n /**\n * Checks that a given batch context has a time context which is below a given que element\n * @param _context The batch context to validate has values lower.\n * @param _queueIndex Index of the queue element we are validating came later than the context.\n * @param _queueRef The storage container for the queue.\n */\n function _validateContextBeforeEnqueue(\n BatchContext memory _context,\n uint40 _queueIndex,\n iOVM_ChainStorageContainer _queueRef\n )\n internal\n view\n {\n Lib_OVMCodec.QueueElement memory nextQueueElement = _getQueueElement(\n _queueIndex,\n _queueRef\n );\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 _context.timestamp <= nextQueueElement.timestamp,\n \"Sequencer transaction timestamp exceeds that of next queue element.\"\n );\n\n require(\n _context.blockNumber <= nextQueueElement.blockNumber,\n \"Sequencer transaction blockNumber exceeds that of next queue element.\"\n );\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 * @param _queueRef The storage container for the queue.\n */\n function _validateNextBatchContext(\n BatchContext memory _prevContext,\n BatchContext memory _nextContext,\n uint40 _nextQueueIndex,\n iOVM_ChainStorageContainer _queueRef\n )\n internal\n view\n {\n // All sequencer transactions' times must be greater than or equal to 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 is going to be a queue element pulled in from this context:\n if (_nextContext.numSubsequentQueueTransactions > 0) {\n _validateContextBeforeEnqueue(\n _nextContext,\n _nextQueueIndex,\n _queueRef\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 * @param _queueLength The length of the queue at the start of the batchAppend call.\n * @param _nextQueueIndex The next element in the queue that will be pulled into the CTC.\n * @param _queueRef The storage container for the queue.\n */\n function _validateFinalBatchContext(\n BatchContext memory _finalContext,\n uint40 _nextQueueIndex,\n uint40 _queueLength,\n iOVM_ChainStorageContainer _queueRef\n )\n internal\n view\n {\n // If the queue is not now empty, check the mononoticity of whatever the next batch that will come in is.\n if (_queueLength - _nextQueueIndex > 0 && _finalContext.numSubsequentQueueTransactions == 0) {\n _validateContextBeforeEnqueue(\n _finalContext,\n _nextQueueIndex,\n _queueRef\n );\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.transactionHash == 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/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_Bytes32Utils } from \"../../libraries/utils/Lib_Bytes32Utils.sol\";\nimport { Lib_EthUtils } from \"../../libraries/utils/Lib_EthUtils.sol\";\nimport { Lib_ErrorUtils } from \"../../libraries/utils/Lib_ErrorUtils.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.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_DeployerWhitelist } from \"../predeploys/OVM_DeployerWhitelist.sol\";\n\n/* External Imports */\nimport { Math } from \"@openzeppelin/contracts/math/Math.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 * Native Value Constants *\n **************************/\n\n // Public so we can access and make assertions in integration tests.\n uint256 public constant CALL_WITH_VALUE_INTRINSIC_GAS = 90000;\n\n\n /**************************\n * Default Context Values *\n **************************/\n\n uint256 constant DEFAULT_UINT256 = 0xdefa017defa017defa017defa017defa017defa017defa017defa017defa017d;\n address constant DEFAULT_ADDRESS = 0xdEfa017defA017DeFA017DEfa017DeFA017DeFa0;\n\n\n /*************************************\n * Container Contract Address Prefix *\n *************************************/\n\n /**\n * @dev The Execution Manager and State Manager each have this 30 byte prefix, and are uncallable.\n */\n address constant CONTAINER_CONTRACT_PREFIX = 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000;\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 Lib_AddressResolver(_libAddressManager)\n {\n ovmSafetyChecker = iOVM_SafetyChecker(resolve(\"OVM_SafetyChecker\"));\n gasMeterConfig = _gasMeterConfig;\n globalContext = _globalContext;\n _resetContext();\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 external\n returns (\n bytes memory\n )\n {\n // Make sure that run() is not re-enterable. This condition should always be satisfied\n // Once run has been called once, due to the behavior of _isValidInput().\n if (transactionContext.ovmNUMBER != DEFAULT_UINT256) {\n return bytes(\"\");\n }\n\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 (_isValidInput(_transaction) == false) {\n _resetContext();\n return bytes(\"\");\n }\n\n // TEMPORARY: Gas metering is disabled for minnet.\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 (, bytes memory returndata) = ovmCALL(\n _transaction.gasLimit - gasMeterConfig.minTransactionGasLimit,\n _transaction.entrypoint,\n 0,\n _transaction.data\n );\n\n // TEMPORARY: Gas metering is disabled for minnet.\n // // Update the cumulative gas based on the amount of gas used.\n // uint256 gasUsed = gasProvided - gasleft();\n // _updateCumulativeGas(gasUsed, _transaction.l1QueueOrigin);\n\n // Wipe the execution context.\n _resetContext();\n\n return returndata;\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 external\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 CALLVALUE.\n * @return _CALLVALUE Value sent along with the call according to the current message context.\n */\n function ovmCALLVALUE()\n override\n public\n view\n returns (\n uint256 _CALLVALUE\n )\n {\n return messageContext.ovmCALLVALUE;\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 external\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 external\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 external\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 external\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 source (Sequencer or Queue) this transaction originated from.\n * @return _queueOrigin Enum indicating the ovmL1QUEUEORIGIN within the current message context.\n */\n function ovmL1QUEUEORIGIN()\n override\n external\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 external\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 Address of the created contract.\n * @return Revert data, if and only if the creation threw an exception.\n */\n function ovmCREATE(\n bytes memory _bytecode\n )\n override\n public\n notStatic\n fixedGasDiscount(40000)\n returns (\n address,\n bytes memory\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 MessageType.ovmCREATE\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 Address of the created contract.\n * @return Revert data, if and only if the creation threw an exception.\n */\n function ovmCREATE2(\n bytes memory _bytecode,\n bytes32 _salt\n )\n override\n external\n notStatic\n fixedGasDiscount(40000)\n returns (\n address,\n bytes memory\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 MessageType.ovmCREATE2\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 external\n returns (\n uint256 _nonce\n )\n {\n return _getAccountNonce(ovmADDRESS());\n }\n\n /**\n * Bumps the nonce of the current ovmADDRESS by one.\n */\n function ovmINCREMENTNONCE()\n override\n external\n notStatic\n {\n address account = ovmADDRESS();\n uint256 nonce = _getAccountNonce(account);\n\n // Prevent overflow.\n if (nonce + 1 > nonce) {\n _setAccountNonce(account, nonce + 1);\n }\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 // Creates a duplicate of the OVM_ProxyEOA located at 0x42....09. Uses the following\n // \"magic\" prefix to deploy an exact copy of the code:\n // PUSH1 0x0D # size of this prefix in bytes\n // CODESIZE\n // SUB # subtract prefix size from codesize\n // DUP1\n // PUSH1 0x0D\n // PUSH1 0x00\n // CODECOPY # copy everything after prefix into memory at pos 0\n // PUSH1 0x00\n // RETURN # return the copied code\n address proxyEOA = Lib_EthUtils.createContract(abi.encodePacked(\n hex\"600D380380600D6000396000f3\",\n ovmEXTCODECOPY(\n Lib_PredeployAddresses.PROXY_EOA,\n 0,\n ovmEXTCODESIZE(Lib_PredeployAddresses.PROXY_EOA)\n )\n ));\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 _value ETH value to pass with the 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 uint256 _value,\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 nextMessageContext.ovmCALLVALUE = _value;\n\n return _callContract(\n nextMessageContext,\n _gasLimit,\n _address,\n _calldata,\n MessageType.ovmCALL\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, valueless context.\n MessageContext memory nextMessageContext = messageContext;\n nextMessageContext.ovmCALLER = nextMessageContext.ovmADDRESS;\n nextMessageContext.ovmADDRESS = _address;\n nextMessageContext.isStatic = true;\n nextMessageContext.ovmCALLVALUE = 0;\n\n return _callContract(\n nextMessageContext,\n _gasLimit,\n _address,\n _calldata,\n MessageType.ovmSTATICCALL\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\n return _callContract(\n nextMessageContext,\n _gasLimit,\n _address,\n _calldata,\n MessageType.ovmDELEGATECALL\n );\n }\n\n /**\n * @notice Legacy ovmCALL function which did not support ETH value; this maintains backwards compatibility.\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 returns(\n bool _success,\n bytes memory _returndata\n )\n {\n // Legacy ovmCALL assumed always-0 value.\n return ovmCALL(\n _gasLimit,\n _address,\n 0,\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 external\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 external\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 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 external\n returns (\n bytes32 _EXTCODEHASH\n )\n {\n return Lib_EthUtils.getCodeHash(\n _getAccountEthAddress(_contract)\n );\n }\n\n\n /***************************************\n * Public Functions: ETH Value Opcodes *\n ***************************************/\n\n /**\n * @notice Overrides BALANCE.\n * NOTE: In the future, this could be optimized to directly invoke EM._getContractStorage(...).\n * @param _contract Address of the contract to query the OVM_ETH balance of.\n * @return _BALANCE OVM_ETH balance of the requested contract.\n */\n function ovmBALANCE(\n address _contract\n )\n override\n public\n returns (\n uint256 _BALANCE\n )\n {\n // Easiest way to get the balance is query OVM_ETH as normal.\n bytes memory balanceOfCalldata = abi.encodeWithSignature(\n \"balanceOf(address)\",\n _contract\n );\n\n // Static call because this should be a read-only query.\n (bool success, bytes memory returndata) = ovmSTATICCALL(\n gasleft(),\n Lib_PredeployAddresses.OVM_ETH,\n balanceOfCalldata\n );\n\n // All balanceOf queries should successfully return a uint, otherwise this must be an OOG.\n if (!success || returndata.length != 32) {\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\n }\n\n // Return the decoded balance.\n return abi.decode(returndata, (uint256));\n }\n\n /**\n * @notice Overrides SELFBALANCE.\n * @return _BALANCE OVM_ETH balance of the requesting contract.\n */\n function ovmSELFBALANCE()\n override\n external\n returns (\n uint256 _BALANCE\n )\n {\n return ovmBALANCE(ovmADDRESS());\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 Whitelisting *\n ********************************************/\n\n /**\n * Checks whether the given address is on the whitelist 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 semantics perspective, this will appear 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) = ovmSTATICCALL(\n gasleft(),\n Lib_PredeployAddresses.DEPLOYER_WHITELIST,\n abi.encodeWithSelector(\n OVM_DeployerWhitelist.isDeployerAllowed.selector,\n _deployerAddress\n )\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 Final OVM contract address.\n * @return Revertdata, if and only if the creation threw an exception.\n */\n function _createContract(\n address _contractAddress,\n bytes memory _bytecode,\n MessageType _messageType\n )\n internal\n returns (\n address,\n bytes memory\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 the common logic which occurs between call-type and create-type messages,\n // passing in the creation bytecode and `true` to trigger create-specific logic.\n (bool success, bytes memory data) = _handleExternalMessage(\n nextMessageContext,\n gasleft(),\n _contractAddress,\n _bytecode,\n _messageType\n );\n\n // Yellow paper requires that address returned is zero if the contract deployment fails.\n return (\n success ? _contractAddress : address(0),\n data\n );\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 MessageType _messageType\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(CONTAINER_CONTRACT_PREFIX)\n ) {\n // EVM does not return data in the success case, see: https://github.com/ethereum/go-ethereum/blob/aae7660410f0ef90279e14afaaf2f429fdc2a186/core/vm/instructions.go#L600-L604\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 _handleExternalMessage(\n _nextMessageContext,\n _gasLimit,\n codeContractAddress,\n _calldata,\n _messageType\n );\n }\n\n /**\n * Handles all interactions which involve the execution manager calling out to untrusted code (both calls and creates).\n * Ensures that OVM-related measures are enforced, including L2 gas refunds, nuisance gas, and flagged reversions.\n *\n * @param _nextMessageContext Message context to be used for the external message.\n * @param _gasLimit Amount of gas to be passed into this message. NOTE: this argument is overwritten in some cases to avoid stack-too-deep.\n * @param _contract OVM address being called or deployed to\n * @param _data Data for the message (either calldata or creation code)\n * @param _messageType What type of ovmOPCODE this message corresponds to.\n * @return Whether or not the message (either a call or deployment) succeeded.\n * @return Data returned by the message.\n */\n function _handleExternalMessage(\n MessageContext memory _nextMessageContext,\n // NOTE: this argument is overwritten in some cases to avoid stack-too-deep.\n uint256 _gasLimit,\n address _contract,\n bytes memory _data,\n MessageType _messageType\n )\n internal\n returns (\n bool,\n bytes memory\n )\n {\n uint256 messageValue = _nextMessageContext.ovmCALLVALUE;\n // If there is value in this message, we need to transfer the ETH over before switching contexts.\n if (\n messageValue > 0\n && _isValueType(_messageType)\n ) {\n // Handle out-of-intrinsic gas consistent with EVM behavior -- the subcall \"appears to revert\" if we don't have enough gas to transfer the ETH.\n // Similar to dynamic gas cost of value exceeding gas here:\n // https://github.com/ethereum/go-ethereum/blob/c503f98f6d5e80e079c1d8a3601d188af2a899da/core/vm/interpreter.go#L268-L273\n if (gasleft() < CALL_WITH_VALUE_INTRINSIC_GAS) {\n return (false, hex\"\");\n }\n\n // If there *is* enough gas to transfer ETH, then we need to make sure this amount of gas is reserved (i.e. not\n // given to the _contract.call below) to guarantee that _handleExternalMessage can't run out of gas.\n // In particular, in the event that the call fails, we will need to transfer the ETH back to the sender.\n // Taking the lesser of _gasLimit and gasleft() - CALL_WITH_VALUE_INTRINSIC_GAS guarantees that the second\n // _attemptForcedEthTransfer below, if needed, always has enough gas to succeed.\n _gasLimit = Math.min(\n _gasLimit,\n gasleft() - CALL_WITH_VALUE_INTRINSIC_GAS // Cannot overflow due to the above check.\n );\n\n // Now transfer the value of the call.\n // The target is interpreted to be the next message's ovmADDRESS account.\n bool transferredOvmEth = _attemptForcedEthTransfer(\n _nextMessageContext.ovmADDRESS,\n messageValue\n );\n\n // If the ETH transfer fails (should only be possible in the case of insufficient balance), then treat this as a revert.\n // This mirrors EVM behavior, see https://github.com/ethereum/go-ethereum/blob/2dee31930c9977af2a9fcb518fb9838aa609a7cf/core/vm/evm.go#L298\n if (!transferredOvmEth) {\n return (false, hex\"\");\n }\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. `_contract` 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\n bool success;\n bytes memory returndata;\n if (_isCreateType(_messageType)) {\n // safeCREATE() is a function which replicates a CREATE message, but uses return values\n // Which match that of CALL (i.e. bool, bytes). This allows many security checks to be\n // to be shared between untrusted call and create call frames.\n (success, returndata) = address(this).call{gas: _gasLimit}(\n abi.encodeWithSelector(\n this.safeCREATE.selector,\n _data,\n _contract\n )\n );\n } else {\n (success, returndata) = _contract.call{gas: _gasLimit}(_data);\n }\n\n // If the message threw an exception, its value should be returned back to the sender.\n // So, we force it back, BEFORE returning the messageContext to the previous addresses.\n // This operation is part of the reason we \"reserved the intrinsic gas\" above.\n if (\n messageValue > 0\n && _isValueType(_messageType)\n && !success\n ) {\n bool transferredOvmEth = _attemptForcedEthTransfer(\n prevMessageContext.ovmADDRESS,\n messageValue\n );\n\n // Since we transferred it in above and the call reverted, the transfer back should always pass.\n // This code path should NEVER be triggered since we sent `messageValue` worth of OVM_ETH into the target\n // and reserved sufficient gas to execute the transfer, but in case there is some edge case which has\n // been missed, we revert the entire frame (and its parent) to make sure the ETH gets sent back.\n if (!transferredOvmEth) {\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\n }\n }\n\n // Switch back to the original message context now that we're out of the call and all OVM_ETH is in the right place.\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. Additionally, we surface custom error messages\n // to developers in the case of unsafe creations for improved devex.\n // All other revert types return no data.\n if (\n flag == RevertFlag.INTENTIONAL_REVERT\n || flag == RevertFlag.UNSAFE_BYTECODE\n ) {\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 * Handles the creation-specific safety measures required for OVM contract deployment.\n * This function sanitizes the return types for creation messages to match calls (bool, bytes),\n * by being an external function which the EM can call, that mimics the success/fail case of the CREATE.\n * This allows for consistent handling of both types of messages in _handleExternalMessage().\n * Having this step occur as a separate call frame also allows us to easily revert the\n * contract deployment in the event that the code is unsafe.\n *\n * @param _creationCode Code to pass into CREATE for deployment.\n * @param _address OVM address being deployed to.\n */\n function safeCREATE(\n bytes memory _creationCode,\n address _address\n )\n external\n {\n // The only way this should callable is from within _createContract(),\n // and it should DEFINITELY not be callable by a non-EM code contract.\n if (msg.sender != address(this)) {\n return;\n }\n // Check that there is not already code at this address.\n if (_hasEmptyAccount(_address) == false) {\n // Note: in the EVM, this case burns all allotted gas. For improved\n // developer experience, we do return the remaining gas.\n _revertWithFlag(\n RevertFlag.CREATE_COLLISION\n );\n }\n\n // Check the creation bytecode against the OVM_SafetyChecker.\n if (ovmSafetyChecker.isBytecodeSafe(_creationCode) == false) {\n // Note: in the EVM, this case burns all allotted gas. For improved\n // developer experience, we do return the remaining gas.\n _revertWithFlag(\n RevertFlag.UNSAFE_BYTECODE,\n Lib_ErrorUtils.encodeRevertString(\"Contract creation code contains unsafe opcodes. Did you use the right compiler or pass an unsafe constructor argument?\")\n );\n }\n\n // We always need to initialize the contract with the default account values.\n _initPendingAccount(_address);\n\n // Actually execute the EVM create message.\n // NOTE: The inline assembly below means we can NOT make any evm calls between here and then.\n address ethAddress = Lib_EthUtils.createContract(_creationCode);\n\n if (ethAddress == address(0)) {\n // If the creation fails, the EVM lets us grab its revert data. This may contain a revert flag\n // to be used above in _handleExternalMessage, so we pass the revert data back up unmodified.\n assembly {\n returndatacopy(0,0,returndatasize())\n revert(0, returndatasize())\n }\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(\n RevertFlag.UNSAFE_BYTECODE,\n Lib_ErrorUtils.encodeRevertString(\"Constructor attempted to deploy unsafe bytecode.\")\n );\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 * Internal Functions: Value Manipulation *\n ******************************************/\n\n /**\n * Invokes an ovmCALL to OVM_ETH.transfer on behalf of the current ovmADDRESS, allowing us to force movement of OVM_ETH in correspondence with ETH's native value functionality.\n * WARNING: this will send on behalf of whatever the messageContext.ovmADDRESS is in storage at the time of the call.\n * NOTE: In the future, this could be optimized to directly invoke EM._setContractStorage(...).\n * @param _to Amount of OVM_ETH to be sent.\n * @param _value Amount of OVM_ETH to send.\n * @return _success Whether or not the transfer worked.\n */\n function _attemptForcedEthTransfer(\n address _to,\n uint256 _value\n )\n internal\n returns(\n bool _success\n )\n {\n bytes memory transferCalldata = abi.encodeWithSignature(\n \"transfer(address,uint256)\",\n _to,\n _value\n );\n\n // OVM_ETH inherits from the UniswapV2ERC20 standard. In this implementation, its return type\n // is a boolean. However, the implementation always returns true if it does not revert.\n // Thus, success of the call frame is sufficient to infer success of the transfer itself.\n (bool success, ) = ovmCALL(\n gasleft(),\n Lib_PredeployAddresses.OVM_ETH,\n 0,\n transferCalldata\n );\n\n return success;\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 ) {\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 view\n {\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 input values of a transaction.\n * @return _valid Whether or not the transaction data is valid.\n */\n function _isValidInput(\n Lib_OVMCodec.Transaction memory _transaction\n )\n view\n internal\n returns (\n bool\n )\n {\n // Prevent reentrancy to run():\n // This check prevents calling run with the default ovmNumber.\n // Combined with the first check in run():\n // if (transactionContext.ovmNUMBER != DEFAULT_UINT256) { return; }\n // It should be impossible to re-enter since run() returns before any other call frames are created.\n // Since this value is already being written to storage, we save much gas compared to\n // using the standard nonReentrant pattern.\n if (_transaction.blockNumber == DEFAULT_UINT256) {\n return false;\n }\n\n if (_isValidGasLimit(_transaction.gasLimit, _transaction.l1QueueOrigin) == false) {\n return false;\n }\n\n return true;\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 view\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 // These conditionals allow us to avoid unneccessary SSTOREs. However, they do mean that the current storage\n // value for the messageContext MUST equal the _prevMessageContext argument, or an SSTORE might be erroneously skipped.\n if (_prevMessageContext.ovmCALLER != _nextMessageContext.ovmCALLER) {\n messageContext.ovmCALLER = _nextMessageContext.ovmCALLER;\n }\n\n if (_prevMessageContext.ovmADDRESS != _nextMessageContext.ovmADDRESS) {\n messageContext.ovmADDRESS = _nextMessageContext.ovmADDRESS;\n }\n\n if (_prevMessageContext.isStatic != _nextMessageContext.isStatic) {\n messageContext.isStatic = _nextMessageContext.isStatic;\n }\n\n if (_prevMessageContext.ovmCALLVALUE != _nextMessageContext.ovmCALLVALUE) {\n messageContext.ovmCALLVALUE = _nextMessageContext.ovmCALLVALUE;\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 = DEFAULT_ADDRESS;\n transactionContext.ovmTIMESTAMP = DEFAULT_UINT256;\n transactionContext.ovmNUMBER = DEFAULT_UINT256;\n transactionContext.ovmGASLIMIT = DEFAULT_UINT256;\n transactionContext.ovmTXGASLIMIT = DEFAULT_UINT256;\n transactionContext.ovmL1QUEUEORIGIN = Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE;\n\n transactionRecord.ovmGasRefund = DEFAULT_UINT256;\n\n messageContext.ovmCALLER = DEFAULT_ADDRESS;\n messageContext.ovmADDRESS = DEFAULT_ADDRESS;\n messageContext.isStatic = false;\n\n messageRecord.nuisanceGasLeft = DEFAULT_UINT256;\n\n // Reset the ovmStateManager.\n ovmStateManager = iOVM_StateManager(address(0));\n }\n\n\n /******************************************\n * Internal Functions: Message Typechecks *\n ******************************************/\n\n /**\n * Returns whether or not the given message type is a CREATE-type.\n * @param _messageType the message type in question.\n */\n function _isCreateType(\n MessageType _messageType\n )\n internal\n pure\n returns(\n bool\n )\n {\n return (\n _messageType == MessageType.ovmCREATE\n || _messageType == MessageType.ovmCREATE2\n );\n }\n\n /**\n * Returns whether or not the given message type (potentially) requires the transfer of ETH value along with the message.\n * @param _messageType the message type in question.\n */\n function _isValueType(\n MessageType _messageType\n )\n internal\n pure\n returns(\n bool\n )\n {\n // ovmSTATICCALL and ovmDELEGATECALL types do not accept or transfer value.\n return (\n _messageType == MessageType.ovmCALL\n || _messageType == MessageType.ovmCREATE\n || _messageType == MessageType.ovmCREATE2\n );\n }\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 * @param _value the amount of ETH value to send.\n * @param _ovmStateManager the address of the OVM_StateManager precompile in the L2 state.\n */\n function simulateMessage(\n Lib_OVMCodec.Transaction memory _transaction,\n address _from,\n uint256 _value,\n iOVM_StateManager _ovmStateManager\n )\n external\n returns (\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 // Initialize the EM's internal state, ignoring nuisance gas.\n ovmStateManager = _ovmStateManager;\n _initContext(_transaction);\n messageRecord.nuisanceGasLeft = uint(-1);\n\n // Set the ovmADDRESS to the _from so that the subsequent call frame \"comes from\" them.\n messageContext.ovmADDRESS = _from;\n\n // Execute the desired message.\n bool isCreate = _transaction.entrypoint == address(0);\n if (isCreate) {\n (address created, bytes memory revertData) = ovmCREATE(_transaction.data);\n if (created == address(0)) {\n return abi.encode(false, revertData);\n } else {\n // The eth_call RPC endpoint for to = undefined will return the deployed bytecode\n // in the success case, differing from standard create messages.\n return abi.encode(true, Lib_EthUtils.getCode(created));\n }\n } else {\n (bool success, bytes memory returndata) = ovmCALL(\n _transaction.gasLimit,\n _transaction.entrypoint,\n _value,\n _transaction.data\n );\n return abi.encode(success, returndata);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow, so we distribute\n return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);\n }\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/predeploys/OVM_DeployerWhitelist.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Interface Imports */\nimport { iOVM_DeployerWhitelist } from \"../../iOVM/predeploys/iOVM_DeployerWhitelist.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: optimistic-solc\n * Runtime target: OVM\n */\ncontract OVM_DeployerWhitelist is iOVM_DeployerWhitelist {\n\n /**********************\n * Contract Constants *\n **********************/\n\n bool public initialized;\n bool public allowArbitraryDeployment;\n address override public owner;\n mapping (address => bool) public whitelist;\n\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * Blocks functions to anyone except the contract owner.\n */\n modifier onlyOwner() {\n require(\n msg.sender == 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 external\n {\n if (initialized == true) {\n return;\n }\n\n initialized = true;\n allowArbitraryDeployment = _allowArbitraryDeployment;\n owner = _owner;\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 external\n onlyOwner\n {\n whitelist[_deployer] = _isWhitelisted;\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 owner = _owner;\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 allowArbitraryDeployment = _allowArbitraryDeployment;\n }\n\n /**\n * Permanently enables arbitrary contract deployment and deletes the owner.\n */\n function enableArbitraryContractDeployment()\n override\n external\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 external\n returns (\n bool\n )\n {\n return (\n initialized == false\n || allowArbitraryDeployment == true\n || whitelist[_deployer]\n );\n }\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/predeploys/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 owner() 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/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 /**\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 (\n bool\n )\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" + }, + "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 *\n ********************/\n\n /**\n * Creates a new OVM_StateManager\n * @param _owner Owner of the created contract.\n * @return New OVM_StateManager instance.\n */\n function create(\n address _owner\n )\n override\n public\n returns (\n iOVM_StateManager\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 * 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 * Variables *\n *************/\n\n address override public owner;\n address override public ovmExecutionManager;\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 {\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 *\n ********************/\n\n /**\n * Checks whether a given address is allowed to modify this contract.\n * @param _address Address to check.\n * @return Whether or not the address can modify this contract.\n */\n function isAuthenticated(\n address _address\n )\n override\n public\n view\n returns (\n bool\n )\n {\n return (_address == owner || _address == ovmExecutionManager);\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 * 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 for the given address.\n */\n function getAccount(\n address _address\n )\n override\n public\n view\n returns (\n Lib_OVMCodec.Account memory\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 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\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 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\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 of the account.\n */\n function getAccountNonce(\n address _address\n )\n override\n public\n view\n returns (\n uint256\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 Corresponding Ethereum address.\n */\n function getAccountEthAddress(\n address _address\n )\n override\n public\n view\n returns (\n address\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 Corresponding storage root.\n */\n function getAccountStorageRoot(\n address _address\n )\n override\n public\n view\n returns (\n bytes32\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 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\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 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\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 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\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 uncommitted accounts.\n */\n function getTotalUncommittedAccounts()\n override\n public\n view\n returns (\n uint256\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 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\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 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\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 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\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 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\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 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\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 uncommitted storage slots.\n */\n function getTotalUncommittedContractStorage()\n override\n public\n view\n returns (\n uint256\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 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\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/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 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" + }, + "contracts/optimistic-ethereum/OVM/bridge/messaging/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_AddressResolver } from \"../../../libraries/resolver/Lib_AddressResolver.sol\";\nimport { Lib_OVMCodec } from \"../../../libraries/codec/Lib_OVMCodec.sol\";\nimport { Lib_AddressManager } from \"../../../libraries/resolver/Lib_AddressManager.sol\";\nimport { Lib_SecureMerkleTrie } from \"../../../libraries/trie/Lib_SecureMerkleTrie.sol\";\nimport { Lib_PredeployAddresses } from \"../../../libraries/constants/Lib_PredeployAddresses.sol\";\nimport { Lib_CrossDomainUtils } from \"../../../libraries/bridge/Lib_CrossDomainUtils.sol\";\n\n/* Interface Imports */\nimport { iOVM_L1CrossDomainMessenger } from \"../../../iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol\";\nimport { iOVM_CanonicalTransactionChain } from \"../../../iOVM/chain/iOVM_CanonicalTransactionChain.sol\";\nimport { iOVM_StateCommitmentChain } from \"../../../iOVM/chain/iOVM_StateCommitmentChain.sol\";\n\n/* External Imports */\nimport { OwnableUpgradeable } from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport { PausableUpgradeable } from \"@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol\";\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol\";\n\n/**\n * @title OVM_L1CrossDomainMessenger\n * @dev The L1 Cross Domain Messenger contract sends messages from L1 to L2, and relays messages\n * from L2 onto L1. In the event that a message sent from L1 to L2 is rejected for exceeding the L2\n * epoch gas limit, it can be resubmitted via this contract's replay function.\n *\n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_L1CrossDomainMessenger is\n iOVM_L1CrossDomainMessenger,\n Lib_AddressResolver,\n OwnableUpgradeable,\n PausableUpgradeable,\n ReentrancyGuardUpgradeable\n{\n\n /**********\n * Events *\n **********/\n\n event MessageBlocked(\n bytes32 indexed _xDomainCalldataHash\n );\n\n event MessageAllowed(\n bytes32 indexed _xDomainCalldataHash\n );\n\n /*************\n * Constants *\n *************/\n\n // The default x-domain message sender being set to a non-zero value makes\n // deployment a bit more expensive, but in exchange the refund on every call to\n // `relayMessage` by the L1 and L2 messengers will be higher.\n address internal constant DEFAULT_XDOMAIN_SENDER = 0x000000000000000000000000000000000000dEaD;\n\n /**********************\n * Contract Variables *\n **********************/\n\n mapping (bytes32 => bool) public blockedMessages;\n mapping (bytes32 => bool) public relayedMessages;\n mapping (bytes32 => bool) public successfulMessages;\n\n address internal xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * This contract is intended to be behind a delegate proxy.\n * We pass the zero address to the address resolver just to satisfy the constructor.\n * We still need to set this value in initialize().\n */\n constructor()\n Lib_AddressResolver(address(0))\n {}\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * Modifier to enforce that, if configured, only the OVM_L2MessageRelayer contract may\n * 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 * @param _libAddressManager Address of the Address Manager.\n */\n function initialize(\n address _libAddressManager\n )\n public\n initializer\n {\n require(\n address(libAddressManager) == address(0),\n \"L1CrossDomainMessenger already intialized.\"\n );\n libAddressManager = Lib_AddressManager(_libAddressManager);\n xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\n\n // Initialize upgradable OZ contracts\n __Context_init_unchained(); // Context is a dependency for both Ownable and Pausable\n __Ownable_init_unchained();\n __Pausable_init_unchained();\n __ReentrancyGuard_init_unchained();\n }\n\n /**\n * Pause relaying.\n */\n function pause()\n external\n onlyOwner\n {\n _pause();\n }\n\n /**\n * Block a message.\n * @param _xDomainCalldataHash Hash of the message to block.\n */\n function blockMessage(\n bytes32 _xDomainCalldataHash\n )\n external\n onlyOwner\n {\n blockedMessages[_xDomainCalldataHash] = true;\n emit MessageBlocked(_xDomainCalldataHash);\n }\n\n /**\n * Allow a message.\n * @param _xDomainCalldataHash Hash of the message to block.\n */\n function allowMessage(\n bytes32 _xDomainCalldataHash\n )\n external\n onlyOwner\n {\n blockedMessages[_xDomainCalldataHash] = false;\n emit MessageAllowed(_xDomainCalldataHash);\n }\n\n function xDomainMessageSender()\n public\n override\n view\n returns (\n address\n )\n {\n require(xDomainMsgSender != DEFAULT_XDOMAIN_SENDER, \"xDomainMessageSender is not set\");\n return xDomainMsgSender;\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 memory _message,\n uint32 _gasLimit\n )\n override\n public\n {\n address ovmCanonicalTransactionChain = resolve(\"OVM_CanonicalTransactionChain\");\n // Use the CTC queue length as nonce\n uint40 nonce = iOVM_CanonicalTransactionChain(ovmCanonicalTransactionChain).getQueueLength();\n\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n msg.sender,\n _message,\n nonce\n );\n\n address l2CrossDomainMessenger = resolve(\"OVM_L2CrossDomainMessenger\");\n _sendXDomainMessage(ovmCanonicalTransactionChain, l2CrossDomainMessenger, xDomainCalldata, _gasLimit);\n emit SentMessage(xDomainCalldata);\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 whenNotPaused\n {\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\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 require(\n blockedMessages[xDomainCalldataHash] == false,\n \"Provided message has been blocked.\"\n );\n\n xDomainMsgSender = _sender;\n (bool success, ) = _target.call(_message);\n xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\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 } else {\n emit FailedRelayedMessage(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 _queueIndex,\n uint32 _gasLimit\n )\n override\n public\n {\n // Verify that the message is in the queue:\n address canonicalTransactionChain = resolve(\"OVM_CanonicalTransactionChain\");\n Lib_OVMCodec.QueueElement memory element = iOVM_CanonicalTransactionChain(canonicalTransactionChain).getQueueElement(_queueIndex);\n\n address l2CrossDomainMessenger = resolve(\"OVM_L2CrossDomainMessenger\");\n // Compute the transactionHash\n bytes32 transactionHash = keccak256(\n abi.encode(\n address(this),\n l2CrossDomainMessenger,\n _gasLimit,\n _message\n )\n );\n\n require(\n transactionHash == element.transactionHash,\n \"Provided message has not been enqueued.\"\n );\n\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n _sender,\n _message,\n _queueIndex\n );\n\n _sendXDomainMessage(canonicalTransactionChain, l2CrossDomainMessenger, 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(\n resolve(\"OVM_StateCommitmentChain\")\n );\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(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER),\n _proof.stateTrieWitness,\n _proof.stateRoot\n );\n\n require(\n exists == true,\n \"Message passing predeploy 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 _canonicalTransactionChain Address of the OVM_CanonicalTransactionChain instance.\n * @param _l2CrossDomainMessenger Address of the OVM_L2CrossDomainMessenger instance.\n * @param _message Message to send.\n * @param _gasLimit OVM gas limit for the message.\n */\n function _sendXDomainMessage(\n address _canonicalTransactionChain,\n address _l2CrossDomainMessenger,\n bytes memory _message,\n uint256 _gasLimit\n )\n internal\n {\n iOVM_CanonicalTransactionChain(_canonicalTransactionChain).enqueue(\n _l2CrossDomainMessenger,\n _gasLimit,\n _message\n );\n }\n}\n" + }, + "contracts/optimistic-ethereum/libraries/bridge/Lib_CrossDomainUtils.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\";\n\n/**\n * @title Lib_CrossDomainUtils\n */\nlibrary Lib_CrossDomainUtils {\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 encodeXDomainCalldata(\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" + }, + "contracts/optimistic-ethereum/iOVM/bridge/messaging/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 { iOVM_CrossDomainMessenger } from \"./iOVM_CrossDomainMessenger.sol\";\n\n/**\n * @title iOVM_L1CrossDomainMessenger\n */\ninterface iOVM_L1CrossDomainMessenger is iOVM_CrossDomainMessenger {\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 _queueIndex CTC Queue index for the message to replay.\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 _queueIndex,\n uint32 _gasLimit\n ) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/Initializable.sol\";\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal initializer {\n __Context_init_unchained();\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal initializer {\n address msgSender = _msgSender();\n _owner = msgSender;\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\n }\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\nimport \"./ContextUpgradeable.sol\";\nimport \"../proxy/Initializable.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n function __Pausable_init() internal initializer {\n __Context_init_unchained();\n __Pausable_init_unchained();\n }\n\n function __Pausable_init_unchained() internal initializer {\n _paused = false;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n require(!paused(), \"Pausable: paused\");\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n require(paused(), \"Pausable: not paused\");\n _;\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\n }\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\nimport \"../proxy/Initializable.sol\";\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 ReentrancyGuardUpgradeable is Initializable {\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 function __ReentrancyGuard_init() internal initializer {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal initializer {\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 uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\nimport \"../proxy/Initializable.sol\";\n\n/*\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with GSN meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal initializer {\n __Context_init_unchained();\n }\n\n function __Context_init_unchained() internal initializer {\n }\n function _msgSender() internal view virtual returns (address payable) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes memory) {\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n return msg.data;\n }\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\n// solhint-disable-next-line compiler-version\npragma solidity >=0.4.24 <0.8.0;\n\nimport \"../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n */\nabstract contract Initializable {\n\n /**\n * @dev Indicates that the contract has been initialized.\n */\n bool private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Modifier to protect an initializer function from being invoked twice.\n */\n modifier initializer() {\n require(_initializing || _isConstructor() || !_initialized, \"Initializable: contract is already initialized\");\n\n bool isTopLevelCall = !_initializing;\n if (isTopLevelCall) {\n _initializing = true;\n _initialized = true;\n }\n\n _;\n\n if (isTopLevelCall) {\n _initializing = false;\n }\n }\n\n /// @dev Returns true if and only if the function is running in the constructor\n function _isConstructor() private view returns (bool) {\n return !AddressUpgradeable.isContract(address(this));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.2 <0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n // solhint-disable-next-line no-inline-assembly\n assembly { size := extcodesize(account) }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\n (bool success, ) = recipient.call{ value: amount }(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain`call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.call{ value: value }(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.staticcall(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1MultiMessageRelayer.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_L1CrossDomainMessenger } from \"../../../iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol\";\nimport { iOVM_L1MultiMessageRelayer } from \"../../../iOVM/bridge/messaging/iOVM_L1MultiMessageRelayer.sol\";\n\n/* Library Imports */\nimport { Lib_AddressResolver } from \"../../../libraries/resolver/Lib_AddressResolver.sol\";\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\n /**\n * @param _libAddressManager Address of the Address Manager.\n */\n constructor(\n address _libAddressManager\n )\n Lib_AddressResolver(_libAddressManager)\n {}\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 /********************\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(\n L2ToL1Message[] calldata _messages\n ) \n override\n external\n onlyBatchRelayer\n {\n iOVM_L1CrossDomainMessenger messenger = iOVM_L1CrossDomainMessenger(\n resolve(\"Proxy__OVM_L1CrossDomainMessenger\")\n );\n\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/messaging/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/messaging/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/optimistic-ethereum/OVM/bridge/messaging/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_CrossDomainUtils } from \"../../../libraries/bridge/Lib_CrossDomainUtils.sol\";\n\n/* Interface Imports */\nimport { iOVM_L2CrossDomainMessenger } from \"../../../iOVM/bridge/messaging/iOVM_L2CrossDomainMessenger.sol\";\nimport { iOVM_L1MessageSender } from \"../../../iOVM/predeploys/iOVM_L1MessageSender.sol\";\nimport { iOVM_L2ToL1MessagePasser } from \"../../../iOVM/predeploys/iOVM_L2ToL1MessagePasser.sol\";\n\n/* External Imports */\nimport { ReentrancyGuard } from \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\";\n\n/* External Imports */\nimport { ReentrancyGuard } from \"@openzeppelin/contracts/utils/ReentrancyGuard.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\n iOVM_L2CrossDomainMessenger,\n Lib_AddressResolver,\n ReentrancyGuard\n{\n\n /*************\n * Constants *\n *************/\n\n // The default x-domain message sender being set to a non-zero value makes\n // deployment a bit more expensive, but in exchange the refund on every call to\n // `relayMessage` by the L1 and L2 messengers will be higher.\n address internal constant DEFAULT_XDOMAIN_SENDER = 0x000000000000000000000000000000000000dEaD;\n\n /*************\n * 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 internal xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address of the Address Manager.\n */\n constructor(address _libAddressManager) Lib_AddressResolver(_libAddressManager) ReentrancyGuard() {}\n\n\n /********************\n * Public Functions *\n ********************/\n\n function xDomainMessageSender()\n public\n override\n view\n returns (\n address\n )\n {\n require(xDomainMsgSender != DEFAULT_XDOMAIN_SENDER, \"xDomainMessageSender is not set\");\n return xDomainMsgSender;\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 memory _message,\n uint32 _gasLimit\n )\n override\n public\n {\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\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 * 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 = Lib_CrossDomainUtils.encodeXDomainCalldata(\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 // Prevent calls to OVM_L2ToL1MessagePasser, which would enable\n // an attacker to maliciously craft the _message to spoof\n // a call from any L2 account.\n if(_target == resolve(\"OVM_L2ToL1MessagePasser\")){\n // Write to the successfulMessages mapping and return immediately.\n successfulMessages[xDomainCalldataHash] = true;\n return;\n }\n\n xDomainMsgSender = _sender;\n (bool success, ) = _target.call(_message);\n xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\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 } else {\n emit FailedRelayedMessage(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\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 view\n internal\n returns (\n bool _valid\n )\n {\n return (\n iOVM_L1MessageSender(\n resolve(\"OVM_L1MessageSender\")\n ).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 internal\n {\n iOVM_L2ToL1MessagePasser(resolve(\"OVM_L2ToL1MessagePasser\")).passMessageToL1(_message);\n }\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_L2CrossDomainMessenger.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Interface Imports */\nimport { iOVM_CrossDomainMessenger } from \"./iOVM_CrossDomainMessenger.sol\";\n\n/**\n * @title iOVM_L2CrossDomainMessenger\n */\ninterface iOVM_L2CrossDomainMessenger is iOVM_CrossDomainMessenger {\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/predeploys/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/predeploys/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" + }, + "@openzeppelin/contracts/utils/ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.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 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/OVM/predeploys/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/predeploys/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 * 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/predeploys/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/predeploys/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/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/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 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/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 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/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 // 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 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 payable\n {\n address target = addressManager[address(this)].getAddress(\n (implementationName[address(this)])\n );\n\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/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* External Imports */\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\n\n/**\n * @title OVM_GasPriceOracle\n * @dev This contract exposes the current l2 gas price, a measure of how congested the network\n * currently is. This measure is used by the Sequencer to determine what fee to charge for\n * transactions. When the system is more congested, the l2 gas price will increase and fees\n * will also increase as a result.\n *\n * Compiler used: optimistic-solc\n * Runtime target: OVM\n */\ncontract OVM_GasPriceOracle is Ownable {\n\n /*************\n * Variables *\n *************/\n\n // Current l2 gas price\n uint256 public gasPrice;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _owner Address that will initially own this contract.\n */\n constructor(\n address _owner,\n uint256 _initialGasPrice\n )\n Ownable()\n {\n setGasPrice(_initialGasPrice);\n transferOwnership(_owner);\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Allows the owner to modify the l2 gas price.\n * @param _gasPrice New l2 gas price.\n */\n function setGasPrice(\n uint256 _gasPrice\n )\n public\n onlyOwner\n {\n gasPrice = _gasPrice;\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/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_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 pure\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 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_Proposer\");\n }\n\n function getGasSpent(\n bytes32, // _preStateRoot,\n address // _who\n )\n override\n public\n pure\n returns (\n uint256\n )\n {\n return 0;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "storageLayout", + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file From 0b91df42676c8b2d9f95b30931bc4e5a7739eba9 Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Wed, 16 Jun 2021 12:12:27 -0400 Subject: [PATCH 093/125] fix[dtl]: defend against RPC provider missing events (#1084) * fix[dtl]: defend against RPC provider missing events * chore: add changeset * respond to review comments * better error handling for missing handlers --- .changeset/brown-boxes-compete.md | 5 +++ .../services/l1-ingestion/handlers/errors.ts | 10 +++++ .../handlers/sequencer-batch-appended.ts | 14 +++++++ .../handlers/state-batch-appended.ts | 14 +++++++ .../handlers/transaction-enqueued.ts | 12 ++++++ .../src/services/l1-ingestion/service.ts | 42 ++++++++++++++++++- 6 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 .changeset/brown-boxes-compete.md create mode 100644 packages/data-transport-layer/src/services/l1-ingestion/handlers/errors.ts diff --git a/.changeset/brown-boxes-compete.md b/.changeset/brown-boxes-compete.md new file mode 100644 index 000000000000..c5a2c95c8aa9 --- /dev/null +++ b/.changeset/brown-boxes-compete.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/data-transport-layer': patch +--- + +Adds additional code into the DTL to defend against situations where an RPC provider might be missing an event. diff --git a/packages/data-transport-layer/src/services/l1-ingestion/handlers/errors.ts b/packages/data-transport-layer/src/services/l1-ingestion/handlers/errors.ts new file mode 100644 index 000000000000..383fb3f36806 --- /dev/null +++ b/packages/data-transport-layer/src/services/l1-ingestion/handlers/errors.ts @@ -0,0 +1,10 @@ +export type EventName = + | 'TransactionEnqueued' + | 'SequencerBatchAppended' + | 'StateBatchAppended' + +export class MissingElementError extends Error { + constructor(public name: EventName) { + super(`missing event: ${name}`) + } +} diff --git a/packages/data-transport-layer/src/services/l1-ingestion/handlers/sequencer-batch-appended.ts b/packages/data-transport-layer/src/services/l1-ingestion/handlers/sequencer-batch-appended.ts index 114e04f3c5c1..76cb9050b6c0 100644 --- a/packages/data-transport-layer/src/services/l1-ingestion/handlers/sequencer-batch-appended.ts +++ b/packages/data-transport-layer/src/services/l1-ingestion/handlers/sequencer-batch-appended.ts @@ -22,6 +22,7 @@ import { SEQUENCER_GAS_LIMIT, parseSignatureVParam, } from '../../../utils' +import { MissingElementError } from './errors' export const handleEventsSequencerBatchAppended: EventHandlerSet< EventArgsSequencerBatchAppended, @@ -181,6 +182,19 @@ export const handleEventsSequencerBatchAppended: EventHandlerSet< } }, storeEvent: async (entry, db) => { + // Defend against situations where we missed an event because the RPC provider + // (infura/alchemy/whatever) is missing an event. + if (entry.transactionBatchEntry.index > 0) { + const prevTransactionBatchEntry = await db.getTransactionBatchByIndex( + entry.transactionBatchEntry.index - 1 + ) + + // We should *always* have a previous transaction batch here. + if (prevTransactionBatchEntry === null) { + throw new MissingElementError('SequencerBatchAppended') + } + } + await db.putTransactionBatchEntries([entry.transactionBatchEntry]) await db.putTransactionEntries(entry.transactionEntries) diff --git a/packages/data-transport-layer/src/services/l1-ingestion/handlers/state-batch-appended.ts b/packages/data-transport-layer/src/services/l1-ingestion/handlers/state-batch-appended.ts index 744ebc1f5284..9f822fc72846 100644 --- a/packages/data-transport-layer/src/services/l1-ingestion/handlers/state-batch-appended.ts +++ b/packages/data-transport-layer/src/services/l1-ingestion/handlers/state-batch-appended.ts @@ -11,6 +11,7 @@ import { StateRootEntry, EventHandlerSet, } from '../../../types' +import { MissingElementError } from './errors' export const handleEventsStateBatchAppended: EventHandlerSet< EventArgsStateBatchAppended, @@ -67,6 +68,19 @@ export const handleEventsStateBatchAppended: EventHandlerSet< } }, storeEvent: async (entry, db) => { + // Defend against situations where we missed an event because the RPC provider + // (infura/alchemy/whatever) is missing an event. + if (entry.stateRootBatchEntry.index > 0) { + const prevStateRootBatchEntry = await db.getStateRootBatchByIndex( + entry.stateRootBatchEntry.index - 1 + ) + + // We should *always* have a previous batch entry here. + if (prevStateRootBatchEntry === null) { + throw new MissingElementError('StateBatchAppended') + } + } + await db.putStateRootBatchEntries([entry.stateRootBatchEntry]) await db.putStateRootEntries(entry.stateRootEntries) }, diff --git a/packages/data-transport-layer/src/services/l1-ingestion/handlers/transaction-enqueued.ts b/packages/data-transport-layer/src/services/l1-ingestion/handlers/transaction-enqueued.ts index 7e6bcb9b2b66..415d65fa1ef6 100644 --- a/packages/data-transport-layer/src/services/l1-ingestion/handlers/transaction-enqueued.ts +++ b/packages/data-transport-layer/src/services/l1-ingestion/handlers/transaction-enqueued.ts @@ -3,6 +3,7 @@ import { EventArgsTransactionEnqueued } from '@eth-optimism/core-utils' /* Imports: Internal */ import { BigNumber } from 'ethers' import { EnqueueEntry, EventHandlerSet } from '../../../types' +import { MissingElementError } from './errors' export const handleEventsTransactionEnqueued: EventHandlerSet< EventArgsTransactionEnqueued, @@ -25,6 +26,17 @@ export const handleEventsTransactionEnqueued: EventHandlerSet< } }, storeEvent: async (entry, db) => { + // Defend against situations where we missed an event because the RPC provider + // (infura/alchemy/whatever) is missing an event. + if (entry.index > 0) { + const prevEnqueueEntry = await db.getEnqueueByIndex(entry.index - 1) + + // We should *alwaus* have a previous enqueue entry here. + if (prevEnqueueEntry === null) { + throw new MissingElementError('TransactionEnqueued') + } + } + await db.putEnqueueEntries([entry]) }, } diff --git a/packages/data-transport-layer/src/services/l1-ingestion/service.ts b/packages/data-transport-layer/src/services/l1-ingestion/service.ts index 27548303d950..b8b8cb4c39b2 100644 --- a/packages/data-transport-layer/src/services/l1-ingestion/service.ts +++ b/packages/data-transport-layer/src/services/l1-ingestion/service.ts @@ -19,6 +19,7 @@ import { handleEventsTransactionEnqueued } from './handlers/transaction-enqueued import { handleEventsSequencerBatchAppended } from './handlers/sequencer-batch-appended' import { handleEventsStateBatchAppended } from './handlers/state-batch-appended' import { L1DataTransportServiceOptions } from '../main/service' +import { MissingElementError, EventName } from './handlers/errors' export interface L1IngestionServiceOptions extends L1DataTransportServiceOptions { @@ -205,7 +206,46 @@ export class L1IngestionService extends BaseService { await sleep(this.options.pollingInterval) } } catch (err) { - if (!this.running || this.options.dangerouslyCatchAllErrors) { + if (err instanceof MissingElementError) { + // Different functions for getting the last good element depending on the event type. + const handlers = { + SequencerBatchAppended: this.state.db.getLatestTransactionBatch, + StateBatchAppended: this.state.db.getLatestStateRootBatch, + TransactionEnqueued: this.state.db.getLatestEnqueue, + } + + // Find the last good element and reset the highest synced L1 block to go back to the + // last good element. Will resync other event types too but we have no issues with + // syncing the same events more than once. + const eventName = err.name + if (!(eventName in handlers)) { + throw new Error( + `unable to recover from missing event, no handler for ${eventName}` + ) + } + + const lastGoodElement: { + blockNumber: number + } = await handlers[eventName]() + + // Erroring out here seems fine. An error like this is only likely to occur quickly after + // this service starts up so someone will be here to deal with it. Automatic recovery is + // nice but not strictly necessary. Could be a good feature for someone to implement. + if (lastGoodElement === null) { + throw new Error(`unable to recover from missing event`) + } + + // Rewind back to the block number that the last good element was in. + await this.state.db.setHighestSyncedL1Block( + lastGoodElement.blockNumber + ) + + // Something we should be keeping track of. + this.logger.warn('recovering from a missing event', { + eventName, + lastGoodBlockNumber: lastGoodElement.blockNumber, + }) + } else if (!this.running || this.options.dangerouslyCatchAllErrors) { this.logger.error('Caught an unhandled error', { message: err.toString(), stack: err.stack, From 2bd49730fa8d2c10953873f0ccc792198a49d5c9 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Wed, 16 Jun 2021 11:29:51 -0700 Subject: [PATCH 094/125] deploy: kovan v.4.0 rc (#1101) * deploy: kovan v0.4.0 rc * chore: add changeset * readme: update --- .changeset/itchy-bikes-flash.md | 5 + packages/contracts/deployments/README.md | 31 +- .../deployments/kovan/Lib_AddressManager.json | 50 +-- .../kovan/OVM_CanonicalTransactionChain.json | 42 +-- ...OVM_ChainStorageContainer-CTC-batches.json | 115 ++---- .../OVM_ChainStorageContainer-CTC-queue.json | 115 ++---- ...OVM_ChainStorageContainer-SCC-batches.json | 115 ++---- .../kovan/OVM_ExecutionManager.json | 310 +++++++++++----- .../deployments/kovan/OVM_FraudVerifier.json | 44 +-- .../kovan/OVM_L1CrossDomainMessenger.json | 154 +++----- .../kovan/OVM_L1MultiMessageRelayer.json | 34 +- .../kovan/OVM_StateCommitmentChain.json | 36 +- .../kovan/OVM_StateManagerFactory.json | 24 +- .../kovan/OVM_StateTransitionerFactory.json | 34 +- .../Proxy__OVM_L1CrossDomainMessenger.json | 40 +-- .../kovan/Proxy__OVM_L1StandardBridge.json | 177 +++++++++ .../kovan/mockOVM_BondManager.json | 34 +- .../7531d7762a77038a37e7490a7b4b176f.json | 38 ++ .../ef3f334bac4d7e77d91b457a0d89ab0a.json | 338 ++++++++++++++++++ 19 files changed, 1106 insertions(+), 630 deletions(-) create mode 100644 .changeset/itchy-bikes-flash.md create mode 100644 packages/contracts/deployments/kovan/Proxy__OVM_L1StandardBridge.json create mode 100644 packages/contracts/deployments/kovan/solcInputs/7531d7762a77038a37e7490a7b4b176f.json create mode 100644 packages/contracts/deployments/kovan/solcInputs/ef3f334bac4d7e77d91b457a0d89ab0a.json diff --git a/.changeset/itchy-bikes-flash.md b/.changeset/itchy-bikes-flash.md new file mode 100644 index 000000000000..ed20c3f61b4a --- /dev/null +++ b/.changeset/itchy-bikes-flash.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/contracts': patch +--- + +Deploy v0.4.0 rc to Kovan diff --git a/packages/contracts/deployments/README.md b/packages/contracts/deployments/README.md index 8d7efdb7caf9..c48cfa9ace8a 100644 --- a/packages/contracts/deployments/README.md +++ b/packages/contracts/deployments/README.md @@ -77,28 +77,29 @@ Network : __kovan (chain id: 42)__ |Contract|Address| |--|--| -|Lib_AddressManager|[0xd56F695e73286ac252A37593DD4E7c14270eC1Df](https://kovan.etherscan.io/address/0xd56F695e73286ac252A37593DD4E7c14270eC1Df)| -|OVM_CanonicalTransactionChain|[0x895eabB95D684c15fa46Dc00a6b7557450083DEF](https://kovan.etherscan.io/address/0x895eabB95D684c15fa46Dc00a6b7557450083DEF)| -|OVM_ChainStorageContainer-CTC-batches|[0xeb335a8A5e8bA008cF7Cb02D5C3432f4fDB576da](https://kovan.etherscan.io/address/0xeb335a8A5e8bA008cF7Cb02D5C3432f4fDB576da)| -|OVM_ChainStorageContainer-CTC-queue|[0x207fa9Aa7Dee9AA790A8DF64778D3E3B6273BC90](https://kovan.etherscan.io/address/0x207fa9Aa7Dee9AA790A8DF64778D3E3B6273BC90)| -|OVM_ChainStorageContainer-SCC-batches|[0xFE1CE27173676A6850ECF4e0536D7C468A4dAfa0](https://kovan.etherscan.io/address/0xFE1CE27173676A6850ECF4e0536D7C468A4dAfa0)| -|OVM_ExecutionManager|[0xa2EB1961183a04157fF707Fa2Be2249e149c8FAB](https://kovan.etherscan.io/address/0xa2EB1961183a04157fF707Fa2Be2249e149c8FAB)| -|OVM_FraudVerifier|[0x4B2F74938Ddb8742C33b46aD1a402c85e9dABC44](https://kovan.etherscan.io/address/0x4B2F74938Ddb8742C33b46aD1a402c85e9dABC44)| -|OVM_L1MultiMessageRelayer|[0x942b1B1CaF9e7654318CbfCfD1bca6727C716638](https://kovan.etherscan.io/address/0x942b1B1CaF9e7654318CbfCfD1bca6727C716638)| +|Lib_AddressManager|[0x100Dd3b414Df5BbA2B542864fF94aF8024aFdf3a](https://kovan.etherscan.io/address/0x100Dd3b414Df5BbA2B542864fF94aF8024aFdf3a)| +|OVM_CanonicalTransactionChain|[0xe28c499EB8c36C0C18d1bdCdC47a51585698cb93](https://kovan.etherscan.io/address/0xe28c499EB8c36C0C18d1bdCdC47a51585698cb93)| +|OVM_ChainStorageContainer-CTC-batches|[0xF95D79298FD12e5ED778CCf717aA30f638b060E1](https://kovan.etherscan.io/address/0xF95D79298FD12e5ED778CCf717aA30f638b060E1)| +|OVM_ChainStorageContainer-CTC-queue|[0x2BE00E5F043a0f62c3e4d775F3235E28A0239395](https://kovan.etherscan.io/address/0x2BE00E5F043a0f62c3e4d775F3235E28A0239395)| +|OVM_ChainStorageContainer-SCC-batches|[0x50DA41A2A185fb917aecEFfa1CB4534dC5C264b4](https://kovan.etherscan.io/address/0x50DA41A2A185fb917aecEFfa1CB4534dC5C264b4)| +|OVM_ExecutionManager|[0xC68795aC9d96374eaE746DAcC1334ba54798e17D](https://kovan.etherscan.io/address/0xC68795aC9d96374eaE746DAcC1334ba54798e17D)| +|OVM_FraudVerifier|[0xaeEd60e029Eb435f960d78C355786060589738B3](https://kovan.etherscan.io/address/0xaeEd60e029Eb435f960d78C355786060589738B3)| +|OVM_L1MultiMessageRelayer|[0x5818840763Ee28ff0A3E3e8CB9eDeDd07Fb1Cd3f](https://kovan.etherscan.io/address/0x5818840763Ee28ff0A3E3e8CB9eDeDd07Fb1Cd3f)| |OVM_SafetyChecker|[0xf0FaB0ce35a6d3F82b0B42f09A2734065908dB6a](https://kovan.etherscan.io/address/0xf0FaB0ce35a6d3F82b0B42f09A2734065908dB6a)| -|OVM_StateCommitmentChain|[0xdB1367bB36C34618778D492725C3eD11B508aC54](https://kovan.etherscan.io/address/0xdB1367bB36C34618778D492725C3eD11B508aC54)| -|OVM_StateManagerFactory|[0x3b96673C9e24D362501e87B239F60543e20beD50](https://kovan.etherscan.io/address/0x3b96673C9e24D362501e87B239F60543e20beD50)| -|OVM_StateTransitionerFactory|[0xd6eDb16a89A2EE4484fa8fdCDb11B8B5633c3687](https://kovan.etherscan.io/address/0xd6eDb16a89A2EE4484fa8fdCDb11B8B5633c3687)| -|Proxy__OVM_L1CrossDomainMessenger|[0x78b88FD62FBdBf67b9C5C6528CF84E9d30BB28e0](https://kovan.etherscan.io/address/0x78b88FD62FBdBf67b9C5C6528CF84E9d30BB28e0)| +|OVM_StateCommitmentChain|[0xa2487713665AC596b0b3E4881417f276834473d2](https://kovan.etherscan.io/address/0xa2487713665AC596b0b3E4881417f276834473d2)| +|OVM_StateManagerFactory|[0xBcca22E9F5579193E27dD39aD821A03778C44EFA](https://kovan.etherscan.io/address/0xBcca22E9F5579193E27dD39aD821A03778C44EFA)| +|OVM_StateTransitionerFactory|[0xFD7B9268e790837d393Fd371Ddeb42FE5EC45B54](https://kovan.etherscan.io/address/0xFD7B9268e790837d393Fd371Ddeb42FE5EC45B54)| +|Proxy__OVM_L1CrossDomainMessenger|[0x4361d0F75A0186C05f971c566dC6bEa5957483fD](https://kovan.etherscan.io/address/0x4361d0F75A0186C05f971c566dC6bEa5957483fD)| |Proxy__OVM_L1ETHGateway|[0xB191d67F69e823445cD59e5A88953a82be73b9C6](https://kovan.etherscan.io/address/0xB191d67F69e823445cD59e5A88953a82be73b9C6)| -|mockOVM_BondManager|[0x8ECe272C9f83041bcb1Cd57AC49Ca6494776bE01](https://kovan.etherscan.io/address/0x8ECe272C9f83041bcb1Cd57AC49Ca6494776bE01)| +|Proxy__OVM_L1StandardBridge|[0x22F24361D548e5FaAfb36d1437839f080363982B](https://kovan.etherscan.io/address/0x22F24361D548e5FaAfb36d1437839f080363982B)| +|mockOVM_BondManager|[0xD6143943447DFf503d948Fba3D8af3d4Df28f45c](https://kovan.etherscan.io/address/0xD6143943447DFf503d948Fba3D8af3d4Df28f45c)| no trie lookup needed.\\n address codeContractAddress =\\n uint(_contract) < 100\\n ? _contract\\n : _getAccountEthAddress(_contract);\\n\\n return _handleExternalMessage(\\n _nextMessageContext,\\n _gasLimit,\\n codeContractAddress,\\n _calldata,\\n false\\n );\\n }\\n\\n /**\\n * Handles all interactions which involve the execution manager calling out to untrusted code (both calls and creates).\\n * Ensures that OVM-related measures are enforced, including L2 gas refunds, nuisance gas, and flagged reversions.\\n *\\n * @param _nextMessageContext Message context to be used for the external message.\\n * @param _gasLimit Amount of gas to be passed into this message.\\n * @param _contract OVM address being called or deployed to\\n * @param _data Data for the message (either calldata or creation code)\\n * @param _isCreate Whether this is a create-type message.\\n * @return Whether or not the message (either a call or deployment) succeeded.\\n * @return Data returned by the message.\\n */\\n function _handleExternalMessage(\\n MessageContext memory _nextMessageContext,\\n uint256 _gasLimit,\\n address _contract,\\n bytes memory _data,\\n bool _isCreate\\n )\\n internal\\n returns (\\n bool,\\n bytes memory\\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. `_contract` 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\\n bool success;\\n bytes memory returndata;\\n if (_isCreate) {\\n // safeCREATE() is a function which replicates a CREATE message, but uses return values\\n // Which match that of CALL (i.e. bool, bytes). This allows many security checks to be\\n // to be shared between untrusted call and create call frames.\\n (success, returndata) = address(this).call(\\n abi.encodeWithSelector(\\n this.safeCREATE.selector,\\n _gasLimit,\\n _data,\\n _contract\\n )\\n );\\n } else {\\n (success, returndata) = _contract.call{gas: _gasLimit}(_data);\\n }\\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 (\\n flag == RevertFlag.INTENTIONAL_REVERT\\n || _isCreate\\n ) {\\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 * Handles the creation-specific safety measures required for OVM contract deployment.\\n * This function sanitizes the return types for creation messages to match calls (bool, bytes),\\n * by being an external function which the EM can call, that mimics the success/fail case of the CREATE.\\n * This allows for consistent handling of both types of messages in _handleExternalMessage().\\n * Having this step occur as a separate call frame also allows us to easily revert the\\n * contract deployment in the event that the code is unsafe.\\n *\\n * @param _gasLimit Amount of gas to be passed into this creation.\\n * @param _creationCode Code to pass into CREATE for deployment.\\n * @param _address OVM address being deployed to.\\n */\\n function safeCREATE(\\n uint _gasLimit,\\n bytes memory _creationCode,\\n address _address\\n )\\n external\\n {\\n // The only way this should callable is from within _createContract(),\\n // and it should DEFINITELY not be callable by a non-EM code contract.\\n if (msg.sender != address(this)) {\\n return;\\n }\\n // Check that there is not already code at this address.\\n if (_hasEmptyAccount(_address) == false) {\\n // Note: in the EVM, this case burns all allotted gas. For improved\\n // developer experience, we do return the remaining gas.\\n _revertWithFlag(\\n RevertFlag.CREATE_COLLISION,\\n Lib_ErrorUtils.encodeRevertString(\\\"A contract has already been deployed to this address\\\")\\n );\\n }\\n\\n // Check the creation bytecode against the OVM_SafetyChecker.\\n if (ovmSafetyChecker.isBytecodeSafe(_creationCode) == false) {\\n _revertWithFlag(\\n RevertFlag.UNSAFE_BYTECODE,\\n Lib_ErrorUtils.encodeRevertString(\\\"Contract creation code contains unsafe opcodes. Did you use the right compiler or pass an unsafe constructor argument?\\\")\\n );\\n }\\n\\n // We always need to initialize the contract with the default account values.\\n _initPendingAccount(_address);\\n\\n // Actually execute the EVM create message.\\n // NOTE: The inline assembly below means we can NOT make any evm calls between here and then.\\n address ethAddress = Lib_EthUtils.createContract(_creationCode);\\n\\n if (ethAddress == address(0)) {\\n // If the creation fails, the EVM lets us grab its revert data. This may contain a revert flag\\n // to be used above in _handleExternalMessage, so we pass the revert data back up unmodified.\\n assembly {\\n returndatacopy(0,0,returndatasize())\\n revert(0, returndatasize())\\n }\\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(\\n RevertFlag.UNSAFE_BYTECODE,\\n Lib_ErrorUtils.encodeRevertString(\\\"Constructor attempted to deploy unsafe bytecode.\\\")\\n );\\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 * 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 ) {\\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 view\\n {\\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 input values of a transaction.\\n * @return _valid Whether or not the transaction data is valid.\\n */\\n function _isValidInput(\\n Lib_OVMCodec.Transaction memory _transaction\\n )\\n view\\n internal\\n returns (\\n bool\\n )\\n {\\n // Prevent reentrancy to run():\\n // This check prevents calling run with the default ovmNumber.\\n // Combined with the first check in run():\\n // if (transactionContext.ovmNUMBER != DEFAULT_UINT256) { return; }\\n // It should be impossible to re-enter since run() returns before any other call frames are created.\\n // Since this value is already being written to storage, we save much gas compared to\\n // using the standard nonReentrant pattern.\\n if (_transaction.blockNumber == DEFAULT_UINT256) {\\n return false;\\n }\\n\\n if (_isValidGasLimit(_transaction.gasLimit, _transaction.l1QueueOrigin) == false) {\\n return false;\\n }\\n\\n return true;\\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 view\\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 = DEFAULT_ADDRESS;\\n transactionContext.ovmTIMESTAMP = DEFAULT_UINT256;\\n transactionContext.ovmNUMBER = DEFAULT_UINT256;\\n transactionContext.ovmGASLIMIT = DEFAULT_UINT256;\\n transactionContext.ovmTXGASLIMIT = DEFAULT_UINT256;\\n transactionContext.ovmL1QUEUEORIGIN = Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE;\\n\\n transactionRecord.ovmGasRefund = DEFAULT_UINT256;\\n\\n messageContext.ovmCALLER = DEFAULT_ADDRESS;\\n messageContext.ovmADDRESS = DEFAULT_ADDRESS;\\n messageContext.isStatic = false;\\n\\n messageRecord.nuisanceGasLeft = DEFAULT_UINT256;\\n\\n // Reset the ovmStateManager.\\n ovmStateManager = iOVM_StateManager(address(0));\\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 messageRecord.nuisanceGasLeft = uint(-1);\\n\\n messageContext.ovmADDRESS = _from;\\n\\n bool isCreate = _transaction.entrypoint == address(0);\\n if (isCreate) {\\n (address created, bytes memory revertData) = ovmCREATE(_transaction.data);\\n if (created == address(0)) {\\n return (false, revertData);\\n } else {\\n // The eth_call RPC endpoint for to = undefined will return the deployed bytecode\\n // in the success case, differing from standard create messages.\\n return (true, Lib_EthUtils.getCode(created));\\n }\\n } else {\\n return ovmCALL(\\n _transaction.gasLimit,\\n _transaction.entrypoint,\\n _transaction.data\\n );\\n }\\n }\\n}\\n\",\"keccak256\":\"0x229011db3d21b69e16814325f8e5debbdf6219b3dffb4011a24f2a6540a0d98e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/predeploys/OVM_DeployerWhitelist.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Interface Imports */\\nimport { iOVM_DeployerWhitelist } from \\\"../../iOVM/predeploys/iOVM_DeployerWhitelist.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: optimistic-solc\\n * Runtime target: OVM\\n */\\ncontract OVM_DeployerWhitelist is iOVM_DeployerWhitelist {\\n\\n /**********************\\n * Contract Constants *\\n **********************/\\n\\n bool public initialized;\\n bool public allowArbitraryDeployment;\\n address override public owner;\\n mapping (address => bool) public whitelist;\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Blocks functions to anyone except the contract owner.\\n */\\n modifier onlyOwner() {\\n require(\\n msg.sender == 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 if (initialized == true) {\\n return;\\n }\\n\\n initialized = true;\\n allowArbitraryDeployment = _allowArbitraryDeployment;\\n owner = _owner;\\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 whitelist[_deployer] = _isWhitelisted;\\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 owner = _owner;\\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 allowArbitraryDeployment = _allowArbitraryDeployment;\\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\\n )\\n {\\n return (\\n initialized == false\\n || allowArbitraryDeployment == true\\n || whitelist[_deployer]\\n );\\n }\\n}\\n\",\"keccak256\":\"0x371e3d3ca1dd4177738b55eead9ad6f8278280e568694df6b42ee01f5558ccb2\",\"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 * 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\":\"0x2d7973a0ad84c23ec62624d3f1e3aeb198cc72686ff1e6cfa17155556b320c94\",\"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 OUT_OF_GAS,\\n INTENTIONAL_REVERT,\\n EXCEEDS_NUISANCE_GAS,\\n INVALID_STATE_ACCESS,\\n UNSAFE_BYTECODE,\\n CREATE_COLLISION,\\n STATIC_VIOLATION,\\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 }\\n\\n\\n /************************************\\n * Transaction Execution Entrypoint *\\n ************************************/\\n\\n function run(\\n Lib_OVMCodec.Transaction calldata _transaction,\\n address _txStateManager\\n ) external returns (bytes memory);\\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, bytes memory _revertdata);\\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract, bytes memory _revertdata);\\n\\n\\n /*******************************\\n * Account Abstraction Opcodes *\\n ******************************/\\n\\n function ovmGETNONCE() external returns (uint256 _nonce);\\n function ovmINCREMENTNONCE() 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 Context *\\n ***************************************/\\n\\n function getMaxTransactionGasLimit() external view returns (uint _maxTransactionGasLimit);\\n}\\n\",\"keccak256\":\"0xf023d5d6fc6a03bd52f7a57af6e21076de77e8925d065bb79db062e73e43b684\",\"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/predeploys/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 owner() 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\":\"0xdf1f27faf0d26d416bf6d408d146a16de32b4e1772a292c65d39eb7ec2b53ceb\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x2ce671a0e004df88b136bea5a3c59d0732cea8887c8496da1d509e0200b03d7d\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xa5195afe32fb2cf104d156e8f4bd39df1ec79bf6ba232097b9e8e0ee14fbc298\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_ErrorUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/**\\n * @title Lib_ErrorUtils\\n */\\nlibrary Lib_ErrorUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes an error string into raw solidity-style revert data.\\n * (i.e. ascii bytes, prefixed with bytes4(keccak(\\\"Error(string))\\\"))\\n * Ref: https://docs.soliditylang.org/en/v0.8.2/control-structures.html?highlight=Error(string)#panic-via-assert-and-error-via-require\\n * @param _reason Reason for the reversion.\\n * @return Standard solidity revert data for the given reason.\\n */\\n function encodeRevertString(\\n string memory _reason\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return abi.encodeWithSignature(\\n \\\"Error(string)\\\",\\n _reason\\n );\\n }\\n}\\n\",\"keccak256\":\"0xfc64ec4a81fb50865b502a0004ed154e8598e1a313db77303fc95e41f536e6b7\",\"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 *\\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 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\\n )\\n {\\n bytes memory code;\\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 Full code of the contract.\\n */\\n function getCode(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes memory\\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 Size of the contract's code in bytes.\\n */\\n function getCodeSize(\\n address _address\\n )\\n internal\\n view\\n returns (\\n uint256\\n )\\n {\\n uint256 codeSize;\\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 Hash of the contract's code.\\n */\\n function getCodeHash(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n bytes32 codeHash;\\n assembly {\\n codeHash := extcodehash(_address)\\n }\\n\\n return codeHash;\\n }\\n\\n /**\\n * Creates a contract with some given initialization code.\\n * @param _code Contract initialization code.\\n * @return Address of the created contract.\\n */\\n function createContract(\\n bytes memory _code\\n )\\n internal\\n returns (\\n address\\n )\\n {\\n address created;\\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 to be generated by CREATE.\\n */\\n function getAddressForCREATE(\\n address _creator,\\n uint256 _nonce\\n )\\n internal\\n pure\\n returns (\\n 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 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 (\\n address\\n )\\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\":\"0xf29a67d78e61cb472d524b779b32cfcb39a587f4096500d5419e6425ed367d49\",\"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 * Note that the _elements argument is modified, therefore it must not be used again afterwards\\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 pure\\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 == 1) {\\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 (uint256 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\":\"0xa78edb9fbd34712771a1ebff05bc5e1abec7fc1e9a1bfb709d183099b44fa62a\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506040516200315338038062003153833981016040819052620000349162000067565b600080546001600160a01b0319166001600160a01b039590951694909417909355600191909155600255600355620000b2565b600080600080608085870312156200007d578384fd5b84516001600160a01b038116811462000094578485fd5b60208601516040870151606090970151919890975090945092505050565b61309180620000c26000396000f3fe608060405234801561001057600080fd5b50600436106101425760003560e01c8063876ed5cb116100b8578063cfdf677e1161007c578063cfdf677e1461023f578063d0f8934414610247578063e10d29ee1461024f578063e561dddc14610257578063f722b41a1461025f578063facdc5da1461026757610142565b8063876ed5cb146102175780638d38c6c11461021f578063b8f7700514610227578063c139eb151461022f578063c2cf696f1461023757610142565b80634de569ce1161010a5780634de569ce146101c25780635ae6256d146101e25780636fee07e0146101ea57806378f4b2f2146101ff5780637a167a8a146102075780637aa63a861461020f57610142565b8063138387a414610147578063299ca478146101655780632a7f18be1461017a578063378997701461019a578063461a4478146101af575b600080fd5b61014f61027a565b60405161015c91906124c7565b60405180910390f35b61016d610280565b60405161015c91906123eb565b61018d610188366004612388565b61028f565b60405161015c9190612e4e565b6101a26102b0565b60405161015c9190612e8d565b61016d6101bd36600461221b565b6102c4565b6101d56101d0366004612261565b6103a0565b60405161015c9190612484565b6101a26103da565b6101fd6101f8366004612188565b6103ee565b005b61014f61066d565b6101a2610674565b61014f610689565b61014f6106a4565b61014f6106aa565b6101a26106b0565b61014f6106c7565b61014f6106cd565b61016d6106d2565b6101fd6106f5565b61016d610b69565b61014f610b8c565b6101a2610c06565b6101fd610275366004612388565b610c1e565b60025481565b6000546001600160a01b031681565b610297611ed9565b6102a8826102a3610b69565b610c36565b90505b919050565b6000806102bb610d76565b50935050505090565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561032457818101518382015260200161030c565b50505050905090810190601f1680156103515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561036e57600080fd5b505afa158015610382573d6000803e3d6000fd5b505050506040513d602081101561039857600080fd5b505192915050565b82516000901515600114156103c2576103bb85858585610e24565b90506103d2565b6103bb8585602001518585610fef565b949350505050565b6000806103e5610d76565b94505050505090565b61c3508151111561041a5760405162461bcd60e51b81526004016104119061259b565b60405180910390fd5b60035482111561043c5760405162461bcd60e51b8152600401610411906127a1565b620186a082101561045f5760405162461bcd60e51b815260040161041190612983565b6020820460005a90508181116104875760405162461bcd60e51b815260040161041190612b8a565b60005b825a8303101561049c5760010161048a565b6000338787876040516020016104b594939291906123ff565b60408051601f19818403018152919052805160209091012090504360281b421760006104df610b69565b60405163b298e36b60e01b81529091506001600160a01b0382169063b298e36b9061050e9086906004016124c7565b600060405180830381600087803b15801561052857600080fd5b505af115801561053c573d6000803e3d6000fd5b505060405163b298e36b60e01b81526001600160a01b038416925063b298e36b915061056c9085906004016124c7565b600060405180830381600087803b15801561058657600080fd5b505af115801561059a573d6000803e3d6000fd5b50505050600060016002836001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156105dd57600080fd5b505afa1580156105f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106159190612203565b8161061c57fe5b040390507f4b388aecf9fa6cc92253704e5975a6129a4f735bdbd99567df4ed0094ee4ceb5338b8b8b85426040516106599695949392919061243c565b60405180910390a150505050505050505050565b620186a081565b60008061067f610d76565b5090935050505090565b600080610694610d76565b50505064ffffffffff1692915050565b61c35081565b60035481565b60006106c26106bd610b69565b6110c4565b905090565b60015481565b602081565b60006106c2604051806060016040528060258152602001613003602591396102c4565b60043560d81c60093560e890811c90600c35901c610711610689565b8364ffffffffff16146107365760405162461bcd60e51b815260040161041190612a35565b6107646040518060400160405280600d81526020016c27ab26afa9b2b8bab2b731b2b960991b8152506102c4565b6001600160a01b0316336001600160a01b0316146107945760405162461bcd60e51b815260040161041190612a92565b60008162ffffff16116107b95760405162461bcd60e51b8152600401610411906127fe565b60008262ffffff16116107de5760405162461bcd60e51b815260040161041190612cdf565b600f601062ffffff8316020164ffffffffff81163610156108115760405162461bcd60e51b815260040161041190612d66565b600061081b610b69565b90506000610828826110c4565b9050600062ffffff8616368161083a57fe5b0460020267ffffffffffffffff8111801561085457600080fd5b506040519080825280601f01601f19166020018201604052801561087f576020820181803683370190505b50905060008662ffffff1667ffffffffffffffff811180156108a057600080fd5b506040519080825280602002602001820160405280156108ca578160200160208202803683370190505b50905060008060006108da610674565b90506108e4611ef9565b60005b8a62ffffff168163ffffffff161015610a3b57600061090b8263ffffffff16611147565b905063ffffffff82166109215761092181611197565b61092d8382868d611264565b80925060005b835163ffffffff821610156109b1578b3560e81c61c3508111156109695760405162461bcd60e51b81526004016104119061259b565b61097c858e64ffffffffff16838d6112cf565b898963ffffffff168151811061098e57fe5b60209081029190910101529b909b016003019a6001968701969586019501610933565b5060005b83602001518163ffffffff161015610a31578964ffffffffff168564ffffffffff16106109f45760405162461bcd60e51b815260040161041190612da8565b610a048564ffffffffff16611363565b888863ffffffff1681518110610a1657fe5b602090810291909101015260019687019694850194016109b5565b50506001016108e7565b50610a488183898b6113a8565b3664ffffffffff8a1614610a6e5760405162461bcd60e51b815260040161041190612846565b8a62ffffff168463ffffffff1614610a985760405162461bcd60e51b815260040161041190612894565b6000838c62ffffff160363ffffffff169050600080836020015160001415610acb57505060408201516060830151610af3565b6000610ae16001870364ffffffffff168d610c36565b90508060200151925080604001519150505b610b14610aff8961141b565b8f62ffffff168564ffffffffff16858561184f565b7f602f1aeac0ca2e7a13e281a9ef0ad7838542712ce16780fa2ecffd351f05f89983860384610b41610689565b604051610b5093929190612e9f565b60405180910390a1505050505050505050505050505050565b60006106c2604051806060016040528060238152602001612ee6602391396102c4565b6000610b966106d2565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610bce57600080fd5b505afa158015610be2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c29190612203565b6000610c10610674565b610c186106b0565b03905090565b60405162461bcd60e51b81526004016104119061250b565b610c3e611ed9565b604051634a83e9cd60e11b815260028402906000906001600160a01b03851690639507d39a90610c72908590600401612e8d565b60206040518083038186803b158015610c8a57600080fd5b505afa158015610c9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc29190612203565b90506000846001600160a01b0316639507d39a846001016040518263ffffffff1660e01b8152600401610cf59190612e8d565b60206040518083038186803b158015610d0d57600080fd5b505afa158015610d21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d459190612203565b6040805160608101825293845264ffffffffff828116602086015260289290921c9091169083015250949350505050565b6000806000806000610d866106d2565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b158015610dbe57600080fd5b505afa158015610dd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df691906121dd565b64ffffffffff602882901c811697605083901c82169750607883901c8216965060a09290921c169350915050565b600080610e5c6040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b8152506102c4565b90506000816001600160a01b0316631c4712a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610e9957600080fd5b505afa158015610ead573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed19190612203565b90506000610ede87611a02565b9050610eeb818787611a9b565b610f075760405162461bcd60e51b8152600401610411906126ca565b86606001518860200151148015610f22575060408701518851145b8015610f635750610f4a604051806060016040528060228152602001612f09602291396102c4565b6001600160a01b031688608001516001600160a01b0316145b8015610f725750818860a00151145b8015610f89575060608801516001600160a01b0316155b8015610fa45750600088604001516001811115610fa257fe5b145b8015610fc557508660800151805190602001208860c0015180519060200120145b610fe15760405162461bcd60e51b81526004016104119061276a565b506001979650505050505050565b600080610ffb85611363565b9050611008818585611a9b565b6110245760405162461bcd60e51b815260040161041190612c2a565b6000866060015187608001518860a001518960c0015160405160200161104d94939291906123ff565b60405160208183030381529060405280519060200120905060006110708761028f565b80519091508214801561108e57508751602082015164ffffffffff16145b80156110a857508760200151816040015164ffffffffff16145b610fe15760405162461bcd60e51b815260040161041190612adf565b60006002826001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b15801561110157600080fd5b505afa158015611115573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111399190612203565b8161114057fe5b0492915050565b61114f611ef9565b5060408051608081018252601092909202600f81013560e890811c84526012820135901c6020840152601581013560d890811c92840192909252601a0135901c606082015290565b60006111a1610689565b1115611211576000806111b2610d76565b9350935050508064ffffffffff16836060015110156111e35760405162461bcd60e51b815260040161041190612718565b8164ffffffffff168360400151101561120e5760405162461bcd60e51b8152600401610411906125f8565b50505b4260015482604001510110156112395760405162461bcd60e51b815260040161041190612d20565b4360025482606001510110156112615760405162461bcd60e51b815260040161041190612552565b50565b83604001518360400151101561128c5760405162461bcd60e51b815260040161041190612bd5565b8360600151836060015110156112b45760405162461bcd60e51b815260040161041190612df1565b6020830151156112c9576112c9838383611b8c565b50505050565b60008151836041011115611326578260410167ffffffffffffffff811180156112f757600080fd5b506040519080825280601f01601f191660200182016040528015611322576020820181803683370190505b5091505b6040850151606086015160006020850160018153836001820152826021820152866003890160418301376041870190209350505050949350505050565b60006102a86040518060a00160405280600015158152602001848152602001600081526020016000815260200160405180602001604052806000815250815250611c2d565b600083830364ffffffffff161180156113c357506020840151155b156113d3576113d3848483611b8c565b42846040015111156113f75760405162461bcd60e51b815260040161041190612b45565b43846060015111156112c95760405162461bcd60e51b815260040161041190612904565b60008082511161145c5760405162461bcd60e51b81526004018080602001828103825260348152602001806130286034913960400191505060405180910390fd5b815160011415611482578160008151811061147357fe5b602002602001015190506102ab565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b600184111561182b5750506002820460018084161460005b828110156117a7578a816002028151811061174e57fe5b602002602001015196508a816002026001018151811061176a57fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061179457fe5b6020908102919091010152600101611737565b50801561180a578960018503815181106117bd57fe5b602002602001015195508783601081106117d357fe5b602002015160001b945085602088015284604088015286805190602001208a83815181106117fd57fe5b6020026020010181815250505b80611816576000611819565b60015b60ff168201935060019092019161171f565b8960008151811061183857fe5b602002602001015198505050505050505050919050565b60006118596106d2565b9050600080611866610d76565b50509150915060006040518060a00160405280856001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156118b257600080fd5b505afa1580156118c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ea9190612203565b81526020018a81526020018981526020018464ffffffffff16815260200160405180602001604052806000815250815250905080600001517f127186556e7be68c7e31263195225b4de02820707889540969f62c05cf73525e826020015183604001518460600151856080015160405161196794939291906124e6565b60405180910390a2600061197a82611c75565b90506000611992836040015186018a86018a8a611c9e565b60405163080549db60e21b81529091506001600160a01b03871690632015276c906119c390859085906004016124d0565b600060405180830381600087803b1580156119dd57600080fd5b505af11580156119f1573d6000803e3d6000fd5b505050505050505050505050505050565b6080810151805160009190826041820167ffffffffffffffff81118015611a2857600080fd5b506040519080825280601f01601f191660200182016040528015611a53576020820181803683370190505b5060408601516060870151919250906000602084016001815383600182015282602182015285604182018760208a0160045afa50604190950190942095505050505050919050565b6000611aa56106d2565b8351604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a91611ad391600401612e7c565b60206040518083038186803b158015611aeb57600080fd5b505afa158015611aff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b239190612203565b611b2c84611c75565b14611b495760405162461bcd60e51b815260040161041190612b16565b611b66836020015185846000015185602001518760400151611cbd565b611b825760405162461bcd60e51b81526004016104119061294c565b5060019392505050565b6000611b9f8364ffffffffff1683610c36565b9050600154816020015164ffffffffff16014210611bcf5760405162461bcd60e51b815260040161041190612647565b806020015164ffffffffff1684604001511115611bfe5760405162461bcd60e51b8152600401610411906129cc565b806040015164ffffffffff16846060015111156112c95760405162461bcd60e51b815260040161041190612c74565b8051602080830151604080850151606086015160808701519251600096611c5896909594910161248f565b604051602081830303815290604052805190602001209050919050565b60008160200151826040015183606001518460800151604051602001611c5894939291906124e6565b602892831b9390931760509190911b1760789290921b91909117901b90565b6000808211611cfd5760405162461bcd60e51b8152600401808060200182810382526037815260200180612f7f6037913960400191505060405180910390fd5b818410611d3b5760405162461bcd60e51b8152600401808060200182810382526024815260200180612f2b6024913960400191505060405180910390fd5b611d4482611e42565b835114611d825760405162461bcd60e51b815260040180806020018281038252604d815260200180612fb6604d913960600191505060405180910390fd5b8460005b8451811015611e35578560011660011415611de457848181518110611da757fe5b6020026020010151826040516020018083815260200182815260200192505050604051602081830303815290604052805190602001209150611e29565b81858281518110611df157fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c9501611d86565b5090951495945050505050565b6000808211611e825760405162461bcd60e51b8152600401808060200182810382526030815260200180612f4f6030913960400191505060405180910390fd5b8160011415611e93575060006102ab565b81600060805b60018110611ec3576000196001821b01811b831615611ebb5791821c91908101905b60011c611e99565b506001811b8414611ed2576001015b9392505050565b604080516060810182526000808252602082018190529181019190915290565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b600067ffffffffffffffff831115611f3557fe5b611f48601f8401601f1916602001612ec1565b9050828152838383011115611f5c57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102ab57600080fd5b600082601f830112611f9a578081fd5b611ed283833560208501611f21565b8035600281106102ab57600080fd5b600060a08284031215611fc9578081fd5b60405160a0810167ffffffffffffffff8282108183111715611fe757fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561202457600080fd5b5061203185828601611f8a565b6080830152505092915050565b60006040828403121561204f578081fd5b6040516040810167ffffffffffffffff828210818311171561206d57fe5b816040528293508435835260209150818501358181111561208d57600080fd5b8501601f8101871361209e57600080fd5b8035828111156120aa57fe5b83810292506120ba848401612ec1565b8181528481019083860185850187018b10156120d557600080fd5b600095505b838610156120f85780358352600195909501949186019186016120da565b5080868801525050505050505092915050565b600060a0828403121561211c578081fd5b60405160a0810167ffffffffffffffff828210818311171561213a57fe5b8160405282935084359150811515821461215357600080fd5b818352602085013560208401526040850135604084015260608501356060840152608085013591508082111561202457600080fd5b60008060006060848603121561219c578283fd5b6121a584611f73565b925060208401359150604084013567ffffffffffffffff8111156121c7578182fd5b6121d386828701611f8a565b9150509250925092565b6000602082840312156121ee578081fd5b815164ffffffffff1981168114611ed2578182fd5b600060208284031215612214578081fd5b5051919050565b60006020828403121561222c578081fd5b813567ffffffffffffffff811115612242578182fd5b8201601f81018413612252578182fd5b6103d284823560208401611f21565b60008060008060808587031215612276578081fd5b843567ffffffffffffffff8082111561228d578283fd5b9086019060e082890312156122a0578283fd5b6122aa60e0612ec1565b82358152602083013560208201526122c460408401611fa9565b60408201526122d560608401611f73565b60608201526122e660808401611f73565b608082015260a083013560a082015260c083013582811115612306578485fd5b6123128a828601611f8a565b60c0830152509550602087013591508082111561232d578283fd5b6123398883890161210b565b9450604087013591508082111561234e578283fd5b61235a88838901611fb8565b9350606087013591508082111561236f578283fd5b5061237c8782880161203e565b91505092959194509250565b600060208284031215612399578081fd5b5035919050565b60008151808452815b818110156123c5576020818501810151868301820152016123a9565b818111156123d65782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612432908301846123a0565b9695505050505050565b6001600160a01b038781168252861660208201526040810185905260c06060820181905260009061246f908301866123a0565b60808301949094525060a00152949350505050565b901515815260200190565b6000861515825285602083015284604083015283606083015260a060808301526124bc60a08301846123a0565b979650505050505050565b90815260200190565b91825264ffffffffff1916602082015260400190565b60008582528460208301528360408301526080606083015261243260808301846123a0565b60208082526027908201527f617070656e64517565756542617463682069732063757272656e746c7920646960408201526639b0b13632b21760c91b606082015260800190565b60208082526029908201527f436f6e7465787420626c6f636b206e756d62657220746f6f2066617220696e206040820152683a3432903830b9ba1760b91b606082015260800190565b6020808252603d908201527f5472616e73616374696f6e20646174612073697a652065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b6020808252602f908201527f436f6e746578742074696d657374616d70206973206c6f776572207468616e2060408201526e3630b9ba1039bab136b4ba3a32b21760891b606082015260800190565b6020808252605b908201527f50726576696f75736c7920656e7175657565642062617463686573206861766560408201527f206578706972656420616e64206d75737420626520617070656e64656420626560608201527f666f72652061206e65772073657175656e6365722062617463682e0000000000608082015260a00190565b6020808252602e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e20696e60408201526d31b63ab9b4b7b710383937b7b31760911b606082015260800190565b60208082526032908201527f436f6e7465787420626c6f636b206e756d626572206973206c6f77657220746860408201527130b7103630b9ba1039bab136b4ba3a32b21760711b606082015260800190565b6020808252601e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e2e0000604082015260600190565b6020808252603d908201527f5472616e73616374696f6e20676173206c696d69742065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b60208082526028908201527f4d7573742070726f76696465206174206c65617374206f6e652062617463682060408201526731b7b73a32bc3a1760c11b606082015260800190565b6020808252602e908201527f4e6f7420616c6c2073657175656e636572207472616e73616374696f6e73207760408201526d32b93290383937b1b2b9b9b2b21760911b606082015260800190565b6020808252604a908201527f41637475616c207472616e73616374696f6e20696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420746f74616c20656c656d656e7473206060820152693a379030b83832b7321760b11b608082015260a00190565b60208082526028908201527f436f6e7465787420626c6f636b206e756d6265722069732066726f6d2074686560408201526710333aba3ab9329760c11b606082015260800190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b60208082526029908201527f5472616e73616374696f6e20676173206c696d697420746f6f206c6f7720746f6040820152681032b738bab2bab29760b91b606082015260800190565b60208082526043908201527f53657175656e636572207472616e73616374696f6e2074696d657374616d702060408201527f657863656564732074686174206f66206e65787420717565756520656c656d65606082015262373a1760e91b608082015260a00190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b6020808252602d908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c6564206279207460408201526c34329029b2b8bab2b731b2b91760991b606082015260800190565b6020808252601a908201527f496e76616c6964205175657565207472616e73616374696f6e2e000000000000604082015260600190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b60208082526025908201527f436f6e746578742074696d657374616d702069732066726f6d207468652066756040820152643a3ab9329760d91b606082015260800190565b6020808252602b908201527f496e73756666696369656e742067617320666f72204c322072617465206c696d60408201526a34ba34b73390313ab9371760a91b606082015260800190565b60208082526035908201527f436f6e746578742074696d657374616d702076616c756573206d757374206d6f6040820152743737ba37b734b1b0b6363c9034b731b932b0b9b29760591b606082015260800190565b6020808252602a908201527f496e76616c6964205175657565207472616e73616374696f6e20696e636c757360408201526934b7b710383937b7b31760b11b606082015260800190565b60208082526045908201527f53657175656e636572207472616e73616374696f6e20626c6f636b4e756d626560408201527f7220657863656564732074686174206f66206e65787420717565756520656c6560608201526436b2b73a1760d91b608082015260a00190565b60208082526021908201527f4d75737420617070656e64206174206c65617374206f6e6520656c656d656e746040820152601760f91b606082015260800190565b60208082526026908201527f436f6e746578742074696d657374616d7020746f6f2066617220696e20746865604082015265103830b9ba1760d11b606082015260800190565b60208082526022908201527f4e6f7420656e6f756768204261746368436f6e74657874732070726f76696465604082015261321760f11b606082015260800190565b60208082526029908201527f4e6f7420656e6f75676820717565756564207472616e73616374696f6e732074604082015268379030b83832b7321760b91b606082015260800190565b60208082526037908201527f436f6e7465787420626c6f636b4e756d6265722076616c756573206d7573742060408201527f6d6f6e6f746f6e6963616c6c7920696e6372656173652e000000000000000000606082015260800190565b8151815260208083015164ffffffffff90811691830191909152604092830151169181019190915260600190565b63ffffffff91909116815260200190565b64ffffffffff91909116815260200190565b64ffffffffff9384168152919092166020820152604081019190915260600190565b60405181810167ffffffffffffffff81118282101715612edd57fe5b60405291905056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a4354433a71756575654f564d5f4465636f6d7072657373696f6e507265636f6d70696c65416464726573734c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4f564d5f436861696e53746f72616765436f6e7461696e65723a4354433a626174636865734c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea2646970667358221220e5d77a6634733b27dcdabf781fd1df7c095b7f821616f55c1b31d62a7238f9d764736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101425760003560e01c8063876ed5cb116100b8578063cfdf677e1161007c578063cfdf677e1461023f578063d0f8934414610247578063e10d29ee1461024f578063e561dddc14610257578063f722b41a1461025f578063facdc5da1461026757610142565b8063876ed5cb146102175780638d38c6c11461021f578063b8f7700514610227578063c139eb151461022f578063c2cf696f1461023757610142565b80634de569ce1161010a5780634de569ce146101c25780635ae6256d146101e25780636fee07e0146101ea57806378f4b2f2146101ff5780637a167a8a146102075780637aa63a861461020f57610142565b8063138387a414610147578063299ca478146101655780632a7f18be1461017a578063378997701461019a578063461a4478146101af575b600080fd5b61014f61027a565b60405161015c91906124c7565b60405180910390f35b61016d610280565b60405161015c91906123eb565b61018d610188366004612388565b61028f565b60405161015c9190612e4e565b6101a26102b0565b60405161015c9190612e8d565b61016d6101bd36600461221b565b6102c4565b6101d56101d0366004612261565b6103a0565b60405161015c9190612484565b6101a26103da565b6101fd6101f8366004612188565b6103ee565b005b61014f61066d565b6101a2610674565b61014f610689565b61014f6106a4565b61014f6106aa565b6101a26106b0565b61014f6106c7565b61014f6106cd565b61016d6106d2565b6101fd6106f5565b61016d610b69565b61014f610b8c565b6101a2610c06565b6101fd610275366004612388565b610c1e565b60025481565b6000546001600160a01b031681565b610297611ed9565b6102a8826102a3610b69565b610c36565b90505b919050565b6000806102bb610d76565b50935050505090565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561032457818101518382015260200161030c565b50505050905090810190601f1680156103515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561036e57600080fd5b505afa158015610382573d6000803e3d6000fd5b505050506040513d602081101561039857600080fd5b505192915050565b82516000901515600114156103c2576103bb85858585610e24565b90506103d2565b6103bb8585602001518585610fef565b949350505050565b6000806103e5610d76565b94505050505090565b61c3508151111561041a5760405162461bcd60e51b81526004016104119061259b565b60405180910390fd5b60035482111561043c5760405162461bcd60e51b8152600401610411906127a1565b620186a082101561045f5760405162461bcd60e51b815260040161041190612983565b6020820460005a90508181116104875760405162461bcd60e51b815260040161041190612b8a565b60005b825a8303101561049c5760010161048a565b6000338787876040516020016104b594939291906123ff565b60408051601f19818403018152919052805160209091012090504360281b421760006104df610b69565b60405163b298e36b60e01b81529091506001600160a01b0382169063b298e36b9061050e9086906004016124c7565b600060405180830381600087803b15801561052857600080fd5b505af115801561053c573d6000803e3d6000fd5b505060405163b298e36b60e01b81526001600160a01b038416925063b298e36b915061056c9085906004016124c7565b600060405180830381600087803b15801561058657600080fd5b505af115801561059a573d6000803e3d6000fd5b50505050600060016002836001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156105dd57600080fd5b505afa1580156105f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106159190612203565b8161061c57fe5b040390507f4b388aecf9fa6cc92253704e5975a6129a4f735bdbd99567df4ed0094ee4ceb5338b8b8b85426040516106599695949392919061243c565b60405180910390a150505050505050505050565b620186a081565b60008061067f610d76565b5090935050505090565b600080610694610d76565b50505064ffffffffff1692915050565b61c35081565b60035481565b60006106c26106bd610b69565b6110c4565b905090565b60015481565b602081565b60006106c2604051806060016040528060258152602001613003602591396102c4565b60043560d81c60093560e890811c90600c35901c610711610689565b8364ffffffffff16146107365760405162461bcd60e51b815260040161041190612a35565b6107646040518060400160405280600d81526020016c27ab26afa9b2b8bab2b731b2b960991b8152506102c4565b6001600160a01b0316336001600160a01b0316146107945760405162461bcd60e51b815260040161041190612a92565b60008162ffffff16116107b95760405162461bcd60e51b8152600401610411906127fe565b60008262ffffff16116107de5760405162461bcd60e51b815260040161041190612cdf565b600f601062ffffff8316020164ffffffffff81163610156108115760405162461bcd60e51b815260040161041190612d66565b600061081b610b69565b90506000610828826110c4565b9050600062ffffff8616368161083a57fe5b0460020267ffffffffffffffff8111801561085457600080fd5b506040519080825280601f01601f19166020018201604052801561087f576020820181803683370190505b50905060008662ffffff1667ffffffffffffffff811180156108a057600080fd5b506040519080825280602002602001820160405280156108ca578160200160208202803683370190505b50905060008060006108da610674565b90506108e4611ef9565b60005b8a62ffffff168163ffffffff161015610a3b57600061090b8263ffffffff16611147565b905063ffffffff82166109215761092181611197565b61092d8382868d611264565b80925060005b835163ffffffff821610156109b1578b3560e81c61c3508111156109695760405162461bcd60e51b81526004016104119061259b565b61097c858e64ffffffffff16838d6112cf565b898963ffffffff168151811061098e57fe5b60209081029190910101529b909b016003019a6001968701969586019501610933565b5060005b83602001518163ffffffff161015610a31578964ffffffffff168564ffffffffff16106109f45760405162461bcd60e51b815260040161041190612da8565b610a048564ffffffffff16611363565b888863ffffffff1681518110610a1657fe5b602090810291909101015260019687019694850194016109b5565b50506001016108e7565b50610a488183898b6113a8565b3664ffffffffff8a1614610a6e5760405162461bcd60e51b815260040161041190612846565b8a62ffffff168463ffffffff1614610a985760405162461bcd60e51b815260040161041190612894565b6000838c62ffffff160363ffffffff169050600080836020015160001415610acb57505060408201516060830151610af3565b6000610ae16001870364ffffffffff168d610c36565b90508060200151925080604001519150505b610b14610aff8961141b565b8f62ffffff168564ffffffffff16858561184f565b7f602f1aeac0ca2e7a13e281a9ef0ad7838542712ce16780fa2ecffd351f05f89983860384610b41610689565b604051610b5093929190612e9f565b60405180910390a1505050505050505050505050505050565b60006106c2604051806060016040528060238152602001612ee6602391396102c4565b6000610b966106d2565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610bce57600080fd5b505afa158015610be2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c29190612203565b6000610c10610674565b610c186106b0565b03905090565b60405162461bcd60e51b81526004016104119061250b565b610c3e611ed9565b604051634a83e9cd60e11b815260028402906000906001600160a01b03851690639507d39a90610c72908590600401612e8d565b60206040518083038186803b158015610c8a57600080fd5b505afa158015610c9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc29190612203565b90506000846001600160a01b0316639507d39a846001016040518263ffffffff1660e01b8152600401610cf59190612e8d565b60206040518083038186803b158015610d0d57600080fd5b505afa158015610d21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d459190612203565b6040805160608101825293845264ffffffffff828116602086015260289290921c9091169083015250949350505050565b6000806000806000610d866106d2565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b158015610dbe57600080fd5b505afa158015610dd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df691906121dd565b64ffffffffff602882901c811697605083901c82169750607883901c8216965060a09290921c169350915050565b600080610e5c6040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b8152506102c4565b90506000816001600160a01b0316631c4712a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610e9957600080fd5b505afa158015610ead573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed19190612203565b90506000610ede87611a02565b9050610eeb818787611a9b565b610f075760405162461bcd60e51b8152600401610411906126ca565b86606001518860200151148015610f22575060408701518851145b8015610f635750610f4a604051806060016040528060228152602001612f09602291396102c4565b6001600160a01b031688608001516001600160a01b0316145b8015610f725750818860a00151145b8015610f89575060608801516001600160a01b0316155b8015610fa45750600088604001516001811115610fa257fe5b145b8015610fc557508660800151805190602001208860c0015180519060200120145b610fe15760405162461bcd60e51b81526004016104119061276a565b506001979650505050505050565b600080610ffb85611363565b9050611008818585611a9b565b6110245760405162461bcd60e51b815260040161041190612c2a565b6000866060015187608001518860a001518960c0015160405160200161104d94939291906123ff565b60405160208183030381529060405280519060200120905060006110708761028f565b80519091508214801561108e57508751602082015164ffffffffff16145b80156110a857508760200151816040015164ffffffffff16145b610fe15760405162461bcd60e51b815260040161041190612adf565b60006002826001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b15801561110157600080fd5b505afa158015611115573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111399190612203565b8161114057fe5b0492915050565b61114f611ef9565b5060408051608081018252601092909202600f81013560e890811c84526012820135901c6020840152601581013560d890811c92840192909252601a0135901c606082015290565b60006111a1610689565b1115611211576000806111b2610d76565b9350935050508064ffffffffff16836060015110156111e35760405162461bcd60e51b815260040161041190612718565b8164ffffffffff168360400151101561120e5760405162461bcd60e51b8152600401610411906125f8565b50505b4260015482604001510110156112395760405162461bcd60e51b815260040161041190612d20565b4360025482606001510110156112615760405162461bcd60e51b815260040161041190612552565b50565b83604001518360400151101561128c5760405162461bcd60e51b815260040161041190612bd5565b8360600151836060015110156112b45760405162461bcd60e51b815260040161041190612df1565b6020830151156112c9576112c9838383611b8c565b50505050565b60008151836041011115611326578260410167ffffffffffffffff811180156112f757600080fd5b506040519080825280601f01601f191660200182016040528015611322576020820181803683370190505b5091505b6040850151606086015160006020850160018153836001820152826021820152866003890160418301376041870190209350505050949350505050565b60006102a86040518060a00160405280600015158152602001848152602001600081526020016000815260200160405180602001604052806000815250815250611c2d565b600083830364ffffffffff161180156113c357506020840151155b156113d3576113d3848483611b8c565b42846040015111156113f75760405162461bcd60e51b815260040161041190612b45565b43846060015111156112c95760405162461bcd60e51b815260040161041190612904565b60008082511161145c5760405162461bcd60e51b81526004018080602001828103825260348152602001806130286034913960400191505060405180910390fd5b815160011415611482578160008151811061147357fe5b602002602001015190506102ab565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b600184111561182b5750506002820460018084161460005b828110156117a7578a816002028151811061174e57fe5b602002602001015196508a816002026001018151811061176a57fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061179457fe5b6020908102919091010152600101611737565b50801561180a578960018503815181106117bd57fe5b602002602001015195508783601081106117d357fe5b602002015160001b945085602088015284604088015286805190602001208a83815181106117fd57fe5b6020026020010181815250505b80611816576000611819565b60015b60ff168201935060019092019161171f565b8960008151811061183857fe5b602002602001015198505050505050505050919050565b60006118596106d2565b9050600080611866610d76565b50509150915060006040518060a00160405280856001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156118b257600080fd5b505afa1580156118c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ea9190612203565b81526020018a81526020018981526020018464ffffffffff16815260200160405180602001604052806000815250815250905080600001517f127186556e7be68c7e31263195225b4de02820707889540969f62c05cf73525e826020015183604001518460600151856080015160405161196794939291906124e6565b60405180910390a2600061197a82611c75565b90506000611992836040015186018a86018a8a611c9e565b60405163080549db60e21b81529091506001600160a01b03871690632015276c906119c390859085906004016124d0565b600060405180830381600087803b1580156119dd57600080fd5b505af11580156119f1573d6000803e3d6000fd5b505050505050505050505050505050565b6080810151805160009190826041820167ffffffffffffffff81118015611a2857600080fd5b506040519080825280601f01601f191660200182016040528015611a53576020820181803683370190505b5060408601516060870151919250906000602084016001815383600182015282602182015285604182018760208a0160045afa50604190950190942095505050505050919050565b6000611aa56106d2565b8351604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a91611ad391600401612e7c565b60206040518083038186803b158015611aeb57600080fd5b505afa158015611aff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b239190612203565b611b2c84611c75565b14611b495760405162461bcd60e51b815260040161041190612b16565b611b66836020015185846000015185602001518760400151611cbd565b611b825760405162461bcd60e51b81526004016104119061294c565b5060019392505050565b6000611b9f8364ffffffffff1683610c36565b9050600154816020015164ffffffffff16014210611bcf5760405162461bcd60e51b815260040161041190612647565b806020015164ffffffffff1684604001511115611bfe5760405162461bcd60e51b8152600401610411906129cc565b806040015164ffffffffff16846060015111156112c95760405162461bcd60e51b815260040161041190612c74565b8051602080830151604080850151606086015160808701519251600096611c5896909594910161248f565b604051602081830303815290604052805190602001209050919050565b60008160200151826040015183606001518460800151604051602001611c5894939291906124e6565b602892831b9390931760509190911b1760789290921b91909117901b90565b6000808211611cfd5760405162461bcd60e51b8152600401808060200182810382526037815260200180612f7f6037913960400191505060405180910390fd5b818410611d3b5760405162461bcd60e51b8152600401808060200182810382526024815260200180612f2b6024913960400191505060405180910390fd5b611d4482611e42565b835114611d825760405162461bcd60e51b815260040180806020018281038252604d815260200180612fb6604d913960600191505060405180910390fd5b8460005b8451811015611e35578560011660011415611de457848181518110611da757fe5b6020026020010151826040516020018083815260200182815260200192505050604051602081830303815290604052805190602001209150611e29565b81858281518110611df157fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c9501611d86565b5090951495945050505050565b6000808211611e825760405162461bcd60e51b8152600401808060200182810382526030815260200180612f4f6030913960400191505060405180910390fd5b8160011415611e93575060006102ab565b81600060805b60018110611ec3576000196001821b01811b831615611ebb5791821c91908101905b60011c611e99565b506001811b8414611ed2576001015b9392505050565b604080516060810182526000808252602082018190529181019190915290565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b600067ffffffffffffffff831115611f3557fe5b611f48601f8401601f1916602001612ec1565b9050828152838383011115611f5c57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102ab57600080fd5b600082601f830112611f9a578081fd5b611ed283833560208501611f21565b8035600281106102ab57600080fd5b600060a08284031215611fc9578081fd5b60405160a0810167ffffffffffffffff8282108183111715611fe757fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561202457600080fd5b5061203185828601611f8a565b6080830152505092915050565b60006040828403121561204f578081fd5b6040516040810167ffffffffffffffff828210818311171561206d57fe5b816040528293508435835260209150818501358181111561208d57600080fd5b8501601f8101871361209e57600080fd5b8035828111156120aa57fe5b83810292506120ba848401612ec1565b8181528481019083860185850187018b10156120d557600080fd5b600095505b838610156120f85780358352600195909501949186019186016120da565b5080868801525050505050505092915050565b600060a0828403121561211c578081fd5b60405160a0810167ffffffffffffffff828210818311171561213a57fe5b8160405282935084359150811515821461215357600080fd5b818352602085013560208401526040850135604084015260608501356060840152608085013591508082111561202457600080fd5b60008060006060848603121561219c578283fd5b6121a584611f73565b925060208401359150604084013567ffffffffffffffff8111156121c7578182fd5b6121d386828701611f8a565b9150509250925092565b6000602082840312156121ee578081fd5b815164ffffffffff1981168114611ed2578182fd5b600060208284031215612214578081fd5b5051919050565b60006020828403121561222c578081fd5b813567ffffffffffffffff811115612242578182fd5b8201601f81018413612252578182fd5b6103d284823560208401611f21565b60008060008060808587031215612276578081fd5b843567ffffffffffffffff8082111561228d578283fd5b9086019060e082890312156122a0578283fd5b6122aa60e0612ec1565b82358152602083013560208201526122c460408401611fa9565b60408201526122d560608401611f73565b60608201526122e660808401611f73565b608082015260a083013560a082015260c083013582811115612306578485fd5b6123128a828601611f8a565b60c0830152509550602087013591508082111561232d578283fd5b6123398883890161210b565b9450604087013591508082111561234e578283fd5b61235a88838901611fb8565b9350606087013591508082111561236f578283fd5b5061237c8782880161203e565b91505092959194509250565b600060208284031215612399578081fd5b5035919050565b60008151808452815b818110156123c5576020818501810151868301820152016123a9565b818111156123d65782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612432908301846123a0565b9695505050505050565b6001600160a01b038781168252861660208201526040810185905260c06060820181905260009061246f908301866123a0565b60808301949094525060a00152949350505050565b901515815260200190565b6000861515825285602083015284604083015283606083015260a060808301526124bc60a08301846123a0565b979650505050505050565b90815260200190565b91825264ffffffffff1916602082015260400190565b60008582528460208301528360408301526080606083015261243260808301846123a0565b60208082526027908201527f617070656e64517565756542617463682069732063757272656e746c7920646960408201526639b0b13632b21760c91b606082015260800190565b60208082526029908201527f436f6e7465787420626c6f636b206e756d62657220746f6f2066617220696e206040820152683a3432903830b9ba1760b91b606082015260800190565b6020808252603d908201527f5472616e73616374696f6e20646174612073697a652065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b6020808252602f908201527f436f6e746578742074696d657374616d70206973206c6f776572207468616e2060408201526e3630b9ba1039bab136b4ba3a32b21760891b606082015260800190565b6020808252605b908201527f50726576696f75736c7920656e7175657565642062617463686573206861766560408201527f206578706972656420616e64206d75737420626520617070656e64656420626560608201527f666f72652061206e65772073657175656e6365722062617463682e0000000000608082015260a00190565b6020808252602e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e20696e60408201526d31b63ab9b4b7b710383937b7b31760911b606082015260800190565b60208082526032908201527f436f6e7465787420626c6f636b206e756d626572206973206c6f77657220746860408201527130b7103630b9ba1039bab136b4ba3a32b21760711b606082015260800190565b6020808252601e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e2e0000604082015260600190565b6020808252603d908201527f5472616e73616374696f6e20676173206c696d69742065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b60208082526028908201527f4d7573742070726f76696465206174206c65617374206f6e652062617463682060408201526731b7b73a32bc3a1760c11b606082015260800190565b6020808252602e908201527f4e6f7420616c6c2073657175656e636572207472616e73616374696f6e73207760408201526d32b93290383937b1b2b9b9b2b21760911b606082015260800190565b6020808252604a908201527f41637475616c207472616e73616374696f6e20696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420746f74616c20656c656d656e7473206060820152693a379030b83832b7321760b11b608082015260a00190565b60208082526028908201527f436f6e7465787420626c6f636b206e756d6265722069732066726f6d2074686560408201526710333aba3ab9329760c11b606082015260800190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b60208082526029908201527f5472616e73616374696f6e20676173206c696d697420746f6f206c6f7720746f6040820152681032b738bab2bab29760b91b606082015260800190565b60208082526043908201527f53657175656e636572207472616e73616374696f6e2074696d657374616d702060408201527f657863656564732074686174206f66206e65787420717565756520656c656d65606082015262373a1760e91b608082015260a00190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b6020808252602d908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c6564206279207460408201526c34329029b2b8bab2b731b2b91760991b606082015260800190565b6020808252601a908201527f496e76616c6964205175657565207472616e73616374696f6e2e000000000000604082015260600190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b60208082526025908201527f436f6e746578742074696d657374616d702069732066726f6d207468652066756040820152643a3ab9329760d91b606082015260800190565b6020808252602b908201527f496e73756666696369656e742067617320666f72204c322072617465206c696d60408201526a34ba34b73390313ab9371760a91b606082015260800190565b60208082526035908201527f436f6e746578742074696d657374616d702076616c756573206d757374206d6f6040820152743737ba37b734b1b0b6363c9034b731b932b0b9b29760591b606082015260800190565b6020808252602a908201527f496e76616c6964205175657565207472616e73616374696f6e20696e636c757360408201526934b7b710383937b7b31760b11b606082015260800190565b60208082526045908201527f53657175656e636572207472616e73616374696f6e20626c6f636b4e756d626560408201527f7220657863656564732074686174206f66206e65787420717565756520656c6560608201526436b2b73a1760d91b608082015260a00190565b60208082526021908201527f4d75737420617070656e64206174206c65617374206f6e6520656c656d656e746040820152601760f91b606082015260800190565b60208082526026908201527f436f6e746578742074696d657374616d7020746f6f2066617220696e20746865604082015265103830b9ba1760d11b606082015260800190565b60208082526022908201527f4e6f7420656e6f756768204261746368436f6e74657874732070726f76696465604082015261321760f11b606082015260800190565b60208082526029908201527f4e6f7420656e6f75676820717565756564207472616e73616374696f6e732074604082015268379030b83832b7321760b91b606082015260800190565b60208082526037908201527f436f6e7465787420626c6f636b4e756d6265722076616c756573206d7573742060408201527f6d6f6e6f746f6e6963616c6c7920696e6372656173652e000000000000000000606082015260800190565b8151815260208083015164ffffffffff90811691830191909152604092830151169181019190915260600190565b63ffffffff91909116815260200190565b64ffffffffff91909116815260200190565b64ffffffffff9384168152919092166020820152604081019190915260600190565b60405181810167ffffffffffffffff81118282101715612edd57fe5b60405291905056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a4354433a71756575654f564d5f4465636f6d7072657373696f6e507265636f6d70696c65416464726573734c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4f564d5f436861696e53746f72616765436f6e7461696e65723a4354433a626174636865734c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea2646970667358221220e5d77a6634733b27dcdabf781fd1df7c095b7f821616f55c1b31d62a7238f9d764736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"\",\"type\":\"uint256\"}],\"name\":\"appendQueueBatch\",\"outputs\":[],\"stateMutability\":\"pure\",\"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\":\"transactionHash\",\"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\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"\",\"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\":{\"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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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. param _numQueuedTransactions Number of transactions to append.\"},\"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.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow, so we distribute\\n return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);\\n }\\n}\\n\",\"keccak256\":\"0x363bd3b45201f07c9b71c2edc96533468cf14a3d029fabd82fddceb1eb3ebd9c\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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\\\";\\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/* External Imports */\\nimport { Math } from \\\"@openzeppelin/contracts/math/Math.sol\\\";\\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 = 50000;\\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 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 return _getQueueElement(\\n _index,\\n queue()\\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 return _getQueueLength(\\n queue()\\n );\\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 queueRef = queue();\\n\\n queueRef.push(transactionHash);\\n queueRef.push(timestampAndBlockNumber);\\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 and subtract 1.\\n uint256 queueIndex = queueRef.length() / 2 - 1;\\n emit TransactionEnqueued(\\n msg.sender,\\n _target,\\n _gasLimit,\\n _data,\\n queueIndex,\\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 pure\\n {\\n // TEMPORARY: Disable `appendQueueBatch` for minnet\\n revert(\\\"appendQueueBatch is currently disabled.\\\");\\n\\n // _numQueuedTransactions = 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\\n require(\\n msg.data.length >= nextTransactionPtr,\\n \\\"Not enough BatchContexts provided.\\\"\\n );\\n\\n // Take a reference to the queue and its length so we don't have to keep resolving it.\\n // Length isn't going to change during the course of execution, so it's fine to simply\\n // resolve this once at the start. Saves gas.\\n iOVM_ChainStorageContainer queueRef = queue();\\n uint40 queueLength = _getQueueLength(queueRef);\\n\\n // Reserve some memory to save gas on hashing later on. This is a relatively safe estimate\\n // for the average transaction size that will prevent having to resize this chunk of memory\\n // later on. Saves gas.\\n bytes memory hashMemory = new bytes((msg.data.length / totalElementsToAppend) * 2);\\n\\n // Initialize the array of canonical chain leaves that we will append.\\n bytes32[] memory leaves = new bytes32[](totalElementsToAppend);\\n\\n // Each leaf index corresponds to a tx, either sequenced or enqueued.\\n uint32 leafIndex = 0;\\n\\n // Counter for number of sequencer transactions appended so far.\\n uint32 numSequencerTransactions = 0;\\n\\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 for (uint32 i = 0; i < numContexts; i++) {\\n BatchContext memory nextContext = _getBatchContext(i);\\n\\n if (i == 0) {\\n // Execute a special check for the first batch.\\n _validateFirstBatchContext(nextContext);\\n }\\n\\n // Execute this check on every single batch, including the first one.\\n _validateNextBatchContext(\\n curContext,\\n nextContext,\\n nextQueueIndex,\\n queueRef\\n );\\n\\n // Now we can update our current context.\\n curContext = nextContext;\\n\\n // Process sequencer transactions first.\\n for (uint32 j = 0; j < curContext.numSequencedTransactions; j++) {\\n uint256 txDataLength;\\n assembly {\\n txDataLength := shr(232, calldataload(nextTransactionPtr))\\n }\\n require(\\n txDataLength <= MAX_ROLLUP_TX_SIZE,\\n \\\"Transaction data size exceeds maximum for rollup transaction.\\\"\\n );\\n\\n leaves[leafIndex] = _getSequencerLeafHash(\\n curContext,\\n nextTransactionPtr,\\n txDataLength,\\n hashMemory\\n );\\n\\n nextTransactionPtr += uint40(TX_DATA_HEADER_SIZE + txDataLength);\\n numSequencerTransactions++;\\n leafIndex++;\\n }\\n\\n // Now process any subsequent queue transactions.\\n for (uint32 j = 0; j < curContext.numSubsequentQueueTransactions; j++) {\\n require(\\n nextQueueIndex < queueLength,\\n \\\"Not enough queued transactions to append.\\\"\\n );\\n\\n leaves[leafIndex] = _getQueueLeafHash(nextQueueIndex);\\n nextQueueIndex++;\\n leafIndex++;\\n }\\n }\\n\\n _validateFinalBatchContext(\\n curContext,\\n nextQueueIndex,\\n queueLength,\\n queueRef\\n );\\n\\n require(\\n msg.data.length == 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 blockTimestamp;\\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 blockTimestamp = 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 // curContext.numSubsequentQueueTransactions > 0 which means that we've processed at least one queue element.\\n // We increment nextQueueIndex after processing each queue element,\\n // so the index of the last element we processed is nextQueueIndex - 1.\\n Lib_OVMCodec.QueueElement memory lastElement = _getQueueElement(\\n nextQueueIndex - 1,\\n queueRef\\n );\\n\\n blockTimestamp = lastElement.timestamp;\\n blockNumber = lastElement.blockNumber;\\n }\\n\\n // For efficiency reasons getMerkleRoot modifies the `leaves` argument in place\\n // while calculating the root hash therefore any arguments passed to it must not\\n // be used again afterwards\\n _appendBatch(\\n Lib_MerkleTree.getMerkleRoot(leaves),\\n totalElementsToAppend,\\n numQueuedTransactions,\\n blockTimestamp,\\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 pure\\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 * 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 iOVM_ChainStorageContainer _queueRef\\n )\\n internal\\n view\\n returns (\\n Lib_OVMCodec.QueueElement memory _element\\n )\\n {\\n // The underlying queue data structure stores 2 elements\\n // per insertion, so to get the actual desired queue index\\n // we need to multiply by 2.\\n uint40 trueIndex = uint40(_index * 2);\\n bytes32 transactionHash = _queueRef.get(trueIndex);\\n bytes32 timestampAndBlockNumber = _queueRef.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 transactionHash: transactionHash,\\n timestamp: elementTimestamp,\\n blockNumber: elementBlockNumber\\n });\\n }\\n\\n /**\\n * Retrieves the length of the queue.\\n * @return Length of the queue.\\n */\\n function _getQueueLength(\\n iOVM_ChainStorageContainer _queueRef\\n )\\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.\\n return uint40(_queueRef.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 bytes memory _hashMemory\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n // Only allocate more memory if we didn't reserve enough to begin with.\\n if (BYTES_TILL_TX_DATA + _txDataLength > _hashMemory.length) {\\n _hashMemory = new bytes(BYTES_TILL_TX_DATA + _txDataLength);\\n }\\n\\n uint256 ctxTimestamp = _context.timestamp;\\n uint256 ctxBlockNumber = _context.blockNumber;\\n\\n bytes32 leafHash;\\n assembly {\\n let chainElementStart := add(_hashMemory, 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 iOVM_ChainStorageContainer batchesRef = batches();\\n (uint40 totalElements, uint40 nextQueueIndex,,) = _getBatchExtraData();\\n\\n Lib_OVMCodec.ChainBatchHeader memory header = Lib_OVMCodec.ChainBatchHeader({\\n batchIndex: batchesRef.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 batchesRef.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 have the same context\\n // or a later timestamp and block number.\\n if (getTotalElements() > 0) {\\n (,, uint40 lastTimestamp, uint40 lastBlockNumber) = _getBatchExtraData();\\n\\n require(\\n _firstContext.blockNumber >= lastBlockNumber,\\n \\\"Context block number is lower than last submitted.\\\"\\n );\\n\\n require(\\n _firstContext.timestamp >= lastTimestamp,\\n \\\"Context timestamp is lower than last submitted.\\\"\\n );\\n }\\n\\n // Sequencer cannot submit contexts which are more than the force inclusion period old.\\n require(\\n _firstContext.timestamp + forceInclusionPeriodSeconds >= block.timestamp,\\n \\\"Context timestamp too far in the past.\\\"\\n );\\n\\n require(\\n _firstContext.blockNumber + forceInclusionPeriodBlocks >= block.number,\\n \\\"Context block number too far in the past.\\\"\\n );\\n }\\n\\n /**\\n * Checks that a given batch context has a time context which is below a given que element\\n * @param _context The batch context to validate has values lower.\\n * @param _queueIndex Index of the queue element we are validating came later than the context.\\n * @param _queueRef The storage container for the queue.\\n */\\n function _validateContextBeforeEnqueue(\\n BatchContext memory _context,\\n uint40 _queueIndex,\\n iOVM_ChainStorageContainer _queueRef\\n )\\n internal\\n view\\n {\\n Lib_OVMCodec.QueueElement memory nextQueueElement = _getQueueElement(\\n _queueIndex,\\n _queueRef\\n );\\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 _context.timestamp <= nextQueueElement.timestamp,\\n \\\"Sequencer transaction timestamp exceeds that of next queue element.\\\"\\n );\\n\\n require(\\n _context.blockNumber <= nextQueueElement.blockNumber,\\n \\\"Sequencer transaction blockNumber exceeds that of next queue element.\\\"\\n );\\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 * @param _queueRef The storage container for the queue.\\n */\\n function _validateNextBatchContext(\\n BatchContext memory _prevContext,\\n BatchContext memory _nextContext,\\n uint40 _nextQueueIndex,\\n iOVM_ChainStorageContainer _queueRef\\n )\\n internal\\n view\\n {\\n // All sequencer transactions' times must be greater than or equal to 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 is going to be a queue element pulled in from this context:\\n if (_nextContext.numSubsequentQueueTransactions > 0) {\\n _validateContextBeforeEnqueue(\\n _nextContext,\\n _nextQueueIndex,\\n _queueRef\\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 * @param _queueLength The length of the queue at the start of the batchAppend call.\\n * @param _nextQueueIndex The next element in the queue that will be pulled into the CTC.\\n * @param _queueRef The storage container for the queue.\\n */\\n function _validateFinalBatchContext(\\n BatchContext memory _finalContext,\\n uint40 _nextQueueIndex,\\n uint40 _queueLength,\\n iOVM_ChainStorageContainer _queueRef\\n )\\n internal\\n view\\n {\\n // If the queue is not now empty, check the mononoticity of whatever the next batch that will come in is.\\n if (_queueLength - _nextQueueIndex > 0 && _finalContext.numSubsequentQueueTransactions == 0) {\\n _validateContextBeforeEnqueue(\\n _finalContext,\\n _nextQueueIndex,\\n _queueRef\\n );\\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.transactionHash == 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\":\"0x36760ab13dafc8bb8f71e0906a20059a520e692a69ed8fca09bf6fd43bd6ff15\",\"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_Bytes32Utils } from \\\"../../libraries/utils/Lib_Bytes32Utils.sol\\\";\\nimport { Lib_EthUtils } from \\\"../../libraries/utils/Lib_EthUtils.sol\\\";\\nimport { Lib_ErrorUtils } from \\\"../../libraries/utils/Lib_ErrorUtils.sol\\\";\\nimport { Lib_PredeployAddresses } from \\\"../../libraries/constants/Lib_PredeployAddresses.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_DeployerWhitelist } from \\\"../predeploys/OVM_DeployerWhitelist.sol\\\";\\n\\n/* External Imports */\\nimport { Math } from \\\"@openzeppelin/contracts/math/Math.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 * Native Value Constants *\\n **************************/\\n\\n // Public so we can access and make assertions in integration tests.\\n uint256 public constant CALL_WITH_VALUE_INTRINSIC_GAS = 90000;\\n\\n\\n /**************************\\n * Default Context Values *\\n **************************/\\n\\n uint256 constant DEFAULT_UINT256 = 0xdefa017defa017defa017defa017defa017defa017defa017defa017defa017d;\\n address constant DEFAULT_ADDRESS = 0xdEfa017defA017DeFA017DEfa017DeFA017DeFa0;\\n\\n\\n /*************************************\\n * Container Contract Address Prefix *\\n *************************************/\\n\\n /**\\n * @dev The Execution Manager and State Manager each have this 30 byte prefix, and are uncallable.\\n */\\n address constant CONTAINER_CONTRACT_PREFIX = 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000;\\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 Lib_AddressResolver(_libAddressManager)\\n {\\n ovmSafetyChecker = iOVM_SafetyChecker(resolve(\\\"OVM_SafetyChecker\\\"));\\n gasMeterConfig = _gasMeterConfig;\\n globalContext = _globalContext;\\n _resetContext();\\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 external\\n returns (\\n bytes memory\\n )\\n {\\n // Make sure that run() is not re-enterable. This condition should always be satisfied\\n // Once run has been called once, due to the behavior of _isValidInput().\\n if (transactionContext.ovmNUMBER != DEFAULT_UINT256) {\\n return bytes(\\\"\\\");\\n }\\n\\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 (_isValidInput(_transaction) == false) {\\n _resetContext();\\n return bytes(\\\"\\\");\\n }\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\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 (, bytes memory returndata) = ovmCALL(\\n _transaction.gasLimit - gasMeterConfig.minTransactionGasLimit,\\n _transaction.entrypoint,\\n 0,\\n _transaction.data\\n );\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\n // // Update the cumulative gas based on the amount of gas used.\\n // uint256 gasUsed = gasProvided - gasleft();\\n // _updateCumulativeGas(gasUsed, _transaction.l1QueueOrigin);\\n\\n // Wipe the execution context.\\n _resetContext();\\n\\n return returndata;\\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 external\\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 CALLVALUE.\\n * @return _CALLVALUE Value sent along with the call according to the current message context.\\n */\\n function ovmCALLVALUE()\\n override\\n public\\n view\\n returns (\\n uint256 _CALLVALUE\\n )\\n {\\n return messageContext.ovmCALLVALUE;\\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 external\\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 external\\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 external\\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 external\\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 source (Sequencer or Queue) this transaction originated from.\\n * @return _queueOrigin Enum indicating the ovmL1QUEUEORIGIN within the current message context.\\n */\\n function ovmL1QUEUEORIGIN()\\n override\\n external\\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 external\\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 Address of the created contract.\\n * @return Revert data, if and only if the creation threw an exception.\\n */\\n function ovmCREATE(\\n bytes memory _bytecode\\n )\\n override\\n public\\n notStatic\\n fixedGasDiscount(40000)\\n returns (\\n address,\\n bytes memory\\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 MessageType.ovmCREATE\\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 Address of the created contract.\\n * @return Revert data, if and only if the creation threw an exception.\\n */\\n function ovmCREATE2(\\n bytes memory _bytecode,\\n bytes32 _salt\\n )\\n override\\n external\\n notStatic\\n fixedGasDiscount(40000)\\n returns (\\n address,\\n bytes memory\\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 MessageType.ovmCREATE2\\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 external\\n returns (\\n uint256 _nonce\\n )\\n {\\n return _getAccountNonce(ovmADDRESS());\\n }\\n\\n /**\\n * Bumps the nonce of the current ovmADDRESS by one.\\n */\\n function ovmINCREMENTNONCE()\\n override\\n external\\n notStatic\\n {\\n address account = ovmADDRESS();\\n uint256 nonce = _getAccountNonce(account);\\n\\n // Prevent overflow.\\n if (nonce + 1 > nonce) {\\n _setAccountNonce(account, nonce + 1);\\n }\\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 // Creates a duplicate of the OVM_ProxyEOA located at 0x42....09. Uses the following\\n // \\\"magic\\\" prefix to deploy an exact copy of the code:\\n // PUSH1 0x0D # size of this prefix in bytes\\n // CODESIZE\\n // SUB # subtract prefix size from codesize\\n // DUP1\\n // PUSH1 0x0D\\n // PUSH1 0x00\\n // CODECOPY # copy everything after prefix into memory at pos 0\\n // PUSH1 0x00\\n // RETURN # return the copied code\\n address proxyEOA = Lib_EthUtils.createContract(abi.encodePacked(\\n hex\\\"600D380380600D6000396000f3\\\",\\n ovmEXTCODECOPY(\\n Lib_PredeployAddresses.PROXY_EOA,\\n 0,\\n ovmEXTCODESIZE(Lib_PredeployAddresses.PROXY_EOA)\\n )\\n ));\\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 _value ETH value to pass with the 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 uint256 _value,\\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 nextMessageContext.ovmCALLVALUE = _value;\\n\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata,\\n MessageType.ovmCALL\\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, valueless context.\\n MessageContext memory nextMessageContext = messageContext;\\n nextMessageContext.ovmCALLER = nextMessageContext.ovmADDRESS;\\n nextMessageContext.ovmADDRESS = _address;\\n nextMessageContext.isStatic = true;\\n nextMessageContext.ovmCALLVALUE = 0;\\n\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata,\\n MessageType.ovmSTATICCALL\\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\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata,\\n MessageType.ovmDELEGATECALL\\n );\\n }\\n\\n /**\\n * @notice Legacy ovmCALL function which did not support ETH value; this maintains backwards compatibility.\\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 returns(\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n // Legacy ovmCALL assumed always-0 value.\\n return ovmCALL(\\n _gasLimit,\\n _address,\\n 0,\\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 external\\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 external\\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 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 external\\n returns (\\n bytes32 _EXTCODEHASH\\n )\\n {\\n return Lib_EthUtils.getCodeHash(\\n _getAccountEthAddress(_contract)\\n );\\n }\\n\\n\\n /***************************************\\n * Public Functions: ETH Value Opcodes *\\n ***************************************/\\n\\n /**\\n * @notice Overrides BALANCE.\\n * NOTE: In the future, this could be optimized to directly invoke EM._getContractStorage(...).\\n * @param _contract Address of the contract to query the OVM_ETH balance of.\\n * @return _BALANCE OVM_ETH balance of the requested contract.\\n */\\n function ovmBALANCE(\\n address _contract\\n )\\n override\\n public\\n returns (\\n uint256 _BALANCE\\n )\\n {\\n // Easiest way to get the balance is query OVM_ETH as normal.\\n bytes memory balanceOfCalldata = abi.encodeWithSignature(\\n \\\"balanceOf(address)\\\",\\n _contract\\n );\\n\\n // Static call because this should be a read-only query.\\n (bool success, bytes memory returndata) = ovmSTATICCALL(\\n gasleft(),\\n Lib_PredeployAddresses.OVM_ETH,\\n balanceOfCalldata\\n );\\n\\n // All balanceOf queries should successfully return a uint, otherwise this must be an OOG.\\n if (!success || returndata.length != 32) {\\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\\n }\\n\\n // Return the decoded balance.\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * @notice Overrides SELFBALANCE.\\n * @return _BALANCE OVM_ETH balance of the requesting contract.\\n */\\n function ovmSELFBALANCE()\\n override\\n external\\n returns (\\n uint256 _BALANCE\\n )\\n {\\n return ovmBALANCE(ovmADDRESS());\\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 Whitelisting *\\n ********************************************/\\n\\n /**\\n * Checks whether the given address is on the whitelist 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 semantics perspective, this will appear 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) = ovmSTATICCALL(\\n gasleft(),\\n Lib_PredeployAddresses.DEPLOYER_WHITELIST,\\n abi.encodeWithSelector(\\n OVM_DeployerWhitelist.isDeployerAllowed.selector,\\n _deployerAddress\\n )\\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 Final OVM contract address.\\n * @return Revertdata, if and only if the creation threw an exception.\\n */\\n function _createContract(\\n address _contractAddress,\\n bytes memory _bytecode,\\n MessageType _messageType\\n )\\n internal\\n returns (\\n address,\\n bytes memory\\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 the common logic which occurs between call-type and create-type messages,\\n // passing in the creation bytecode and `true` to trigger create-specific logic.\\n (bool success, bytes memory data) = _handleExternalMessage(\\n nextMessageContext,\\n gasleft(),\\n _contractAddress,\\n _bytecode,\\n _messageType\\n );\\n\\n // Yellow paper requires that address returned is zero if the contract deployment fails.\\n return (\\n success ? _contractAddress : address(0),\\n data\\n );\\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 MessageType _messageType\\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(CONTAINER_CONTRACT_PREFIX)\\n ) {\\n // EVM does not return data in the success case, see: https://github.com/ethereum/go-ethereum/blob/aae7660410f0ef90279e14afaaf2f429fdc2a186/core/vm/instructions.go#L600-L604\\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 _handleExternalMessage(\\n _nextMessageContext,\\n _gasLimit,\\n codeContractAddress,\\n _calldata,\\n _messageType\\n );\\n }\\n\\n /**\\n * Handles all interactions which involve the execution manager calling out to untrusted code (both calls and creates).\\n * Ensures that OVM-related measures are enforced, including L2 gas refunds, nuisance gas, and flagged reversions.\\n *\\n * @param _nextMessageContext Message context to be used for the external message.\\n * @param _gasLimit Amount of gas to be passed into this message. NOTE: this argument is overwritten in some cases to avoid stack-too-deep.\\n * @param _contract OVM address being called or deployed to\\n * @param _data Data for the message (either calldata or creation code)\\n * @param _messageType What type of ovmOPCODE this message corresponds to.\\n * @return Whether or not the message (either a call or deployment) succeeded.\\n * @return Data returned by the message.\\n */\\n function _handleExternalMessage(\\n MessageContext memory _nextMessageContext,\\n // NOTE: this argument is overwritten in some cases to avoid stack-too-deep.\\n uint256 _gasLimit,\\n address _contract,\\n bytes memory _data,\\n MessageType _messageType\\n )\\n internal\\n returns (\\n bool,\\n bytes memory\\n )\\n {\\n uint256 messageValue = _nextMessageContext.ovmCALLVALUE;\\n // If there is value in this message, we need to transfer the ETH over before switching contexts.\\n if (\\n messageValue > 0\\n && _isValueType(_messageType)\\n ) {\\n // Handle out-of-intrinsic gas consistent with EVM behavior -- the subcall \\\"appears to revert\\\" if we don't have enough gas to transfer the ETH.\\n // Similar to dynamic gas cost of value exceeding gas here:\\n // https://github.com/ethereum/go-ethereum/blob/c503f98f6d5e80e079c1d8a3601d188af2a899da/core/vm/interpreter.go#L268-L273\\n if (gasleft() < CALL_WITH_VALUE_INTRINSIC_GAS) {\\n return (false, hex\\\"\\\");\\n }\\n\\n // If there *is* enough gas to transfer ETH, then we need to make sure this amount of gas is reserved (i.e. not\\n // given to the _contract.call below) to guarantee that _handleExternalMessage can't run out of gas.\\n // In particular, in the event that the call fails, we will need to transfer the ETH back to the sender.\\n // Taking the lesser of _gasLimit and gasleft() - CALL_WITH_VALUE_INTRINSIC_GAS guarantees that the second\\n // _attemptForcedEthTransfer below, if needed, always has enough gas to succeed.\\n _gasLimit = Math.min(\\n _gasLimit,\\n gasleft() - CALL_WITH_VALUE_INTRINSIC_GAS // Cannot overflow due to the above check.\\n );\\n\\n // Now transfer the value of the call.\\n // The target is interpreted to be the next message's ovmADDRESS account.\\n bool transferredOvmEth = _attemptForcedEthTransfer(\\n _nextMessageContext.ovmADDRESS,\\n messageValue\\n );\\n\\n // If the ETH transfer fails (should only be possible in the case of insufficient balance), then treat this as a revert.\\n // This mirrors EVM behavior, see https://github.com/ethereum/go-ethereum/blob/2dee31930c9977af2a9fcb518fb9838aa609a7cf/core/vm/evm.go#L298\\n if (!transferredOvmEth) {\\n return (false, hex\\\"\\\");\\n }\\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. `_contract` 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\\n bool success;\\n bytes memory returndata;\\n if (_isCreateType(_messageType)) {\\n // safeCREATE() is a function which replicates a CREATE message, but uses return values\\n // Which match that of CALL (i.e. bool, bytes). This allows many security checks to be\\n // to be shared between untrusted call and create call frames.\\n (success, returndata) = address(this).call{gas: _gasLimit}(\\n abi.encodeWithSelector(\\n this.safeCREATE.selector,\\n _data,\\n _contract\\n )\\n );\\n } else {\\n (success, returndata) = _contract.call{gas: _gasLimit}(_data);\\n }\\n\\n // If the message threw an exception, its value should be returned back to the sender.\\n // So, we force it back, BEFORE returning the messageContext to the previous addresses.\\n // This operation is part of the reason we \\\"reserved the intrinsic gas\\\" above.\\n if (\\n messageValue > 0\\n && _isValueType(_messageType)\\n && !success\\n ) {\\n bool transferredOvmEth = _attemptForcedEthTransfer(\\n prevMessageContext.ovmADDRESS,\\n messageValue\\n );\\n\\n // Since we transferred it in above and the call reverted, the transfer back should always pass.\\n // This code path should NEVER be triggered since we sent `messageValue` worth of OVM_ETH into the target\\n // and reserved sufficient gas to execute the transfer, but in case there is some edge case which has\\n // been missed, we revert the entire frame (and its parent) to make sure the ETH gets sent back.\\n if (!transferredOvmEth) {\\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\\n }\\n }\\n\\n // Switch back to the original message context now that we're out of the call and all OVM_ETH is in the right place.\\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. Additionally, we surface custom error messages\\n // to developers in the case of unsafe creations for improved devex.\\n // All other revert types return no data.\\n if (\\n flag == RevertFlag.INTENTIONAL_REVERT\\n || flag == RevertFlag.UNSAFE_BYTECODE\\n ) {\\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 * Handles the creation-specific safety measures required for OVM contract deployment.\\n * This function sanitizes the return types for creation messages to match calls (bool, bytes),\\n * by being an external function which the EM can call, that mimics the success/fail case of the CREATE.\\n * This allows for consistent handling of both types of messages in _handleExternalMessage().\\n * Having this step occur as a separate call frame also allows us to easily revert the\\n * contract deployment in the event that the code is unsafe.\\n *\\n * @param _creationCode Code to pass into CREATE for deployment.\\n * @param _address OVM address being deployed to.\\n */\\n function safeCREATE(\\n bytes memory _creationCode,\\n address _address\\n )\\n external\\n {\\n // The only way this should callable is from within _createContract(),\\n // and it should DEFINITELY not be callable by a non-EM code contract.\\n if (msg.sender != address(this)) {\\n return;\\n }\\n // Check that there is not already code at this address.\\n if (_hasEmptyAccount(_address) == false) {\\n // Note: in the EVM, this case burns all allotted gas. For improved\\n // developer experience, we do return the remaining gas.\\n _revertWithFlag(\\n RevertFlag.CREATE_COLLISION\\n );\\n }\\n\\n // Check the creation bytecode against the OVM_SafetyChecker.\\n if (ovmSafetyChecker.isBytecodeSafe(_creationCode) == false) {\\n // Note: in the EVM, this case burns all allotted gas. For improved\\n // developer experience, we do return the remaining gas.\\n _revertWithFlag(\\n RevertFlag.UNSAFE_BYTECODE,\\n Lib_ErrorUtils.encodeRevertString(\\\"Contract creation code contains unsafe opcodes. Did you use the right compiler or pass an unsafe constructor argument?\\\")\\n );\\n }\\n\\n // We always need to initialize the contract with the default account values.\\n _initPendingAccount(_address);\\n\\n // Actually execute the EVM create message.\\n // NOTE: The inline assembly below means we can NOT make any evm calls between here and then.\\n address ethAddress = Lib_EthUtils.createContract(_creationCode);\\n\\n if (ethAddress == address(0)) {\\n // If the creation fails, the EVM lets us grab its revert data. This may contain a revert flag\\n // to be used above in _handleExternalMessage, so we pass the revert data back up unmodified.\\n assembly {\\n returndatacopy(0,0,returndatasize())\\n revert(0, returndatasize())\\n }\\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(\\n RevertFlag.UNSAFE_BYTECODE,\\n Lib_ErrorUtils.encodeRevertString(\\\"Constructor attempted to deploy unsafe bytecode.\\\")\\n );\\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 * Internal Functions: Value Manipulation *\\n ******************************************/\\n\\n /**\\n * Invokes an ovmCALL to OVM_ETH.transfer on behalf of the current ovmADDRESS, allowing us to force movement of OVM_ETH in correspondence with ETH's native value functionality.\\n * WARNING: this will send on behalf of whatever the messageContext.ovmADDRESS is in storage at the time of the call.\\n * NOTE: In the future, this could be optimized to directly invoke EM._setContractStorage(...).\\n * @param _to Amount of OVM_ETH to be sent.\\n * @param _value Amount of OVM_ETH to send.\\n * @return _success Whether or not the transfer worked.\\n */\\n function _attemptForcedEthTransfer(\\n address _to,\\n uint256 _value\\n )\\n internal\\n returns(\\n bool _success\\n )\\n {\\n bytes memory transferCalldata = abi.encodeWithSignature(\\n \\\"transfer(address,uint256)\\\",\\n _to,\\n _value\\n );\\n\\n // OVM_ETH inherits from the UniswapV2ERC20 standard. In this implementation, its return type\\n // is a boolean. However, the implementation always returns true if it does not revert.\\n // Thus, success of the call frame is sufficient to infer success of the transfer itself.\\n (bool success, ) = ovmCALL(\\n gasleft(),\\n Lib_PredeployAddresses.OVM_ETH,\\n 0,\\n transferCalldata\\n );\\n\\n return success;\\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 ) {\\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 view\\n {\\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 input values of a transaction.\\n * @return _valid Whether or not the transaction data is valid.\\n */\\n function _isValidInput(\\n Lib_OVMCodec.Transaction memory _transaction\\n )\\n view\\n internal\\n returns (\\n bool\\n )\\n {\\n // Prevent reentrancy to run():\\n // This check prevents calling run with the default ovmNumber.\\n // Combined with the first check in run():\\n // if (transactionContext.ovmNUMBER != DEFAULT_UINT256) { return; }\\n // It should be impossible to re-enter since run() returns before any other call frames are created.\\n // Since this value is already being written to storage, we save much gas compared to\\n // using the standard nonReentrant pattern.\\n if (_transaction.blockNumber == DEFAULT_UINT256) {\\n return false;\\n }\\n\\n if (_isValidGasLimit(_transaction.gasLimit, _transaction.l1QueueOrigin) == false) {\\n return false;\\n }\\n\\n return true;\\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 view\\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 // These conditionals allow us to avoid unneccessary SSTOREs. However, they do mean that the current storage\\n // value for the messageContext MUST equal the _prevMessageContext argument, or an SSTORE might be erroneously skipped.\\n if (_prevMessageContext.ovmCALLER != _nextMessageContext.ovmCALLER) {\\n messageContext.ovmCALLER = _nextMessageContext.ovmCALLER;\\n }\\n\\n if (_prevMessageContext.ovmADDRESS != _nextMessageContext.ovmADDRESS) {\\n messageContext.ovmADDRESS = _nextMessageContext.ovmADDRESS;\\n }\\n\\n if (_prevMessageContext.isStatic != _nextMessageContext.isStatic) {\\n messageContext.isStatic = _nextMessageContext.isStatic;\\n }\\n\\n if (_prevMessageContext.ovmCALLVALUE != _nextMessageContext.ovmCALLVALUE) {\\n messageContext.ovmCALLVALUE = _nextMessageContext.ovmCALLVALUE;\\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 = DEFAULT_ADDRESS;\\n transactionContext.ovmTIMESTAMP = DEFAULT_UINT256;\\n transactionContext.ovmNUMBER = DEFAULT_UINT256;\\n transactionContext.ovmGASLIMIT = DEFAULT_UINT256;\\n transactionContext.ovmTXGASLIMIT = DEFAULT_UINT256;\\n transactionContext.ovmL1QUEUEORIGIN = Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE;\\n\\n transactionRecord.ovmGasRefund = DEFAULT_UINT256;\\n\\n messageContext.ovmCALLER = DEFAULT_ADDRESS;\\n messageContext.ovmADDRESS = DEFAULT_ADDRESS;\\n messageContext.isStatic = false;\\n\\n messageRecord.nuisanceGasLeft = DEFAULT_UINT256;\\n\\n // Reset the ovmStateManager.\\n ovmStateManager = iOVM_StateManager(address(0));\\n }\\n\\n\\n /******************************************\\n * Internal Functions: Message Typechecks *\\n ******************************************/\\n\\n /**\\n * Returns whether or not the given message type is a CREATE-type.\\n * @param _messageType the message type in question.\\n */\\n function _isCreateType(\\n MessageType _messageType\\n )\\n internal\\n pure\\n returns(\\n bool\\n )\\n {\\n return (\\n _messageType == MessageType.ovmCREATE\\n || _messageType == MessageType.ovmCREATE2\\n );\\n }\\n\\n /**\\n * Returns whether or not the given message type (potentially) requires the transfer of ETH value along with the message.\\n * @param _messageType the message type in question.\\n */\\n function _isValueType(\\n MessageType _messageType\\n )\\n internal\\n pure\\n returns(\\n bool\\n )\\n {\\n // ovmSTATICCALL and ovmDELEGATECALL types do not accept or transfer value.\\n return (\\n _messageType == MessageType.ovmCALL\\n || _messageType == MessageType.ovmCREATE\\n || _messageType == MessageType.ovmCREATE2\\n );\\n }\\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 * @param _value the amount of ETH value to send.\\n * @param _ovmStateManager the address of the OVM_StateManager precompile in the L2 state.\\n */\\n function simulateMessage(\\n Lib_OVMCodec.Transaction memory _transaction,\\n address _from,\\n uint256 _value,\\n iOVM_StateManager _ovmStateManager\\n )\\n external\\n returns (\\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 // Initialize the EM's internal state, ignoring nuisance gas.\\n ovmStateManager = _ovmStateManager;\\n _initContext(_transaction);\\n messageRecord.nuisanceGasLeft = uint(-1);\\n\\n // Set the ovmADDRESS to the _from so that the subsequent call frame \\\"comes from\\\" them.\\n messageContext.ovmADDRESS = _from;\\n\\n // Execute the desired message.\\n bool isCreate = _transaction.entrypoint == address(0);\\n if (isCreate) {\\n (address created, bytes memory revertData) = ovmCREATE(_transaction.data);\\n if (created == address(0)) {\\n return abi.encode(false, revertData);\\n } else {\\n // The eth_call RPC endpoint for to = undefined will return the deployed bytecode\\n // in the success case, differing from standard create messages.\\n return abi.encode(true, Lib_EthUtils.getCode(created));\\n }\\n } else {\\n (bool success, bytes memory returndata) = ovmCALL(\\n _transaction.gasLimit,\\n _transaction.entrypoint,\\n _value,\\n _transaction.data\\n );\\n return abi.encode(success, returndata);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x166912c588f2871fd2825ea9288cb3d50a888d4fcafd9fe3cc4461df839acf70\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/predeploys/OVM_DeployerWhitelist.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Interface Imports */\\nimport { iOVM_DeployerWhitelist } from \\\"../../iOVM/predeploys/iOVM_DeployerWhitelist.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: optimistic-solc\\n * Runtime target: OVM\\n */\\ncontract OVM_DeployerWhitelist is iOVM_DeployerWhitelist {\\n\\n /**********************\\n * Contract Constants *\\n **********************/\\n\\n bool public initialized;\\n bool public allowArbitraryDeployment;\\n address override public owner;\\n mapping (address => bool) public whitelist;\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Blocks functions to anyone except the contract owner.\\n */\\n modifier onlyOwner() {\\n require(\\n msg.sender == 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 external\\n {\\n if (initialized == true) {\\n return;\\n }\\n\\n initialized = true;\\n allowArbitraryDeployment = _allowArbitraryDeployment;\\n owner = _owner;\\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 external\\n onlyOwner\\n {\\n whitelist[_deployer] = _isWhitelisted;\\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 owner = _owner;\\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 allowArbitraryDeployment = _allowArbitraryDeployment;\\n }\\n\\n /**\\n * Permanently enables arbitrary contract deployment and deletes the owner.\\n */\\n function enableArbitraryContractDeployment()\\n override\\n external\\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 external\\n returns (\\n bool\\n )\\n {\\n return (\\n initialized == false\\n || allowArbitraryDeployment == true\\n || whitelist[_deployer]\\n );\\n }\\n}\\n\",\"keccak256\":\"0xb96bfb8eb24503b05de41483cc9fb7a7f81107aa1ca146dc281952f8100848a0\",\"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 * 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\",\"keccak256\":\"0x180b9c347e20f1a6efa553b0f2b9a59aebceda92a7484ae6fca4da2bf1d960c3\",\"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 OUT_OF_GAS,\\n INTENTIONAL_REVERT,\\n EXCEEDS_NUISANCE_GAS,\\n INVALID_STATE_ACCESS,\\n UNSAFE_BYTECODE,\\n CREATE_COLLISION,\\n STATIC_VIOLATION,\\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 enum MessageType {\\n ovmCALL,\\n ovmSTATICCALL,\\n ovmDELEGATECALL,\\n ovmCREATE,\\n ovmCREATE2\\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 uint256 ovmCALLVALUE;\\n bool isStatic;\\n }\\n\\n struct MessageRecord {\\n uint256 nuisanceGasLeft;\\n }\\n\\n\\n /************************************\\n * Transaction Execution Entrypoint *\\n ************************************/\\n\\n function run(\\n Lib_OVMCodec.Transaction calldata _transaction,\\n address _txStateManager\\n ) external returns (bytes memory);\\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 ovmCALLVALUE() external view returns (uint _callValue);\\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, bytes memory _revertdata);\\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract, bytes memory _revertdata);\\n\\n\\n /*******************************\\n * Account Abstraction Opcodes *\\n ******************************/\\n\\n function ovmGETNONCE() external returns (uint256 _nonce);\\n function ovmINCREMENTNONCE() external;\\n function ovmCREATEEOA(bytes32 _messageHash, uint8 _v, bytes32 _r, bytes32 _s) external;\\n\\n\\n /****************************\\n * Contract Calling Opcodes *\\n ****************************/\\n\\n // Valueless ovmCALL for maintaining backwards compatibility with legacy OVM bytecode.\\n function ovmCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\\n function ovmCALL(uint256 _gasLimit, address _address, uint256 _value, 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 * ETH Value Opcodes *\\n *********************/\\n\\n function ovmBALANCE(address _contract) external returns (uint256 _balance);\\n function ovmSELFBALANCE() external returns (uint256 _balance);\\n\\n\\n /***************************************\\n * Public Functions: Execution Context *\\n ***************************************/\\n\\n function getMaxTransactionGasLimit() external view returns (uint _maxTransactionGasLimit);\\n}\\n\",\"keccak256\":\"0x87a056425696719488dbd06adbbf89280d86651e75e1f77d9e96b0632c8634cc\",\"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/predeploys/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 owner() 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\":\"0xdf1f27faf0d26d416bf6d408d146a16de32b4e1772a292c65d39eb7ec2b53ceb\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_PredeployAddresses\\n */\\nlibrary Lib_PredeployAddresses {\\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\\n address internal constant ECDSA_CONTRACT_ACCOUNT = 0x4200000000000000000000000000000000000003;\\n address internal constant SEQUENCER_ENTRYPOINT = 0x4200000000000000000000000000000000000005;\\n address payable internal constant OVM_ETH = 0x4200000000000000000000000000000000000006;\\n address internal constant L2_CROSS_DOMAIN_MESSENGER = 0x4200000000000000000000000000000000000007;\\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\\n address internal constant EXECUTION_MANAGER_WRAPPER = 0x420000000000000000000000000000000000000B;\\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\\n address internal constant ERC1820_REGISTRY = 0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24;\\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\\n}\\n\",\"keccak256\":\"0x798dd3fe47c172880978c8e4d35573b25d5135be29a77584e9fac45845748695\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_ErrorUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/**\\n * @title Lib_ErrorUtils\\n */\\nlibrary Lib_ErrorUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes an error string into raw solidity-style revert data.\\n * (i.e. ascii bytes, prefixed with bytes4(keccak(\\\"Error(string))\\\"))\\n * Ref: https://docs.soliditylang.org/en/v0.8.2/control-structures.html?highlight=Error(string)#panic-via-assert-and-error-via-require\\n * @param _reason Reason for the reversion.\\n * @return Standard solidity revert data for the given reason.\\n */\\n function encodeRevertString(\\n string memory _reason\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return abi.encodeWithSignature(\\n \\\"Error(string)\\\",\\n _reason\\n );\\n }\\n}\\n\",\"keccak256\":\"0xfc64ec4a81fb50865b502a0004ed154e8598e1a313db77303fc95e41f536e6b7\",\"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 *\\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 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\\n )\\n {\\n bytes memory code;\\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 Full code of the contract.\\n */\\n function getCode(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes memory\\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 Size of the contract's code in bytes.\\n */\\n function getCodeSize(\\n address _address\\n )\\n internal\\n view\\n returns (\\n uint256\\n )\\n {\\n uint256 codeSize;\\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 Hash of the contract's code.\\n */\\n function getCodeHash(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n bytes32 codeHash;\\n assembly {\\n codeHash := extcodehash(_address)\\n }\\n\\n return codeHash;\\n }\\n\\n /**\\n * Creates a contract with some given initialization code.\\n * @param _code Contract initialization code.\\n * @return Address of the created contract.\\n */\\n function createContract(\\n bytes memory _code\\n )\\n internal\\n returns (\\n address\\n )\\n {\\n address created;\\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 to be generated by CREATE.\\n */\\n function getAddressForCREATE(\\n address _creator,\\n uint256 _nonce\\n )\\n internal\\n pure\\n returns (\\n 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 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 (\\n address\\n )\\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\":\"0xf29a67d78e61cb472d524b779b32cfcb39a587f4096500d5419e6425ed367d49\",\"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 * Note that the _elements argument is modified, therefore it must not be used again afterwards\\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 pure\\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 == 1) {\\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 (uint256 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\":\"0xa78edb9fbd34712771a1ebff05bc5e1abec7fc1e9a1bfb709d183099b44fa62a\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b506040516200315338038062003153833981016040819052620000349162000067565b600080546001600160a01b0319166001600160a01b039590951694909417909355600191909155600255600355620000b2565b600080600080608085870312156200007d578384fd5b84516001600160a01b038116811462000094578485fd5b60208601516040870151606090970151919890975090945092505050565b61309180620000c26000396000f3fe608060405234801561001057600080fd5b50600436106101425760003560e01c8063876ed5cb116100b8578063cfdf677e1161007c578063cfdf677e1461023f578063d0f8934414610247578063e10d29ee1461024f578063e561dddc14610257578063f722b41a1461025f578063facdc5da1461026757610142565b8063876ed5cb146102175780638d38c6c11461021f578063b8f7700514610227578063c139eb151461022f578063c2cf696f1461023757610142565b80634de569ce1161010a5780634de569ce146101c25780635ae6256d146101e25780636fee07e0146101ea57806378f4b2f2146101ff5780637a167a8a146102075780637aa63a861461020f57610142565b8063138387a414610147578063299ca478146101655780632a7f18be1461017a578063378997701461019a578063461a4478146101af575b600080fd5b61014f61027a565b60405161015c91906124c7565b60405180910390f35b61016d610280565b60405161015c91906123eb565b61018d610188366004612388565b61028f565b60405161015c9190612e4e565b6101a26102b0565b60405161015c9190612e8d565b61016d6101bd36600461221b565b6102c4565b6101d56101d0366004612261565b6103a0565b60405161015c9190612484565b6101a26103da565b6101fd6101f8366004612188565b6103ee565b005b61014f61066d565b6101a2610674565b61014f610689565b61014f6106a4565b61014f6106aa565b6101a26106b0565b61014f6106c7565b61014f6106cd565b61016d6106d2565b6101fd6106f5565b61016d610b69565b61014f610b8c565b6101a2610c06565b6101fd610275366004612388565b610c1e565b60025481565b6000546001600160a01b031681565b610297611ed9565b6102a8826102a3610b69565b610c36565b90505b919050565b6000806102bb610d76565b50935050505090565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561032457818101518382015260200161030c565b50505050905090810190601f1680156103515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561036e57600080fd5b505afa158015610382573d6000803e3d6000fd5b505050506040513d602081101561039857600080fd5b505192915050565b82516000901515600114156103c2576103bb85858585610e24565b90506103d2565b6103bb8585602001518585610fef565b949350505050565b6000806103e5610d76565b94505050505090565b61c3508151111561041a5760405162461bcd60e51b81526004016104119061259b565b60405180910390fd5b60035482111561043c5760405162461bcd60e51b8152600401610411906127a1565b620186a082101561045f5760405162461bcd60e51b815260040161041190612983565b6020820460005a90508181116104875760405162461bcd60e51b815260040161041190612b8a565b60005b825a8303101561049c5760010161048a565b6000338787876040516020016104b594939291906123ff565b60408051601f19818403018152919052805160209091012090504360281b421760006104df610b69565b60405163b298e36b60e01b81529091506001600160a01b0382169063b298e36b9061050e9086906004016124c7565b600060405180830381600087803b15801561052857600080fd5b505af115801561053c573d6000803e3d6000fd5b505060405163b298e36b60e01b81526001600160a01b038416925063b298e36b915061056c9085906004016124c7565b600060405180830381600087803b15801561058657600080fd5b505af115801561059a573d6000803e3d6000fd5b50505050600060016002836001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156105dd57600080fd5b505afa1580156105f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106159190612203565b8161061c57fe5b040390507f4b388aecf9fa6cc92253704e5975a6129a4f735bdbd99567df4ed0094ee4ceb5338b8b8b85426040516106599695949392919061243c565b60405180910390a150505050505050505050565b620186a081565b60008061067f610d76565b5090935050505090565b600080610694610d76565b50505064ffffffffff1692915050565b61c35081565b60035481565b60006106c26106bd610b69565b6110c4565b905090565b60015481565b602081565b60006106c2604051806060016040528060258152602001612f08602591396102c4565b60043560d81c60093560e890811c90600c35901c610711610689565b8364ffffffffff16146107365760405162461bcd60e51b815260040161041190612a35565b6107646040518060400160405280600d81526020016c27ab26afa9b2b8bab2b731b2b960991b8152506102c4565b6001600160a01b0316336001600160a01b0316146107945760405162461bcd60e51b815260040161041190612a92565b60008162ffffff16116107b95760405162461bcd60e51b8152600401610411906127fe565b60008262ffffff16116107de5760405162461bcd60e51b815260040161041190612cdf565b600f601062ffffff8316020164ffffffffff81163610156108115760405162461bcd60e51b815260040161041190612d66565b600061081b610b69565b90506000610828826110c4565b9050600062ffffff8616368161083a57fe5b0460020267ffffffffffffffff8111801561085457600080fd5b506040519080825280601f01601f19166020018201604052801561087f576020820181803683370190505b50905060008662ffffff1667ffffffffffffffff811180156108a057600080fd5b506040519080825280602002602001820160405280156108ca578160200160208202803683370190505b50905060008060006108da610674565b90506108e4611ef9565b60005b8a62ffffff168163ffffffff161015610a3b57600061090b8263ffffffff16611147565b905063ffffffff82166109215761092181611197565b61092d8382868d611264565b80925060005b835163ffffffff821610156109b1578b3560e81c61c3508111156109695760405162461bcd60e51b81526004016104119061259b565b61097c858e64ffffffffff16838d6112cf565b898963ffffffff168151811061098e57fe5b60209081029190910101529b909b016003019a6001968701969586019501610933565b5060005b83602001518163ffffffff161015610a31578964ffffffffff168564ffffffffff16106109f45760405162461bcd60e51b815260040161041190612da8565b610a048564ffffffffff16611363565b888863ffffffff1681518110610a1657fe5b602090810291909101015260019687019694850194016109b5565b50506001016108e7565b50610a488183898b6113a8565b3664ffffffffff8a1614610a6e5760405162461bcd60e51b815260040161041190612846565b8a62ffffff168463ffffffff1614610a985760405162461bcd60e51b815260040161041190612894565b6000838c62ffffff160363ffffffff169050600080836020015160001415610acb57505060408201516060830151610af3565b6000610ae16001870364ffffffffff168d610c36565b90508060200151925080604001519150505b610b14610aff8961141b565b8f62ffffff168564ffffffffff16858561184f565b7f602f1aeac0ca2e7a13e281a9ef0ad7838542712ce16780fa2ecffd351f05f89983860384610b41610689565b604051610b5093929190612e9f565b60405180910390a1505050505050505050505050505050565b60006106c2604051806060016040528060238152602001613005602391396102c4565b6000610b966106d2565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610bce57600080fd5b505afa158015610be2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c29190612203565b6000610c10610674565b610c186106b0565b03905090565b60405162461bcd60e51b81526004016104119061250b565b610c3e611ed9565b604051634a83e9cd60e11b815260028402906000906001600160a01b03851690639507d39a90610c72908590600401612e8d565b60206040518083038186803b158015610c8a57600080fd5b505afa158015610c9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc29190612203565b90506000846001600160a01b0316639507d39a846001016040518263ffffffff1660e01b8152600401610cf59190612e8d565b60206040518083038186803b158015610d0d57600080fd5b505afa158015610d21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d459190612203565b6040805160608101825293845264ffffffffff828116602086015260289290921c9091169083015250949350505050565b6000806000806000610d866106d2565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b158015610dbe57600080fd5b505afa158015610dd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df691906121dd565b64ffffffffff602882901c811697605083901c82169750607883901c8216965060a09290921c169350915050565b600080610e5c6040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b8152506102c4565b90506000816001600160a01b0316631c4712a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610e9957600080fd5b505afa158015610ead573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed19190612203565b90506000610ede87611a02565b9050610eeb818787611a9b565b610f075760405162461bcd60e51b8152600401610411906126ca565b86606001518860200151148015610f22575060408701518851145b8015610f635750610f4a604051806060016040528060228152602001612ee6602291396102c4565b6001600160a01b031688608001516001600160a01b0316145b8015610f725750818860a00151145b8015610f89575060608801516001600160a01b0316155b8015610fa45750600088604001516001811115610fa257fe5b145b8015610fc557508660800151805190602001208860c0015180519060200120145b610fe15760405162461bcd60e51b81526004016104119061276a565b506001979650505050505050565b600080610ffb85611363565b9050611008818585611a9b565b6110245760405162461bcd60e51b815260040161041190612c2a565b6000866060015187608001518860a001518960c0015160405160200161104d94939291906123ff565b60405160208183030381529060405280519060200120905060006110708761028f565b80519091508214801561108e57508751602082015164ffffffffff16145b80156110a857508760200151816040015164ffffffffff16145b610fe15760405162461bcd60e51b815260040161041190612adf565b60006002826001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b15801561110157600080fd5b505afa158015611115573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111399190612203565b8161114057fe5b0492915050565b61114f611ef9565b5060408051608081018252601092909202600f81013560e890811c84526012820135901c6020840152601581013560d890811c92840192909252601a0135901c606082015290565b60006111a1610689565b1115611211576000806111b2610d76565b9350935050508064ffffffffff16836060015110156111e35760405162461bcd60e51b815260040161041190612718565b8164ffffffffff168360400151101561120e5760405162461bcd60e51b8152600401610411906125f8565b50505b4260015482604001510110156112395760405162461bcd60e51b815260040161041190612d20565b4360025482606001510110156112615760405162461bcd60e51b815260040161041190612552565b50565b83604001518360400151101561128c5760405162461bcd60e51b815260040161041190612bd5565b8360600151836060015110156112b45760405162461bcd60e51b815260040161041190612df1565b6020830151156112c9576112c9838383611b8c565b50505050565b60008151836041011115611326578260410167ffffffffffffffff811180156112f757600080fd5b506040519080825280601f01601f191660200182016040528015611322576020820181803683370190505b5091505b6040850151606086015160006020850160018153836001820152826021820152866003890160418301376041870190209350505050949350505050565b60006102a86040518060a00160405280600015158152602001848152602001600081526020016000815260200160405180602001604052806000815250815250611c2d565b600083830364ffffffffff161180156113c357506020840151155b156113d3576113d3848483611b8c565b42846040015111156113f75760405162461bcd60e51b815260040161041190612b45565b43846060015111156112c95760405162461bcd60e51b815260040161041190612904565b60008082511161145c5760405162461bcd60e51b81526004018080602001828103825260348152602001806130286034913960400191505060405180910390fd5b815160011415611482578160008151811061147357fe5b602002602001015190506102ab565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b600184111561182b5750506002820460018084161460005b828110156117a7578a816002028151811061174e57fe5b602002602001015196508a816002026001018151811061176a57fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061179457fe5b6020908102919091010152600101611737565b50801561180a578960018503815181106117bd57fe5b602002602001015195508783601081106117d357fe5b602002015160001b945085602088015284604088015286805190602001208a83815181106117fd57fe5b6020026020010181815250505b80611816576000611819565b60015b60ff168201935060019092019161171f565b8960008151811061183857fe5b602002602001015198505050505050505050919050565b60006118596106d2565b9050600080611866610d76565b50509150915060006040518060a00160405280856001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156118b257600080fd5b505afa1580156118c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ea9190612203565b81526020018a81526020018981526020018464ffffffffff16815260200160405180602001604052806000815250815250905080600001517f127186556e7be68c7e31263195225b4de02820707889540969f62c05cf73525e826020015183604001518460600151856080015160405161196794939291906124e6565b60405180910390a2600061197a82611c75565b90506000611992836040015186018a86018a8a611c9e565b60405163080549db60e21b81529091506001600160a01b03871690632015276c906119c390859085906004016124d0565b600060405180830381600087803b1580156119dd57600080fd5b505af11580156119f1573d6000803e3d6000fd5b505050505050505050505050505050565b6080810151805160009190826041820167ffffffffffffffff81118015611a2857600080fd5b506040519080825280601f01601f191660200182016040528015611a53576020820181803683370190505b5060408601516060870151919250906000602084016001815383600182015282602182015285604182018760208a0160045afa50604190950190942095505050505050919050565b6000611aa56106d2565b8351604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a91611ad391600401612e7c565b60206040518083038186803b158015611aeb57600080fd5b505afa158015611aff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b239190612203565b611b2c84611c75565b14611b495760405162461bcd60e51b815260040161041190612b16565b611b66836020015185846000015185602001518760400151611cbd565b611b825760405162461bcd60e51b81526004016104119061294c565b5060019392505050565b6000611b9f8364ffffffffff1683610c36565b9050600154816020015164ffffffffff16014210611bcf5760405162461bcd60e51b815260040161041190612647565b806020015164ffffffffff1684604001511115611bfe5760405162461bcd60e51b8152600401610411906129cc565b806040015164ffffffffff16846060015111156112c95760405162461bcd60e51b815260040161041190612c74565b8051602080830151604080850151606086015160808701519251600096611c5896909594910161248f565b604051602081830303815290604052805190602001209050919050565b60008160200151826040015183606001518460800151604051602001611c5894939291906124e6565b602892831b9390931760509190911b1760789290921b91909117901b90565b6000808211611cfd5760405162461bcd60e51b8152600401808060200182810382526037815260200180612f816037913960400191505060405180910390fd5b818410611d3b5760405162461bcd60e51b8152600401808060200182810382526024815260200180612f2d6024913960400191505060405180910390fd5b611d4482611e42565b835114611d825760405162461bcd60e51b815260040180806020018281038252604d815260200180612fb8604d913960600191505060405180910390fd5b8460005b8451811015611e35578560011660011415611de457848181518110611da757fe5b6020026020010151826040516020018083815260200182815260200192505050604051602081830303815290604052805190602001209150611e29565b81858281518110611df157fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c9501611d86565b5090951495945050505050565b6000808211611e825760405162461bcd60e51b8152600401808060200182810382526030815260200180612f516030913960400191505060405180910390fd5b8160011415611e93575060006102ab565b81600060805b60018110611ec3576000196001821b01811b831615611ebb5791821c91908101905b60011c611e99565b506001811b8414611ed2576001015b9392505050565b604080516060810182526000808252602082018190529181019190915290565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b600067ffffffffffffffff831115611f3557fe5b611f48601f8401601f1916602001612ec1565b9050828152838383011115611f5c57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102ab57600080fd5b600082601f830112611f9a578081fd5b611ed283833560208501611f21565b8035600281106102ab57600080fd5b600060a08284031215611fc9578081fd5b60405160a0810167ffffffffffffffff8282108183111715611fe757fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561202457600080fd5b5061203185828601611f8a565b6080830152505092915050565b60006040828403121561204f578081fd5b6040516040810167ffffffffffffffff828210818311171561206d57fe5b816040528293508435835260209150818501358181111561208d57600080fd5b8501601f8101871361209e57600080fd5b8035828111156120aa57fe5b83810292506120ba848401612ec1565b8181528481019083860185850187018b10156120d557600080fd5b600095505b838610156120f85780358352600195909501949186019186016120da565b5080868801525050505050505092915050565b600060a0828403121561211c578081fd5b60405160a0810167ffffffffffffffff828210818311171561213a57fe5b8160405282935084359150811515821461215357600080fd5b818352602085013560208401526040850135604084015260608501356060840152608085013591508082111561202457600080fd5b60008060006060848603121561219c578283fd5b6121a584611f73565b925060208401359150604084013567ffffffffffffffff8111156121c7578182fd5b6121d386828701611f8a565b9150509250925092565b6000602082840312156121ee578081fd5b815164ffffffffff1981168114611ed2578182fd5b600060208284031215612214578081fd5b5051919050565b60006020828403121561222c578081fd5b813567ffffffffffffffff811115612242578182fd5b8201601f81018413612252578182fd5b6103d284823560208401611f21565b60008060008060808587031215612276578081fd5b843567ffffffffffffffff8082111561228d578283fd5b9086019060e082890312156122a0578283fd5b6122aa60e0612ec1565b82358152602083013560208201526122c460408401611fa9565b60408201526122d560608401611f73565b60608201526122e660808401611f73565b608082015260a083013560a082015260c083013582811115612306578485fd5b6123128a828601611f8a565b60c0830152509550602087013591508082111561232d578283fd5b6123398883890161210b565b9450604087013591508082111561234e578283fd5b61235a88838901611fb8565b9350606087013591508082111561236f578283fd5b5061237c8782880161203e565b91505092959194509250565b600060208284031215612399578081fd5b5035919050565b60008151808452815b818110156123c5576020818501810151868301820152016123a9565b818111156123d65782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612432908301846123a0565b9695505050505050565b6001600160a01b038781168252861660208201526040810185905260c06060820181905260009061246f908301866123a0565b60808301949094525060a00152949350505050565b901515815260200190565b6000861515825285602083015284604083015283606083015260a060808301526124bc60a08301846123a0565b979650505050505050565b90815260200190565b91825264ffffffffff1916602082015260400190565b60008582528460208301528360408301526080606083015261243260808301846123a0565b60208082526027908201527f617070656e64517565756542617463682069732063757272656e746c7920646960408201526639b0b13632b21760c91b606082015260800190565b60208082526029908201527f436f6e7465787420626c6f636b206e756d62657220746f6f2066617220696e206040820152683a3432903830b9ba1760b91b606082015260800190565b6020808252603d908201527f5472616e73616374696f6e20646174612073697a652065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b6020808252602f908201527f436f6e746578742074696d657374616d70206973206c6f776572207468616e2060408201526e3630b9ba1039bab136b4ba3a32b21760891b606082015260800190565b6020808252605b908201527f50726576696f75736c7920656e7175657565642062617463686573206861766560408201527f206578706972656420616e64206d75737420626520617070656e64656420626560608201527f666f72652061206e65772073657175656e6365722062617463682e0000000000608082015260a00190565b6020808252602e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e20696e60408201526d31b63ab9b4b7b710383937b7b31760911b606082015260800190565b60208082526032908201527f436f6e7465787420626c6f636b206e756d626572206973206c6f77657220746860408201527130b7103630b9ba1039bab136b4ba3a32b21760711b606082015260800190565b6020808252601e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e2e0000604082015260600190565b6020808252603d908201527f5472616e73616374696f6e20676173206c696d69742065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b60208082526028908201527f4d7573742070726f76696465206174206c65617374206f6e652062617463682060408201526731b7b73a32bc3a1760c11b606082015260800190565b6020808252602e908201527f4e6f7420616c6c2073657175656e636572207472616e73616374696f6e73207760408201526d32b93290383937b1b2b9b9b2b21760911b606082015260800190565b6020808252604a908201527f41637475616c207472616e73616374696f6e20696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420746f74616c20656c656d656e7473206060820152693a379030b83832b7321760b11b608082015260a00190565b60208082526028908201527f436f6e7465787420626c6f636b206e756d6265722069732066726f6d2074686560408201526710333aba3ab9329760c11b606082015260800190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b60208082526029908201527f5472616e73616374696f6e20676173206c696d697420746f6f206c6f7720746f6040820152681032b738bab2bab29760b91b606082015260800190565b60208082526043908201527f53657175656e636572207472616e73616374696f6e2074696d657374616d702060408201527f657863656564732074686174206f66206e65787420717565756520656c656d65606082015262373a1760e91b608082015260a00190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b6020808252602d908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c6564206279207460408201526c34329029b2b8bab2b731b2b91760991b606082015260800190565b6020808252601a908201527f496e76616c6964205175657565207472616e73616374696f6e2e000000000000604082015260600190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b60208082526025908201527f436f6e746578742074696d657374616d702069732066726f6d207468652066756040820152643a3ab9329760d91b606082015260800190565b6020808252602b908201527f496e73756666696369656e742067617320666f72204c322072617465206c696d60408201526a34ba34b73390313ab9371760a91b606082015260800190565b60208082526035908201527f436f6e746578742074696d657374616d702076616c756573206d757374206d6f6040820152743737ba37b734b1b0b6363c9034b731b932b0b9b29760591b606082015260800190565b6020808252602a908201527f496e76616c6964205175657565207472616e73616374696f6e20696e636c757360408201526934b7b710383937b7b31760b11b606082015260800190565b60208082526045908201527f53657175656e636572207472616e73616374696f6e20626c6f636b4e756d626560408201527f7220657863656564732074686174206f66206e65787420717565756520656c6560608201526436b2b73a1760d91b608082015260a00190565b60208082526021908201527f4d75737420617070656e64206174206c65617374206f6e6520656c656d656e746040820152601760f91b606082015260800190565b60208082526026908201527f436f6e746578742074696d657374616d7020746f6f2066617220696e20746865604082015265103830b9ba1760d11b606082015260800190565b60208082526022908201527f4e6f7420656e6f756768204261746368436f6e74657874732070726f76696465604082015261321760f11b606082015260800190565b60208082526029908201527f4e6f7420656e6f75676820717565756564207472616e73616374696f6e732074604082015268379030b83832b7321760b91b606082015260800190565b60208082526037908201527f436f6e7465787420626c6f636b4e756d6265722076616c756573206d7573742060408201527f6d6f6e6f746f6e6963616c6c7920696e6372656173652e000000000000000000606082015260800190565b8151815260208083015164ffffffffff90811691830191909152604092830151169181019190915260600190565b63ffffffff91909116815260200190565b64ffffffffff91909116815260200190565b64ffffffffff9384168152919092166020820152604081019190915260600190565b60405181810167ffffffffffffffff81118282101715612edd57fe5b60405291905056fe4f564d5f4465636f6d7072657373696f6e507265636f6d70696c65416464726573734f564d5f436861696e53746f72616765436f6e7461696e65722d4354432d626174636865734c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4f564d5f436861696e53746f72616765436f6e7461696e65722d4354432d71756575654c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea2646970667358221220ccd26d70e29e57df01efbc12fcd4152555b136a977c6cd56cd6a3e465f2e8fef64736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101425760003560e01c8063876ed5cb116100b8578063cfdf677e1161007c578063cfdf677e1461023f578063d0f8934414610247578063e10d29ee1461024f578063e561dddc14610257578063f722b41a1461025f578063facdc5da1461026757610142565b8063876ed5cb146102175780638d38c6c11461021f578063b8f7700514610227578063c139eb151461022f578063c2cf696f1461023757610142565b80634de569ce1161010a5780634de569ce146101c25780635ae6256d146101e25780636fee07e0146101ea57806378f4b2f2146101ff5780637a167a8a146102075780637aa63a861461020f57610142565b8063138387a414610147578063299ca478146101655780632a7f18be1461017a578063378997701461019a578063461a4478146101af575b600080fd5b61014f61027a565b60405161015c91906124c7565b60405180910390f35b61016d610280565b60405161015c91906123eb565b61018d610188366004612388565b61028f565b60405161015c9190612e4e565b6101a26102b0565b60405161015c9190612e8d565b61016d6101bd36600461221b565b6102c4565b6101d56101d0366004612261565b6103a0565b60405161015c9190612484565b6101a26103da565b6101fd6101f8366004612188565b6103ee565b005b61014f61066d565b6101a2610674565b61014f610689565b61014f6106a4565b61014f6106aa565b6101a26106b0565b61014f6106c7565b61014f6106cd565b61016d6106d2565b6101fd6106f5565b61016d610b69565b61014f610b8c565b6101a2610c06565b6101fd610275366004612388565b610c1e565b60025481565b6000546001600160a01b031681565b610297611ed9565b6102a8826102a3610b69565b610c36565b90505b919050565b6000806102bb610d76565b50935050505090565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561032457818101518382015260200161030c565b50505050905090810190601f1680156103515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561036e57600080fd5b505afa158015610382573d6000803e3d6000fd5b505050506040513d602081101561039857600080fd5b505192915050565b82516000901515600114156103c2576103bb85858585610e24565b90506103d2565b6103bb8585602001518585610fef565b949350505050565b6000806103e5610d76565b94505050505090565b61c3508151111561041a5760405162461bcd60e51b81526004016104119061259b565b60405180910390fd5b60035482111561043c5760405162461bcd60e51b8152600401610411906127a1565b620186a082101561045f5760405162461bcd60e51b815260040161041190612983565b6020820460005a90508181116104875760405162461bcd60e51b815260040161041190612b8a565b60005b825a8303101561049c5760010161048a565b6000338787876040516020016104b594939291906123ff565b60408051601f19818403018152919052805160209091012090504360281b421760006104df610b69565b60405163b298e36b60e01b81529091506001600160a01b0382169063b298e36b9061050e9086906004016124c7565b600060405180830381600087803b15801561052857600080fd5b505af115801561053c573d6000803e3d6000fd5b505060405163b298e36b60e01b81526001600160a01b038416925063b298e36b915061056c9085906004016124c7565b600060405180830381600087803b15801561058657600080fd5b505af115801561059a573d6000803e3d6000fd5b50505050600060016002836001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156105dd57600080fd5b505afa1580156105f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106159190612203565b8161061c57fe5b040390507f4b388aecf9fa6cc92253704e5975a6129a4f735bdbd99567df4ed0094ee4ceb5338b8b8b85426040516106599695949392919061243c565b60405180910390a150505050505050505050565b620186a081565b60008061067f610d76565b5090935050505090565b600080610694610d76565b50505064ffffffffff1692915050565b61c35081565b60035481565b60006106c26106bd610b69565b6110c4565b905090565b60015481565b602081565b60006106c2604051806060016040528060258152602001612f08602591396102c4565b60043560d81c60093560e890811c90600c35901c610711610689565b8364ffffffffff16146107365760405162461bcd60e51b815260040161041190612a35565b6107646040518060400160405280600d81526020016c27ab26afa9b2b8bab2b731b2b960991b8152506102c4565b6001600160a01b0316336001600160a01b0316146107945760405162461bcd60e51b815260040161041190612a92565b60008162ffffff16116107b95760405162461bcd60e51b8152600401610411906127fe565b60008262ffffff16116107de5760405162461bcd60e51b815260040161041190612cdf565b600f601062ffffff8316020164ffffffffff81163610156108115760405162461bcd60e51b815260040161041190612d66565b600061081b610b69565b90506000610828826110c4565b9050600062ffffff8616368161083a57fe5b0460020267ffffffffffffffff8111801561085457600080fd5b506040519080825280601f01601f19166020018201604052801561087f576020820181803683370190505b50905060008662ffffff1667ffffffffffffffff811180156108a057600080fd5b506040519080825280602002602001820160405280156108ca578160200160208202803683370190505b50905060008060006108da610674565b90506108e4611ef9565b60005b8a62ffffff168163ffffffff161015610a3b57600061090b8263ffffffff16611147565b905063ffffffff82166109215761092181611197565b61092d8382868d611264565b80925060005b835163ffffffff821610156109b1578b3560e81c61c3508111156109695760405162461bcd60e51b81526004016104119061259b565b61097c858e64ffffffffff16838d6112cf565b898963ffffffff168151811061098e57fe5b60209081029190910101529b909b016003019a6001968701969586019501610933565b5060005b83602001518163ffffffff161015610a31578964ffffffffff168564ffffffffff16106109f45760405162461bcd60e51b815260040161041190612da8565b610a048564ffffffffff16611363565b888863ffffffff1681518110610a1657fe5b602090810291909101015260019687019694850194016109b5565b50506001016108e7565b50610a488183898b6113a8565b3664ffffffffff8a1614610a6e5760405162461bcd60e51b815260040161041190612846565b8a62ffffff168463ffffffff1614610a985760405162461bcd60e51b815260040161041190612894565b6000838c62ffffff160363ffffffff169050600080836020015160001415610acb57505060408201516060830151610af3565b6000610ae16001870364ffffffffff168d610c36565b90508060200151925080604001519150505b610b14610aff8961141b565b8f62ffffff168564ffffffffff16858561184f565b7f602f1aeac0ca2e7a13e281a9ef0ad7838542712ce16780fa2ecffd351f05f89983860384610b41610689565b604051610b5093929190612e9f565b60405180910390a1505050505050505050505050505050565b60006106c2604051806060016040528060238152602001613005602391396102c4565b6000610b966106d2565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610bce57600080fd5b505afa158015610be2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c29190612203565b6000610c10610674565b610c186106b0565b03905090565b60405162461bcd60e51b81526004016104119061250b565b610c3e611ed9565b604051634a83e9cd60e11b815260028402906000906001600160a01b03851690639507d39a90610c72908590600401612e8d565b60206040518083038186803b158015610c8a57600080fd5b505afa158015610c9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc29190612203565b90506000846001600160a01b0316639507d39a846001016040518263ffffffff1660e01b8152600401610cf59190612e8d565b60206040518083038186803b158015610d0d57600080fd5b505afa158015610d21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d459190612203565b6040805160608101825293845264ffffffffff828116602086015260289290921c9091169083015250949350505050565b6000806000806000610d866106d2565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b158015610dbe57600080fd5b505afa158015610dd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df691906121dd565b64ffffffffff602882901c811697605083901c82169750607883901c8216965060a09290921c169350915050565b600080610e5c6040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b8152506102c4565b90506000816001600160a01b0316631c4712a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610e9957600080fd5b505afa158015610ead573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed19190612203565b90506000610ede87611a02565b9050610eeb818787611a9b565b610f075760405162461bcd60e51b8152600401610411906126ca565b86606001518860200151148015610f22575060408701518851145b8015610f635750610f4a604051806060016040528060228152602001612ee6602291396102c4565b6001600160a01b031688608001516001600160a01b0316145b8015610f725750818860a00151145b8015610f89575060608801516001600160a01b0316155b8015610fa45750600088604001516001811115610fa257fe5b145b8015610fc557508660800151805190602001208860c0015180519060200120145b610fe15760405162461bcd60e51b81526004016104119061276a565b506001979650505050505050565b600080610ffb85611363565b9050611008818585611a9b565b6110245760405162461bcd60e51b815260040161041190612c2a565b6000866060015187608001518860a001518960c0015160405160200161104d94939291906123ff565b60405160208183030381529060405280519060200120905060006110708761028f565b80519091508214801561108e57508751602082015164ffffffffff16145b80156110a857508760200151816040015164ffffffffff16145b610fe15760405162461bcd60e51b815260040161041190612adf565b60006002826001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b15801561110157600080fd5b505afa158015611115573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111399190612203565b8161114057fe5b0492915050565b61114f611ef9565b5060408051608081018252601092909202600f81013560e890811c84526012820135901c6020840152601581013560d890811c92840192909252601a0135901c606082015290565b60006111a1610689565b1115611211576000806111b2610d76565b9350935050508064ffffffffff16836060015110156111e35760405162461bcd60e51b815260040161041190612718565b8164ffffffffff168360400151101561120e5760405162461bcd60e51b8152600401610411906125f8565b50505b4260015482604001510110156112395760405162461bcd60e51b815260040161041190612d20565b4360025482606001510110156112615760405162461bcd60e51b815260040161041190612552565b50565b83604001518360400151101561128c5760405162461bcd60e51b815260040161041190612bd5565b8360600151836060015110156112b45760405162461bcd60e51b815260040161041190612df1565b6020830151156112c9576112c9838383611b8c565b50505050565b60008151836041011115611326578260410167ffffffffffffffff811180156112f757600080fd5b506040519080825280601f01601f191660200182016040528015611322576020820181803683370190505b5091505b6040850151606086015160006020850160018153836001820152826021820152866003890160418301376041870190209350505050949350505050565b60006102a86040518060a00160405280600015158152602001848152602001600081526020016000815260200160405180602001604052806000815250815250611c2d565b600083830364ffffffffff161180156113c357506020840151155b156113d3576113d3848483611b8c565b42846040015111156113f75760405162461bcd60e51b815260040161041190612b45565b43846060015111156112c95760405162461bcd60e51b815260040161041190612904565b60008082511161145c5760405162461bcd60e51b81526004018080602001828103825260348152602001806130286034913960400191505060405180910390fd5b815160011415611482578160008151811061147357fe5b602002602001015190506102ab565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b600184111561182b5750506002820460018084161460005b828110156117a7578a816002028151811061174e57fe5b602002602001015196508a816002026001018151811061176a57fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061179457fe5b6020908102919091010152600101611737565b50801561180a578960018503815181106117bd57fe5b602002602001015195508783601081106117d357fe5b602002015160001b945085602088015284604088015286805190602001208a83815181106117fd57fe5b6020026020010181815250505b80611816576000611819565b60015b60ff168201935060019092019161171f565b8960008151811061183857fe5b602002602001015198505050505050505050919050565b60006118596106d2565b9050600080611866610d76565b50509150915060006040518060a00160405280856001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156118b257600080fd5b505afa1580156118c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ea9190612203565b81526020018a81526020018981526020018464ffffffffff16815260200160405180602001604052806000815250815250905080600001517f127186556e7be68c7e31263195225b4de02820707889540969f62c05cf73525e826020015183604001518460600151856080015160405161196794939291906124e6565b60405180910390a2600061197a82611c75565b90506000611992836040015186018a86018a8a611c9e565b60405163080549db60e21b81529091506001600160a01b03871690632015276c906119c390859085906004016124d0565b600060405180830381600087803b1580156119dd57600080fd5b505af11580156119f1573d6000803e3d6000fd5b505050505050505050505050505050565b6080810151805160009190826041820167ffffffffffffffff81118015611a2857600080fd5b506040519080825280601f01601f191660200182016040528015611a53576020820181803683370190505b5060408601516060870151919250906000602084016001815383600182015282602182015285604182018760208a0160045afa50604190950190942095505050505050919050565b6000611aa56106d2565b8351604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a91611ad391600401612e7c565b60206040518083038186803b158015611aeb57600080fd5b505afa158015611aff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b239190612203565b611b2c84611c75565b14611b495760405162461bcd60e51b815260040161041190612b16565b611b66836020015185846000015185602001518760400151611cbd565b611b825760405162461bcd60e51b81526004016104119061294c565b5060019392505050565b6000611b9f8364ffffffffff1683610c36565b9050600154816020015164ffffffffff16014210611bcf5760405162461bcd60e51b815260040161041190612647565b806020015164ffffffffff1684604001511115611bfe5760405162461bcd60e51b8152600401610411906129cc565b806040015164ffffffffff16846060015111156112c95760405162461bcd60e51b815260040161041190612c74565b8051602080830151604080850151606086015160808701519251600096611c5896909594910161248f565b604051602081830303815290604052805190602001209050919050565b60008160200151826040015183606001518460800151604051602001611c5894939291906124e6565b602892831b9390931760509190911b1760789290921b91909117901b90565b6000808211611cfd5760405162461bcd60e51b8152600401808060200182810382526037815260200180612f816037913960400191505060405180910390fd5b818410611d3b5760405162461bcd60e51b8152600401808060200182810382526024815260200180612f2d6024913960400191505060405180910390fd5b611d4482611e42565b835114611d825760405162461bcd60e51b815260040180806020018281038252604d815260200180612fb8604d913960600191505060405180910390fd5b8460005b8451811015611e35578560011660011415611de457848181518110611da757fe5b6020026020010151826040516020018083815260200182815260200192505050604051602081830303815290604052805190602001209150611e29565b81858281518110611df157fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c9501611d86565b5090951495945050505050565b6000808211611e825760405162461bcd60e51b8152600401808060200182810382526030815260200180612f516030913960400191505060405180910390fd5b8160011415611e93575060006102ab565b81600060805b60018110611ec3576000196001821b01811b831615611ebb5791821c91908101905b60011c611e99565b506001811b8414611ed2576001015b9392505050565b604080516060810182526000808252602082018190529181019190915290565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b600067ffffffffffffffff831115611f3557fe5b611f48601f8401601f1916602001612ec1565b9050828152838383011115611f5c57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102ab57600080fd5b600082601f830112611f9a578081fd5b611ed283833560208501611f21565b8035600281106102ab57600080fd5b600060a08284031215611fc9578081fd5b60405160a0810167ffffffffffffffff8282108183111715611fe757fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561202457600080fd5b5061203185828601611f8a565b6080830152505092915050565b60006040828403121561204f578081fd5b6040516040810167ffffffffffffffff828210818311171561206d57fe5b816040528293508435835260209150818501358181111561208d57600080fd5b8501601f8101871361209e57600080fd5b8035828111156120aa57fe5b83810292506120ba848401612ec1565b8181528481019083860185850187018b10156120d557600080fd5b600095505b838610156120f85780358352600195909501949186019186016120da565b5080868801525050505050505092915050565b600060a0828403121561211c578081fd5b60405160a0810167ffffffffffffffff828210818311171561213a57fe5b8160405282935084359150811515821461215357600080fd5b818352602085013560208401526040850135604084015260608501356060840152608085013591508082111561202457600080fd5b60008060006060848603121561219c578283fd5b6121a584611f73565b925060208401359150604084013567ffffffffffffffff8111156121c7578182fd5b6121d386828701611f8a565b9150509250925092565b6000602082840312156121ee578081fd5b815164ffffffffff1981168114611ed2578182fd5b600060208284031215612214578081fd5b5051919050565b60006020828403121561222c578081fd5b813567ffffffffffffffff811115612242578182fd5b8201601f81018413612252578182fd5b6103d284823560208401611f21565b60008060008060808587031215612276578081fd5b843567ffffffffffffffff8082111561228d578283fd5b9086019060e082890312156122a0578283fd5b6122aa60e0612ec1565b82358152602083013560208201526122c460408401611fa9565b60408201526122d560608401611f73565b60608201526122e660808401611f73565b608082015260a083013560a082015260c083013582811115612306578485fd5b6123128a828601611f8a565b60c0830152509550602087013591508082111561232d578283fd5b6123398883890161210b565b9450604087013591508082111561234e578283fd5b61235a88838901611fb8565b9350606087013591508082111561236f578283fd5b5061237c8782880161203e565b91505092959194509250565b600060208284031215612399578081fd5b5035919050565b60008151808452815b818110156123c5576020818501810151868301820152016123a9565b818111156123d65782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612432908301846123a0565b9695505050505050565b6001600160a01b038781168252861660208201526040810185905260c06060820181905260009061246f908301866123a0565b60808301949094525060a00152949350505050565b901515815260200190565b6000861515825285602083015284604083015283606083015260a060808301526124bc60a08301846123a0565b979650505050505050565b90815260200190565b91825264ffffffffff1916602082015260400190565b60008582528460208301528360408301526080606083015261243260808301846123a0565b60208082526027908201527f617070656e64517565756542617463682069732063757272656e746c7920646960408201526639b0b13632b21760c91b606082015260800190565b60208082526029908201527f436f6e7465787420626c6f636b206e756d62657220746f6f2066617220696e206040820152683a3432903830b9ba1760b91b606082015260800190565b6020808252603d908201527f5472616e73616374696f6e20646174612073697a652065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b6020808252602f908201527f436f6e746578742074696d657374616d70206973206c6f776572207468616e2060408201526e3630b9ba1039bab136b4ba3a32b21760891b606082015260800190565b6020808252605b908201527f50726576696f75736c7920656e7175657565642062617463686573206861766560408201527f206578706972656420616e64206d75737420626520617070656e64656420626560608201527f666f72652061206e65772073657175656e6365722062617463682e0000000000608082015260a00190565b6020808252602e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e20696e60408201526d31b63ab9b4b7b710383937b7b31760911b606082015260800190565b60208082526032908201527f436f6e7465787420626c6f636b206e756d626572206973206c6f77657220746860408201527130b7103630b9ba1039bab136b4ba3a32b21760711b606082015260800190565b6020808252601e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e2e0000604082015260600190565b6020808252603d908201527f5472616e73616374696f6e20676173206c696d69742065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b60208082526028908201527f4d7573742070726f76696465206174206c65617374206f6e652062617463682060408201526731b7b73a32bc3a1760c11b606082015260800190565b6020808252602e908201527f4e6f7420616c6c2073657175656e636572207472616e73616374696f6e73207760408201526d32b93290383937b1b2b9b9b2b21760911b606082015260800190565b6020808252604a908201527f41637475616c207472616e73616374696f6e20696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420746f74616c20656c656d656e7473206060820152693a379030b83832b7321760b11b608082015260a00190565b60208082526028908201527f436f6e7465787420626c6f636b206e756d6265722069732066726f6d2074686560408201526710333aba3ab9329760c11b606082015260800190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b60208082526029908201527f5472616e73616374696f6e20676173206c696d697420746f6f206c6f7720746f6040820152681032b738bab2bab29760b91b606082015260800190565b60208082526043908201527f53657175656e636572207472616e73616374696f6e2074696d657374616d702060408201527f657863656564732074686174206f66206e65787420717565756520656c656d65606082015262373a1760e91b608082015260a00190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b6020808252602d908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c6564206279207460408201526c34329029b2b8bab2b731b2b91760991b606082015260800190565b6020808252601a908201527f496e76616c6964205175657565207472616e73616374696f6e2e000000000000604082015260600190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b60208082526025908201527f436f6e746578742074696d657374616d702069732066726f6d207468652066756040820152643a3ab9329760d91b606082015260800190565b6020808252602b908201527f496e73756666696369656e742067617320666f72204c322072617465206c696d60408201526a34ba34b73390313ab9371760a91b606082015260800190565b60208082526035908201527f436f6e746578742074696d657374616d702076616c756573206d757374206d6f6040820152743737ba37b734b1b0b6363c9034b731b932b0b9b29760591b606082015260800190565b6020808252602a908201527f496e76616c6964205175657565207472616e73616374696f6e20696e636c757360408201526934b7b710383937b7b31760b11b606082015260800190565b60208082526045908201527f53657175656e636572207472616e73616374696f6e20626c6f636b4e756d626560408201527f7220657863656564732074686174206f66206e65787420717565756520656c6560608201526436b2b73a1760d91b608082015260a00190565b60208082526021908201527f4d75737420617070656e64206174206c65617374206f6e6520656c656d656e746040820152601760f91b606082015260800190565b60208082526026908201527f436f6e746578742074696d657374616d7020746f6f2066617220696e20746865604082015265103830b9ba1760d11b606082015260800190565b60208082526022908201527f4e6f7420656e6f756768204261746368436f6e74657874732070726f76696465604082015261321760f11b606082015260800190565b60208082526029908201527f4e6f7420656e6f75676820717565756564207472616e73616374696f6e732074604082015268379030b83832b7321760b91b606082015260800190565b60208082526037908201527f436f6e7465787420626c6f636b4e756d6265722076616c756573206d7573742060408201527f6d6f6e6f746f6e6963616c6c7920696e6372656173652e000000000000000000606082015260800190565b8151815260208083015164ffffffffff90811691830191909152604092830151169181019190915260600190565b63ffffffff91909116815260200190565b64ffffffffff91909116815260200190565b64ffffffffff9384168152919092166020820152604081019190915260600190565b60405181810167ffffffffffffffff81118282101715612edd57fe5b60405291905056fe4f564d5f4465636f6d7072657373696f6e507265636f6d70696c65416464726573734f564d5f436861696e53746f72616765436f6e7461696e65722d4354432d626174636865734c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4f564d5f436861696e53746f72616765436f6e7461696e65722d4354432d71756575654c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea2646970667358221220ccd26d70e29e57df01efbc12fcd4152555b136a977c6cd56cd6a3e465f2e8fef64736f6c63430007060033", "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", @@ -771,15 +771,15 @@ "storageLayout": { "storage": [ { - "astId": 12800, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol:OVM_CanonicalTransactionChain", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12793" + "type": "t_contract(Lib_AddressManager)15296" }, { - "astId": 2943, + "astId": 4440, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol:OVM_CanonicalTransactionChain", "label": "forceInclusionPeriodSeconds", "offset": 0, @@ -787,7 +787,7 @@ "type": "t_uint256" }, { - "astId": 2945, + "astId": 4442, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol:OVM_CanonicalTransactionChain", "label": "forceInclusionPeriodBlocks", "offset": 0, @@ -795,7 +795,7 @@ "type": "t_uint256" }, { - "astId": 2947, + "astId": 4444, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol:OVM_CanonicalTransactionChain", "label": "maxTransactionGasLimit", "offset": 0, @@ -804,7 +804,7 @@ } ], "types": { - "t_contract(Lib_AddressManager)12793": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" diff --git a/packages/contracts/deployments/kovan/OVM_ChainStorageContainer-CTC-batches.json b/packages/contracts/deployments/kovan/OVM_ChainStorageContainer-CTC-batches.json index 7d6a67f2d39f..28584a5a6f0c 100644 --- a/packages/contracts/deployments/kovan/OVM_ChainStorageContainer-CTC-batches.json +++ b/packages/contracts/deployments/kovan/OVM_ChainStorageContainer-CTC-batches.json @@ -1,5 +1,5 @@ { - "address": "0xeb335a8A5e8bA008cF7Cb02D5C3432f4fDB576da", + "address": "0xF95D79298FD12e5ED778CCf717aA30f638b060E1", "abi": [ { "inputs": [ @@ -181,45 +181,32 @@ "outputs": [], "stateMutability": "nonpayable", "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "setNextOverwritableIndex", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" } ], - "transactionHash": "0x787b44347630217940635c7c654bb383c4f85dba4727578dff104e50dbea79dc", + "transactionHash": "0x8e4f0fd7c4e5bbe407c1561bc083986f70173bc8b3ad73b389462e72d2b9537d", "receipt": { "to": null, "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", - "contractAddress": "0xeb335a8A5e8bA008cF7Cb02D5C3432f4fDB576da", - "transactionIndex": 0, - "gasUsed": "968390", + "contractAddress": "0xF95D79298FD12e5ED778CCf717aA30f638b060E1", + "transactionIndex": 1, + "gasUsed": "742305", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x8ea3e9319a68cca7fb784f92017ee846c2eb68c34308a6f8970dfd2dd7999eb1", - "transactionHash": "0x787b44347630217940635c7c654bb383c4f85dba4727578dff104e50dbea79dc", + "blockHash": "0xc1e21d544ccb02bf36ff8982bfe1c92f2f80a34f0098362acee0303764b758cb", + "transactionHash": "0x8e4f0fd7c4e5bbe407c1561bc083986f70173bc8b3ad73b389462e72d2b9537d", "logs": [], - "blockNumber": 24572785, - "cumulativeGasUsed": "968390", + "blockNumber": 25502571, + "cumulativeGasUsed": "797333", "status": 1, "byzantium": true }, "args": [ - "0xd56F695e73286ac252A37593DD4E7c14270eC1Df", + "0x100Dd3b414Df5BbA2B542864fF94aF8024aFdf3a", "OVM_CanonicalTransactionChain" ], - "solcInputHash": "5ee8e508e2c54cb5ac6783b4855b1558", - "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\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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 distinct 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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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).\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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 distinct 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 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 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\":\"0x93325c961516aa2a22bf1aacf4029353d5e3b693e04b485753170337b50224e6\",\"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 * 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\":\"0x2d7973a0ad84c23ec62624d3f1e3aeb198cc72686ff1e6cfa17155556b320c94\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x2ce671a0e004df88b136bea5a3c59d0732cea8887c8496da1d509e0200b03d7d\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 * 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 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 {\\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\":\"0xe30fc56d4499f98582e1f800dfa3b343f171163a557266c31a56449d5fd3ffae\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506040516200118d3803806200118d833981810160405260408110156200003757600080fd5b8151602083018051604051929492938301929190846401000000008211156200005f57600080fd5b9083019060208201858111156200007557600080fd5b82516401000000008111828201881017156200009057600080fd5b82525081516020918201929091019080838360005b83811015620000bf578181015183820152602001620000a5565b50505050905090810190601f168015620000ed5780820380516001836020036101000a031916815260200191505b506040525050600080546001600160a01b0319166001600160a01b038516179055508051620001249060019060208401906200012d565b505050620001d9565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282620001655760008555620001b0565b82601f106200018057805160ff1916838001178555620001b0565b82800160010185558215620001b0579182015b82811115620001b057825182559160200191906001019062000193565b50620001be929150620001c2565b5090565b5b80821115620001be5760008155600101620001c3565b610fa480620001e96000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80634651d91e116100715780634651d91e1461021a5780638da5cb5b146102375780639507d39a146102b4578063b298e36b146102d1578063ccf8f969146102ee578063fa9e936c14610311576100b4565b8063167fd681146100b95780631f7b6d32146100e65780632015276c1461010057806329061de21461012b578063299ca47814610150578063461a447814610174575b600080fd5b6100e4600480360360408110156100cf57600080fd5b508035906020013564ffffffffff191661032e565b005b6100ee610423565b60408051918252519081900360200190f35b6100e46004803603604081101561011657600080fd5b508035906020013564ffffffffff191661043b565b6100e46004803603602081101561014157600080fd5b503564ffffffffff19166104f7565b6101586105b5565b604080516001600160a01b039092168252519081900360200190f35b6101586004803603602081101561018a57600080fd5b8101906020810181356401000000008111156101a557600080fd5b8201836020820111156101b757600080fd5b803590602001918460018302840111640100000000831117156101d957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105c4945050505050565b6100e46004803603602081101561023057600080fd5b50356106a0565b61023f61075b565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610279578181015183820152602001610261565b50505050905090810190601f1680156102a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100ee600480360360208110156102ca57600080fd5b50356107e8565b6100e4600480360360208110156102e757600080fd5b5035610802565b6102f66108bd565b6040805164ffffffffff199092168252519081900360200190f35b6100e46004803603602081101561032757600080fd5b50356108ce565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526103c493909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b820191906000526020600020905b81548152906001019060200180831161039d57829003601f168201915b50505050506105c4565b6001600160a01b0316336001600160a01b0316146104135760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610983565b5050565b600061042f6002610a75565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261049c93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146104eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610a89565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261055893909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146105a75760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610b90565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561062457818101518382015260200161060c565b50505050905090810190601f1680156106515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561066e57600080fd5b505afa158015610682573d6000803e3d6000fd5b505050506040513d602081101561069857600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261070193909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146107505760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610bba565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107e05780601f106107b5576101008083540402835291602001916107e0565b820191906000526020600020905b8154815290600101906020018083116107c357829003601f168201915b505050505081565b60006107fc600264ffffffffff8416610be0565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261086393909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146108b25760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610de9565b60006108c96002610e0f565b905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261092f93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b03161461097e5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b600855565b600061098e84610e26565b9050806000015164ffffffffff168364ffffffffff161080156109c35750806060015164ffffffffff168364ffffffffff1610155b610a0b576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b806080015164ffffffffff168364ffffffffff161015610a4d576040810180516000190167ffffffffffffffff169052606081015164ffffffffff1660808201525b64ffffffffff8316815264ffffffffff1982166020820152610a6f8482610e86565b50505050565b600080610a8183610e26565b519392505050565b6000610a9484610e26565b90506000610ab9826040015167ffffffffffffffff1686610edc90919063ffffffff16565b8054909150610ac757601081555b8054608083015183510364ffffffffff1610610b3e578460060154826080015164ffffffffff161015610b365760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610b2f908690610edc565b9050610b3e565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610b888684610e86565b505050505050565b6000610b9b83610e26565b64ffffffffff19831660208201529050610bb58382610e86565b505050565b6000610bc583610e26565b9050610bb5828260200151856109839092919063ffffffff16565b600080610bec84610e26565b805190915064ffffffffff168310610c42576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c65826040015167ffffffffffffffff1686610edc90919063ffffffff16565b90506000610c8d836040015160010167ffffffffffffffff1687610edc90919063ffffffff16565b9050826080015164ffffffffff168510610d1a576080830151825464ffffffffff9091168603908110610cfe576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506107fc9050565b6080830151606084015164ffffffffff9182168781039290911610610d7d576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610dca576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b81540360009081526001909101602052604090205492506107fc915050565b6000610df483610e26565b9050610bb582826020015185610a899092919063ffffffff16565b600080610e1b83610e26565b602001519392505050565b610e2e610efc565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b80516020820151604080840151606085015160808601518754858717969483901b8417606883901b1795939291908714610ebe578689555b85896001015414610ed157600189018690555b505050505050505050565b60006002820615610ef05782600401610ef5565b826002015b9392505050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea2646970667358221220376cbc00341dd082d644157f6511fcd1ac26a6a924d04ae6532cfcab93d9191864736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80634651d91e116100715780634651d91e1461021a5780638da5cb5b146102375780639507d39a146102b4578063b298e36b146102d1578063ccf8f969146102ee578063fa9e936c14610311576100b4565b8063167fd681146100b95780631f7b6d32146100e65780632015276c1461010057806329061de21461012b578063299ca47814610150578063461a447814610174575b600080fd5b6100e4600480360360408110156100cf57600080fd5b508035906020013564ffffffffff191661032e565b005b6100ee610423565b60408051918252519081900360200190f35b6100e46004803603604081101561011657600080fd5b508035906020013564ffffffffff191661043b565b6100e46004803603602081101561014157600080fd5b503564ffffffffff19166104f7565b6101586105b5565b604080516001600160a01b039092168252519081900360200190f35b6101586004803603602081101561018a57600080fd5b8101906020810181356401000000008111156101a557600080fd5b8201836020820111156101b757600080fd5b803590602001918460018302840111640100000000831117156101d957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105c4945050505050565b6100e46004803603602081101561023057600080fd5b50356106a0565b61023f61075b565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610279578181015183820152602001610261565b50505050905090810190601f1680156102a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100ee600480360360208110156102ca57600080fd5b50356107e8565b6100e4600480360360208110156102e757600080fd5b5035610802565b6102f66108bd565b6040805164ffffffffff199092168252519081900360200190f35b6100e46004803603602081101561032757600080fd5b50356108ce565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526103c493909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b820191906000526020600020905b81548152906001019060200180831161039d57829003601f168201915b50505050506105c4565b6001600160a01b0316336001600160a01b0316146104135760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610983565b5050565b600061042f6002610a75565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261049c93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146104eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610a89565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261055893909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146105a75760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610b90565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561062457818101518382015260200161060c565b50505050905090810190601f1680156106515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561066e57600080fd5b505afa158015610682573d6000803e3d6000fd5b505050506040513d602081101561069857600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261070193909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146107505760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610bba565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107e05780601f106107b5576101008083540402835291602001916107e0565b820191906000526020600020905b8154815290600101906020018083116107c357829003601f168201915b505050505081565b60006107fc600264ffffffffff8416610be0565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261086393909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146108b25760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610de9565b60006108c96002610e0f565b905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261092f93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b03161461097e5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b600855565b600061098e84610e26565b9050806000015164ffffffffff168364ffffffffff161080156109c35750806060015164ffffffffff168364ffffffffff1610155b610a0b576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b806080015164ffffffffff168364ffffffffff161015610a4d576040810180516000190167ffffffffffffffff169052606081015164ffffffffff1660808201525b64ffffffffff8316815264ffffffffff1982166020820152610a6f8482610e86565b50505050565b600080610a8183610e26565b519392505050565b6000610a9484610e26565b90506000610ab9826040015167ffffffffffffffff1686610edc90919063ffffffff16565b8054909150610ac757601081555b8054608083015183510364ffffffffff1610610b3e578460060154826080015164ffffffffff161015610b365760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610b2f908690610edc565b9050610b3e565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610b888684610e86565b505050505050565b6000610b9b83610e26565b64ffffffffff19831660208201529050610bb58382610e86565b505050565b6000610bc583610e26565b9050610bb5828260200151856109839092919063ffffffff16565b600080610bec84610e26565b805190915064ffffffffff168310610c42576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c65826040015167ffffffffffffffff1686610edc90919063ffffffff16565b90506000610c8d836040015160010167ffffffffffffffff1687610edc90919063ffffffff16565b9050826080015164ffffffffff168510610d1a576080830151825464ffffffffff9091168603908110610cfe576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506107fc9050565b6080830151606084015164ffffffffff9182168781039290911610610d7d576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610dca576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b81540360009081526001909101602052604090205492506107fc915050565b6000610df483610e26565b9050610bb582826020015185610a899092919063ffffffff16565b600080610e1b83610e26565b602001519392505050565b610e2e610efc565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b80516020820151604080840151606085015160808601518754858717969483901b8417606883901b1795939291908714610ebe578689555b85896001015414610ed157600189018690555b505050505050505050565b60006002820615610ef05782600401610ef5565b826002015b9392505050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea2646970667358221220376cbc00341dd082d644157f6511fcd1ac26a6a924d04ae6532cfcab93d9191864736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"setGlobalMetadata\",\"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 distinct 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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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).\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"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.\"}},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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_Buffer } from \\\"../../libraries/utils/Lib_Buffer.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 distinct 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_Buffer for Lib_Buffer.Buffer;\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n string public owner;\\n Lib_Buffer.Buffer 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 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 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\",\"keccak256\":\"0xace1f7a38106e7e95084ca6b39ea9e706cd561fb37c595afa362bb2a39a676ff\",\"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 * 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\",\"keccak256\":\"0x180b9c347e20f1a6efa553b0f2b9a59aebceda92a7484ae6fca4da2bf1d960c3\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Buffer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Buffer\\n * @dev This library implements a bytes32 storage array with some additional gas-optimized\\n * functionality. In particular, it encodes its length as a uint40, and tightly packs this with an\\n * overwritable \\\"extra data\\\" field so we can store more information with a single SSTORE.\\n */\\nlibrary Lib_Buffer {\\n\\n /*************\\n * Libraries *\\n *************/\\n\\n using Lib_Buffer for Buffer;\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Buffer {\\n bytes32 context;\\n mapping (uint256 => bytes32) buf;\\n }\\n\\n struct BufferContext {\\n // Stores the length of the array. Uint40 is way more elements than we'll ever reasonably\\n // need in an array and we get an extra 27 bytes of extra data to play with.\\n uint40 length;\\n\\n // Arbitrary extra data that can be modified whenever the length is updated. Useful for\\n // squeezing out some gas optimizations.\\n bytes27 extraData;\\n }\\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 Global extra data.\\n */\\n function push(\\n Buffer storage _self,\\n bytes32 _value,\\n bytes27 _extraData\\n )\\n internal\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n _self.buf[ctx.length] = _value;\\n\\n // Bump the global index and insert our extra data, then save the context.\\n ctx.length++;\\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 Buffer storage _self,\\n bytes32 _value\\n )\\n internal\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n _self.push(\\n _value,\\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 Buffer storage _self,\\n uint256 _index\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n return _self.buf[_index];\\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 Buffer storage _self,\\n uint40 _index,\\n bytes27 _extraData\\n )\\n internal\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n // Set our length and extra data, save the context.\\n ctx.length = _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 Buffer storage _self,\\n uint40 _index\\n )\\n internal\\n {\\n BufferContext 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 Buffer storage _self\\n )\\n internal\\n view\\n returns (\\n uint40\\n )\\n {\\n BufferContext memory ctx = _self.getContext();\\n return ctx.length;\\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 Buffer storage _self,\\n bytes27 _extraData\\n )\\n internal\\n {\\n BufferContext 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 Buffer storage _self\\n )\\n internal\\n view\\n returns (\\n bytes27\\n )\\n {\\n BufferContext memory ctx = _self.getContext();\\n return ctx.extraData;\\n }\\n\\n /**\\n * Sets the current buffer context.\\n * @param _self Buffer to access.\\n * @param _ctx Current buffer context.\\n */\\n function setContext(\\n Buffer storage _self,\\n BufferContext memory _ctx\\n )\\n internal\\n {\\n bytes32 context;\\n uint40 length = _ctx.length;\\n bytes27 extraData = _ctx.extraData;\\n assembly {\\n context := length\\n context := or(context, extraData)\\n }\\n\\n if (_self.context != context) {\\n _self.context = context;\\n }\\n }\\n\\n /**\\n * Retrieves the current buffer context.\\n * @param _self Buffer to access.\\n * @return Current buffer context.\\n */\\n function getContext(\\n Buffer storage _self\\n )\\n internal\\n view\\n returns (\\n BufferContext memory\\n )\\n {\\n bytes32 context = _self.context;\\n uint40 length;\\n bytes27 extraData;\\n assembly {\\n length := and(context, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\\n extraData := and(context, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000)\\n }\\n\\n return BufferContext({\\n length: length,\\n extraData: extraData\\n });\\n }\\n}\\n\",\"keccak256\":\"0xbce4f4db3d80b2cb252177752eee1ca38482731d1e2e5d165c7fce2e04c487fb\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405162000d5538038062000d558339818101604052604081101561003557600080fd5b81516020830180516040519294929383019291908464010000000082111561005c57600080fd5b90830190602082018581111561007157600080fd5b825164010000000081118282018810171561008b57600080fd5b82525081516020918201929091019080838360005b838110156100b85781810151838201526020016100a0565b50505050905090810190601f1680156100e55780820380516001836020036101000a031916815260200191505b506040525050600080546001600160a01b0319166001600160a01b03851617905550805161011a906001906020840190610122565b5050506101c3565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282610158576000855561019e565b82601f1061017157805160ff191683800117855561019e565b8280016001018555821561019e579182015b8281111561019e578251825591602001919060010190610183565b506101aa9291506101ae565b5090565b5b808211156101aa57600081556001016101af565b610b8280620001d36000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c8063461a447811610071578063461a4478146101695780634651d91e1461020f5780638da5cb5b1461022c5780639507d39a146102a9578063b298e36b146102c6578063ccf8f969146102e3576100a9565b8063167fd681146100ae5780631f7b6d32146100db5780632015276c146100f557806329061de214610120578063299ca47814610145575b600080fd5b6100d9600480360360408110156100c457600080fd5b508035906020013564ffffffffff1916610306565b005b6100e36103fb565b60408051918252519081900360200190f35b6100d96004803603604081101561010b57600080fd5b508035906020013564ffffffffff1916610413565b6100d96004803603602081101561013657600080fd5b503564ffffffffff19166104cf565b61014d61058d565b604080516001600160a01b039092168252519081900360200190f35b61014d6004803603602081101561017f57600080fd5b81019060208101813564010000000081111561019a57600080fd5b8201836020820111156101ac57600080fd5b803590602001918460018302840111640100000000831117156101ce57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061059c945050505050565b6100d96004803603602081101561022557600080fd5b5035610678565b610234610733565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561026e578181015183820152602001610256565b50505050905090810190601f16801561029b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100e3600480360360208110156102bf57600080fd5b50356107c0565b6100d9600480360360208110156102dc57600080fd5b50356107da565b6102eb610895565b6040805164ffffffffff199092168252519081900360200190f35b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261039c93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b820191906000526020600020905b81548152906001019060200180831161037557829003601f168201915b505050505061059c565b6001600160a01b0316336001600160a01b0316146103eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f7600283836108a6565b5050565b60006104076002610938565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261047493909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146104c35760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f76002838361094c565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261053093909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461057f5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a60028261099a565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156105fc5781810151838201526020016105e4565b50505050905090810190601f1680156106295780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561064657600080fd5b505afa15801561065a573d6000803e3d6000fd5b505050506040513d602081101561067057600080fd5b505192915050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526106d993909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146107285760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a6002826109c4565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107b85780601f1061078d576101008083540402835291602001916107b8565b820191906000526020600020905b81548152906001019060200180831161079b57829003601f168201915b505050505081565b60006107d4600264ffffffffff84166109ea565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261083b93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461088a5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a600282610a64565b60006108a16002610a8a565b905090565b60006108b184610aa1565b9050806000015164ffffffffff168364ffffffffff1610610910576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b64ffffffffff8316815264ffffffffff19821660208201526109328482610ad1565b50505050565b60008061094483610aa1565b519392505050565b600061095784610aa1565b805164ffffffffff9081166000908152600180880160209081526040909220879055835101909116825264ffffffffff1984169082015290506109328482610ad1565b60006109a583610aa1565b64ffffffffff198316602082015290506109bf8382610ad1565b505050565b60006109cf83610aa1565b90506109bf828260200151856108a69092919063ffffffff16565b6000806109f684610aa1565b805190915064ffffffffff168310610a4c576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b50506000908152600191909101602052604090205490565b6000610a6f83610aa1565b90506109bf8282602001518561094c9092919063ffffffff16565b600080610a9683610aa1565b602001519392505050565b610aa9610af1565b50546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b8051602082015183548183179291908314610aea578285555b5050505050565b60408051808201909152600080825260208201529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122038869143d4598418a0ef5faf124214a16dc032f21ac35b7170b13b796c6eb00464736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c8063461a447811610071578063461a4478146101695780634651d91e1461020f5780638da5cb5b1461022c5780639507d39a146102a9578063b298e36b146102c6578063ccf8f969146102e3576100a9565b8063167fd681146100ae5780631f7b6d32146100db5780632015276c146100f557806329061de214610120578063299ca47814610145575b600080fd5b6100d9600480360360408110156100c457600080fd5b508035906020013564ffffffffff1916610306565b005b6100e36103fb565b60408051918252519081900360200190f35b6100d96004803603604081101561010b57600080fd5b508035906020013564ffffffffff1916610413565b6100d96004803603602081101561013657600080fd5b503564ffffffffff19166104cf565b61014d61058d565b604080516001600160a01b039092168252519081900360200190f35b61014d6004803603602081101561017f57600080fd5b81019060208101813564010000000081111561019a57600080fd5b8201836020820111156101ac57600080fd5b803590602001918460018302840111640100000000831117156101ce57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061059c945050505050565b6100d96004803603602081101561022557600080fd5b5035610678565b610234610733565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561026e578181015183820152602001610256565b50505050905090810190601f16801561029b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100e3600480360360208110156102bf57600080fd5b50356107c0565b6100d9600480360360208110156102dc57600080fd5b50356107da565b6102eb610895565b6040805164ffffffffff199092168252519081900360200190f35b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261039c93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b820191906000526020600020905b81548152906001019060200180831161037557829003601f168201915b505050505061059c565b6001600160a01b0316336001600160a01b0316146103eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f7600283836108a6565b5050565b60006104076002610938565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261047493909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146104c35760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f76002838361094c565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261053093909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461057f5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a60028261099a565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156105fc5781810151838201526020016105e4565b50505050905090810190601f1680156106295780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561064657600080fd5b505afa15801561065a573d6000803e3d6000fd5b505050506040513d602081101561067057600080fd5b505192915050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526106d993909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146107285760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a6002826109c4565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107b85780601f1061078d576101008083540402835291602001916107b8565b820191906000526020600020905b81548152906001019060200180831161079b57829003601f168201915b505050505081565b60006107d4600264ffffffffff84166109ea565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261083b93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461088a5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a600282610a64565b60006108a16002610a8a565b905090565b60006108b184610aa1565b9050806000015164ffffffffff168364ffffffffff1610610910576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b64ffffffffff8316815264ffffffffff19821660208201526109328482610ad1565b50505050565b60008061094483610aa1565b519392505050565b600061095784610aa1565b805164ffffffffff9081166000908152600180880160209081526040909220879055835101909116825264ffffffffff1984169082015290506109328482610ad1565b60006109a583610aa1565b64ffffffffff198316602082015290506109bf8382610ad1565b505050565b60006109cf83610aa1565b90506109bf828260200151856108a69092919063ffffffff16565b6000806109f684610aa1565b805190915064ffffffffff168310610a4c576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b50506000908152600191909101602052604090205490565b6000610a6f83610aa1565b90506109bf8282602001518561094c9092919063ffffffff16565b600080610a9683610aa1565b602001519392505050565b610aa9610af1565b50546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b8051602082015183548183179291908314610aea578285555b5050505050565b60408051808201909152600080825260208201529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122038869143d4598418a0ef5faf124214a16dc032f21ac35b7170b13b796c6eb00464736f6c63430007060033", "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 distinct 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", @@ -316,9 +303,6 @@ }, "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 @@ -326,15 +310,15 @@ "storageLayout": { "storage": [ { - "astId": 12800, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12793" + "type": "t_contract(Lib_AddressManager)15296" }, { - "astId": 4466, + "astId": 5963, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "owner", "offset": 0, @@ -342,12 +326,12 @@ "type": "t_string_storage" }, { - "astId": 4468, + "astId": 5965, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "buffer", "offset": 0, "slot": "2", - "type": "t_struct(RingBuffer)17846_storage" + "type": "t_struct(Buffer)18996_storage" } ], "types": { @@ -356,7 +340,7 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(Lib_AddressManager)12793": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" @@ -373,20 +357,20 @@ "label": "string", "numberOfBytes": "32" }, - "t_struct(Buffer)17835_storage": { + "t_struct(Buffer)18996_storage": { "encoding": "inplace", - "label": "struct Lib_RingBuffer.Buffer", + "label": "struct Lib_Buffer.Buffer", "members": [ { - "astId": 17830, + "astId": 18991, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "length", + "label": "context", "offset": 0, "slot": "0", - "type": "t_uint256" + "type": "t_bytes32" }, { - "astId": 17834, + "astId": 18995, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "buf", "offset": 0, @@ -396,53 +380,6 @@ ], "numberOfBytes": "64" }, - "t_struct(RingBuffer)17846_storage": { - "encoding": "inplace", - "label": "struct Lib_RingBuffer.RingBuffer", - "members": [ - { - "astId": 17837, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "contextA", - "offset": 0, - "slot": "0", - "type": "t_bytes32" - }, - { - "astId": 17839, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "contextB", - "offset": 0, - "slot": "1", - "type": "t_bytes32" - }, - { - "astId": 17841, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "bufferA", - "offset": 0, - "slot": "2", - "type": "t_struct(Buffer)17835_storage" - }, - { - "astId": 17843, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "bufferB", - "offset": 0, - "slot": "4", - "type": "t_struct(Buffer)17835_storage" - }, - { - "astId": 17845, - "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", diff --git a/packages/contracts/deployments/kovan/OVM_ChainStorageContainer-CTC-queue.json b/packages/contracts/deployments/kovan/OVM_ChainStorageContainer-CTC-queue.json index 663815c631ef..4d8c03ab5e84 100644 --- a/packages/contracts/deployments/kovan/OVM_ChainStorageContainer-CTC-queue.json +++ b/packages/contracts/deployments/kovan/OVM_ChainStorageContainer-CTC-queue.json @@ -1,5 +1,5 @@ { - "address": "0x207fa9Aa7Dee9AA790A8DF64778D3E3B6273BC90", + "address": "0x2BE00E5F043a0f62c3e4d775F3235E28A0239395", "abi": [ { "inputs": [ @@ -181,45 +181,32 @@ "outputs": [], "stateMutability": "nonpayable", "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "setNextOverwritableIndex", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" } ], - "transactionHash": "0x131733524a44e43d5ae59ec1eba4fe60c893da9cc9f38e501d35a5b3c8cf1310", + "transactionHash": "0xb4d89ec5c680c10d105607cf3bb7fceffef07d32487f58a840760319c4f795bd", "receipt": { "to": null, "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", - "contractAddress": "0x207fa9Aa7Dee9AA790A8DF64778D3E3B6273BC90", - "transactionIndex": 1, - "gasUsed": "968390", + "contractAddress": "0x2BE00E5F043a0f62c3e4d775F3235E28A0239395", + "transactionIndex": 0, + "gasUsed": "742305", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x3f742457c998e215c0a89528d46d770ba3f2c9d49f791673bc07501ede825f8d", - "transactionHash": "0x131733524a44e43d5ae59ec1eba4fe60c893da9cc9f38e501d35a5b3c8cf1310", + "blockHash": "0x78f84c4da7416fa156ad3d9a58769c854616788a9fbc2f2fa8522ef0a7b3902d", + "transactionHash": "0xb4d89ec5c680c10d105607cf3bb7fceffef07d32487f58a840760319c4f795bd", "logs": [], - "blockNumber": 24572792, - "cumulativeGasUsed": "1010846", + "blockNumber": 25502577, + "cumulativeGasUsed": "742305", "status": 1, "byzantium": true }, "args": [ - "0xd56F695e73286ac252A37593DD4E7c14270eC1Df", + "0x100Dd3b414Df5BbA2B542864fF94aF8024aFdf3a", "OVM_CanonicalTransactionChain" ], - "solcInputHash": "5ee8e508e2c54cb5ac6783b4855b1558", - "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\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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 distinct 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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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).\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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 distinct 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 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 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\":\"0x93325c961516aa2a22bf1aacf4029353d5e3b693e04b485753170337b50224e6\",\"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 * 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\":\"0x2d7973a0ad84c23ec62624d3f1e3aeb198cc72686ff1e6cfa17155556b320c94\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x2ce671a0e004df88b136bea5a3c59d0732cea8887c8496da1d509e0200b03d7d\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 * 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 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 {\\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\":\"0xe30fc56d4499f98582e1f800dfa3b343f171163a557266c31a56449d5fd3ffae\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506040516200118d3803806200118d833981810160405260408110156200003757600080fd5b8151602083018051604051929492938301929190846401000000008211156200005f57600080fd5b9083019060208201858111156200007557600080fd5b82516401000000008111828201881017156200009057600080fd5b82525081516020918201929091019080838360005b83811015620000bf578181015183820152602001620000a5565b50505050905090810190601f168015620000ed5780820380516001836020036101000a031916815260200191505b506040525050600080546001600160a01b0319166001600160a01b038516179055508051620001249060019060208401906200012d565b505050620001d9565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282620001655760008555620001b0565b82601f106200018057805160ff1916838001178555620001b0565b82800160010185558215620001b0579182015b82811115620001b057825182559160200191906001019062000193565b50620001be929150620001c2565b5090565b5b80821115620001be5760008155600101620001c3565b610fa480620001e96000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80634651d91e116100715780634651d91e1461021a5780638da5cb5b146102375780639507d39a146102b4578063b298e36b146102d1578063ccf8f969146102ee578063fa9e936c14610311576100b4565b8063167fd681146100b95780631f7b6d32146100e65780632015276c1461010057806329061de21461012b578063299ca47814610150578063461a447814610174575b600080fd5b6100e4600480360360408110156100cf57600080fd5b508035906020013564ffffffffff191661032e565b005b6100ee610423565b60408051918252519081900360200190f35b6100e46004803603604081101561011657600080fd5b508035906020013564ffffffffff191661043b565b6100e46004803603602081101561014157600080fd5b503564ffffffffff19166104f7565b6101586105b5565b604080516001600160a01b039092168252519081900360200190f35b6101586004803603602081101561018a57600080fd5b8101906020810181356401000000008111156101a557600080fd5b8201836020820111156101b757600080fd5b803590602001918460018302840111640100000000831117156101d957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105c4945050505050565b6100e46004803603602081101561023057600080fd5b50356106a0565b61023f61075b565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610279578181015183820152602001610261565b50505050905090810190601f1680156102a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100ee600480360360208110156102ca57600080fd5b50356107e8565b6100e4600480360360208110156102e757600080fd5b5035610802565b6102f66108bd565b6040805164ffffffffff199092168252519081900360200190f35b6100e46004803603602081101561032757600080fd5b50356108ce565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526103c493909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b820191906000526020600020905b81548152906001019060200180831161039d57829003601f168201915b50505050506105c4565b6001600160a01b0316336001600160a01b0316146104135760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610983565b5050565b600061042f6002610a75565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261049c93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146104eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610a89565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261055893909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146105a75760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610b90565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561062457818101518382015260200161060c565b50505050905090810190601f1680156106515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561066e57600080fd5b505afa158015610682573d6000803e3d6000fd5b505050506040513d602081101561069857600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261070193909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146107505760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610bba565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107e05780601f106107b5576101008083540402835291602001916107e0565b820191906000526020600020905b8154815290600101906020018083116107c357829003601f168201915b505050505081565b60006107fc600264ffffffffff8416610be0565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261086393909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146108b25760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610de9565b60006108c96002610e0f565b905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261092f93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b03161461097e5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b600855565b600061098e84610e26565b9050806000015164ffffffffff168364ffffffffff161080156109c35750806060015164ffffffffff168364ffffffffff1610155b610a0b576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b806080015164ffffffffff168364ffffffffff161015610a4d576040810180516000190167ffffffffffffffff169052606081015164ffffffffff1660808201525b64ffffffffff8316815264ffffffffff1982166020820152610a6f8482610e86565b50505050565b600080610a8183610e26565b519392505050565b6000610a9484610e26565b90506000610ab9826040015167ffffffffffffffff1686610edc90919063ffffffff16565b8054909150610ac757601081555b8054608083015183510364ffffffffff1610610b3e578460060154826080015164ffffffffff161015610b365760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610b2f908690610edc565b9050610b3e565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610b888684610e86565b505050505050565b6000610b9b83610e26565b64ffffffffff19831660208201529050610bb58382610e86565b505050565b6000610bc583610e26565b9050610bb5828260200151856109839092919063ffffffff16565b600080610bec84610e26565b805190915064ffffffffff168310610c42576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c65826040015167ffffffffffffffff1686610edc90919063ffffffff16565b90506000610c8d836040015160010167ffffffffffffffff1687610edc90919063ffffffff16565b9050826080015164ffffffffff168510610d1a576080830151825464ffffffffff9091168603908110610cfe576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506107fc9050565b6080830151606084015164ffffffffff9182168781039290911610610d7d576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610dca576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b81540360009081526001909101602052604090205492506107fc915050565b6000610df483610e26565b9050610bb582826020015185610a899092919063ffffffff16565b600080610e1b83610e26565b602001519392505050565b610e2e610efc565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b80516020820151604080840151606085015160808601518754858717969483901b8417606883901b1795939291908714610ebe578689555b85896001015414610ed157600189018690555b505050505050505050565b60006002820615610ef05782600401610ef5565b826002015b9392505050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea2646970667358221220376cbc00341dd082d644157f6511fcd1ac26a6a924d04ae6532cfcab93d9191864736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80634651d91e116100715780634651d91e1461021a5780638da5cb5b146102375780639507d39a146102b4578063b298e36b146102d1578063ccf8f969146102ee578063fa9e936c14610311576100b4565b8063167fd681146100b95780631f7b6d32146100e65780632015276c1461010057806329061de21461012b578063299ca47814610150578063461a447814610174575b600080fd5b6100e4600480360360408110156100cf57600080fd5b508035906020013564ffffffffff191661032e565b005b6100ee610423565b60408051918252519081900360200190f35b6100e46004803603604081101561011657600080fd5b508035906020013564ffffffffff191661043b565b6100e46004803603602081101561014157600080fd5b503564ffffffffff19166104f7565b6101586105b5565b604080516001600160a01b039092168252519081900360200190f35b6101586004803603602081101561018a57600080fd5b8101906020810181356401000000008111156101a557600080fd5b8201836020820111156101b757600080fd5b803590602001918460018302840111640100000000831117156101d957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105c4945050505050565b6100e46004803603602081101561023057600080fd5b50356106a0565b61023f61075b565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610279578181015183820152602001610261565b50505050905090810190601f1680156102a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100ee600480360360208110156102ca57600080fd5b50356107e8565b6100e4600480360360208110156102e757600080fd5b5035610802565b6102f66108bd565b6040805164ffffffffff199092168252519081900360200190f35b6100e46004803603602081101561032757600080fd5b50356108ce565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526103c493909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b820191906000526020600020905b81548152906001019060200180831161039d57829003601f168201915b50505050506105c4565b6001600160a01b0316336001600160a01b0316146104135760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610983565b5050565b600061042f6002610a75565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261049c93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146104eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610a89565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261055893909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146105a75760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610b90565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561062457818101518382015260200161060c565b50505050905090810190601f1680156106515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561066e57600080fd5b505afa158015610682573d6000803e3d6000fd5b505050506040513d602081101561069857600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261070193909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146107505760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610bba565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107e05780601f106107b5576101008083540402835291602001916107e0565b820191906000526020600020905b8154815290600101906020018083116107c357829003601f168201915b505050505081565b60006107fc600264ffffffffff8416610be0565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261086393909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146108b25760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610de9565b60006108c96002610e0f565b905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261092f93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b03161461097e5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b600855565b600061098e84610e26565b9050806000015164ffffffffff168364ffffffffff161080156109c35750806060015164ffffffffff168364ffffffffff1610155b610a0b576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b806080015164ffffffffff168364ffffffffff161015610a4d576040810180516000190167ffffffffffffffff169052606081015164ffffffffff1660808201525b64ffffffffff8316815264ffffffffff1982166020820152610a6f8482610e86565b50505050565b600080610a8183610e26565b519392505050565b6000610a9484610e26565b90506000610ab9826040015167ffffffffffffffff1686610edc90919063ffffffff16565b8054909150610ac757601081555b8054608083015183510364ffffffffff1610610b3e578460060154826080015164ffffffffff161015610b365760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610b2f908690610edc565b9050610b3e565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610b888684610e86565b505050505050565b6000610b9b83610e26565b64ffffffffff19831660208201529050610bb58382610e86565b505050565b6000610bc583610e26565b9050610bb5828260200151856109839092919063ffffffff16565b600080610bec84610e26565b805190915064ffffffffff168310610c42576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c65826040015167ffffffffffffffff1686610edc90919063ffffffff16565b90506000610c8d836040015160010167ffffffffffffffff1687610edc90919063ffffffff16565b9050826080015164ffffffffff168510610d1a576080830151825464ffffffffff9091168603908110610cfe576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506107fc9050565b6080830151606084015164ffffffffff9182168781039290911610610d7d576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610dca576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b81540360009081526001909101602052604090205492506107fc915050565b6000610df483610e26565b9050610bb582826020015185610a899092919063ffffffff16565b600080610e1b83610e26565b602001519392505050565b610e2e610efc565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b80516020820151604080840151606085015160808601518754858717969483901b8417606883901b1795939291908714610ebe578689555b85896001015414610ed157600189018690555b505050505050505050565b60006002820615610ef05782600401610ef5565b826002015b9392505050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea2646970667358221220376cbc00341dd082d644157f6511fcd1ac26a6a924d04ae6532cfcab93d9191864736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"setGlobalMetadata\",\"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 distinct 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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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).\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"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.\"}},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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_Buffer } from \\\"../../libraries/utils/Lib_Buffer.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 distinct 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_Buffer for Lib_Buffer.Buffer;\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n string public owner;\\n Lib_Buffer.Buffer 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 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 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\",\"keccak256\":\"0xace1f7a38106e7e95084ca6b39ea9e706cd561fb37c595afa362bb2a39a676ff\",\"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 * 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\",\"keccak256\":\"0x180b9c347e20f1a6efa553b0f2b9a59aebceda92a7484ae6fca4da2bf1d960c3\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Buffer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Buffer\\n * @dev This library implements a bytes32 storage array with some additional gas-optimized\\n * functionality. In particular, it encodes its length as a uint40, and tightly packs this with an\\n * overwritable \\\"extra data\\\" field so we can store more information with a single SSTORE.\\n */\\nlibrary Lib_Buffer {\\n\\n /*************\\n * Libraries *\\n *************/\\n\\n using Lib_Buffer for Buffer;\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Buffer {\\n bytes32 context;\\n mapping (uint256 => bytes32) buf;\\n }\\n\\n struct BufferContext {\\n // Stores the length of the array. Uint40 is way more elements than we'll ever reasonably\\n // need in an array and we get an extra 27 bytes of extra data to play with.\\n uint40 length;\\n\\n // Arbitrary extra data that can be modified whenever the length is updated. Useful for\\n // squeezing out some gas optimizations.\\n bytes27 extraData;\\n }\\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 Global extra data.\\n */\\n function push(\\n Buffer storage _self,\\n bytes32 _value,\\n bytes27 _extraData\\n )\\n internal\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n _self.buf[ctx.length] = _value;\\n\\n // Bump the global index and insert our extra data, then save the context.\\n ctx.length++;\\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 Buffer storage _self,\\n bytes32 _value\\n )\\n internal\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n _self.push(\\n _value,\\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 Buffer storage _self,\\n uint256 _index\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n return _self.buf[_index];\\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 Buffer storage _self,\\n uint40 _index,\\n bytes27 _extraData\\n )\\n internal\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n // Set our length and extra data, save the context.\\n ctx.length = _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 Buffer storage _self,\\n uint40 _index\\n )\\n internal\\n {\\n BufferContext 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 Buffer storage _self\\n )\\n internal\\n view\\n returns (\\n uint40\\n )\\n {\\n BufferContext memory ctx = _self.getContext();\\n return ctx.length;\\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 Buffer storage _self,\\n bytes27 _extraData\\n )\\n internal\\n {\\n BufferContext 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 Buffer storage _self\\n )\\n internal\\n view\\n returns (\\n bytes27\\n )\\n {\\n BufferContext memory ctx = _self.getContext();\\n return ctx.extraData;\\n }\\n\\n /**\\n * Sets the current buffer context.\\n * @param _self Buffer to access.\\n * @param _ctx Current buffer context.\\n */\\n function setContext(\\n Buffer storage _self,\\n BufferContext memory _ctx\\n )\\n internal\\n {\\n bytes32 context;\\n uint40 length = _ctx.length;\\n bytes27 extraData = _ctx.extraData;\\n assembly {\\n context := length\\n context := or(context, extraData)\\n }\\n\\n if (_self.context != context) {\\n _self.context = context;\\n }\\n }\\n\\n /**\\n * Retrieves the current buffer context.\\n * @param _self Buffer to access.\\n * @return Current buffer context.\\n */\\n function getContext(\\n Buffer storage _self\\n )\\n internal\\n view\\n returns (\\n BufferContext memory\\n )\\n {\\n bytes32 context = _self.context;\\n uint40 length;\\n bytes27 extraData;\\n assembly {\\n length := and(context, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\\n extraData := and(context, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000)\\n }\\n\\n return BufferContext({\\n length: length,\\n extraData: extraData\\n });\\n }\\n}\\n\",\"keccak256\":\"0xbce4f4db3d80b2cb252177752eee1ca38482731d1e2e5d165c7fce2e04c487fb\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405162000d5538038062000d558339818101604052604081101561003557600080fd5b81516020830180516040519294929383019291908464010000000082111561005c57600080fd5b90830190602082018581111561007157600080fd5b825164010000000081118282018810171561008b57600080fd5b82525081516020918201929091019080838360005b838110156100b85781810151838201526020016100a0565b50505050905090810190601f1680156100e55780820380516001836020036101000a031916815260200191505b506040525050600080546001600160a01b0319166001600160a01b03851617905550805161011a906001906020840190610122565b5050506101c3565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282610158576000855561019e565b82601f1061017157805160ff191683800117855561019e565b8280016001018555821561019e579182015b8281111561019e578251825591602001919060010190610183565b506101aa9291506101ae565b5090565b5b808211156101aa57600081556001016101af565b610b8280620001d36000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c8063461a447811610071578063461a4478146101695780634651d91e1461020f5780638da5cb5b1461022c5780639507d39a146102a9578063b298e36b146102c6578063ccf8f969146102e3576100a9565b8063167fd681146100ae5780631f7b6d32146100db5780632015276c146100f557806329061de214610120578063299ca47814610145575b600080fd5b6100d9600480360360408110156100c457600080fd5b508035906020013564ffffffffff1916610306565b005b6100e36103fb565b60408051918252519081900360200190f35b6100d96004803603604081101561010b57600080fd5b508035906020013564ffffffffff1916610413565b6100d96004803603602081101561013657600080fd5b503564ffffffffff19166104cf565b61014d61058d565b604080516001600160a01b039092168252519081900360200190f35b61014d6004803603602081101561017f57600080fd5b81019060208101813564010000000081111561019a57600080fd5b8201836020820111156101ac57600080fd5b803590602001918460018302840111640100000000831117156101ce57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061059c945050505050565b6100d96004803603602081101561022557600080fd5b5035610678565b610234610733565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561026e578181015183820152602001610256565b50505050905090810190601f16801561029b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100e3600480360360208110156102bf57600080fd5b50356107c0565b6100d9600480360360208110156102dc57600080fd5b50356107da565b6102eb610895565b6040805164ffffffffff199092168252519081900360200190f35b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261039c93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b820191906000526020600020905b81548152906001019060200180831161037557829003601f168201915b505050505061059c565b6001600160a01b0316336001600160a01b0316146103eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f7600283836108a6565b5050565b60006104076002610938565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261047493909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146104c35760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f76002838361094c565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261053093909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461057f5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a60028261099a565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156105fc5781810151838201526020016105e4565b50505050905090810190601f1680156106295780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561064657600080fd5b505afa15801561065a573d6000803e3d6000fd5b505050506040513d602081101561067057600080fd5b505192915050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526106d993909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146107285760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a6002826109c4565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107b85780601f1061078d576101008083540402835291602001916107b8565b820191906000526020600020905b81548152906001019060200180831161079b57829003601f168201915b505050505081565b60006107d4600264ffffffffff84166109ea565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261083b93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461088a5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a600282610a64565b60006108a16002610a8a565b905090565b60006108b184610aa1565b9050806000015164ffffffffff168364ffffffffff1610610910576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b64ffffffffff8316815264ffffffffff19821660208201526109328482610ad1565b50505050565b60008061094483610aa1565b519392505050565b600061095784610aa1565b805164ffffffffff9081166000908152600180880160209081526040909220879055835101909116825264ffffffffff1984169082015290506109328482610ad1565b60006109a583610aa1565b64ffffffffff198316602082015290506109bf8382610ad1565b505050565b60006109cf83610aa1565b90506109bf828260200151856108a69092919063ffffffff16565b6000806109f684610aa1565b805190915064ffffffffff168310610a4c576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b50506000908152600191909101602052604090205490565b6000610a6f83610aa1565b90506109bf8282602001518561094c9092919063ffffffff16565b600080610a9683610aa1565b602001519392505050565b610aa9610af1565b50546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b8051602082015183548183179291908314610aea578285555b5050505050565b60408051808201909152600080825260208201529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122038869143d4598418a0ef5faf124214a16dc032f21ac35b7170b13b796c6eb00464736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c8063461a447811610071578063461a4478146101695780634651d91e1461020f5780638da5cb5b1461022c5780639507d39a146102a9578063b298e36b146102c6578063ccf8f969146102e3576100a9565b8063167fd681146100ae5780631f7b6d32146100db5780632015276c146100f557806329061de214610120578063299ca47814610145575b600080fd5b6100d9600480360360408110156100c457600080fd5b508035906020013564ffffffffff1916610306565b005b6100e36103fb565b60408051918252519081900360200190f35b6100d96004803603604081101561010b57600080fd5b508035906020013564ffffffffff1916610413565b6100d96004803603602081101561013657600080fd5b503564ffffffffff19166104cf565b61014d61058d565b604080516001600160a01b039092168252519081900360200190f35b61014d6004803603602081101561017f57600080fd5b81019060208101813564010000000081111561019a57600080fd5b8201836020820111156101ac57600080fd5b803590602001918460018302840111640100000000831117156101ce57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061059c945050505050565b6100d96004803603602081101561022557600080fd5b5035610678565b610234610733565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561026e578181015183820152602001610256565b50505050905090810190601f16801561029b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100e3600480360360208110156102bf57600080fd5b50356107c0565b6100d9600480360360208110156102dc57600080fd5b50356107da565b6102eb610895565b6040805164ffffffffff199092168252519081900360200190f35b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261039c93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b820191906000526020600020905b81548152906001019060200180831161037557829003601f168201915b505050505061059c565b6001600160a01b0316336001600160a01b0316146103eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f7600283836108a6565b5050565b60006104076002610938565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261047493909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146104c35760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f76002838361094c565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261053093909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461057f5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a60028261099a565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156105fc5781810151838201526020016105e4565b50505050905090810190601f1680156106295780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561064657600080fd5b505afa15801561065a573d6000803e3d6000fd5b505050506040513d602081101561067057600080fd5b505192915050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526106d993909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146107285760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a6002826109c4565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107b85780601f1061078d576101008083540402835291602001916107b8565b820191906000526020600020905b81548152906001019060200180831161079b57829003601f168201915b505050505081565b60006107d4600264ffffffffff84166109ea565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261083b93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461088a5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a600282610a64565b60006108a16002610a8a565b905090565b60006108b184610aa1565b9050806000015164ffffffffff168364ffffffffff1610610910576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b64ffffffffff8316815264ffffffffff19821660208201526109328482610ad1565b50505050565b60008061094483610aa1565b519392505050565b600061095784610aa1565b805164ffffffffff9081166000908152600180880160209081526040909220879055835101909116825264ffffffffff1984169082015290506109328482610ad1565b60006109a583610aa1565b64ffffffffff198316602082015290506109bf8382610ad1565b505050565b60006109cf83610aa1565b90506109bf828260200151856108a69092919063ffffffff16565b6000806109f684610aa1565b805190915064ffffffffff168310610a4c576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b50506000908152600191909101602052604090205490565b6000610a6f83610aa1565b90506109bf8282602001518561094c9092919063ffffffff16565b600080610a9683610aa1565b602001519392505050565b610aa9610af1565b50546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b8051602082015183548183179291908314610aea578285555b5050505050565b60408051808201909152600080825260208201529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122038869143d4598418a0ef5faf124214a16dc032f21ac35b7170b13b796c6eb00464736f6c63430007060033", "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 distinct 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", @@ -316,9 +303,6 @@ }, "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 @@ -326,15 +310,15 @@ "storageLayout": { "storage": [ { - "astId": 12800, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12793" + "type": "t_contract(Lib_AddressManager)15296" }, { - "astId": 4466, + "astId": 5963, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "owner", "offset": 0, @@ -342,12 +326,12 @@ "type": "t_string_storage" }, { - "astId": 4468, + "astId": 5965, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "buffer", "offset": 0, "slot": "2", - "type": "t_struct(RingBuffer)17846_storage" + "type": "t_struct(Buffer)18996_storage" } ], "types": { @@ -356,7 +340,7 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(Lib_AddressManager)12793": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" @@ -373,20 +357,20 @@ "label": "string", "numberOfBytes": "32" }, - "t_struct(Buffer)17835_storage": { + "t_struct(Buffer)18996_storage": { "encoding": "inplace", - "label": "struct Lib_RingBuffer.Buffer", + "label": "struct Lib_Buffer.Buffer", "members": [ { - "astId": 17830, + "astId": 18991, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "length", + "label": "context", "offset": 0, "slot": "0", - "type": "t_uint256" + "type": "t_bytes32" }, { - "astId": 17834, + "astId": 18995, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "buf", "offset": 0, @@ -396,53 +380,6 @@ ], "numberOfBytes": "64" }, - "t_struct(RingBuffer)17846_storage": { - "encoding": "inplace", - "label": "struct Lib_RingBuffer.RingBuffer", - "members": [ - { - "astId": 17837, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "contextA", - "offset": 0, - "slot": "0", - "type": "t_bytes32" - }, - { - "astId": 17839, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "contextB", - "offset": 0, - "slot": "1", - "type": "t_bytes32" - }, - { - "astId": 17841, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "bufferA", - "offset": 0, - "slot": "2", - "type": "t_struct(Buffer)17835_storage" - }, - { - "astId": 17843, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "bufferB", - "offset": 0, - "slot": "4", - "type": "t_struct(Buffer)17835_storage" - }, - { - "astId": 17845, - "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", diff --git a/packages/contracts/deployments/kovan/OVM_ChainStorageContainer-SCC-batches.json b/packages/contracts/deployments/kovan/OVM_ChainStorageContainer-SCC-batches.json index c0192021dfa1..458158ad1164 100644 --- a/packages/contracts/deployments/kovan/OVM_ChainStorageContainer-SCC-batches.json +++ b/packages/contracts/deployments/kovan/OVM_ChainStorageContainer-SCC-batches.json @@ -1,5 +1,5 @@ { - "address": "0xFE1CE27173676A6850ECF4e0536D7C468A4dAfa0", + "address": "0x50DA41A2A185fb917aecEFfa1CB4534dC5C264b4", "abi": [ { "inputs": [ @@ -181,45 +181,32 @@ "outputs": [], "stateMutability": "nonpayable", "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "setNextOverwritableIndex", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" } ], - "transactionHash": "0x9a6bad52721e26c2993afcc88ee94280ebde659d16dde1800520e2f23d8a993e", + "transactionHash": "0xc15cf303e60e43ae12d95cdc3eddd885320dd2b88d12e69afbf088624730272f", "receipt": { "to": null, "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", - "contractAddress": "0xFE1CE27173676A6850ECF4e0536D7C468A4dAfa0", - "transactionIndex": 2, - "gasUsed": "968330", + "contractAddress": "0x50DA41A2A185fb917aecEFfa1CB4534dC5C264b4", + "transactionIndex": 0, + "gasUsed": "742245", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x7f062788bcd72681fe2d1681ec3b1a30f6c5093d76e50ef210302436ee01a5d9", - "transactionHash": "0x9a6bad52721e26c2993afcc88ee94280ebde659d16dde1800520e2f23d8a993e", + "blockHash": "0xc1a101e3c10399e858c7456b5a201fcb08f7b6f7715eb3c78ecaa457c707a5a3", + "transactionHash": "0xc15cf303e60e43ae12d95cdc3eddd885320dd2b88d12e69afbf088624730272f", "logs": [], - "blockNumber": 24572799, - "cumulativeGasUsed": "1044174", + "blockNumber": 25502582, + "cumulativeGasUsed": "742245", "status": 1, "byzantium": true }, "args": [ - "0xd56F695e73286ac252A37593DD4E7c14270eC1Df", + "0x100Dd3b414Df5BbA2B542864fF94aF8024aFdf3a", "OVM_StateCommitmentChain" ], - "solcInputHash": "5ee8e508e2c54cb5ac6783b4855b1558", - "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\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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 distinct 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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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).\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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 distinct 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 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 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\":\"0x93325c961516aa2a22bf1aacf4029353d5e3b693e04b485753170337b50224e6\",\"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 * 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\":\"0x2d7973a0ad84c23ec62624d3f1e3aeb198cc72686ff1e6cfa17155556b320c94\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x2ce671a0e004df88b136bea5a3c59d0732cea8887c8496da1d509e0200b03d7d\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 * 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 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 {\\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\":\"0xe30fc56d4499f98582e1f800dfa3b343f171163a557266c31a56449d5fd3ffae\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506040516200118d3803806200118d833981810160405260408110156200003757600080fd5b8151602083018051604051929492938301929190846401000000008211156200005f57600080fd5b9083019060208201858111156200007557600080fd5b82516401000000008111828201881017156200009057600080fd5b82525081516020918201929091019080838360005b83811015620000bf578181015183820152602001620000a5565b50505050905090810190601f168015620000ed5780820380516001836020036101000a031916815260200191505b506040525050600080546001600160a01b0319166001600160a01b038516179055508051620001249060019060208401906200012d565b505050620001d9565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282620001655760008555620001b0565b82601f106200018057805160ff1916838001178555620001b0565b82800160010185558215620001b0579182015b82811115620001b057825182559160200191906001019062000193565b50620001be929150620001c2565b5090565b5b80821115620001be5760008155600101620001c3565b610fa480620001e96000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80634651d91e116100715780634651d91e1461021a5780638da5cb5b146102375780639507d39a146102b4578063b298e36b146102d1578063ccf8f969146102ee578063fa9e936c14610311576100b4565b8063167fd681146100b95780631f7b6d32146100e65780632015276c1461010057806329061de21461012b578063299ca47814610150578063461a447814610174575b600080fd5b6100e4600480360360408110156100cf57600080fd5b508035906020013564ffffffffff191661032e565b005b6100ee610423565b60408051918252519081900360200190f35b6100e46004803603604081101561011657600080fd5b508035906020013564ffffffffff191661043b565b6100e46004803603602081101561014157600080fd5b503564ffffffffff19166104f7565b6101586105b5565b604080516001600160a01b039092168252519081900360200190f35b6101586004803603602081101561018a57600080fd5b8101906020810181356401000000008111156101a557600080fd5b8201836020820111156101b757600080fd5b803590602001918460018302840111640100000000831117156101d957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105c4945050505050565b6100e46004803603602081101561023057600080fd5b50356106a0565b61023f61075b565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610279578181015183820152602001610261565b50505050905090810190601f1680156102a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100ee600480360360208110156102ca57600080fd5b50356107e8565b6100e4600480360360208110156102e757600080fd5b5035610802565b6102f66108bd565b6040805164ffffffffff199092168252519081900360200190f35b6100e46004803603602081101561032757600080fd5b50356108ce565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526103c493909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b820191906000526020600020905b81548152906001019060200180831161039d57829003601f168201915b50505050506105c4565b6001600160a01b0316336001600160a01b0316146104135760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610983565b5050565b600061042f6002610a75565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261049c93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146104eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610a89565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261055893909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146105a75760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610b90565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561062457818101518382015260200161060c565b50505050905090810190601f1680156106515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561066e57600080fd5b505afa158015610682573d6000803e3d6000fd5b505050506040513d602081101561069857600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261070193909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146107505760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610bba565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107e05780601f106107b5576101008083540402835291602001916107e0565b820191906000526020600020905b8154815290600101906020018083116107c357829003601f168201915b505050505081565b60006107fc600264ffffffffff8416610be0565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261086393909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146108b25760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610de9565b60006108c96002610e0f565b905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261092f93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b03161461097e5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b600855565b600061098e84610e26565b9050806000015164ffffffffff168364ffffffffff161080156109c35750806060015164ffffffffff168364ffffffffff1610155b610a0b576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b806080015164ffffffffff168364ffffffffff161015610a4d576040810180516000190167ffffffffffffffff169052606081015164ffffffffff1660808201525b64ffffffffff8316815264ffffffffff1982166020820152610a6f8482610e86565b50505050565b600080610a8183610e26565b519392505050565b6000610a9484610e26565b90506000610ab9826040015167ffffffffffffffff1686610edc90919063ffffffff16565b8054909150610ac757601081555b8054608083015183510364ffffffffff1610610b3e578460060154826080015164ffffffffff161015610b365760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610b2f908690610edc565b9050610b3e565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610b888684610e86565b505050505050565b6000610b9b83610e26565b64ffffffffff19831660208201529050610bb58382610e86565b505050565b6000610bc583610e26565b9050610bb5828260200151856109839092919063ffffffff16565b600080610bec84610e26565b805190915064ffffffffff168310610c42576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c65826040015167ffffffffffffffff1686610edc90919063ffffffff16565b90506000610c8d836040015160010167ffffffffffffffff1687610edc90919063ffffffff16565b9050826080015164ffffffffff168510610d1a576080830151825464ffffffffff9091168603908110610cfe576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506107fc9050565b6080830151606084015164ffffffffff9182168781039290911610610d7d576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610dca576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b81540360009081526001909101602052604090205492506107fc915050565b6000610df483610e26565b9050610bb582826020015185610a899092919063ffffffff16565b600080610e1b83610e26565b602001519392505050565b610e2e610efc565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b80516020820151604080840151606085015160808601518754858717969483901b8417606883901b1795939291908714610ebe578689555b85896001015414610ed157600189018690555b505050505050505050565b60006002820615610ef05782600401610ef5565b826002015b9392505050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea2646970667358221220376cbc00341dd082d644157f6511fcd1ac26a6a924d04ae6532cfcab93d9191864736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80634651d91e116100715780634651d91e1461021a5780638da5cb5b146102375780639507d39a146102b4578063b298e36b146102d1578063ccf8f969146102ee578063fa9e936c14610311576100b4565b8063167fd681146100b95780631f7b6d32146100e65780632015276c1461010057806329061de21461012b578063299ca47814610150578063461a447814610174575b600080fd5b6100e4600480360360408110156100cf57600080fd5b508035906020013564ffffffffff191661032e565b005b6100ee610423565b60408051918252519081900360200190f35b6100e46004803603604081101561011657600080fd5b508035906020013564ffffffffff191661043b565b6100e46004803603602081101561014157600080fd5b503564ffffffffff19166104f7565b6101586105b5565b604080516001600160a01b039092168252519081900360200190f35b6101586004803603602081101561018a57600080fd5b8101906020810181356401000000008111156101a557600080fd5b8201836020820111156101b757600080fd5b803590602001918460018302840111640100000000831117156101d957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105c4945050505050565b6100e46004803603602081101561023057600080fd5b50356106a0565b61023f61075b565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610279578181015183820152602001610261565b50505050905090810190601f1680156102a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100ee600480360360208110156102ca57600080fd5b50356107e8565b6100e4600480360360208110156102e757600080fd5b5035610802565b6102f66108bd565b6040805164ffffffffff199092168252519081900360200190f35b6100e46004803603602081101561032757600080fd5b50356108ce565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526103c493909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b820191906000526020600020905b81548152906001019060200180831161039d57829003601f168201915b50505050506105c4565b6001600160a01b0316336001600160a01b0316146104135760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610983565b5050565b600061042f6002610a75565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261049c93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146104eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610a89565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261055893909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146105a75760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610b90565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561062457818101518382015260200161060c565b50505050905090810190601f1680156106515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561066e57600080fd5b505afa158015610682573d6000803e3d6000fd5b505050506040513d602081101561069857600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261070193909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146107505760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610bba565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107e05780601f106107b5576101008083540402835291602001916107e0565b820191906000526020600020905b8154815290600101906020018083116107c357829003601f168201915b505050505081565b60006107fc600264ffffffffff8416610be0565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261086393909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146108b25760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610de9565b60006108c96002610e0f565b905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261092f93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b03161461097e5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b600855565b600061098e84610e26565b9050806000015164ffffffffff168364ffffffffff161080156109c35750806060015164ffffffffff168364ffffffffff1610155b610a0b576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b806080015164ffffffffff168364ffffffffff161015610a4d576040810180516000190167ffffffffffffffff169052606081015164ffffffffff1660808201525b64ffffffffff8316815264ffffffffff1982166020820152610a6f8482610e86565b50505050565b600080610a8183610e26565b519392505050565b6000610a9484610e26565b90506000610ab9826040015167ffffffffffffffff1686610edc90919063ffffffff16565b8054909150610ac757601081555b8054608083015183510364ffffffffff1610610b3e578460060154826080015164ffffffffff161015610b365760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610b2f908690610edc565b9050610b3e565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610b888684610e86565b505050505050565b6000610b9b83610e26565b64ffffffffff19831660208201529050610bb58382610e86565b505050565b6000610bc583610e26565b9050610bb5828260200151856109839092919063ffffffff16565b600080610bec84610e26565b805190915064ffffffffff168310610c42576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c65826040015167ffffffffffffffff1686610edc90919063ffffffff16565b90506000610c8d836040015160010167ffffffffffffffff1687610edc90919063ffffffff16565b9050826080015164ffffffffff168510610d1a576080830151825464ffffffffff9091168603908110610cfe576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506107fc9050565b6080830151606084015164ffffffffff9182168781039290911610610d7d576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610dca576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b81540360009081526001909101602052604090205492506107fc915050565b6000610df483610e26565b9050610bb582826020015185610a899092919063ffffffff16565b600080610e1b83610e26565b602001519392505050565b610e2e610efc565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b80516020820151604080840151606085015160808601518754858717969483901b8417606883901b1795939291908714610ebe578689555b85896001015414610ed157600189018690555b505050505050505050565b60006002820615610ef05782600401610ef5565b826002015b9392505050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea2646970667358221220376cbc00341dd082d644157f6511fcd1ac26a6a924d04ae6532cfcab93d9191864736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"setGlobalMetadata\",\"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 distinct 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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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).\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"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.\"}},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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_Buffer } from \\\"../../libraries/utils/Lib_Buffer.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 distinct 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_Buffer for Lib_Buffer.Buffer;\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n string public owner;\\n Lib_Buffer.Buffer 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 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 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\",\"keccak256\":\"0xace1f7a38106e7e95084ca6b39ea9e706cd561fb37c595afa362bb2a39a676ff\",\"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 * 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\",\"keccak256\":\"0x180b9c347e20f1a6efa553b0f2b9a59aebceda92a7484ae6fca4da2bf1d960c3\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Buffer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Buffer\\n * @dev This library implements a bytes32 storage array with some additional gas-optimized\\n * functionality. In particular, it encodes its length as a uint40, and tightly packs this with an\\n * overwritable \\\"extra data\\\" field so we can store more information with a single SSTORE.\\n */\\nlibrary Lib_Buffer {\\n\\n /*************\\n * Libraries *\\n *************/\\n\\n using Lib_Buffer for Buffer;\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Buffer {\\n bytes32 context;\\n mapping (uint256 => bytes32) buf;\\n }\\n\\n struct BufferContext {\\n // Stores the length of the array. Uint40 is way more elements than we'll ever reasonably\\n // need in an array and we get an extra 27 bytes of extra data to play with.\\n uint40 length;\\n\\n // Arbitrary extra data that can be modified whenever the length is updated. Useful for\\n // squeezing out some gas optimizations.\\n bytes27 extraData;\\n }\\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 Global extra data.\\n */\\n function push(\\n Buffer storage _self,\\n bytes32 _value,\\n bytes27 _extraData\\n )\\n internal\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n _self.buf[ctx.length] = _value;\\n\\n // Bump the global index and insert our extra data, then save the context.\\n ctx.length++;\\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 Buffer storage _self,\\n bytes32 _value\\n )\\n internal\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n _self.push(\\n _value,\\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 Buffer storage _self,\\n uint256 _index\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n return _self.buf[_index];\\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 Buffer storage _self,\\n uint40 _index,\\n bytes27 _extraData\\n )\\n internal\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n // Set our length and extra data, save the context.\\n ctx.length = _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 Buffer storage _self,\\n uint40 _index\\n )\\n internal\\n {\\n BufferContext 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 Buffer storage _self\\n )\\n internal\\n view\\n returns (\\n uint40\\n )\\n {\\n BufferContext memory ctx = _self.getContext();\\n return ctx.length;\\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 Buffer storage _self,\\n bytes27 _extraData\\n )\\n internal\\n {\\n BufferContext 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 Buffer storage _self\\n )\\n internal\\n view\\n returns (\\n bytes27\\n )\\n {\\n BufferContext memory ctx = _self.getContext();\\n return ctx.extraData;\\n }\\n\\n /**\\n * Sets the current buffer context.\\n * @param _self Buffer to access.\\n * @param _ctx Current buffer context.\\n */\\n function setContext(\\n Buffer storage _self,\\n BufferContext memory _ctx\\n )\\n internal\\n {\\n bytes32 context;\\n uint40 length = _ctx.length;\\n bytes27 extraData = _ctx.extraData;\\n assembly {\\n context := length\\n context := or(context, extraData)\\n }\\n\\n if (_self.context != context) {\\n _self.context = context;\\n }\\n }\\n\\n /**\\n * Retrieves the current buffer context.\\n * @param _self Buffer to access.\\n * @return Current buffer context.\\n */\\n function getContext(\\n Buffer storage _self\\n )\\n internal\\n view\\n returns (\\n BufferContext memory\\n )\\n {\\n bytes32 context = _self.context;\\n uint40 length;\\n bytes27 extraData;\\n assembly {\\n length := and(context, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\\n extraData := and(context, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000)\\n }\\n\\n return BufferContext({\\n length: length,\\n extraData: extraData\\n });\\n }\\n}\\n\",\"keccak256\":\"0xbce4f4db3d80b2cb252177752eee1ca38482731d1e2e5d165c7fce2e04c487fb\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405162000d5538038062000d558339818101604052604081101561003557600080fd5b81516020830180516040519294929383019291908464010000000082111561005c57600080fd5b90830190602082018581111561007157600080fd5b825164010000000081118282018810171561008b57600080fd5b82525081516020918201929091019080838360005b838110156100b85781810151838201526020016100a0565b50505050905090810190601f1680156100e55780820380516001836020036101000a031916815260200191505b506040525050600080546001600160a01b0319166001600160a01b03851617905550805161011a906001906020840190610122565b5050506101c3565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282610158576000855561019e565b82601f1061017157805160ff191683800117855561019e565b8280016001018555821561019e579182015b8281111561019e578251825591602001919060010190610183565b506101aa9291506101ae565b5090565b5b808211156101aa57600081556001016101af565b610b8280620001d36000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c8063461a447811610071578063461a4478146101695780634651d91e1461020f5780638da5cb5b1461022c5780639507d39a146102a9578063b298e36b146102c6578063ccf8f969146102e3576100a9565b8063167fd681146100ae5780631f7b6d32146100db5780632015276c146100f557806329061de214610120578063299ca47814610145575b600080fd5b6100d9600480360360408110156100c457600080fd5b508035906020013564ffffffffff1916610306565b005b6100e36103fb565b60408051918252519081900360200190f35b6100d96004803603604081101561010b57600080fd5b508035906020013564ffffffffff1916610413565b6100d96004803603602081101561013657600080fd5b503564ffffffffff19166104cf565b61014d61058d565b604080516001600160a01b039092168252519081900360200190f35b61014d6004803603602081101561017f57600080fd5b81019060208101813564010000000081111561019a57600080fd5b8201836020820111156101ac57600080fd5b803590602001918460018302840111640100000000831117156101ce57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061059c945050505050565b6100d96004803603602081101561022557600080fd5b5035610678565b610234610733565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561026e578181015183820152602001610256565b50505050905090810190601f16801561029b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100e3600480360360208110156102bf57600080fd5b50356107c0565b6100d9600480360360208110156102dc57600080fd5b50356107da565b6102eb610895565b6040805164ffffffffff199092168252519081900360200190f35b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261039c93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b820191906000526020600020905b81548152906001019060200180831161037557829003601f168201915b505050505061059c565b6001600160a01b0316336001600160a01b0316146103eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f7600283836108a6565b5050565b60006104076002610938565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261047493909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146104c35760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f76002838361094c565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261053093909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461057f5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a60028261099a565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156105fc5781810151838201526020016105e4565b50505050905090810190601f1680156106295780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561064657600080fd5b505afa15801561065a573d6000803e3d6000fd5b505050506040513d602081101561067057600080fd5b505192915050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526106d993909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146107285760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a6002826109c4565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107b85780601f1061078d576101008083540402835291602001916107b8565b820191906000526020600020905b81548152906001019060200180831161079b57829003601f168201915b505050505081565b60006107d4600264ffffffffff84166109ea565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261083b93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461088a5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a600282610a64565b60006108a16002610a8a565b905090565b60006108b184610aa1565b9050806000015164ffffffffff168364ffffffffff1610610910576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b64ffffffffff8316815264ffffffffff19821660208201526109328482610ad1565b50505050565b60008061094483610aa1565b519392505050565b600061095784610aa1565b805164ffffffffff9081166000908152600180880160209081526040909220879055835101909116825264ffffffffff1984169082015290506109328482610ad1565b60006109a583610aa1565b64ffffffffff198316602082015290506109bf8382610ad1565b505050565b60006109cf83610aa1565b90506109bf828260200151856108a69092919063ffffffff16565b6000806109f684610aa1565b805190915064ffffffffff168310610a4c576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b50506000908152600191909101602052604090205490565b6000610a6f83610aa1565b90506109bf8282602001518561094c9092919063ffffffff16565b600080610a9683610aa1565b602001519392505050565b610aa9610af1565b50546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b8051602082015183548183179291908314610aea578285555b5050505050565b60408051808201909152600080825260208201529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122038869143d4598418a0ef5faf124214a16dc032f21ac35b7170b13b796c6eb00464736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c8063461a447811610071578063461a4478146101695780634651d91e1461020f5780638da5cb5b1461022c5780639507d39a146102a9578063b298e36b146102c6578063ccf8f969146102e3576100a9565b8063167fd681146100ae5780631f7b6d32146100db5780632015276c146100f557806329061de214610120578063299ca47814610145575b600080fd5b6100d9600480360360408110156100c457600080fd5b508035906020013564ffffffffff1916610306565b005b6100e36103fb565b60408051918252519081900360200190f35b6100d96004803603604081101561010b57600080fd5b508035906020013564ffffffffff1916610413565b6100d96004803603602081101561013657600080fd5b503564ffffffffff19166104cf565b61014d61058d565b604080516001600160a01b039092168252519081900360200190f35b61014d6004803603602081101561017f57600080fd5b81019060208101813564010000000081111561019a57600080fd5b8201836020820111156101ac57600080fd5b803590602001918460018302840111640100000000831117156101ce57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061059c945050505050565b6100d96004803603602081101561022557600080fd5b5035610678565b610234610733565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561026e578181015183820152602001610256565b50505050905090810190601f16801561029b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100e3600480360360208110156102bf57600080fd5b50356107c0565b6100d9600480360360208110156102dc57600080fd5b50356107da565b6102eb610895565b6040805164ffffffffff199092168252519081900360200190f35b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261039c93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b820191906000526020600020905b81548152906001019060200180831161037557829003601f168201915b505050505061059c565b6001600160a01b0316336001600160a01b0316146103eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f7600283836108a6565b5050565b60006104076002610938565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261047493909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146104c35760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f76002838361094c565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261053093909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461057f5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a60028261099a565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156105fc5781810151838201526020016105e4565b50505050905090810190601f1680156106295780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561064657600080fd5b505afa15801561065a573d6000803e3d6000fd5b505050506040513d602081101561067057600080fd5b505192915050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526106d993909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146107285760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a6002826109c4565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107b85780601f1061078d576101008083540402835291602001916107b8565b820191906000526020600020905b81548152906001019060200180831161079b57829003601f168201915b505050505081565b60006107d4600264ffffffffff84166109ea565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261083b93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461088a5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a600282610a64565b60006108a16002610a8a565b905090565b60006108b184610aa1565b9050806000015164ffffffffff168364ffffffffff1610610910576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b64ffffffffff8316815264ffffffffff19821660208201526109328482610ad1565b50505050565b60008061094483610aa1565b519392505050565b600061095784610aa1565b805164ffffffffff9081166000908152600180880160209081526040909220879055835101909116825264ffffffffff1984169082015290506109328482610ad1565b60006109a583610aa1565b64ffffffffff198316602082015290506109bf8382610ad1565b505050565b60006109cf83610aa1565b90506109bf828260200151856108a69092919063ffffffff16565b6000806109f684610aa1565b805190915064ffffffffff168310610a4c576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b50506000908152600191909101602052604090205490565b6000610a6f83610aa1565b90506109bf8282602001518561094c9092919063ffffffff16565b600080610a9683610aa1565b602001519392505050565b610aa9610af1565b50546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b8051602082015183548183179291908314610aea578285555b5050505050565b60408051808201909152600080825260208201529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122038869143d4598418a0ef5faf124214a16dc032f21ac35b7170b13b796c6eb00464736f6c63430007060033", "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 distinct 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", @@ -316,9 +303,6 @@ }, "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 @@ -326,15 +310,15 @@ "storageLayout": { "storage": [ { - "astId": 12800, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12793" + "type": "t_contract(Lib_AddressManager)15296" }, { - "astId": 4466, + "astId": 5963, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "owner", "offset": 0, @@ -342,12 +326,12 @@ "type": "t_string_storage" }, { - "astId": 4468, + "astId": 5965, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "buffer", "offset": 0, "slot": "2", - "type": "t_struct(RingBuffer)17846_storage" + "type": "t_struct(Buffer)18996_storage" } ], "types": { @@ -356,7 +340,7 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(Lib_AddressManager)12793": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" @@ -373,20 +357,20 @@ "label": "string", "numberOfBytes": "32" }, - "t_struct(Buffer)17835_storage": { + "t_struct(Buffer)18996_storage": { "encoding": "inplace", - "label": "struct Lib_RingBuffer.Buffer", + "label": "struct Lib_Buffer.Buffer", "members": [ { - "astId": 17830, + "astId": 18991, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "length", + "label": "context", "offset": 0, "slot": "0", - "type": "t_uint256" + "type": "t_bytes32" }, { - "astId": 17834, + "astId": 18995, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "buf", "offset": 0, @@ -396,53 +380,6 @@ ], "numberOfBytes": "64" }, - "t_struct(RingBuffer)17846_storage": { - "encoding": "inplace", - "label": "struct Lib_RingBuffer.RingBuffer", - "members": [ - { - "astId": 17837, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "contextA", - "offset": 0, - "slot": "0", - "type": "t_bytes32" - }, - { - "astId": 17839, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "contextB", - "offset": 0, - "slot": "1", - "type": "t_bytes32" - }, - { - "astId": 17841, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "bufferA", - "offset": 0, - "slot": "2", - "type": "t_struct(Buffer)17835_storage" - }, - { - "astId": 17843, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "bufferB", - "offset": 0, - "slot": "4", - "type": "t_struct(Buffer)17835_storage" - }, - { - "astId": 17845, - "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", diff --git a/packages/contracts/deployments/kovan/OVM_ExecutionManager.json b/packages/contracts/deployments/kovan/OVM_ExecutionManager.json index 2a066f76e002..6c1642eea6b4 100644 --- a/packages/contracts/deployments/kovan/OVM_ExecutionManager.json +++ b/packages/contracts/deployments/kovan/OVM_ExecutionManager.json @@ -1,5 +1,5 @@ { - "address": "0xa2EB1961183a04157fF707Fa2Be2249e149c8FAB", + "address": "0xC68795aC9d96374eaE746DAcC1334ba54798e17D", "abi": [ { "inputs": [ @@ -51,6 +51,19 @@ "stateMutability": "nonpayable", "type": "constructor" }, + { + "inputs": [], + "name": "CALL_WITH_VALUE_INTRINSIC_GAS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "getMaxTransactionGasLimit", @@ -90,6 +103,64 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contract", + "type": "address" + } + ], + "name": "ovmBALANCE", + "outputs": [ + { + "internalType": "uint256", + "name": "_BALANCE", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_gasLimit", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_address", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + }, + { + "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": [ { @@ -137,6 +208,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "ovmCALLVALUE", + "outputs": [ + { + "internalType": "uint256", + "name": "_CALLVALUE", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "ovmCHAINID", @@ -417,6 +501,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "ovmSELFBALANCE", + "outputs": [ + { + "internalType": "uint256", + "name": "_BALANCE", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -583,11 +680,6 @@ }, { "inputs": [ - { - "internalType": "uint256", - "name": "_gasLimit", - "type": "uint256" - }, { "internalType": "bytes", "name": "_creationCode", @@ -653,6 +745,11 @@ "name": "_from", "type": "address" }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + }, { "internalType": "contract iOVM_StateManager", "name": "_ovmStateManager", @@ -661,11 +758,6 @@ ], "name": "simulateMessage", "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - }, { "internalType": "bytes", "name": "", @@ -676,27 +768,27 @@ "type": "function" } ], - "transactionHash": "0x8da706bbdc66066481106f6452161e0f6ad95f928a10f6a86b7175a52f2057c5", + "transactionHash": "0x6a4cc0b2c04772760ba47b3e014ed5c688615bef4ab81000e7a08061adc07977", "receipt": { "to": null, "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", - "contractAddress": "0xa2EB1961183a04157fF707Fa2Be2249e149c8FAB", + "contractAddress": "0xC68795aC9d96374eaE746DAcC1334ba54798e17D", "transactionIndex": 1, - "gasUsed": "2901234", + "gasUsed": "3122036", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xe33c92c8c1fef82666476fb549221769ae5c6ec66490489f8c123a07b6a0d115", - "transactionHash": "0x8da706bbdc66066481106f6452161e0f6ad95f928a10f6a86b7175a52f2057c5", + "blockHash": "0x7f02b989c010e183ec5e3576bd760fd652d6a6d7e6ced2bd2d144fc09184db5c", + "transactionHash": "0x6a4cc0b2c04772760ba47b3e014ed5c688615bef4ab81000e7a08061adc07977", "logs": [], - "blockNumber": 24572845, - "cumulativeGasUsed": "3041792", + "blockNumber": 25502621, + "cumulativeGasUsed": "3222305", "status": 1, "byzantium": true }, "args": [ - "0xd56F695e73286ac252A37593DD4E7c14270eC1Df", + "0x100Dd3b414Df5BbA2B542864fF94aF8024aFdf3a", { "minTransactionGasLimit": 50000, - "maxTransactionGasLimit": 9000000, + "maxTransactionGasLimit": 11000000, "maxGasPerQueuePerEpoch": 250000000, "secondsPerEpoch": 0 }, @@ -704,10 +796,10 @@ "ovmCHAINID": 420 } ], - "solcInputHash": "5ee8e508e2c54cb5ac6783b4855b1558", - "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\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_bytecode\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"ovmCREATE2\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"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\":\"ovmINCREMENTNONCE\",\"outputs\":[],\"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\":\"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\":\"\",\"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\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_creationCode\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"}],\"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\":{\"_0\":\"Address of the created contract.\",\"_1\":\"Revert data, if and only if the creation threw an exception.\"}},\"ovmCREATE2(bytes,bytes32)\":{\"params\":{\"_bytecode\":\"Code to be used to CREATE2 a new contract.\",\"_salt\":\"Value used to determine the contract's address.\"},\"returns\":{\"_0\":\"Address of the created contract.\",\"_1\":\"Revert data, if and only if the creation threw an exception.\"}},\"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\":\"Enum indicating 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.\"}},\"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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"run((uint256,uint256,uint8,address,address,uint256,bytes),address)\":{\"params\":{\"_ovmStateManager\":\"iOVM_StateManager implementation providing account state.\",\"_transaction\":\"Transaction data to be executed.\"}},\"safeCREATE(uint256,bytes,address)\":{\"params\":{\"_address\":\"OVM address being deployed to.\",\"_creationCode\":\"Code to pass into CREATE for deployment.\",\"_gasLimit\":\"Amount of gas to be passed into this creation.\"}},\"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.\"},\"ovmINCREMENTNONCE()\":{\"notice\":\"Bumps the nonce of the current ovmADDRESS by one.\"},\"ovmL1QUEUEORIGIN()\":{\"notice\":\"Specifies from which source (Sequencer or 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.\"},\"ovmSLOAD(bytes32)\":{\"notice\":\"Overrides SLOAD.\"},\"ovmSSTORE(bytes32,bytes32)\":{\"notice\":\"Overrides SSTORE.\"},\"ovmSTATICCALL(uint256,address,bytes)\":{\"notice\":\"Overrides STATICCALL.\"},\"ovmTIMESTAMP()\":{\"notice\":\"Overrides TIMESTAMP.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"run((uint256,uint256,uint8,address,address,uint256,bytes),address)\":{\"notice\":\"Starts the execution of a transaction via the OVM_ExecutionManager.\"},\"safeCREATE(uint256,bytes,address)\":{\"notice\":\"Handles the creation-specific safety measures required for OVM contract deployment. This function sanitizes the return types for creation messages to match calls (bool, bytes), by being an external function which the EM can call, that mimics the success/fail case of the CREATE. This allows for consistent handling of both types of messages in _handleExternalMessage(). Having this step occur as a separate call frame also allows us to easily revert the contract deployment in the event that the code is unsafe.\"},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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\\\";\\nimport { Lib_ErrorUtils } from \\\"../../libraries/utils/Lib_ErrorUtils.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_DeployerWhitelist } from \\\"../predeploys/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 * Default Context Values *\\n **************************/\\n\\n uint256 constant DEFAULT_UINT256 = 0xdefa017defa017defa017defa017defa017defa017defa017defa017defa017d;\\n address constant DEFAULT_ADDRESS = 0xdEfa017defA017DeFA017DEfa017DeFA017DeFa0;\\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 Lib_AddressResolver(_libAddressManager)\\n {\\n ovmSafetyChecker = iOVM_SafetyChecker(resolve(\\\"OVM_SafetyChecker\\\"));\\n gasMeterConfig = _gasMeterConfig;\\n globalContext = _globalContext;\\n _resetContext();\\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 returns (\\n bytes memory\\n )\\n {\\n // Make sure that run() is not re-enterable. This condition should always be satisfied\\n // Once run has been called once, due to the behavior of _isValidInput().\\n if (transactionContext.ovmNUMBER != DEFAULT_UINT256) {\\n return bytes(\\\"\\\");\\n }\\n\\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 (_isValidInput(_transaction) == false) {\\n _resetContext();\\n return bytes(\\\"\\\");\\n }\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\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 (, bytes memory returndata) = ovmCALL(\\n _transaction.gasLimit - gasMeterConfig.minTransactionGasLimit,\\n _transaction.entrypoint,\\n _transaction.data\\n );\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\n // // Update the cumulative gas based on the amount of gas used.\\n // uint256 gasUsed = gasProvided - gasleft();\\n // _updateCumulativeGas(gasUsed, _transaction.l1QueueOrigin);\\n\\n // Wipe the execution context.\\n _resetContext();\\n\\n return returndata;\\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 source (Sequencer or Queue) this transaction originated from.\\n * @return _queueOrigin Enum indicating 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 Address of the created contract.\\n * @return Revert data, if and only if the creation threw an exception.\\n */\\n function ovmCREATE(\\n bytes memory _bytecode\\n )\\n override\\n public\\n notStatic\\n fixedGasDiscount(40000)\\n returns (\\n address,\\n bytes memory\\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 Address of the created contract.\\n * @return Revert data, if and only if the creation threw an exception.\\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,\\n bytes memory\\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 * Bumps the nonce of the current ovmADDRESS by one.\\n */\\n function ovmINCREMENTNONCE()\\n override\\n public\\n notStatic\\n {\\n address account = ovmADDRESS();\\n uint256 nonce = _getAccountNonce(account);\\n\\n // Prevent overflow.\\n if (nonce + 1 > nonce) {\\n _setAccountNonce(account, nonce + 1);\\n }\\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 // Creates a duplicate of the OVM_ProxyEOA located at 0x42....09. Uses the following\\n // \\\"magic\\\" prefix to deploy an exact copy of the code:\\n // PUSH1 0x0D # size of this prefix in bytes\\n // CODESIZE\\n // SUB # subtract prefix size from codesize\\n // DUP1\\n // PUSH1 0x0D\\n // PUSH1 0x00\\n // CODECOPY # copy everything after prefix into memory at pos 0\\n // PUSH1 0x00\\n // RETURN # return the copied code\\n address proxyEOA = Lib_EthUtils.createContract(abi.encodePacked(\\n hex\\\"600D380380600D6000396000f3\\\",\\n ovmEXTCODECOPY(\\n 0x4200000000000000000000000000000000000009,\\n 0,\\n ovmEXTCODESIZE(0x4200000000000000000000000000000000000009)\\n )\\n ));\\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\\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 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 * 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 Whitelisting *\\n ********************************************/\\n\\n /**\\n * Checks whether the given address is on the whitelist 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 semantics perspective, this will appear 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 Final OVM contract address.\\n * @return Revertdata, if and only if the creation threw an exception.\\n */\\n function _createContract(\\n address _contractAddress,\\n bytes memory _bytecode\\n )\\n internal\\n returns (\\n address,\\n bytes memory\\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 the common logic which occurs between call-type and create-type messages,\\n // passing in the creation bytecode and `true` to trigger create-specific logic.\\n (bool success, bytes memory data) = _handleExternalMessage(\\n nextMessageContext,\\n gasleft(),\\n _contractAddress,\\n _bytecode,\\n true\\n );\\n\\n // Yellow paper requires that address returned is zero if the contract deployment fails.\\n return (\\n success ? _contractAddress : address(0),\\n data\\n );\\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 // EVM does not return data in the success case, see: https://github.com/ethereum/go-ethereum/blob/aae7660410f0ef90279e14afaaf2f429fdc2a186/core/vm/instructions.go#L600-L604\\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 _handleExternalMessage(\\n _nextMessageContext,\\n _gasLimit,\\n codeContractAddress,\\n _calldata,\\n false\\n );\\n }\\n\\n /**\\n * Handles all interactions which involve the execution manager calling out to untrusted code (both calls and creates).\\n * Ensures that OVM-related measures are enforced, including L2 gas refunds, nuisance gas, and flagged reversions.\\n *\\n * @param _nextMessageContext Message context to be used for the external message.\\n * @param _gasLimit Amount of gas to be passed into this message.\\n * @param _contract OVM address being called or deployed to\\n * @param _data Data for the message (either calldata or creation code)\\n * @param _isCreate Whether this is a create-type message.\\n * @return Whether or not the message (either a call or deployment) succeeded.\\n * @return Data returned by the message.\\n */\\n function _handleExternalMessage(\\n MessageContext memory _nextMessageContext,\\n uint256 _gasLimit,\\n address _contract,\\n bytes memory _data,\\n bool _isCreate\\n )\\n internal\\n returns (\\n bool,\\n bytes memory\\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. `_contract` 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\\n bool success;\\n bytes memory returndata;\\n if (_isCreate) {\\n // safeCREATE() is a function which replicates a CREATE message, but uses return values\\n // Which match that of CALL (i.e. bool, bytes). This allows many security checks to be\\n // to be shared between untrusted call and create call frames.\\n (success, returndata) = address(this).call(\\n abi.encodeWithSelector(\\n this.safeCREATE.selector,\\n _gasLimit,\\n _data,\\n _contract\\n )\\n );\\n } else {\\n (success, returndata) = _contract.call{gas: _gasLimit}(_data);\\n }\\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 (\\n flag == RevertFlag.INTENTIONAL_REVERT\\n || _isCreate\\n ) {\\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 * Handles the creation-specific safety measures required for OVM contract deployment.\\n * This function sanitizes the return types for creation messages to match calls (bool, bytes),\\n * by being an external function which the EM can call, that mimics the success/fail case of the CREATE.\\n * This allows for consistent handling of both types of messages in _handleExternalMessage().\\n * Having this step occur as a separate call frame also allows us to easily revert the\\n * contract deployment in the event that the code is unsafe.\\n *\\n * @param _gasLimit Amount of gas to be passed into this creation.\\n * @param _creationCode Code to pass into CREATE for deployment.\\n * @param _address OVM address being deployed to.\\n */\\n function safeCREATE(\\n uint _gasLimit,\\n bytes memory _creationCode,\\n address _address\\n )\\n external\\n {\\n // The only way this should callable is from within _createContract(),\\n // and it should DEFINITELY not be callable by a non-EM code contract.\\n if (msg.sender != address(this)) {\\n return;\\n }\\n // Check that there is not already code at this address.\\n if (_hasEmptyAccount(_address) == false) {\\n // Note: in the EVM, this case burns all allotted gas. For improved\\n // developer experience, we do return the remaining gas.\\n _revertWithFlag(\\n RevertFlag.CREATE_COLLISION,\\n Lib_ErrorUtils.encodeRevertString(\\\"A contract has already been deployed to this address\\\")\\n );\\n }\\n\\n // Check the creation bytecode against the OVM_SafetyChecker.\\n if (ovmSafetyChecker.isBytecodeSafe(_creationCode) == false) {\\n _revertWithFlag(\\n RevertFlag.UNSAFE_BYTECODE,\\n Lib_ErrorUtils.encodeRevertString(\\\"Contract creation code contains unsafe opcodes. Did you use the right compiler or pass an unsafe constructor argument?\\\")\\n );\\n }\\n\\n // We always need to initialize the contract with the default account values.\\n _initPendingAccount(_address);\\n\\n // Actually execute the EVM create message.\\n // NOTE: The inline assembly below means we can NOT make any evm calls between here and then.\\n address ethAddress = Lib_EthUtils.createContract(_creationCode);\\n\\n if (ethAddress == address(0)) {\\n // If the creation fails, the EVM lets us grab its revert data. This may contain a revert flag\\n // to be used above in _handleExternalMessage, so we pass the revert data back up unmodified.\\n assembly {\\n returndatacopy(0,0,returndatasize())\\n revert(0, returndatasize())\\n }\\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(\\n RevertFlag.UNSAFE_BYTECODE,\\n Lib_ErrorUtils.encodeRevertString(\\\"Constructor attempted to deploy unsafe bytecode.\\\")\\n );\\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 * 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 ) {\\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 view\\n {\\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 input values of a transaction.\\n * @return _valid Whether or not the transaction data is valid.\\n */\\n function _isValidInput(\\n Lib_OVMCodec.Transaction memory _transaction\\n )\\n view\\n internal\\n returns (\\n bool\\n )\\n {\\n // Prevent reentrancy to run():\\n // This check prevents calling run with the default ovmNumber.\\n // Combined with the first check in run():\\n // if (transactionContext.ovmNUMBER != DEFAULT_UINT256) { return; }\\n // It should be impossible to re-enter since run() returns before any other call frames are created.\\n // Since this value is already being written to storage, we save much gas compared to\\n // using the standard nonReentrant pattern.\\n if (_transaction.blockNumber == DEFAULT_UINT256) {\\n return false;\\n }\\n\\n if (_isValidGasLimit(_transaction.gasLimit, _transaction.l1QueueOrigin) == false) {\\n return false;\\n }\\n\\n return true;\\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 view\\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 = DEFAULT_ADDRESS;\\n transactionContext.ovmTIMESTAMP = DEFAULT_UINT256;\\n transactionContext.ovmNUMBER = DEFAULT_UINT256;\\n transactionContext.ovmGASLIMIT = DEFAULT_UINT256;\\n transactionContext.ovmTXGASLIMIT = DEFAULT_UINT256;\\n transactionContext.ovmL1QUEUEORIGIN = Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE;\\n\\n transactionRecord.ovmGasRefund = DEFAULT_UINT256;\\n\\n messageContext.ovmCALLER = DEFAULT_ADDRESS;\\n messageContext.ovmADDRESS = DEFAULT_ADDRESS;\\n messageContext.isStatic = false;\\n\\n messageRecord.nuisanceGasLeft = DEFAULT_UINT256;\\n\\n // Reset the ovmStateManager.\\n ovmStateManager = iOVM_StateManager(address(0));\\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 messageRecord.nuisanceGasLeft = uint(-1);\\n\\n messageContext.ovmADDRESS = _from;\\n\\n bool isCreate = _transaction.entrypoint == address(0);\\n if (isCreate) {\\n (address created, bytes memory revertData) = ovmCREATE(_transaction.data);\\n if (created == address(0)) {\\n return (false, revertData);\\n } else {\\n // The eth_call RPC endpoint for to = undefined will return the deployed bytecode\\n // in the success case, differing from standard create messages.\\n return (true, Lib_EthUtils.getCode(created));\\n }\\n } else {\\n return ovmCALL(\\n _transaction.gasLimit,\\n _transaction.entrypoint,\\n _transaction.data\\n );\\n }\\n }\\n}\\n\",\"keccak256\":\"0x229011db3d21b69e16814325f8e5debbdf6219b3dffb4011a24f2a6540a0d98e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/predeploys/OVM_DeployerWhitelist.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Interface Imports */\\nimport { iOVM_DeployerWhitelist } from \\\"../../iOVM/predeploys/iOVM_DeployerWhitelist.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: optimistic-solc\\n * Runtime target: OVM\\n */\\ncontract OVM_DeployerWhitelist is iOVM_DeployerWhitelist {\\n\\n /**********************\\n * Contract Constants *\\n **********************/\\n\\n bool public initialized;\\n bool public allowArbitraryDeployment;\\n address override public owner;\\n mapping (address => bool) public whitelist;\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Blocks functions to anyone except the contract owner.\\n */\\n modifier onlyOwner() {\\n require(\\n msg.sender == 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 if (initialized == true) {\\n return;\\n }\\n\\n initialized = true;\\n allowArbitraryDeployment = _allowArbitraryDeployment;\\n owner = _owner;\\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 whitelist[_deployer] = _isWhitelisted;\\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 owner = _owner;\\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 allowArbitraryDeployment = _allowArbitraryDeployment;\\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\\n )\\n {\\n return (\\n initialized == false\\n || allowArbitraryDeployment == true\\n || whitelist[_deployer]\\n );\\n }\\n}\\n\",\"keccak256\":\"0x371e3d3ca1dd4177738b55eead9ad6f8278280e568694df6b42ee01f5558ccb2\",\"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 OUT_OF_GAS,\\n INTENTIONAL_REVERT,\\n EXCEEDS_NUISANCE_GAS,\\n INVALID_STATE_ACCESS,\\n UNSAFE_BYTECODE,\\n CREATE_COLLISION,\\n STATIC_VIOLATION,\\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 }\\n\\n\\n /************************************\\n * Transaction Execution Entrypoint *\\n ************************************/\\n\\n function run(\\n Lib_OVMCodec.Transaction calldata _transaction,\\n address _txStateManager\\n ) external returns (bytes memory);\\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, bytes memory _revertdata);\\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract, bytes memory _revertdata);\\n\\n\\n /*******************************\\n * Account Abstraction Opcodes *\\n ******************************/\\n\\n function ovmGETNONCE() external returns (uint256 _nonce);\\n function ovmINCREMENTNONCE() 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 Context *\\n ***************************************/\\n\\n function getMaxTransactionGasLimit() external view returns (uint _maxTransactionGasLimit);\\n}\\n\",\"keccak256\":\"0xf023d5d6fc6a03bd52f7a57af6e21076de77e8925d065bb79db062e73e43b684\",\"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/predeploys/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 owner() 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\":\"0xdf1f27faf0d26d416bf6d408d146a16de32b4e1772a292c65d39eb7ec2b53ceb\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x2ce671a0e004df88b136bea5a3c59d0732cea8887c8496da1d509e0200b03d7d\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xa5195afe32fb2cf104d156e8f4bd39df1ec79bf6ba232097b9e8e0ee14fbc298\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_ErrorUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/**\\n * @title Lib_ErrorUtils\\n */\\nlibrary Lib_ErrorUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes an error string into raw solidity-style revert data.\\n * (i.e. ascii bytes, prefixed with bytes4(keccak(\\\"Error(string))\\\"))\\n * Ref: https://docs.soliditylang.org/en/v0.8.2/control-structures.html?highlight=Error(string)#panic-via-assert-and-error-via-require\\n * @param _reason Reason for the reversion.\\n * @return Standard solidity revert data for the given reason.\\n */\\n function encodeRevertString(\\n string memory _reason\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return abi.encodeWithSignature(\\n \\\"Error(string)\\\",\\n _reason\\n );\\n }\\n}\\n\",\"keccak256\":\"0xfc64ec4a81fb50865b502a0004ed154e8598e1a313db77303fc95e41f536e6b7\",\"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 *\\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 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\\n )\\n {\\n bytes memory code;\\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 Full code of the contract.\\n */\\n function getCode(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes memory\\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 Size of the contract's code in bytes.\\n */\\n function getCodeSize(\\n address _address\\n )\\n internal\\n view\\n returns (\\n uint256\\n )\\n {\\n uint256 codeSize;\\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 Hash of the contract's code.\\n */\\n function getCodeHash(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n bytes32 codeHash;\\n assembly {\\n codeHash := extcodehash(_address)\\n }\\n\\n return codeHash;\\n }\\n\\n /**\\n * Creates a contract with some given initialization code.\\n * @param _code Contract initialization code.\\n * @return Address of the created contract.\\n */\\n function createContract(\\n bytes memory _code\\n )\\n internal\\n returns (\\n address\\n )\\n {\\n address created;\\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 to be generated by CREATE.\\n */\\n function getAddressForCREATE(\\n address _creator,\\n uint256 _nonce\\n )\\n internal\\n pure\\n returns (\\n 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 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 (\\n address\\n )\\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\":\"0xf29a67d78e61cb472d524b779b32cfcb39a587f4096500d5419e6425ed367d49\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506040516200313838038062003138833981016040819052620000349162000292565b600080546001600160a01b0319166001600160a01b03851617905560408051808201909152601181527027ab26afa9b0b332ba3ca1b432b1b5b2b960791b60208201526200008290620000d7565b600180546001600160a01b0319166001600160a01b039290921691909117905581516003556020820151600455604082015160055560608201516006558051600755620000ce620001b9565b50505062000337565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015620001395781810151838201526020016200011f565b50505050905090810190601f168015620001675780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156200018557600080fd5b505afa1580156200019a573d6000803e3d6000fd5b505050506040513d6020811015620001b157600080fd5b505192915050565b600d80546001600160a01b031990811673defa017defa017defa017defa017defa017defa09081179092557fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d6009819055600a819055600b819055600c8190556008805460ff191690556010819055600e8054831684179055600f8054831690931760ff60a01b1916909255601191909155600280549091169055565b60006020828403121562000268578081fd5b604051602081016001600160401b03811182821017156200028557fe5b6040529151825250919050565b600080600083850360c0811215620002a8578384fd5b84516001600160a01b0381168114620002bf578485fd5b93506080601f1982011215620002d3578283fd5b50604051608081016001600160401b0381118282101715620002f157fe5b806040525060208501518152604085015160208201526060850151604082015260808501516060820152809250506200032e8560a0860162000256565b90509250925092565b612df180620003476000396000f3fe608060405234801561001057600080fd5b50600436106101c45760003560e01c80637cebbe94116100f957806399ccd98b11610097578063bdbf8c3611610071578063bdbf8c361461037e578063c1fb2ea214610386578063fcb6829b1461038e578063ffe73914146103a1576101c4565b806399ccd98b146103505780639be3ad67146103635780639dc9dc9314610376576101c4565b806385979f76116100d357806385979f761461031a5780638bb42e151461032d5780639058025614610340578063996d79a514610348576101c4565b80637cebbe94146102de5780638435035b146102e65780638540661f146102f9576101c4565b8063299ca478116101665780635a98c361116101405780635a98c3611461029b57806373509064146102a3578063741a33eb146102ab578063746c32f1146102be576101c4565b8063299ca478146102605780632a2a7adb14610275578063461a447814610288576101c4565b80631c4712a7116101a25780631c4712a71461022857806320160f3a1461023057806322bd64c01461023857806324749d5c1461024d576101c4565b806303daa959146101c9578063101185a4146101f257806314aa2ff714610207575b600080fd5b6101dc6101d73660046125d4565b6103b4565b6040516101e99190612a20565b60405180910390f35b6101fa6103f9565b6040516101e99190612b0b565b61021a610215366004612666565b610402565b6040516101e9929190612a9b565b6101dc61049a565b6101dc6104a0565b61024b610246366004612604565b6104a6565b005b6101dc61025b366004612548565b610509565b610268610524565b6040516101e99190612a29565b61024b610283366004612666565b610533565b610268610296366004612777565b610541565b6101dc61061d565b610268610623565b61024b6102b9366004612625565b610632565b6102d16102cc366004612580565b61079f565b6040516101e99190612af8565b61024b6107bc565b6101dc6102f4366004612548565b610813565b61030c61030736600461286c565b610826565b6040516101e9929190612abf565b61030c61032836600461286c565b61089f565b61030c61033b36600461280b565b6108ee565b6101dc6109c1565b6102686109c7565b61021a61035e366004612698565b6109d6565b6102d16103713660046127bc565b610a69565b610268610bcb565b6101dc610bda565b6101dc610be0565b61024b61039c3660046128c2565b610bf7565b61030c6103af36600461286c565b610de1565b6000619c4060005a905060006103c86109c7565b90506103d48186610e32565b93505060005a82039050808310156103f157601080548483030190555b505050919050565b60085460ff1690565b600f5460009060609060ff600160a01b9091041615156001141561042a5761042a6006610ec0565b619c4060005a9050600061043c6109c7565b905061044781610ed9565b600061045b8261045684610f5e565b610fe9565b90506104678188611083565b95509550505060005a8203905080831015610489576010805484019055610492565b60108054820190555b505050915091565b60045490565b600b5490565b600f5460ff600160a01b909104161515600114156104c8576104c86006610ec0565b61ea6060005a905060006104da6109c7565b90506104e7818686611109565b5060005a820390508083101561050257601080548483030190555b5050505050565b600061051c6105178361118b565b611216565b90505b919050565b6000546001600160a01b031681565b61053e60018261121a565b50565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156105a1578181015183820152602001610589565b50505050905090810190601f1680156105ce5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156105eb57600080fd5b505afa1580156105ff573d6000803e3d6000fd5b505050506040513d602081101561061557600080fd5b505192915050565b600a5490565b600e546001600160a01b031690565b600f5460ff600160a01b90910416151560011415610654576106546006610ec0565b600060018585601b0185856040516000815260200160405260405161067c9493929190612ada565b6020604051602081039080840390855afa15801561069e573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166106da576106da604051806060016040528060388152602001612caa60389139610533565b6106e381611230565b6106ed5750610799565b6106f6816112bb565b600f80546001600160a01b038381166001600160a01b031983161790925516600061075361072f6009602160991b01836102cc82610813565b60405160200161073f91906129ea565b604051602081830303815290604052611322565b600f80546001600160a01b0319166001600160a01b038516179055905061078a838261077e81611335565b8051906020012061134b565b610795836000611388565b5050505b50505050565b60606107b46107ad8561118b565b84846113f9565b949350505050565b600f5460ff600160a01b909104161515600114156107de576107de6006610ec0565b60006107e86109c7565b905060006107f582610f5e565b90508081600101111561080f5761080f8282600101611388565b5050565b600061051c6108218361118b565b61141d565b600060606201388060005a60408051606081018252600f546001600160a01b0390811682528916602082015260019181019190915290915061086a81898989611421565b945094505060005a820390508083101561088b576010805484019055610894565b60108054820190555b505050935093915050565b60006060620186a060005a60408051606081018252600f5460ff600160a01b8204161515928201929092526001600160a01b039182168152908816602082015290915061086a81898989611421565b6000606033156108fd57600080fd5b600280546001600160a01b0319166001600160a01b038516179055610921856114b2565b600019601155600f80546001600160a01b0319166001600160a01b038681169190911790915560808601511615801561099c576000806109648860c00151610402565b90925090506001600160a01b038216610985576000945092506109b9915050565b600161099083611335565b945094505050506109b9565b6109b38660a0015187608001518860c0015161089f565b92509250505b935093915050565b60075490565b600f546001600160a01b031690565b600f5460009060609060ff600160a01b909104161515600114156109fe576109fe6006610ec0565b619c4060005a90506000610a106109c7565b9050610a1b81610ed9565b6000610a28828989611524565b9050610a348189611083565b95509550505060005a8203905080831015610a56576010805484019055610a5f565b60108054820190555b5050509250929050565b600a546060907fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d14610aaa5750604080516020810190915260008152610bc5565b600280546001600160a01b0319166001600160a01b038481169190911791829055604051630d15d41560e41b815291169063d15d415090610aef903390600401612a29565b60206040518083038186803b158015610b0757600080fd5b505afa158015610b1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3f91906125b4565b610b645760405162461bcd60e51b8152600401610b5b90612b87565b60405180910390fd5b610b6d836114b2565b610b768361156a565b610b9757610b826115c6565b50604080516020810190915260008152610bc5565b6000610bb76003600001548560a001510385608001518660c0015161089f565b915050610bc26115c6565b90505b92915050565b600d546001600160a01b031690565b60095490565b6000610bf2610bed6109c7565b610f5e565b905090565b333014610c0357610ddc565b610c0c81611230565b610c3b57610c3b6005610c36604051806060016040528060348152602001612d5860349139611663565b61121a565b6001546040516352275acd60e11b81526001600160a01b039091169063a44eb59a90610c6b908590600401612af8565b60206040518083038186803b158015610c8357600080fd5b505afa158015610c97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cbb91906125b4565b610ce557610ce56004610c366040518060a0016040528060768152602001612ce260769139611663565b610cee816112bb565b6000610cf983611322565b90506001600160a01b038116610d13573d6000803e3d6000fd5b6000610d1e82611335565b6001546040516352275acd60e11b81529192506001600160a01b03169063a44eb59a90610d4f908490600401612af8565b60206040518083038186803b158015610d6757600080fd5b505afa158015610d7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9f91906125b4565b610dc957610dc96004610c36604051806060016040528060308152602001612d8c60309139611663565b6105028383610dd785611216565b61134b565b505050565b60006060619c4060005a60408051606081018252600e546001600160a01b039081168252600f549081166020830152600160a01b900460ff1615159181019190915290915061086a81898989611421565b6000610e3e83836116a6565b600254604051631aaf392f60e01b81526001600160a01b0390911690631aaf392f90610e709086908690600401612a61565b60206040518083038186803b158015610e8857600080fd5b505afa158015610e9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc291906125ec565b61053e816040518060200160405280600081525061121a565b600080610f285a6002602160991b0185604051602401610ef99190612a29565b60408051601f198184030181529190526020810180516001600160e01b031663b1540a0160e01b17905261089f565b91509150600081806020019051810190610f4291906125b4565b9050801580610f4f575082155b15610799576107996007610ec0565b6000610f69826117e1565b60025460405163d126199f60e01b81526001600160a01b039091169063d126199f90610f99908590600401612a29565b60206040518083038186803b158015610fb157600080fd5b505afa158015610fc5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051c91906125ec565b60408051600280825260608201909252600091829190816020015b606081526020019060019003908161100457905050905061102484611928565b8160008151811061103157fe5b602002602001018190525061104583611952565b8160018151811061105257fe5b6020026020010181905250600061106882611965565b905061107a81805190602001206119a9565b95945050505050565b600060606110a56110926109c7565b61109d610bed6109c7565b600101611388565b60408051606081018252600f5460ff600160a01b8204161515928201929092526001600160a01b03918216815290851660208201526000806110eb835a898960016119ac565b91509150816110fb5760006110fd565b865b97909650945050505050565b806111148484610e32565b141561111f57610ddc565b6111298383611c1a565b600254604051635c17d62960e01b81526001600160a01b0390911690635c17d6299061115d90869086908690600401612a7a565b600060405180830381600087803b15801561117757600080fd5b505af1158015610795573d6000803e3d6000fd5b6000611196826117e1565b600254604051637c8ee70360e01b81526001600160a01b0390911690637c8ee703906111c6908590600401612a29565b60206040518083038186803b1580156111de57600080fd5b505afa1580156111f2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051c9190612564565b3f90565b60006112268383611d2c565b9050805160208201fd5b600061123b826117e1565b6002546040516307a1294560e01b81526001600160a01b03909116906307a129459061126b908590600401612a29565b60206040518083038186803b15801561128357600080fd5b505afa158015611297573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051c91906125b4565b6112c4816117e1565b600254604051637e78a4d160e11b81526001600160a01b039091169063fcf149a2906112f4908490600401612a29565b600060405180830381600087803b15801561130e57600080fd5b505af1158015610502573d6000803e3d6000fd5b6000808251602084016000f09392505050565b606061051c8260006113468561141d565b6113f9565b61135483611dd5565b6002546040516368510af960e11b81526001600160a01b039091169063d0a215f29061115d90869086908690600401612a3d565b61139182611dd5565b6002546040516374855dc360e11b81526001600160a01b039091169063e90abb86906113c39085908590600401612a61565b600060405180830381600087803b1580156113dd57600080fd5b505af11580156113f1573d6000803e3d6000fd5b505050505050565b6060806040519050602083018101604052828152828460208301873c949350505050565b3b90565b6000606073ffffffffffffffffffffffffffffffffffff0000841673deaddeaddeaddeaddeaddeaddeaddeaddead000014156114705750506040805160208101909152600081526001906114a9565b60006064856001600160a01b0316106114915761148c8561118b565b611493565b845b90506114a38787838760006119ac565b92509250505b94509492505050565b80516009556020810151600a5560a0810151600c5560408101516008805460ff1916600183818111156114e157fe5b02179055506060810151600d80546001600160a01b0319166001600160a01b03909216919091179055600554600b5560a081015161151e90611ee4565b60115550565b60008060ff60f81b858486805190602001206040516020016115499493929190612966565b60405160208183030381529060405280519060200120905061107a816119a9565b60007fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d826020015114156115a05750600061051f565b6115b28260a001518360400151611ef7565b6115be5750600061051f565b506001919050565b600d80546001600160a01b031990811673defa017defa017defa017defa017defa017defa09081179092557fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d6009819055600a819055600b819055600c8190556008805460ff191690556010819055600e8054831684179055600f8054831690931760ff60a01b1916909255601191909155600280549091169055565b6060816040516024016116769190612af8565b60408051601f198184030181529190526020810180516001600160e01b031662461bcd60e51b1790529050919050565b6175305a10156116ba576116ba6000610ec0565b600254604051630ad2267960e01b81526001600160a01b0390911690630ad22679906116ec9085908590600401612a61565b60206040518083038186803b15801561170457600080fd5b505afa158015611718573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061173c91906125b4565b61174a5761174a6003610ec0565b600254604051632bcdee1960e21b81526000916001600160a01b03169063af37b8649061177d9086908690600401612a61565b602060405180830381600087803b15801561179757600080fd5b505af11580156117ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117cf91906125b4565b905080610ddc57610ddc614e20611f27565b6175305a10156117f5576117f56000610ec0565b60025460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf90611825908490600401612a29565b60206040518083038186803b15801561183d57600080fd5b505afa158015611851573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061187591906125b4565b611883576118836003610ec0565b600254604051633ecdecc760e21b81526000916001600160a01b03169063fb37b31c906118b4908590600401612a29565b602060405180830381600087803b1580156118ce57600080fd5b505af11580156118e2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061190691906125b4565b90508061080f5761080f61753060646119216108218661118b565b0201611f27565b606061051c8260405160200161193e9190612949565b604051602081830303815290604052611f47565b606061051c61196083611f99565b611f47565b606060006119728361209d565b9050611980815160c061219d565b816040516020016119929291906129bb565b604051602081830303815290604052915050919050565b90565b6040805160608082018352600e546001600160a01b039081168352600f549081166020840152600160a01b900460ff16151592820192909252600091906119f381896122ed565b6011546000611a0189611ee4565b60118190559050600060608715611abd57604051309063fcb6829b60e01b90611a32908e908d908f90602401612bf3565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051611a70919061299f565b6000604051808303816000865af19150503d8060008114611aad576040519150601f19603f3d011682016040523d82523d6000602084013e611ab2565b606091505b509092509050611b20565b896001600160a01b03168b8a604051611ad6919061299f565b60006040518083038160008787f1925050503d8060008114611b14576040519150601f19603f3d011682016040523d82523d6000602084013e611b19565b606091505b5090925090505b611b2a8c866122ed565b60115482611c0257600080600080611b41866123a1565b929650909450925090506003846007811115611b5957fe5b1415611b6857611b6884610ec0565b6001846007811115611b7657fe5b1480611b8d57506004846007811115611b8b57fe5b145b80611ba357506006846007811115611ba157fe5b145b80611bb957506007846007811115611bb757fe5b145b15611bc45760108290555b6001846007811115611bd257fe5b1480611bdb57508c5b15611be857809550611bfb565b6040518060200160405280600081525095505b5090925050505b90920390920360115590999098509650505050505050565b611c2482826116a6565b60025460405163af3dc01160e01b81526000916001600160a01b03169063af3dc01190611c579086908690600401612a61565b602060405180830381600087803b158015611c7157600080fd5b505af1158015611c85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ca991906125b4565b905080610ddc57611cb983611dd5565b600260009054906101000a90046001600160a01b03166001600160a01b031663c3fd9b256040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611d0957600080fd5b505af1158015611d1d573d6000803e3d6000fd5b50505050610ddc614e20611f27565b60606000836007811115611d3c57fe5b1415611d575750604080516020810190915260008152610bc5565b6003836007811115611d6557fe5b1415611da357604080516020808201835260008083529251611d8d9387939092839201612b1f565b6040516020818303038152906040529050610bc5565b601154601054604051611dbe92869290918690602001612b5b565b604051602081830303815290604052905092915050565b611dde816117e1565b60025460405163011b1f7960e41b81526000916001600160a01b0316906311b1f79090611e0f908590600401612a29565b602060405180830381600087803b158015611e2957600080fd5b505af1158015611e3d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e6191906125b4565b90508061080f57600260009054906101000a90046001600160a01b03166001600160a01b03166333f943056040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611eb857600080fd5b505af1158015611ecc573d6000803e3d6000fd5b5050505061080f61753060646119216108218661118b565b60005a8210611ef3575a61051c565b5090565b600454600090831115611f0c57506000610bc5565b600354831015611f1e57506000610bc5565b50600192915050565b601154811115611f3b57611f3b6002610ec0565b60118054919091039055565b60608082516001148015611f6f5750608083600081518110611f6557fe5b016020015160f81c105b15611f7b57508161051c565b611f878351608061219d565b83604051602001611dbe9291906129bb565b6060600082604051602001611fae9190612a20565b604051602081830303815290604052905060005b6020811015611ff857818181518110611fd757fe5b01602001516001600160f81b03191615611ff057611ff8565b600101611fc2565b6000816020036001600160401b038111801561201357600080fd5b506040519080825280601f01601f19166020018201604052801561203e576020820181803683370190505b50905060005b815181101561209457835160018401938591811061205e57fe5b602001015160f81c60f81b82828151811061207557fe5b60200101906001600160f81b031916908160001a905350600101612044565b50949350505050565b60608151600014156120be575060408051600081526020810190915261051f565b6000805b83518110156120f1578381815181106120d757fe5b6020026020010151518201915080806001019150506120c2565b6000826001600160401b038111801561210957600080fd5b506040519080825280601f01601f191660200182016040528015612134576020820181803683370190505b50600092509050602081015b855183101561209457600086848151811061215757fe5b602002602001015190506000602082019050612175838284516123f4565b87858151811061218157fe5b6020026020010151518301925050508280600101935050612140565b60608060388410156121f7576040805160018082528183019092529060208201818036833701905050905082840160f81b816000815181106121db57fe5b60200101906001600160f81b031916908160001a905350610bc2565b600060015b80868161220557fe5b041561221a57600190910190610100026121fc565b816001016001600160401b038111801561223357600080fd5b506040519080825280601f01601f19166020018201604052801561225e576020820181803683370190505b50925084820160370160f81b8360008151811061227757fe5b60200101906001600160f81b031916908160001a905350600190505b8181116122e3576101008183036101000a87816122ac57fe5b04816122b457fe5b0660f81b8382815181106122c457fe5b60200101906001600160f81b031916908160001a905350600101612293565b5050905092915050565b805182516001600160a01b03908116911614612325578051600e80546001600160a01b0319166001600160a01b039092169190911790555b80602001516001600160a01b031682602001516001600160a01b03161461236b576020810151600f80546001600160a01b0319166001600160a01b039092169190911790555b80604001511515826040015115151461080f5760400151600f8054911515600160a01b0260ff60a01b1990921691909117905550565b600080600060608451600014156123d057505060408051602081019091526000808252925082915081906123ed565b848060200190518101906123e491906126da565b93509350935093505b9193509193565b8282825b60208110612417578151835260209283019290910190601f19016123f8565b905182516020929092036101000a6000190180199091169116179052505050565b600061244b61244684612c47565b612c24565b905082815283838301111561245f57600080fd5b828260208301376000602084830101529392505050565b803561051f81612c94565b600082601f830112612491578081fd5b610bc283833560208501612438565b80356002811061051f57600080fd5b600060e082840312156124c0578081fd5b6124ca60e0612c24565b905081358152602082013560208201526124e6604083016124a0565b60408201526124f760608301612476565b606082015261250860808301612476565b608082015260a082013560a082015260c08201356001600160401b0381111561253057600080fd5b61253c84828501612481565b60c08301525092915050565b600060208284031215612559578081fd5b8135610bc281612c94565b600060208284031215612575578081fd5b8151610bc281612c94565b600080600060608486031215612594578182fd5b833561259f81612c94565b95602085013595506040909401359392505050565b6000602082840312156125c5578081fd5b81518015158114610bc2578182fd5b6000602082840312156125e5578081fd5b5035919050565b6000602082840312156125fd578081fd5b5051919050565b60008060408385031215612616578182fd5b50508035926020909101359150565b6000806000806080858703121561263a578081fd5b84359350602085013560ff81168114612651578182fd5b93969395505050506040820135916060013590565b600060208284031215612677578081fd5b81356001600160401b0381111561268c578182fd5b6107b484828501612481565b600080604083850312156126aa578182fd5b82356001600160401b038111156126bf578283fd5b6126cb85828601612481565b95602094909401359450505050565b600080600080608085870312156126ef578182fd5b8451600881106126fd578283fd5b80945050602085015192506040850151915060608501516001600160401b03811115612727578182fd5b8501601f81018713612737578182fd5b805161274561244682612c47565b818152886020838501011115612759578384fd5b61276a826020830160208601612c68565b9598949750929550505050565b600060208284031215612788578081fd5b81356001600160401b0381111561279d578182fd5b8201601f810184136127ad578182fd5b6107b484823560208401612438565b600080604083850312156127ce578182fd5b82356001600160401b038111156127e3578283fd5b6127ef858286016124af565b925050602083013561280081612c94565b809150509250929050565b60008060006060848603121561281f578081fd5b83356001600160401b03811115612834578182fd5b612840868287016124af565b935050602084013561285181612c94565b9150604084013561286181612c94565b809150509250925092565b600080600060608486031215612880578081fd5b83359250602084013561289281612c94565b915060408401356001600160401b038111156128ac578182fd5b6128b886828701612481565b9150509250925092565b6000806000606084860312156128d6578081fd5b8335925060208401356001600160401b038111156128f2578182fd5b6128fe86828701612481565b925050604084013561286181612c94565b60008151808452612927816020860160208601612c68565b601f01601f19169290920160200192915050565b6008811061294557fe5b9052565b60609190911b6bffffffffffffffffffffffff1916815260140190565b6001600160f81b031994909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b600082516129b1818460208701612c68565b9190910192915050565b600083516129cd818460208801612c68565b8351908301906129e1818360208801612c68565b01949350505050565b6c600d380380600d6000396000f360981b81528151600090612a1381600d850160208701612c68565b91909101600d0192915050565b90815260200190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b03831681526040602082018190526000906107b49083018461290f565b60008315158252604060208301526107b4604083018461290f565b93845260ff9290921660208401526040830152606082015260800190565b600060208252610bc2602083018461290f565b6020810160028310612b1957fe5b91905290565b6000612b2b828761293b565b60ff8516602083015260ff8416604083015260806060830152612b51608083018461290f565b9695505050505050565b6000612b67828761293b565b84602083015283604083015260806060830152612b51608083018461290f565b60208082526046908201527f4f6e6c792061757468656e746963617465642061646472657373657320696e2060408201527f6f766d53746174654d616e616765722063616e2063616c6c20746869732066756060820152653731ba34b7b760d11b608082015260a00190565b600084825260606020830152612c0c606083018561290f565b905060018060a01b0383166040830152949350505050565b6040518181016001600160401b0381118282101715612c3f57fe5b604052919050565b60006001600160401b03821115612c5a57fe5b50601f01601f191660200190565b60005b83811015612c83578181015183820152602001612c6b565b838111156107995750506000910152565b6001600160a01b038116811461053e57600080fdfe5369676e61747572652070726f766964656420666f7220454f4120636f6e7472616374206372656174696f6e20697320696e76616c69642e436f6e7472616374206372656174696f6e20636f646520636f6e7461696e7320756e73616665206f70636f6465732e2044696420796f75207573652074686520726967687420636f6d70696c6572206f72207061737320616e20756e7361666520636f6e7374727563746f7220617267756d656e743f4120636f6e74726163742068617320616c7265616479206265656e206465706c6f79656420746f20746869732061646472657373436f6e7374727563746f7220617474656d7074656420746f206465706c6f7920756e736166652062797465636f64652ea2646970667358221220ba09f3066e98cffa8b50d7fb9822c62cac7bc36099454fe6dbe318573486c14d64736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101c45760003560e01c80637cebbe94116100f957806399ccd98b11610097578063bdbf8c3611610071578063bdbf8c361461037e578063c1fb2ea214610386578063fcb6829b1461038e578063ffe73914146103a1576101c4565b806399ccd98b146103505780639be3ad67146103635780639dc9dc9314610376576101c4565b806385979f76116100d357806385979f761461031a5780638bb42e151461032d5780639058025614610340578063996d79a514610348576101c4565b80637cebbe94146102de5780638435035b146102e65780638540661f146102f9576101c4565b8063299ca478116101665780635a98c361116101405780635a98c3611461029b57806373509064146102a3578063741a33eb146102ab578063746c32f1146102be576101c4565b8063299ca478146102605780632a2a7adb14610275578063461a447814610288576101c4565b80631c4712a7116101a25780631c4712a71461022857806320160f3a1461023057806322bd64c01461023857806324749d5c1461024d576101c4565b806303daa959146101c9578063101185a4146101f257806314aa2ff714610207575b600080fd5b6101dc6101d73660046125d4565b6103b4565b6040516101e99190612a20565b60405180910390f35b6101fa6103f9565b6040516101e99190612b0b565b61021a610215366004612666565b610402565b6040516101e9929190612a9b565b6101dc61049a565b6101dc6104a0565b61024b610246366004612604565b6104a6565b005b6101dc61025b366004612548565b610509565b610268610524565b6040516101e99190612a29565b61024b610283366004612666565b610533565b610268610296366004612777565b610541565b6101dc61061d565b610268610623565b61024b6102b9366004612625565b610632565b6102d16102cc366004612580565b61079f565b6040516101e99190612af8565b61024b6107bc565b6101dc6102f4366004612548565b610813565b61030c61030736600461286c565b610826565b6040516101e9929190612abf565b61030c61032836600461286c565b61089f565b61030c61033b36600461280b565b6108ee565b6101dc6109c1565b6102686109c7565b61021a61035e366004612698565b6109d6565b6102d16103713660046127bc565b610a69565b610268610bcb565b6101dc610bda565b6101dc610be0565b61024b61039c3660046128c2565b610bf7565b61030c6103af36600461286c565b610de1565b6000619c4060005a905060006103c86109c7565b90506103d48186610e32565b93505060005a82039050808310156103f157601080548483030190555b505050919050565b60085460ff1690565b600f5460009060609060ff600160a01b9091041615156001141561042a5761042a6006610ec0565b619c4060005a9050600061043c6109c7565b905061044781610ed9565b600061045b8261045684610f5e565b610fe9565b90506104678188611083565b95509550505060005a8203905080831015610489576010805484019055610492565b60108054820190555b505050915091565b60045490565b600b5490565b600f5460ff600160a01b909104161515600114156104c8576104c86006610ec0565b61ea6060005a905060006104da6109c7565b90506104e7818686611109565b5060005a820390508083101561050257601080548483030190555b5050505050565b600061051c6105178361118b565b611216565b90505b919050565b6000546001600160a01b031681565b61053e60018261121a565b50565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156105a1578181015183820152602001610589565b50505050905090810190601f1680156105ce5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156105eb57600080fd5b505afa1580156105ff573d6000803e3d6000fd5b505050506040513d602081101561061557600080fd5b505192915050565b600a5490565b600e546001600160a01b031690565b600f5460ff600160a01b90910416151560011415610654576106546006610ec0565b600060018585601b0185856040516000815260200160405260405161067c9493929190612ada565b6020604051602081039080840390855afa15801561069e573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166106da576106da604051806060016040528060388152602001612caa60389139610533565b6106e381611230565b6106ed5750610799565b6106f6816112bb565b600f80546001600160a01b038381166001600160a01b031983161790925516600061075361072f6009602160991b01836102cc82610813565b60405160200161073f91906129ea565b604051602081830303815290604052611322565b600f80546001600160a01b0319166001600160a01b038516179055905061078a838261077e81611335565b8051906020012061134b565b610795836000611388565b5050505b50505050565b60606107b46107ad8561118b565b84846113f9565b949350505050565b600f5460ff600160a01b909104161515600114156107de576107de6006610ec0565b60006107e86109c7565b905060006107f582610f5e565b90508081600101111561080f5761080f8282600101611388565b5050565b600061051c6108218361118b565b61141d565b600060606201388060005a60408051606081018252600f546001600160a01b0390811682528916602082015260019181019190915290915061086a81898989611421565b945094505060005a820390508083101561088b576010805484019055610894565b60108054820190555b505050935093915050565b60006060620186a060005a60408051606081018252600f5460ff600160a01b8204161515928201929092526001600160a01b039182168152908816602082015290915061086a81898989611421565b6000606033156108fd57600080fd5b600280546001600160a01b0319166001600160a01b038516179055610921856114b2565b600019601155600f80546001600160a01b0319166001600160a01b038681169190911790915560808601511615801561099c576000806109648860c00151610402565b90925090506001600160a01b038216610985576000945092506109b9915050565b600161099083611335565b945094505050506109b9565b6109b38660a0015187608001518860c0015161089f565b92509250505b935093915050565b60075490565b600f546001600160a01b031690565b600f5460009060609060ff600160a01b909104161515600114156109fe576109fe6006610ec0565b619c4060005a90506000610a106109c7565b9050610a1b81610ed9565b6000610a28828989611524565b9050610a348189611083565b95509550505060005a8203905080831015610a56576010805484019055610a5f565b60108054820190555b5050509250929050565b600a546060907fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d14610aaa5750604080516020810190915260008152610bc5565b600280546001600160a01b0319166001600160a01b038481169190911791829055604051630d15d41560e41b815291169063d15d415090610aef903390600401612a29565b60206040518083038186803b158015610b0757600080fd5b505afa158015610b1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3f91906125b4565b610b645760405162461bcd60e51b8152600401610b5b90612b87565b60405180910390fd5b610b6d836114b2565b610b768361156a565b610b9757610b826115c6565b50604080516020810190915260008152610bc5565b6000610bb76003600001548560a001510385608001518660c0015161089f565b915050610bc26115c6565b90505b92915050565b600d546001600160a01b031690565b60095490565b6000610bf2610bed6109c7565b610f5e565b905090565b333014610c0357610ddc565b610c0c81611230565b610c3b57610c3b6005610c36604051806060016040528060348152602001612d5860349139611663565b61121a565b6001546040516352275acd60e11b81526001600160a01b039091169063a44eb59a90610c6b908590600401612af8565b60206040518083038186803b158015610c8357600080fd5b505afa158015610c97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cbb91906125b4565b610ce557610ce56004610c366040518060a0016040528060768152602001612ce260769139611663565b610cee816112bb565b6000610cf983611322565b90506001600160a01b038116610d13573d6000803e3d6000fd5b6000610d1e82611335565b6001546040516352275acd60e11b81529192506001600160a01b03169063a44eb59a90610d4f908490600401612af8565b60206040518083038186803b158015610d6757600080fd5b505afa158015610d7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9f91906125b4565b610dc957610dc96004610c36604051806060016040528060308152602001612d8c60309139611663565b6105028383610dd785611216565b61134b565b505050565b60006060619c4060005a60408051606081018252600e546001600160a01b039081168252600f549081166020830152600160a01b900460ff1615159181019190915290915061086a81898989611421565b6000610e3e83836116a6565b600254604051631aaf392f60e01b81526001600160a01b0390911690631aaf392f90610e709086908690600401612a61565b60206040518083038186803b158015610e8857600080fd5b505afa158015610e9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc291906125ec565b61053e816040518060200160405280600081525061121a565b600080610f285a6002602160991b0185604051602401610ef99190612a29565b60408051601f198184030181529190526020810180516001600160e01b031663b1540a0160e01b17905261089f565b91509150600081806020019051810190610f4291906125b4565b9050801580610f4f575082155b15610799576107996007610ec0565b6000610f69826117e1565b60025460405163d126199f60e01b81526001600160a01b039091169063d126199f90610f99908590600401612a29565b60206040518083038186803b158015610fb157600080fd5b505afa158015610fc5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051c91906125ec565b60408051600280825260608201909252600091829190816020015b606081526020019060019003908161100457905050905061102484611928565b8160008151811061103157fe5b602002602001018190525061104583611952565b8160018151811061105257fe5b6020026020010181905250600061106882611965565b905061107a81805190602001206119a9565b95945050505050565b600060606110a56110926109c7565b61109d610bed6109c7565b600101611388565b60408051606081018252600f5460ff600160a01b8204161515928201929092526001600160a01b03918216815290851660208201526000806110eb835a898960016119ac565b91509150816110fb5760006110fd565b865b97909650945050505050565b806111148484610e32565b141561111f57610ddc565b6111298383611c1a565b600254604051635c17d62960e01b81526001600160a01b0390911690635c17d6299061115d90869086908690600401612a7a565b600060405180830381600087803b15801561117757600080fd5b505af1158015610795573d6000803e3d6000fd5b6000611196826117e1565b600254604051637c8ee70360e01b81526001600160a01b0390911690637c8ee703906111c6908590600401612a29565b60206040518083038186803b1580156111de57600080fd5b505afa1580156111f2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051c9190612564565b3f90565b60006112268383611d2c565b9050805160208201fd5b600061123b826117e1565b6002546040516307a1294560e01b81526001600160a01b03909116906307a129459061126b908590600401612a29565b60206040518083038186803b15801561128357600080fd5b505afa158015611297573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051c91906125b4565b6112c4816117e1565b600254604051637e78a4d160e11b81526001600160a01b039091169063fcf149a2906112f4908490600401612a29565b600060405180830381600087803b15801561130e57600080fd5b505af1158015610502573d6000803e3d6000fd5b6000808251602084016000f09392505050565b606061051c8260006113468561141d565b6113f9565b61135483611dd5565b6002546040516368510af960e11b81526001600160a01b039091169063d0a215f29061115d90869086908690600401612a3d565b61139182611dd5565b6002546040516374855dc360e11b81526001600160a01b039091169063e90abb86906113c39085908590600401612a61565b600060405180830381600087803b1580156113dd57600080fd5b505af11580156113f1573d6000803e3d6000fd5b505050505050565b6060806040519050602083018101604052828152828460208301873c949350505050565b3b90565b6000606073ffffffffffffffffffffffffffffffffffff0000841673deaddeaddeaddeaddeaddeaddeaddeaddead000014156114705750506040805160208101909152600081526001906114a9565b60006064856001600160a01b0316106114915761148c8561118b565b611493565b845b90506114a38787838760006119ac565b92509250505b94509492505050565b80516009556020810151600a5560a0810151600c5560408101516008805460ff1916600183818111156114e157fe5b02179055506060810151600d80546001600160a01b0319166001600160a01b03909216919091179055600554600b5560a081015161151e90611ee4565b60115550565b60008060ff60f81b858486805190602001206040516020016115499493929190612966565b60405160208183030381529060405280519060200120905061107a816119a9565b60007fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d826020015114156115a05750600061051f565b6115b28260a001518360400151611ef7565b6115be5750600061051f565b506001919050565b600d80546001600160a01b031990811673defa017defa017defa017defa017defa017defa09081179092557fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d6009819055600a819055600b819055600c8190556008805460ff191690556010819055600e8054831684179055600f8054831690931760ff60a01b1916909255601191909155600280549091169055565b6060816040516024016116769190612af8565b60408051601f198184030181529190526020810180516001600160e01b031662461bcd60e51b1790529050919050565b6175305a10156116ba576116ba6000610ec0565b600254604051630ad2267960e01b81526001600160a01b0390911690630ad22679906116ec9085908590600401612a61565b60206040518083038186803b15801561170457600080fd5b505afa158015611718573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061173c91906125b4565b61174a5761174a6003610ec0565b600254604051632bcdee1960e21b81526000916001600160a01b03169063af37b8649061177d9086908690600401612a61565b602060405180830381600087803b15801561179757600080fd5b505af11580156117ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117cf91906125b4565b905080610ddc57610ddc614e20611f27565b6175305a10156117f5576117f56000610ec0565b60025460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf90611825908490600401612a29565b60206040518083038186803b15801561183d57600080fd5b505afa158015611851573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061187591906125b4565b611883576118836003610ec0565b600254604051633ecdecc760e21b81526000916001600160a01b03169063fb37b31c906118b4908590600401612a29565b602060405180830381600087803b1580156118ce57600080fd5b505af11580156118e2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061190691906125b4565b90508061080f5761080f61753060646119216108218661118b565b0201611f27565b606061051c8260405160200161193e9190612949565b604051602081830303815290604052611f47565b606061051c61196083611f99565b611f47565b606060006119728361209d565b9050611980815160c061219d565b816040516020016119929291906129bb565b604051602081830303815290604052915050919050565b90565b6040805160608082018352600e546001600160a01b039081168352600f549081166020840152600160a01b900460ff16151592820192909252600091906119f381896122ed565b6011546000611a0189611ee4565b60118190559050600060608715611abd57604051309063fcb6829b60e01b90611a32908e908d908f90602401612bf3565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051611a70919061299f565b6000604051808303816000865af19150503d8060008114611aad576040519150601f19603f3d011682016040523d82523d6000602084013e611ab2565b606091505b509092509050611b20565b896001600160a01b03168b8a604051611ad6919061299f565b60006040518083038160008787f1925050503d8060008114611b14576040519150601f19603f3d011682016040523d82523d6000602084013e611b19565b606091505b5090925090505b611b2a8c866122ed565b60115482611c0257600080600080611b41866123a1565b929650909450925090506003846007811115611b5957fe5b1415611b6857611b6884610ec0565b6001846007811115611b7657fe5b1480611b8d57506004846007811115611b8b57fe5b145b80611ba357506006846007811115611ba157fe5b145b80611bb957506007846007811115611bb757fe5b145b15611bc45760108290555b6001846007811115611bd257fe5b1480611bdb57508c5b15611be857809550611bfb565b6040518060200160405280600081525095505b5090925050505b90920390920360115590999098509650505050505050565b611c2482826116a6565b60025460405163af3dc01160e01b81526000916001600160a01b03169063af3dc01190611c579086908690600401612a61565b602060405180830381600087803b158015611c7157600080fd5b505af1158015611c85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ca991906125b4565b905080610ddc57611cb983611dd5565b600260009054906101000a90046001600160a01b03166001600160a01b031663c3fd9b256040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611d0957600080fd5b505af1158015611d1d573d6000803e3d6000fd5b50505050610ddc614e20611f27565b60606000836007811115611d3c57fe5b1415611d575750604080516020810190915260008152610bc5565b6003836007811115611d6557fe5b1415611da357604080516020808201835260008083529251611d8d9387939092839201612b1f565b6040516020818303038152906040529050610bc5565b601154601054604051611dbe92869290918690602001612b5b565b604051602081830303815290604052905092915050565b611dde816117e1565b60025460405163011b1f7960e41b81526000916001600160a01b0316906311b1f79090611e0f908590600401612a29565b602060405180830381600087803b158015611e2957600080fd5b505af1158015611e3d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e6191906125b4565b90508061080f57600260009054906101000a90046001600160a01b03166001600160a01b03166333f943056040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611eb857600080fd5b505af1158015611ecc573d6000803e3d6000fd5b5050505061080f61753060646119216108218661118b565b60005a8210611ef3575a61051c565b5090565b600454600090831115611f0c57506000610bc5565b600354831015611f1e57506000610bc5565b50600192915050565b601154811115611f3b57611f3b6002610ec0565b60118054919091039055565b60608082516001148015611f6f5750608083600081518110611f6557fe5b016020015160f81c105b15611f7b57508161051c565b611f878351608061219d565b83604051602001611dbe9291906129bb565b6060600082604051602001611fae9190612a20565b604051602081830303815290604052905060005b6020811015611ff857818181518110611fd757fe5b01602001516001600160f81b03191615611ff057611ff8565b600101611fc2565b6000816020036001600160401b038111801561201357600080fd5b506040519080825280601f01601f19166020018201604052801561203e576020820181803683370190505b50905060005b815181101561209457835160018401938591811061205e57fe5b602001015160f81c60f81b82828151811061207557fe5b60200101906001600160f81b031916908160001a905350600101612044565b50949350505050565b60608151600014156120be575060408051600081526020810190915261051f565b6000805b83518110156120f1578381815181106120d757fe5b6020026020010151518201915080806001019150506120c2565b6000826001600160401b038111801561210957600080fd5b506040519080825280601f01601f191660200182016040528015612134576020820181803683370190505b50600092509050602081015b855183101561209457600086848151811061215757fe5b602002602001015190506000602082019050612175838284516123f4565b87858151811061218157fe5b6020026020010151518301925050508280600101935050612140565b60608060388410156121f7576040805160018082528183019092529060208201818036833701905050905082840160f81b816000815181106121db57fe5b60200101906001600160f81b031916908160001a905350610bc2565b600060015b80868161220557fe5b041561221a57600190910190610100026121fc565b816001016001600160401b038111801561223357600080fd5b506040519080825280601f01601f19166020018201604052801561225e576020820181803683370190505b50925084820160370160f81b8360008151811061227757fe5b60200101906001600160f81b031916908160001a905350600190505b8181116122e3576101008183036101000a87816122ac57fe5b04816122b457fe5b0660f81b8382815181106122c457fe5b60200101906001600160f81b031916908160001a905350600101612293565b5050905092915050565b805182516001600160a01b03908116911614612325578051600e80546001600160a01b0319166001600160a01b039092169190911790555b80602001516001600160a01b031682602001516001600160a01b03161461236b576020810151600f80546001600160a01b0319166001600160a01b039092169190911790555b80604001511515826040015115151461080f5760400151600f8054911515600160a01b0260ff60a01b1990921691909117905550565b600080600060608451600014156123d057505060408051602081019091526000808252925082915081906123ed565b848060200190518101906123e491906126da565b93509350935093505b9193509193565b8282825b60208110612417578151835260209283019290910190601f19016123f8565b905182516020929092036101000a6000190180199091169116179052505050565b600061244b61244684612c47565b612c24565b905082815283838301111561245f57600080fd5b828260208301376000602084830101529392505050565b803561051f81612c94565b600082601f830112612491578081fd5b610bc283833560208501612438565b80356002811061051f57600080fd5b600060e082840312156124c0578081fd5b6124ca60e0612c24565b905081358152602082013560208201526124e6604083016124a0565b60408201526124f760608301612476565b606082015261250860808301612476565b608082015260a082013560a082015260c08201356001600160401b0381111561253057600080fd5b61253c84828501612481565b60c08301525092915050565b600060208284031215612559578081fd5b8135610bc281612c94565b600060208284031215612575578081fd5b8151610bc281612c94565b600080600060608486031215612594578182fd5b833561259f81612c94565b95602085013595506040909401359392505050565b6000602082840312156125c5578081fd5b81518015158114610bc2578182fd5b6000602082840312156125e5578081fd5b5035919050565b6000602082840312156125fd578081fd5b5051919050565b60008060408385031215612616578182fd5b50508035926020909101359150565b6000806000806080858703121561263a578081fd5b84359350602085013560ff81168114612651578182fd5b93969395505050506040820135916060013590565b600060208284031215612677578081fd5b81356001600160401b0381111561268c578182fd5b6107b484828501612481565b600080604083850312156126aa578182fd5b82356001600160401b038111156126bf578283fd5b6126cb85828601612481565b95602094909401359450505050565b600080600080608085870312156126ef578182fd5b8451600881106126fd578283fd5b80945050602085015192506040850151915060608501516001600160401b03811115612727578182fd5b8501601f81018713612737578182fd5b805161274561244682612c47565b818152886020838501011115612759578384fd5b61276a826020830160208601612c68565b9598949750929550505050565b600060208284031215612788578081fd5b81356001600160401b0381111561279d578182fd5b8201601f810184136127ad578182fd5b6107b484823560208401612438565b600080604083850312156127ce578182fd5b82356001600160401b038111156127e3578283fd5b6127ef858286016124af565b925050602083013561280081612c94565b809150509250929050565b60008060006060848603121561281f578081fd5b83356001600160401b03811115612834578182fd5b612840868287016124af565b935050602084013561285181612c94565b9150604084013561286181612c94565b809150509250925092565b600080600060608486031215612880578081fd5b83359250602084013561289281612c94565b915060408401356001600160401b038111156128ac578182fd5b6128b886828701612481565b9150509250925092565b6000806000606084860312156128d6578081fd5b8335925060208401356001600160401b038111156128f2578182fd5b6128fe86828701612481565b925050604084013561286181612c94565b60008151808452612927816020860160208601612c68565b601f01601f19169290920160200192915050565b6008811061294557fe5b9052565b60609190911b6bffffffffffffffffffffffff1916815260140190565b6001600160f81b031994909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b600082516129b1818460208701612c68565b9190910192915050565b600083516129cd818460208801612c68565b8351908301906129e1818360208801612c68565b01949350505050565b6c600d380380600d6000396000f360981b81528151600090612a1381600d850160208701612c68565b91909101600d0192915050565b90815260200190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b03831681526040602082018190526000906107b49083018461290f565b60008315158252604060208301526107b4604083018461290f565b93845260ff9290921660208401526040830152606082015260800190565b600060208252610bc2602083018461290f565b6020810160028310612b1957fe5b91905290565b6000612b2b828761293b565b60ff8516602083015260ff8416604083015260806060830152612b51608083018461290f565b9695505050505050565b6000612b67828761293b565b84602083015283604083015260806060830152612b51608083018461290f565b60208082526046908201527f4f6e6c792061757468656e746963617465642061646472657373657320696e2060408201527f6f766d53746174654d616e616765722063616e2063616c6c20746869732066756060820152653731ba34b7b760d11b608082015260a00190565b600084825260606020830152612c0c606083018561290f565b905060018060a01b0383166040830152949350505050565b6040518181016001600160401b0381118282101715612c3f57fe5b604052919050565b60006001600160401b03821115612c5a57fe5b50601f01601f191660200190565b60005b83811015612c83578181015183820152602001612c6b565b838111156107995750506000910152565b6001600160a01b038116811461053e57600080fdfe5369676e61747572652070726f766964656420666f7220454f4120636f6e7472616374206372656174696f6e20697320696e76616c69642e436f6e7472616374206372656174696f6e20636f646520636f6e7461696e7320756e73616665206f70636f6465732e2044696420796f75207573652074686520726967687420636f6d70696c6572206f72207061737320616e20756e7361666520636f6e7374727563746f7220617267756d656e743f4120636f6e74726163742068617320616c7265616479206265656e206465706c6f79656420746f20746869732061646472657373436f6e7374727563746f7220617474656d7074656420746f206465706c6f7920756e736166652062797465636f64652ea2646970667358221220ba09f3066e98cffa8b50d7fb9822c62cac7bc36099454fe6dbe318573486c14d64736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"CALL_WITH_VALUE_INTRINSIC_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMaxTransactionGasLimit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxTransactionGasLimit\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ovmADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_ADDRESS\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"name\":\"ovmBALANCE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_BALANCE\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"},{\"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\":[{\"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\":\"ovmCALLVALUE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_CALLVALUE\",\"type\":\"uint256\"}],\"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\":\"\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_bytecode\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"ovmCREATE2\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"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\":\"ovmINCREMENTNONCE\",\"outputs\":[],\"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\":[],\"name\":\"ovmSELFBALANCE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_BALANCE\",\"type\":\"uint256\"}],\"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\":\"\",\"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\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_creationCode\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"}],\"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\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"},{\"internalType\":\"contract iOVM_StateManager\",\"name\":\"_ovmStateManager\",\"type\":\"address\"}],\"name\":\"simulateMessage\",\"outputs\":[{\"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.\"}},\"ovmBALANCE(address)\":{\"params\":{\"_contract\":\"Address of the contract to query the OVM_ETH balance of.\"},\"returns\":{\"_BALANCE\":\"OVM_ETH balance of the requested contract.\"}},\"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).\"}},\"ovmCALL(uint256,address,uint256,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.\",\"_value\":\"ETH value to pass with the 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.\"}},\"ovmCALLVALUE()\":{\"returns\":{\"_CALLVALUE\":\"Value sent along with the call according to 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\":{\"_0\":\"Address of the created contract.\",\"_1\":\"Revert data, if and only if the creation threw an exception.\"}},\"ovmCREATE2(bytes,bytes32)\":{\"params\":{\"_bytecode\":\"Code to be used to CREATE2 a new contract.\",\"_salt\":\"Value used to determine the contract's address.\"},\"returns\":{\"_0\":\"Address of the created contract.\",\"_1\":\"Revert data, if and only if the creation threw an exception.\"}},\"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\":\"Enum indicating 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.\"}},\"ovmSELFBALANCE()\":{\"returns\":{\"_BALANCE\":\"OVM_ETH balance of the requesting 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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"run((uint256,uint256,uint8,address,address,uint256,bytes),address)\":{\"params\":{\"_ovmStateManager\":\"iOVM_StateManager implementation providing account state.\",\"_transaction\":\"Transaction data to be executed.\"}},\"safeCREATE(bytes,address)\":{\"params\":{\"_address\":\"OVM address being deployed to.\",\"_creationCode\":\"Code to pass into CREATE for deployment.\"}},\"simulateMessage((uint256,uint256,uint8,address,address,uint256,bytes),address,uint256,address)\":{\"params\":{\"_from\":\"the OVM account the simulated call should be from.\",\"_ovmStateManager\":\"the address of the OVM_StateManager precompile in the L2 state.\",\"_transaction\":\"the message transaction to simulate.\",\"_value\":\"the amount of ETH value to send.\"}}},\"stateVariables\":{\"CONTAINER_CONTRACT_PREFIX\":{\"details\":\"The Execution Manager and State Manager each have this 30 byte prefix, and are uncallable.\"}},\"title\":\"OVM_ExecutionManager\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"ovmADDRESS()\":{\"notice\":\"Overrides ADDRESS.\"},\"ovmBALANCE(address)\":{\"notice\":\"Overrides BALANCE. NOTE: In the future, this could be optimized to directly invoke EM._getContractStorage(...).\"},\"ovmCALL(uint256,address,bytes)\":{\"notice\":\"Legacy ovmCALL function which did not support ETH value; this maintains backwards compatibility.\"},\"ovmCALL(uint256,address,uint256,bytes)\":{\"notice\":\"Overrides CALL.\"},\"ovmCALLER()\":{\"notice\":\"Overrides CALLER.\"},\"ovmCALLVALUE()\":{\"notice\":\"Overrides CALLVALUE.\"},\"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.\"},\"ovmINCREMENTNONCE()\":{\"notice\":\"Bumps the nonce of the current ovmADDRESS by one.\"},\"ovmL1QUEUEORIGIN()\":{\"notice\":\"Specifies from which source (Sequencer or 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.\"},\"ovmSELFBALANCE()\":{\"notice\":\"Overrides SELFBALANCE.\"},\"ovmSLOAD(bytes32)\":{\"notice\":\"Overrides SLOAD.\"},\"ovmSSTORE(bytes32,bytes32)\":{\"notice\":\"Overrides SSTORE.\"},\"ovmSTATICCALL(uint256,address,bytes)\":{\"notice\":\"Overrides STATICCALL.\"},\"ovmTIMESTAMP()\":{\"notice\":\"Overrides TIMESTAMP.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"run((uint256,uint256,uint8,address,address,uint256,bytes),address)\":{\"notice\":\"Starts the execution of a transaction via the OVM_ExecutionManager.\"},\"safeCREATE(bytes,address)\":{\"notice\":\"Handles the creation-specific safety measures required for OVM contract deployment. This function sanitizes the return types for creation messages to match calls (bool, bytes), by being an external function which the EM can call, that mimics the success/fail case of the CREATE. This allows for consistent handling of both types of messages in _handleExternalMessage(). Having this step occur as a separate call frame also allows us to easily revert the contract deployment in the event that the code is unsafe.\"},\"simulateMessage((uint256,uint256,uint8,address,address,uint256,bytes),address,uint256,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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow, so we distribute\\n return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);\\n }\\n}\\n\",\"keccak256\":\"0x363bd3b45201f07c9b71c2edc96533468cf14a3d029fabd82fddceb1eb3ebd9c\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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_Bytes32Utils } from \\\"../../libraries/utils/Lib_Bytes32Utils.sol\\\";\\nimport { Lib_EthUtils } from \\\"../../libraries/utils/Lib_EthUtils.sol\\\";\\nimport { Lib_ErrorUtils } from \\\"../../libraries/utils/Lib_ErrorUtils.sol\\\";\\nimport { Lib_PredeployAddresses } from \\\"../../libraries/constants/Lib_PredeployAddresses.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_DeployerWhitelist } from \\\"../predeploys/OVM_DeployerWhitelist.sol\\\";\\n\\n/* External Imports */\\nimport { Math } from \\\"@openzeppelin/contracts/math/Math.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 * Native Value Constants *\\n **************************/\\n\\n // Public so we can access and make assertions in integration tests.\\n uint256 public constant CALL_WITH_VALUE_INTRINSIC_GAS = 90000;\\n\\n\\n /**************************\\n * Default Context Values *\\n **************************/\\n\\n uint256 constant DEFAULT_UINT256 = 0xdefa017defa017defa017defa017defa017defa017defa017defa017defa017d;\\n address constant DEFAULT_ADDRESS = 0xdEfa017defA017DeFA017DEfa017DeFA017DeFa0;\\n\\n\\n /*************************************\\n * Container Contract Address Prefix *\\n *************************************/\\n\\n /**\\n * @dev The Execution Manager and State Manager each have this 30 byte prefix, and are uncallable.\\n */\\n address constant CONTAINER_CONTRACT_PREFIX = 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000;\\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 Lib_AddressResolver(_libAddressManager)\\n {\\n ovmSafetyChecker = iOVM_SafetyChecker(resolve(\\\"OVM_SafetyChecker\\\"));\\n gasMeterConfig = _gasMeterConfig;\\n globalContext = _globalContext;\\n _resetContext();\\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 external\\n returns (\\n bytes memory\\n )\\n {\\n // Make sure that run() is not re-enterable. This condition should always be satisfied\\n // Once run has been called once, due to the behavior of _isValidInput().\\n if (transactionContext.ovmNUMBER != DEFAULT_UINT256) {\\n return bytes(\\\"\\\");\\n }\\n\\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 (_isValidInput(_transaction) == false) {\\n _resetContext();\\n return bytes(\\\"\\\");\\n }\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\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 (, bytes memory returndata) = ovmCALL(\\n _transaction.gasLimit - gasMeterConfig.minTransactionGasLimit,\\n _transaction.entrypoint,\\n 0,\\n _transaction.data\\n );\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\n // // Update the cumulative gas based on the amount of gas used.\\n // uint256 gasUsed = gasProvided - gasleft();\\n // _updateCumulativeGas(gasUsed, _transaction.l1QueueOrigin);\\n\\n // Wipe the execution context.\\n _resetContext();\\n\\n return returndata;\\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 external\\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 CALLVALUE.\\n * @return _CALLVALUE Value sent along with the call according to the current message context.\\n */\\n function ovmCALLVALUE()\\n override\\n public\\n view\\n returns (\\n uint256 _CALLVALUE\\n )\\n {\\n return messageContext.ovmCALLVALUE;\\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 external\\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 external\\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 external\\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 external\\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 source (Sequencer or Queue) this transaction originated from.\\n * @return _queueOrigin Enum indicating the ovmL1QUEUEORIGIN within the current message context.\\n */\\n function ovmL1QUEUEORIGIN()\\n override\\n external\\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 external\\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 Address of the created contract.\\n * @return Revert data, if and only if the creation threw an exception.\\n */\\n function ovmCREATE(\\n bytes memory _bytecode\\n )\\n override\\n public\\n notStatic\\n fixedGasDiscount(40000)\\n returns (\\n address,\\n bytes memory\\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 MessageType.ovmCREATE\\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 Address of the created contract.\\n * @return Revert data, if and only if the creation threw an exception.\\n */\\n function ovmCREATE2(\\n bytes memory _bytecode,\\n bytes32 _salt\\n )\\n override\\n external\\n notStatic\\n fixedGasDiscount(40000)\\n returns (\\n address,\\n bytes memory\\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 MessageType.ovmCREATE2\\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 external\\n returns (\\n uint256 _nonce\\n )\\n {\\n return _getAccountNonce(ovmADDRESS());\\n }\\n\\n /**\\n * Bumps the nonce of the current ovmADDRESS by one.\\n */\\n function ovmINCREMENTNONCE()\\n override\\n external\\n notStatic\\n {\\n address account = ovmADDRESS();\\n uint256 nonce = _getAccountNonce(account);\\n\\n // Prevent overflow.\\n if (nonce + 1 > nonce) {\\n _setAccountNonce(account, nonce + 1);\\n }\\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 // Creates a duplicate of the OVM_ProxyEOA located at 0x42....09. Uses the following\\n // \\\"magic\\\" prefix to deploy an exact copy of the code:\\n // PUSH1 0x0D # size of this prefix in bytes\\n // CODESIZE\\n // SUB # subtract prefix size from codesize\\n // DUP1\\n // PUSH1 0x0D\\n // PUSH1 0x00\\n // CODECOPY # copy everything after prefix into memory at pos 0\\n // PUSH1 0x00\\n // RETURN # return the copied code\\n address proxyEOA = Lib_EthUtils.createContract(abi.encodePacked(\\n hex\\\"600D380380600D6000396000f3\\\",\\n ovmEXTCODECOPY(\\n Lib_PredeployAddresses.PROXY_EOA,\\n 0,\\n ovmEXTCODESIZE(Lib_PredeployAddresses.PROXY_EOA)\\n )\\n ));\\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 _value ETH value to pass with the 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 uint256 _value,\\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 nextMessageContext.ovmCALLVALUE = _value;\\n\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata,\\n MessageType.ovmCALL\\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, valueless context.\\n MessageContext memory nextMessageContext = messageContext;\\n nextMessageContext.ovmCALLER = nextMessageContext.ovmADDRESS;\\n nextMessageContext.ovmADDRESS = _address;\\n nextMessageContext.isStatic = true;\\n nextMessageContext.ovmCALLVALUE = 0;\\n\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata,\\n MessageType.ovmSTATICCALL\\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\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata,\\n MessageType.ovmDELEGATECALL\\n );\\n }\\n\\n /**\\n * @notice Legacy ovmCALL function which did not support ETH value; this maintains backwards compatibility.\\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 returns(\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n // Legacy ovmCALL assumed always-0 value.\\n return ovmCALL(\\n _gasLimit,\\n _address,\\n 0,\\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 external\\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 external\\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 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 external\\n returns (\\n bytes32 _EXTCODEHASH\\n )\\n {\\n return Lib_EthUtils.getCodeHash(\\n _getAccountEthAddress(_contract)\\n );\\n }\\n\\n\\n /***************************************\\n * Public Functions: ETH Value Opcodes *\\n ***************************************/\\n\\n /**\\n * @notice Overrides BALANCE.\\n * NOTE: In the future, this could be optimized to directly invoke EM._getContractStorage(...).\\n * @param _contract Address of the contract to query the OVM_ETH balance of.\\n * @return _BALANCE OVM_ETH balance of the requested contract.\\n */\\n function ovmBALANCE(\\n address _contract\\n )\\n override\\n public\\n returns (\\n uint256 _BALANCE\\n )\\n {\\n // Easiest way to get the balance is query OVM_ETH as normal.\\n bytes memory balanceOfCalldata = abi.encodeWithSignature(\\n \\\"balanceOf(address)\\\",\\n _contract\\n );\\n\\n // Static call because this should be a read-only query.\\n (bool success, bytes memory returndata) = ovmSTATICCALL(\\n gasleft(),\\n Lib_PredeployAddresses.OVM_ETH,\\n balanceOfCalldata\\n );\\n\\n // All balanceOf queries should successfully return a uint, otherwise this must be an OOG.\\n if (!success || returndata.length != 32) {\\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\\n }\\n\\n // Return the decoded balance.\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * @notice Overrides SELFBALANCE.\\n * @return _BALANCE OVM_ETH balance of the requesting contract.\\n */\\n function ovmSELFBALANCE()\\n override\\n external\\n returns (\\n uint256 _BALANCE\\n )\\n {\\n return ovmBALANCE(ovmADDRESS());\\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 Whitelisting *\\n ********************************************/\\n\\n /**\\n * Checks whether the given address is on the whitelist 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 semantics perspective, this will appear 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) = ovmSTATICCALL(\\n gasleft(),\\n Lib_PredeployAddresses.DEPLOYER_WHITELIST,\\n abi.encodeWithSelector(\\n OVM_DeployerWhitelist.isDeployerAllowed.selector,\\n _deployerAddress\\n )\\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 Final OVM contract address.\\n * @return Revertdata, if and only if the creation threw an exception.\\n */\\n function _createContract(\\n address _contractAddress,\\n bytes memory _bytecode,\\n MessageType _messageType\\n )\\n internal\\n returns (\\n address,\\n bytes memory\\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 the common logic which occurs between call-type and create-type messages,\\n // passing in the creation bytecode and `true` to trigger create-specific logic.\\n (bool success, bytes memory data) = _handleExternalMessage(\\n nextMessageContext,\\n gasleft(),\\n _contractAddress,\\n _bytecode,\\n _messageType\\n );\\n\\n // Yellow paper requires that address returned is zero if the contract deployment fails.\\n return (\\n success ? _contractAddress : address(0),\\n data\\n );\\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 MessageType _messageType\\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(CONTAINER_CONTRACT_PREFIX)\\n ) {\\n // EVM does not return data in the success case, see: https://github.com/ethereum/go-ethereum/blob/aae7660410f0ef90279e14afaaf2f429fdc2a186/core/vm/instructions.go#L600-L604\\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 _handleExternalMessage(\\n _nextMessageContext,\\n _gasLimit,\\n codeContractAddress,\\n _calldata,\\n _messageType\\n );\\n }\\n\\n /**\\n * Handles all interactions which involve the execution manager calling out to untrusted code (both calls and creates).\\n * Ensures that OVM-related measures are enforced, including L2 gas refunds, nuisance gas, and flagged reversions.\\n *\\n * @param _nextMessageContext Message context to be used for the external message.\\n * @param _gasLimit Amount of gas to be passed into this message. NOTE: this argument is overwritten in some cases to avoid stack-too-deep.\\n * @param _contract OVM address being called or deployed to\\n * @param _data Data for the message (either calldata or creation code)\\n * @param _messageType What type of ovmOPCODE this message corresponds to.\\n * @return Whether or not the message (either a call or deployment) succeeded.\\n * @return Data returned by the message.\\n */\\n function _handleExternalMessage(\\n MessageContext memory _nextMessageContext,\\n // NOTE: this argument is overwritten in some cases to avoid stack-too-deep.\\n uint256 _gasLimit,\\n address _contract,\\n bytes memory _data,\\n MessageType _messageType\\n )\\n internal\\n returns (\\n bool,\\n bytes memory\\n )\\n {\\n uint256 messageValue = _nextMessageContext.ovmCALLVALUE;\\n // If there is value in this message, we need to transfer the ETH over before switching contexts.\\n if (\\n messageValue > 0\\n && _isValueType(_messageType)\\n ) {\\n // Handle out-of-intrinsic gas consistent with EVM behavior -- the subcall \\\"appears to revert\\\" if we don't have enough gas to transfer the ETH.\\n // Similar to dynamic gas cost of value exceeding gas here:\\n // https://github.com/ethereum/go-ethereum/blob/c503f98f6d5e80e079c1d8a3601d188af2a899da/core/vm/interpreter.go#L268-L273\\n if (gasleft() < CALL_WITH_VALUE_INTRINSIC_GAS) {\\n return (false, hex\\\"\\\");\\n }\\n\\n // If there *is* enough gas to transfer ETH, then we need to make sure this amount of gas is reserved (i.e. not\\n // given to the _contract.call below) to guarantee that _handleExternalMessage can't run out of gas.\\n // In particular, in the event that the call fails, we will need to transfer the ETH back to the sender.\\n // Taking the lesser of _gasLimit and gasleft() - CALL_WITH_VALUE_INTRINSIC_GAS guarantees that the second\\n // _attemptForcedEthTransfer below, if needed, always has enough gas to succeed.\\n _gasLimit = Math.min(\\n _gasLimit,\\n gasleft() - CALL_WITH_VALUE_INTRINSIC_GAS // Cannot overflow due to the above check.\\n );\\n\\n // Now transfer the value of the call.\\n // The target is interpreted to be the next message's ovmADDRESS account.\\n bool transferredOvmEth = _attemptForcedEthTransfer(\\n _nextMessageContext.ovmADDRESS,\\n messageValue\\n );\\n\\n // If the ETH transfer fails (should only be possible in the case of insufficient balance), then treat this as a revert.\\n // This mirrors EVM behavior, see https://github.com/ethereum/go-ethereum/blob/2dee31930c9977af2a9fcb518fb9838aa609a7cf/core/vm/evm.go#L298\\n if (!transferredOvmEth) {\\n return (false, hex\\\"\\\");\\n }\\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. `_contract` 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\\n bool success;\\n bytes memory returndata;\\n if (_isCreateType(_messageType)) {\\n // safeCREATE() is a function which replicates a CREATE message, but uses return values\\n // Which match that of CALL (i.e. bool, bytes). This allows many security checks to be\\n // to be shared between untrusted call and create call frames.\\n (success, returndata) = address(this).call{gas: _gasLimit}(\\n abi.encodeWithSelector(\\n this.safeCREATE.selector,\\n _data,\\n _contract\\n )\\n );\\n } else {\\n (success, returndata) = _contract.call{gas: _gasLimit}(_data);\\n }\\n\\n // If the message threw an exception, its value should be returned back to the sender.\\n // So, we force it back, BEFORE returning the messageContext to the previous addresses.\\n // This operation is part of the reason we \\\"reserved the intrinsic gas\\\" above.\\n if (\\n messageValue > 0\\n && _isValueType(_messageType)\\n && !success\\n ) {\\n bool transferredOvmEth = _attemptForcedEthTransfer(\\n prevMessageContext.ovmADDRESS,\\n messageValue\\n );\\n\\n // Since we transferred it in above and the call reverted, the transfer back should always pass.\\n // This code path should NEVER be triggered since we sent `messageValue` worth of OVM_ETH into the target\\n // and reserved sufficient gas to execute the transfer, but in case there is some edge case which has\\n // been missed, we revert the entire frame (and its parent) to make sure the ETH gets sent back.\\n if (!transferredOvmEth) {\\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\\n }\\n }\\n\\n // Switch back to the original message context now that we're out of the call and all OVM_ETH is in the right place.\\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. Additionally, we surface custom error messages\\n // to developers in the case of unsafe creations for improved devex.\\n // All other revert types return no data.\\n if (\\n flag == RevertFlag.INTENTIONAL_REVERT\\n || flag == RevertFlag.UNSAFE_BYTECODE\\n ) {\\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 * Handles the creation-specific safety measures required for OVM contract deployment.\\n * This function sanitizes the return types for creation messages to match calls (bool, bytes),\\n * by being an external function which the EM can call, that mimics the success/fail case of the CREATE.\\n * This allows for consistent handling of both types of messages in _handleExternalMessage().\\n * Having this step occur as a separate call frame also allows us to easily revert the\\n * contract deployment in the event that the code is unsafe.\\n *\\n * @param _creationCode Code to pass into CREATE for deployment.\\n * @param _address OVM address being deployed to.\\n */\\n function safeCREATE(\\n bytes memory _creationCode,\\n address _address\\n )\\n external\\n {\\n // The only way this should callable is from within _createContract(),\\n // and it should DEFINITELY not be callable by a non-EM code contract.\\n if (msg.sender != address(this)) {\\n return;\\n }\\n // Check that there is not already code at this address.\\n if (_hasEmptyAccount(_address) == false) {\\n // Note: in the EVM, this case burns all allotted gas. For improved\\n // developer experience, we do return the remaining gas.\\n _revertWithFlag(\\n RevertFlag.CREATE_COLLISION\\n );\\n }\\n\\n // Check the creation bytecode against the OVM_SafetyChecker.\\n if (ovmSafetyChecker.isBytecodeSafe(_creationCode) == false) {\\n // Note: in the EVM, this case burns all allotted gas. For improved\\n // developer experience, we do return the remaining gas.\\n _revertWithFlag(\\n RevertFlag.UNSAFE_BYTECODE,\\n Lib_ErrorUtils.encodeRevertString(\\\"Contract creation code contains unsafe opcodes. Did you use the right compiler or pass an unsafe constructor argument?\\\")\\n );\\n }\\n\\n // We always need to initialize the contract with the default account values.\\n _initPendingAccount(_address);\\n\\n // Actually execute the EVM create message.\\n // NOTE: The inline assembly below means we can NOT make any evm calls between here and then.\\n address ethAddress = Lib_EthUtils.createContract(_creationCode);\\n\\n if (ethAddress == address(0)) {\\n // If the creation fails, the EVM lets us grab its revert data. This may contain a revert flag\\n // to be used above in _handleExternalMessage, so we pass the revert data back up unmodified.\\n assembly {\\n returndatacopy(0,0,returndatasize())\\n revert(0, returndatasize())\\n }\\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(\\n RevertFlag.UNSAFE_BYTECODE,\\n Lib_ErrorUtils.encodeRevertString(\\\"Constructor attempted to deploy unsafe bytecode.\\\")\\n );\\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 * Internal Functions: Value Manipulation *\\n ******************************************/\\n\\n /**\\n * Invokes an ovmCALL to OVM_ETH.transfer on behalf of the current ovmADDRESS, allowing us to force movement of OVM_ETH in correspondence with ETH's native value functionality.\\n * WARNING: this will send on behalf of whatever the messageContext.ovmADDRESS is in storage at the time of the call.\\n * NOTE: In the future, this could be optimized to directly invoke EM._setContractStorage(...).\\n * @param _to Amount of OVM_ETH to be sent.\\n * @param _value Amount of OVM_ETH to send.\\n * @return _success Whether or not the transfer worked.\\n */\\n function _attemptForcedEthTransfer(\\n address _to,\\n uint256 _value\\n )\\n internal\\n returns(\\n bool _success\\n )\\n {\\n bytes memory transferCalldata = abi.encodeWithSignature(\\n \\\"transfer(address,uint256)\\\",\\n _to,\\n _value\\n );\\n\\n // OVM_ETH inherits from the UniswapV2ERC20 standard. In this implementation, its return type\\n // is a boolean. However, the implementation always returns true if it does not revert.\\n // Thus, success of the call frame is sufficient to infer success of the transfer itself.\\n (bool success, ) = ovmCALL(\\n gasleft(),\\n Lib_PredeployAddresses.OVM_ETH,\\n 0,\\n transferCalldata\\n );\\n\\n return success;\\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 ) {\\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 view\\n {\\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 input values of a transaction.\\n * @return _valid Whether or not the transaction data is valid.\\n */\\n function _isValidInput(\\n Lib_OVMCodec.Transaction memory _transaction\\n )\\n view\\n internal\\n returns (\\n bool\\n )\\n {\\n // Prevent reentrancy to run():\\n // This check prevents calling run with the default ovmNumber.\\n // Combined with the first check in run():\\n // if (transactionContext.ovmNUMBER != DEFAULT_UINT256) { return; }\\n // It should be impossible to re-enter since run() returns before any other call frames are created.\\n // Since this value is already being written to storage, we save much gas compared to\\n // using the standard nonReentrant pattern.\\n if (_transaction.blockNumber == DEFAULT_UINT256) {\\n return false;\\n }\\n\\n if (_isValidGasLimit(_transaction.gasLimit, _transaction.l1QueueOrigin) == false) {\\n return false;\\n }\\n\\n return true;\\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 view\\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 // These conditionals allow us to avoid unneccessary SSTOREs. However, they do mean that the current storage\\n // value for the messageContext MUST equal the _prevMessageContext argument, or an SSTORE might be erroneously skipped.\\n if (_prevMessageContext.ovmCALLER != _nextMessageContext.ovmCALLER) {\\n messageContext.ovmCALLER = _nextMessageContext.ovmCALLER;\\n }\\n\\n if (_prevMessageContext.ovmADDRESS != _nextMessageContext.ovmADDRESS) {\\n messageContext.ovmADDRESS = _nextMessageContext.ovmADDRESS;\\n }\\n\\n if (_prevMessageContext.isStatic != _nextMessageContext.isStatic) {\\n messageContext.isStatic = _nextMessageContext.isStatic;\\n }\\n\\n if (_prevMessageContext.ovmCALLVALUE != _nextMessageContext.ovmCALLVALUE) {\\n messageContext.ovmCALLVALUE = _nextMessageContext.ovmCALLVALUE;\\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 = DEFAULT_ADDRESS;\\n transactionContext.ovmTIMESTAMP = DEFAULT_UINT256;\\n transactionContext.ovmNUMBER = DEFAULT_UINT256;\\n transactionContext.ovmGASLIMIT = DEFAULT_UINT256;\\n transactionContext.ovmTXGASLIMIT = DEFAULT_UINT256;\\n transactionContext.ovmL1QUEUEORIGIN = Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE;\\n\\n transactionRecord.ovmGasRefund = DEFAULT_UINT256;\\n\\n messageContext.ovmCALLER = DEFAULT_ADDRESS;\\n messageContext.ovmADDRESS = DEFAULT_ADDRESS;\\n messageContext.isStatic = false;\\n\\n messageRecord.nuisanceGasLeft = DEFAULT_UINT256;\\n\\n // Reset the ovmStateManager.\\n ovmStateManager = iOVM_StateManager(address(0));\\n }\\n\\n\\n /******************************************\\n * Internal Functions: Message Typechecks *\\n ******************************************/\\n\\n /**\\n * Returns whether or not the given message type is a CREATE-type.\\n * @param _messageType the message type in question.\\n */\\n function _isCreateType(\\n MessageType _messageType\\n )\\n internal\\n pure\\n returns(\\n bool\\n )\\n {\\n return (\\n _messageType == MessageType.ovmCREATE\\n || _messageType == MessageType.ovmCREATE2\\n );\\n }\\n\\n /**\\n * Returns whether or not the given message type (potentially) requires the transfer of ETH value along with the message.\\n * @param _messageType the message type in question.\\n */\\n function _isValueType(\\n MessageType _messageType\\n )\\n internal\\n pure\\n returns(\\n bool\\n )\\n {\\n // ovmSTATICCALL and ovmDELEGATECALL types do not accept or transfer value.\\n return (\\n _messageType == MessageType.ovmCALL\\n || _messageType == MessageType.ovmCREATE\\n || _messageType == MessageType.ovmCREATE2\\n );\\n }\\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 * @param _value the amount of ETH value to send.\\n * @param _ovmStateManager the address of the OVM_StateManager precompile in the L2 state.\\n */\\n function simulateMessage(\\n Lib_OVMCodec.Transaction memory _transaction,\\n address _from,\\n uint256 _value,\\n iOVM_StateManager _ovmStateManager\\n )\\n external\\n returns (\\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 // Initialize the EM's internal state, ignoring nuisance gas.\\n ovmStateManager = _ovmStateManager;\\n _initContext(_transaction);\\n messageRecord.nuisanceGasLeft = uint(-1);\\n\\n // Set the ovmADDRESS to the _from so that the subsequent call frame \\\"comes from\\\" them.\\n messageContext.ovmADDRESS = _from;\\n\\n // Execute the desired message.\\n bool isCreate = _transaction.entrypoint == address(0);\\n if (isCreate) {\\n (address created, bytes memory revertData) = ovmCREATE(_transaction.data);\\n if (created == address(0)) {\\n return abi.encode(false, revertData);\\n } else {\\n // The eth_call RPC endpoint for to = undefined will return the deployed bytecode\\n // in the success case, differing from standard create messages.\\n return abi.encode(true, Lib_EthUtils.getCode(created));\\n }\\n } else {\\n (bool success, bytes memory returndata) = ovmCALL(\\n _transaction.gasLimit,\\n _transaction.entrypoint,\\n _value,\\n _transaction.data\\n );\\n return abi.encode(success, returndata);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x166912c588f2871fd2825ea9288cb3d50a888d4fcafd9fe3cc4461df839acf70\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/predeploys/OVM_DeployerWhitelist.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Interface Imports */\\nimport { iOVM_DeployerWhitelist } from \\\"../../iOVM/predeploys/iOVM_DeployerWhitelist.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: optimistic-solc\\n * Runtime target: OVM\\n */\\ncontract OVM_DeployerWhitelist is iOVM_DeployerWhitelist {\\n\\n /**********************\\n * Contract Constants *\\n **********************/\\n\\n bool public initialized;\\n bool public allowArbitraryDeployment;\\n address override public owner;\\n mapping (address => bool) public whitelist;\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Blocks functions to anyone except the contract owner.\\n */\\n modifier onlyOwner() {\\n require(\\n msg.sender == 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 external\\n {\\n if (initialized == true) {\\n return;\\n }\\n\\n initialized = true;\\n allowArbitraryDeployment = _allowArbitraryDeployment;\\n owner = _owner;\\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 external\\n onlyOwner\\n {\\n whitelist[_deployer] = _isWhitelisted;\\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 owner = _owner;\\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 allowArbitraryDeployment = _allowArbitraryDeployment;\\n }\\n\\n /**\\n * Permanently enables arbitrary contract deployment and deletes the owner.\\n */\\n function enableArbitraryContractDeployment()\\n override\\n external\\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 external\\n returns (\\n bool\\n )\\n {\\n return (\\n initialized == false\\n || allowArbitraryDeployment == true\\n || whitelist[_deployer]\\n );\\n }\\n}\\n\",\"keccak256\":\"0xb96bfb8eb24503b05de41483cc9fb7a7f81107aa1ca146dc281952f8100848a0\",\"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 OUT_OF_GAS,\\n INTENTIONAL_REVERT,\\n EXCEEDS_NUISANCE_GAS,\\n INVALID_STATE_ACCESS,\\n UNSAFE_BYTECODE,\\n CREATE_COLLISION,\\n STATIC_VIOLATION,\\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 enum MessageType {\\n ovmCALL,\\n ovmSTATICCALL,\\n ovmDELEGATECALL,\\n ovmCREATE,\\n ovmCREATE2\\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 uint256 ovmCALLVALUE;\\n bool isStatic;\\n }\\n\\n struct MessageRecord {\\n uint256 nuisanceGasLeft;\\n }\\n\\n\\n /************************************\\n * Transaction Execution Entrypoint *\\n ************************************/\\n\\n function run(\\n Lib_OVMCodec.Transaction calldata _transaction,\\n address _txStateManager\\n ) external returns (bytes memory);\\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 ovmCALLVALUE() external view returns (uint _callValue);\\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, bytes memory _revertdata);\\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract, bytes memory _revertdata);\\n\\n\\n /*******************************\\n * Account Abstraction Opcodes *\\n ******************************/\\n\\n function ovmGETNONCE() external returns (uint256 _nonce);\\n function ovmINCREMENTNONCE() external;\\n function ovmCREATEEOA(bytes32 _messageHash, uint8 _v, bytes32 _r, bytes32 _s) external;\\n\\n\\n /****************************\\n * Contract Calling Opcodes *\\n ****************************/\\n\\n // Valueless ovmCALL for maintaining backwards compatibility with legacy OVM bytecode.\\n function ovmCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\\n function ovmCALL(uint256 _gasLimit, address _address, uint256 _value, 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 * ETH Value Opcodes *\\n *********************/\\n\\n function ovmBALANCE(address _contract) external returns (uint256 _balance);\\n function ovmSELFBALANCE() external returns (uint256 _balance);\\n\\n\\n /***************************************\\n * Public Functions: Execution Context *\\n ***************************************/\\n\\n function getMaxTransactionGasLimit() external view returns (uint _maxTransactionGasLimit);\\n}\\n\",\"keccak256\":\"0x87a056425696719488dbd06adbbf89280d86651e75e1f77d9e96b0632c8634cc\",\"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/predeploys/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 owner() 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\":\"0xdf1f27faf0d26d416bf6d408d146a16de32b4e1772a292c65d39eb7ec2b53ceb\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_PredeployAddresses\\n */\\nlibrary Lib_PredeployAddresses {\\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\\n address internal constant ECDSA_CONTRACT_ACCOUNT = 0x4200000000000000000000000000000000000003;\\n address internal constant SEQUENCER_ENTRYPOINT = 0x4200000000000000000000000000000000000005;\\n address payable internal constant OVM_ETH = 0x4200000000000000000000000000000000000006;\\n address internal constant L2_CROSS_DOMAIN_MESSENGER = 0x4200000000000000000000000000000000000007;\\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\\n address internal constant EXECUTION_MANAGER_WRAPPER = 0x420000000000000000000000000000000000000B;\\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\\n address internal constant ERC1820_REGISTRY = 0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24;\\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\\n}\\n\",\"keccak256\":\"0x798dd3fe47c172880978c8e4d35573b25d5135be29a77584e9fac45845748695\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_ErrorUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/**\\n * @title Lib_ErrorUtils\\n */\\nlibrary Lib_ErrorUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes an error string into raw solidity-style revert data.\\n * (i.e. ascii bytes, prefixed with bytes4(keccak(\\\"Error(string))\\\"))\\n * Ref: https://docs.soliditylang.org/en/v0.8.2/control-structures.html?highlight=Error(string)#panic-via-assert-and-error-via-require\\n * @param _reason Reason for the reversion.\\n * @return Standard solidity revert data for the given reason.\\n */\\n function encodeRevertString(\\n string memory _reason\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return abi.encodeWithSignature(\\n \\\"Error(string)\\\",\\n _reason\\n );\\n }\\n}\\n\",\"keccak256\":\"0xfc64ec4a81fb50865b502a0004ed154e8598e1a313db77303fc95e41f536e6b7\",\"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 *\\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 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\\n )\\n {\\n bytes memory code;\\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 Full code of the contract.\\n */\\n function getCode(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes memory\\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 Size of the contract's code in bytes.\\n */\\n function getCodeSize(\\n address _address\\n )\\n internal\\n view\\n returns (\\n uint256\\n )\\n {\\n uint256 codeSize;\\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 Hash of the contract's code.\\n */\\n function getCodeHash(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n bytes32 codeHash;\\n assembly {\\n codeHash := extcodehash(_address)\\n }\\n\\n return codeHash;\\n }\\n\\n /**\\n * Creates a contract with some given initialization code.\\n * @param _code Contract initialization code.\\n * @return Address of the created contract.\\n */\\n function createContract(\\n bytes memory _code\\n )\\n internal\\n returns (\\n address\\n )\\n {\\n address created;\\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 to be generated by CREATE.\\n */\\n function getAddressForCREATE(\\n address _creator,\\n uint256 _nonce\\n )\\n internal\\n pure\\n returns (\\n 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 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 (\\n address\\n )\\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\":\"0xf29a67d78e61cb472d524b779b32cfcb39a587f4096500d5419e6425ed367d49\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50604051620034a0380380620034a0833981016040819052620000349162000297565b600080546001600160a01b0319166001600160a01b03851617905560408051808201909152601181527027ab26afa9b0b332ba3ca1b432b1b5b2b960791b60208201526200008290620000d7565b600180546001600160a01b0319166001600160a01b039290921691909117905581516003556020820151600455604082015160055560608201516006558051600755620000ce620001b9565b5050506200033c565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015620001395781810151838201526020016200011f565b50505050905090810190601f168015620001675780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156200018557600080fd5b505afa1580156200019a573d6000803e3d6000fd5b505050506040513d6020811015620001b157600080fd5b505192915050565b600d805473defa017defa017defa017defa017defa017defa06001600160a01b031991821681179092557fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d6009819055600a819055600b819055600c8190556008805460ff199081169091556012829055600e8054841685179055600f8054841690941790935560118054909316909255601391909155600280549091169055565b6000602082840312156200026d578081fd5b604051602081016001600160401b03811182821017156200028a57fe5b6040529151825250919050565b600080600083850360c0811215620002ad578384fd5b84516001600160a01b0381168114620002c4578485fd5b93506080601f1982011215620002d8578283fd5b50604051608081016001600160401b0381118282101715620002f657fe5b80604052506020850151815260408501516020820152606085015160408201526080850151606082015280925050620003338560a086016200025b565b90509250925092565b613154806200034c6000396000f3fe608060405234801561001057600080fd5b50600436106101fb5760003560e01c8063741a33eb1161011a578063996d79a5116100ad578063a8c4c5ec1161007c578063a8c4c5ec146103eb578063bdbf8c36146103f3578063c1fb2ea2146103fb578063f573102114610403578063ffe7391414610416576101fb565b8063996d79a5146103b557806399ccd98b146103bd5780639be3ad67146103d05780639dc9dc93146103e3576101fb565b80638435035b116100e95780638435035b146103745780638540661f1461038757806385979f761461039a57806390580256146103ad576101fb565b8063741a33eb14610326578063746c32f11461033957806376427cac146103595780637cebbe941461036c576101fb565b806322bd64c011610192578063461a447811610161578063461a4478146102e25780635a98c361146102f55780635b99d1c5146102fd578063735090641461031e576101fb565b806322bd64c01461029257806324749d5c146102a7578063299ca478146102ba5780632a2a7adb146102cf576101fb565b806314aa2ff7116101ce57806314aa2ff7146102595780631c4712a71461027a5780631f64338b1461028257806320160f3a1461028a576101fb565b806303daa9591461020057806308bf7dbf146102295780630a5635ae14610231578063101185a414610244575b600080fd5b61021361020e366004612924565b610429565b6040516102209190612dbe565b60405180910390f35b61021361046e565b61021361023f366004612898565b610480565b61024c610516565b6040516102209190612ed3565b61026c6102673660046129b6565b61051f565b604051610220929190612e39565b6102136105b1565b6102136105b7565b6102136105be565b6102a56102a0366004612954565b6105c4565b005b6102136102b5366004612898565b61061f565b6102c2610638565b6040516102209190612dc7565b6102a56102dd3660046129b6565b610647565b6102c26102f0366004612b16565b610655565b610213610731565b61031061030b366004612c4d565b610737565b604051610220929190612e5d565b6102c26107bd565b6102a5610334366004612975565b6107cc565b61034c6103473660046128d0565b610931565b6040516102209190612e96565b61034c610367366004612b8e565b61094e565b6102a5610a50565b610213610382366004612898565b610a9f565b610310610395366004612bf7565b610ab2565b6103106103a8366004612bf7565b610b39565b610213610b56565b6102c2610b5c565b61026c6103cb366004612a37565b610b6b565b61034c6103de366004612b5b565b610bf8565b6102c2610d5a565b610213610d69565b610213610d6f565b610213610d75565b6102a56104113660046129e8565b610d87565b610310610424366004612bf7565b610f50565b6000619c4060005a9050600061043d610b5c565b90506104498186610fa5565b93505060005a820390508083101561046657601280548483030190555b505050919050565b600061047b61023f610b5c565b905090565b600080826040516024016104949190612dc7565b60408051601f198184030181529190526020810180516001600160e01b03166370a0823160e01b17905290506000806104d55a6006602160991b0185610ab2565b915091508115806104e857508051602014155b156104f7576104f76000611033565b8080602001905181019061050b919061293c565b93505050505b919050565b60085460ff1690565b60115460009060609060ff1615156001141561053f5761053f6006611033565b619c4060005a90506000610551610b5c565b905061055c8161104c565b60006105708261056b846110e1565b61116c565b905061057e81886003611206565b95509550505060005a82039050808310156105a05760128054840190556105a9565b60128054820190555b505050915091565b60045490565b62015f9081565b600b5490565b60115460ff161515600114156105de576105de6006611033565b61ea6060005a905060006105f0610b5c565b90506105fd818686611290565b5060005a820390508083101561061857601280548483030190555b5050505050565b600061063261062d83611317565b6113a2565b92915050565b6000546001600160a01b031681565b6106526001826113a6565b50565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156106b557818101518382015260200161069d565b50505050905090810190601f1680156106e25780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156106ff57600080fd5b505afa158015610713573d6000803e3d6000fd5b505050506040513d602081101561072957600080fd5b505192915050565b600a5490565b60006060620186a060005a60408051608081018252600f5460115460ff16151560608301526001600160a01b0390811682528a166020820152908101889052909150610787818a8a8960006113bc565b945094505060005a82039050808310156107a85760128054840190556107b1565b60128054820190555b50505094509492505050565b600e546001600160a01b031690565b60115460ff161515600114156107e6576107e66006611033565b600060018585601b0185856040516000815260200160405260405161080e9493929190612e78565b6020604051602081039080840390855afa158015610830573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661086c5761086c60405180606001604052806038815260200161304160389139610647565b6108758161144d565b61087f575061092b565b610888816114d8565b600f80546001600160a01b038381166001600160a01b03198316179092551660006108e56108c16009602160991b018361034782610a9f565b6040516020016108d19190612d88565b60405160208183030381529060405261153f565b600f80546001600160a01b0319166001600160a01b038516179055905061091c838261091081611552565b80519060200120611568565b6109278360006115a5565b5050505b50505050565b606061094661093f85611317565b8484611616565b949350505050565b6060331561095b57600080fd5b600280546001600160a01b0319166001600160a01b03841617905561097f8561163a565b600019601355600f80546001600160a01b0319166001600160a01b0386811691909117909155608086015116158015610a1e576000806109c28860c0015161051f565b90925090506001600160a01b038216610a02576000816040516020016109e9929190612e5d565b6040516020818303038152906040529350505050610946565b6001610a0d83611552565b6040516020016109e9929190612e5d565b600080610a398860a001518960800151888b60c00151610737565b9150915081816040516020016109e9929190612e5d565b60115460ff16151560011415610a6a57610a6a6006611033565b6000610a74610b5c565b90506000610a81826110e1565b905080816001011115610a9b57610a9b82826001016115a5565b5050565b6000610632610aad83611317565b6116ac565b600060606201388060005a60408051608081018252600f546001600160a01b03908116825289166020820152600160608201819052600092820192909252919250610b049082908a908a908a906113bc565b945094505060005a8203905080831015610b25576012805484019055610b2e565b60128054820190555b505050935093915050565b60006060610b4a8585600086610737565b91509150935093915050565b60075490565b600f546001600160a01b031690565b60115460009060609060ff16151560011415610b8b57610b8b6006611033565b619c4060005a90506000610b9d610b5c565b9050610ba88161104c565b6000610bb58289896116b0565b9050610bc381896004611206565b95509550505060005a8203905080831015610be5576012805484019055610bee565b60128054820190555b5050509250929050565b600a546060907fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d14610c395750604080516020810190915260008152610632565b600280546001600160a01b0319166001600160a01b038481169190911791829055604051630d15d41560e41b815291169063d15d415090610c7e903390600401612dc7565b60206040518083038186803b158015610c9657600080fd5b505afa158015610caa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cce9190612904565b610cf35760405162461bcd60e51b8152600401610cea90612f4f565b60405180910390fd5b610cfc8361163a565b610d05836116f6565b610d2657610d11611752565b50604080516020810190915260008152610632565b6000610d486003600001548560a0015103856080015160008760c00151610737565b915050610d53611752565b9392505050565b600d546001600160a01b031690565b60105490565b60095490565b600061047b610d82610b5c565b6110e1565b333014610d9357610a9b565b610d9c8161144d565b610daa57610daa6005611033565b6001546040516352275acd60e11b81526001600160a01b039091169063a44eb59a90610dda908590600401612e96565b60206040518083038186803b158015610df257600080fd5b505afa158015610e06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2a9190612904565b610e5957610e596004610e546040518060a0016040528060768152602001613079607691396117f4565b6113a6565b610e62816114d8565b6000610e6d8361153f565b90506001600160a01b038116610e87573d6000803e3d6000fd5b6000610e9282611552565b6001546040516352275acd60e11b81529192506001600160a01b03169063a44eb59a90610ec3908490600401612e96565b60206040518083038186803b158015610edb57600080fd5b505afa158015610eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f139190612904565b610f3d57610f3d6004610e546040518060600160405280603081526020016130ef603091396117f4565b61092b8383610f4b856113a2565b611568565b60006060619c4060005a60408051608081018252600e546001600160a01b039081168252600f541660208201526010549181019190915260115460ff1615156060820152909150610b048189898960026113bc565b6000610fb18383611837565b600254604051631aaf392f60e01b81526001600160a01b0390911690631aaf392f90610fe39086908690600401612dff565b60206040518083038186803b158015610ffb57600080fd5b505afa15801561100f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d53919061293c565b61065281604051806020016040528060008152506113a6565b6000806110ab5a6002602160991b0163b1540a0160e01b866040516024016110749190612dc7565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610ab2565b915091506000818060200190518101906110c59190612904565b90508015806110d2575082155b1561092b5761092b6007611033565b60006110ec82611972565b60025460405163d126199f60e01b81526001600160a01b039091169063d126199f9061111c908590600401612dc7565b60206040518083038186803b15801561113457600080fd5b505afa158015611148573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610632919061293c565b60408051600280825260608201909252600091829190816020015b60608152602001906001900390816111875790505090506111a784611ab9565b816000815181106111b457fe5b60200260200101819052506111c883611ae3565b816001815181106111d557fe5b602002602001018190525060006111eb82611af6565b90506111fd8180519060200120611b3a565b95945050505050565b60006060611228611215610b5c565b611220610d82610b5c565b6001016115a5565b60408051608081018252600f546010549282019290925260115460ff16151560608201526001600160a01b0391821681529086166020820152600080611271835a8a8a8a611b3d565b9150915081611281576000611283565b875b9890975095505050505050565b8061129b8484610fa5565b14156112a657611312565b6112b08383611e9a565b600254604051635c17d62960e01b81526001600160a01b0390911690635c17d629906112e490869086908690600401612e18565b600060405180830381600087803b1580156112fe57600080fd5b505af1158015610927573d6000803e3d6000fd5b505050565b600061132282611972565b600254604051637c8ee70360e01b81526001600160a01b0390911690637c8ee70390611352908590600401612dc7565b60206040518083038186803b15801561136a57600080fd5b505afa15801561137e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063291906128b4565b3f90565b60006113b28383611fac565b9050805160208201fd5b6000606073ffffffffffffffffffffffffffffffffffff0000851673deaddeaddeaddeaddeaddeaddeaddeaddead0000141561140b575050604080516020810190915260008152600190611443565b60006064866001600160a01b03161061142c5761142786611317565b61142e565b855b905061143d8888838888611b3d565b92509250505b9550959350505050565b600061145882611972565b6002546040516307a1294560e01b81526001600160a01b03909116906307a1294590611488908590600401612dc7565b60206040518083038186803b1580156114a057600080fd5b505afa1580156114b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106329190612904565b6114e181611972565b600254604051637e78a4d160e11b81526001600160a01b039091169063fcf149a290611511908490600401612dc7565b600060405180830381600087803b15801561152b57600080fd5b505af1158015610618573d6000803e3d6000fd5b6000808251602084016000f09392505050565b6060610632826000611563856116ac565b611616565b61157183612055565b6002546040516368510af960e11b81526001600160a01b039091169063d0a215f2906112e490869086908690600401612ddb565b6115ae82612055565b6002546040516374855dc360e11b81526001600160a01b039091169063e90abb86906115e09085908590600401612dff565b600060405180830381600087803b1580156115fa57600080fd5b505af115801561160e573d6000803e3d6000fd5b505050505050565b6060806040519050602083018101604052828152828460208301873c949350505050565b80516009556020810151600a5560a0810151600c5560408101516008805460ff19166001838181111561166957fe5b02179055506060810151600d80546001600160a01b0319166001600160a01b03909216919091179055600554600b5560a08101516116a690612164565b60135550565b3b90565b60008060ff60f81b858486805190602001206040516020016116d59493929190612d04565b6040516020818303038152906040528051906020012090506111fd81611b3a565b60007fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d8260200151141561172c57506000610511565b61173e8260a001518360400151612177565b61174a57506000610511565b506001919050565b600d805473defa017defa017defa017defa017defa017defa06001600160a01b031991821681179092557fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d6009819055600a819055600b819055600c8190556008805460ff199081169091556012829055600e8054841685179055600f8054841690941790935560118054909316909255601391909155600280549091169055565b6060816040516024016118079190612e96565b60408051601f198184030181529190526020810180516001600160e01b031662461bcd60e51b1790529050919050565b6175305a101561184b5761184b6000611033565b600254604051630ad2267960e01b81526001600160a01b0390911690630ad226799061187d9085908590600401612dff565b60206040518083038186803b15801561189557600080fd5b505afa1580156118a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118cd9190612904565b6118db576118db6003611033565b600254604051632bcdee1960e21b81526000916001600160a01b03169063af37b8649061190e9086908690600401612dff565b602060405180830381600087803b15801561192857600080fd5b505af115801561193c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119609190612904565b90508061131257611312614e206121a7565b6175305a1015611986576119866000611033565b60025460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf906119b6908490600401612dc7565b60206040518083038186803b1580156119ce57600080fd5b505afa1580156119e2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a069190612904565b611a1457611a146003611033565b600254604051633ecdecc760e21b81526000916001600160a01b03169063fb37b31c90611a45908590600401612dc7565b602060405180830381600087803b158015611a5f57600080fd5b505af1158015611a73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a979190612904565b905080610a9b57610a9b6175306064611ab2610aad86611317565b02016121a7565b606061063282604051602001611acf9190612ce7565b6040516020818303038152906040526121c7565b6060610632611af183612219565b6121c7565b60606000611b038361231d565b9050611b11815160c061241d565b81604051602001611b23929190612d59565b604051602081830303815290604052915050919050565b90565b60408501516000906060908015801590611b5b5750611b5b8461256d565b15611bcb5762015f905a1015611b84575050604080516020810190915260008082529150611443565b611b938762015f905a036125af565b96506000611ba58960200151836125c5565b905080611bc957600060405180602001604052806000815250935093505050611443565b505b60408051608081018252600e546001600160a01b039081168252600f541660208201526010549181019190915260115460ff1615156060820152611c0f818a612627565b6013546000611c1d8a612164565b6013819055905060006060611c31896126e8565b15611ce857306001600160a01b03168c63f573102160e01b8c8e604051602401611c5c929190612ea9565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051611c9a9190612d3d565b60006040518083038160008787f1925050503d8060008114611cd8576040519150601f19603f3d011682016040523d82523d6000602084013e611cdd565b606091505b509092509050611d4b565b8a6001600160a01b03168c8b604051611d019190612d3d565b60006040518083038160008787f1925050503d8060008114611d3f576040519150601f19603f3d011682016040523d82523d6000602084013e611d44565b606091505b5090925090505b600086118015611d5f5750611d5f8961256d565b8015611d69575081155b15611d91576000611d7e8660200151886125c5565b905080611d8f57611d8f6000611033565b505b611d9b8d86612627565b60135482611e8157600080600080611db2866126f1565b929650909450925090506003846007811115611dca57fe5b1415611dd957611dd984611033565b6001846007811115611de757fe5b1480611dfe57506004846007811115611dfc57fe5b145b80611e1457506006846007811115611e1257fe5b145b80611e2a57506007846007811115611e2857fe5b145b15611e355760128290555b6001846007811115611e4357fe5b1480611e5a57506004846007811115611e5857fe5b145b15611e6757809550611e7a565b6040518060200160405280600081525095505b5090925050505b909203909203601355909a909950975050505050505050565b611ea48282611837565b60025460405163af3dc01160e01b81526000916001600160a01b03169063af3dc01190611ed79086908690600401612dff565b602060405180830381600087803b158015611ef157600080fd5b505af1158015611f05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f299190612904565b90508061131257611f3983612055565b600260009054906101000a90046001600160a01b03166001600160a01b031663c3fd9b256040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611f8957600080fd5b505af1158015611f9d573d6000803e3d6000fd5b50505050611312614e206121a7565b60606000836007811115611fbc57fe5b1415611fd75750604080516020810190915260008152610632565b6003836007811115611fe557fe5b14156120235760408051602080820183526000808352925161200d9387939092839201612ee7565b6040516020818303038152906040529050610632565b60135460125460405161203e92869290918690602001612f23565b604051602081830303815290604052905092915050565b61205e81611972565b60025460405163011b1f7960e41b81526000916001600160a01b0316906311b1f7909061208f908590600401612dc7565b602060405180830381600087803b1580156120a957600080fd5b505af11580156120bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120e19190612904565b905080610a9b57600260009054906101000a90046001600160a01b03166001600160a01b03166333f943056040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561213857600080fd5b505af115801561214c573d6000803e3d6000fd5b50505050610a9b6175306064611ab2610aad86611317565b60005a8210612173575a610632565b5090565b60045460009083111561218c57506000610632565b60035483101561219e57506000610632565b50600192915050565b6013548111156121bb576121bb6002611033565b60138054919091039055565b606080825160011480156121ef57506080836000815181106121e557fe5b016020015160f81c105b156121fb575081610632565b6122078351608061241d565b8360405160200161203e929190612d59565b606060008260405160200161222e9190612dbe565b604051602081830303815290604052905060005b60208110156122785781818151811061225757fe5b01602001516001600160f81b0319161561227057612278565b600101612242565b6000816020036001600160401b038111801561229357600080fd5b506040519080825280601f01601f1916602001820160405280156122be576020820181803683370190505b50905060005b81518110156123145783516001840193859181106122de57fe5b602001015160f81c60f81b8282815181106122f557fe5b60200101906001600160f81b031916908160001a9053506001016122c4565b50949350505050565b606081516000141561233e5750604080516000815260208101909152610511565b6000805b83518110156123715783818151811061235757fe5b602002602001015151820191508080600101915050612342565b6000826001600160401b038111801561238957600080fd5b506040519080825280601f01601f1916602001820160405280156123b4576020820181803683370190505b50600092509050602081015b85518310156123145760008684815181106123d757fe5b6020026020010151905060006020820190506123f583828451612744565b87858151811061240157fe5b60200260200101515183019250505082806001019350506123c0565b6060806038841015612477576040805160018082528183019092529060208201818036833701905050905082840160f81b8160008151811061245b57fe5b60200101906001600160f81b031916908160001a905350610d53565b600060015b80868161248557fe5b041561249a576001909101906101000261247c565b816001016001600160401b03811180156124b357600080fd5b506040519080825280601f01601f1916602001820160405280156124de576020820181803683370190505b50925084820160370160f81b836000815181106124f757fe5b60200101906001600160f81b031916908160001a905350600190505b818111612563576101008183036101000a878161252c57fe5b048161253457fe5b0660f81b83828151811061254457fe5b60200101906001600160f81b031916908160001a905350600101612513565b5050905092915050565b60008082600481111561257c57fe5b1480612594575060035b82600481111561259257fe5b145b80610632575060048260048111156125a857fe5b1492915050565b60008183106125be5781610d53565b5090919050565b60008083836040516024016125db929190612dff565b60408051601f198184030181529190526020810180516001600160e01b031663a9059cbb60e01b1790529050600061261d5a6006602160991b01600085610737565b5095945050505050565b805182516001600160a01b0390811691161461265f578051600e80546001600160a01b0319166001600160a01b039092169190911790555b80602001516001600160a01b031682602001516001600160a01b0316146126a5576020810151600f80546001600160a01b0319166001600160a01b039092169190911790555b8060600151151582606001511515146126cf5760608101516011805460ff19169115159190911790555b8060400151826040015114610a9b576040015160105550565b60006003612586565b60008060006060845160001415612720575050604080516020810190915260008082529250829150819061273d565b848060200190518101906127349190612a79565b93509350935093505b9193509193565b8282825b60208110612767578151835260209283019290910190601f1901612748565b905182516020929092036101000a6000190180199091169116179052505050565b600061279b61279684612fde565b612fbb565b90508281528383830111156127af57600080fd5b828260208301376000602084830101529392505050565b80356105118161302b565b600082601f8301126127e1578081fd5b610d5383833560208501612788565b80356002811061051157600080fd5b600060e08284031215612810578081fd5b61281a60e0612fbb565b90508135815260208201356020820152612836604083016127f0565b6040820152612847606083016127c6565b6060820152612858608083016127c6565b608082015260a082013560a082015260c08201356001600160401b0381111561288057600080fd5b61288c848285016127d1565b60c08301525092915050565b6000602082840312156128a9578081fd5b8135610d538161302b565b6000602082840312156128c5578081fd5b8151610d538161302b565b6000806000606084860312156128e4578182fd5b83356128ef8161302b565b95602085013595506040909401359392505050565b600060208284031215612915578081fd5b81518015158114610d53578182fd5b600060208284031215612935578081fd5b5035919050565b60006020828403121561294d578081fd5b5051919050565b60008060408385031215612966578182fd5b50508035926020909101359150565b6000806000806080858703121561298a578081fd5b84359350602085013560ff811681146129a1578182fd5b93969395505050506040820135916060013590565b6000602082840312156129c7578081fd5b81356001600160401b038111156129dc578182fd5b610946848285016127d1565b600080604083850312156129fa578182fd5b82356001600160401b03811115612a0f578283fd5b612a1b858286016127d1565b9250506020830135612a2c8161302b565b809150509250929050565b60008060408385031215612a49578182fd5b82356001600160401b03811115612a5e578283fd5b612a6a858286016127d1565b95602094909401359450505050565b60008060008060808587031215612a8e578182fd5b845160088110612a9c578283fd5b80945050602085015192506040850151915060608501516001600160401b03811115612ac6578182fd5b8501601f81018713612ad6578182fd5b8051612ae461279682612fde565b818152886020838501011115612af8578384fd5b612b09826020830160208601612fff565b9598949750929550505050565b600060208284031215612b27578081fd5b81356001600160401b03811115612b3c578182fd5b8201601f81018413612b4c578182fd5b61094684823560208401612788565b60008060408385031215612b6d578182fd5b82356001600160401b03811115612b82578283fd5b612a1b858286016127ff565b60008060008060808587031215612ba3578182fd5b84356001600160401b03811115612bb8578283fd5b612bc4878288016127ff565b9450506020850135612bd58161302b565b9250604085013591506060850135612bec8161302b565b939692955090935050565b600080600060608486031215612c0b578081fd5b833592506020840135612c1d8161302b565b915060408401356001600160401b03811115612c37578182fd5b612c43868287016127d1565b9150509250925092565b60008060008060808587031215612c62578182fd5b843593506020850135612c748161302b565b92506040850135915060608501356001600160401b03811115612c95578182fd5b612ca1878288016127d1565b91505092959194509250565b60008151808452612cc5816020860160208601612fff565b601f01601f19169290920160200192915050565b60088110612ce357fe5b9052565b60609190911b6bffffffffffffffffffffffff1916815260140190565b6001600160f81b031994909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b60008251612d4f818460208701612fff565b9190910192915050565b60008351612d6b818460208801612fff565b835190830190612d7f818360208801612fff565b01949350505050565b6c600d380380600d6000396000f360981b81528151600090612db181600d850160208701612fff565b91909101600d0192915050565b90815260200190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b038316815260406020820181905260009061094690830184612cad565b60008315158252604060208301526109466040830184612cad565b93845260ff9290921660208401526040830152606082015260800190565b600060208252610d536020830184612cad565b600060408252612ebc6040830185612cad565b905060018060a01b03831660208301529392505050565b6020810160028310612ee157fe5b91905290565b6000612ef38287612cd9565b60ff8516602083015260ff8416604083015260806060830152612f196080830184612cad565b9695505050505050565b6000612f2f8287612cd9565b84602083015283604083015260806060830152612f196080830184612cad565b60208082526046908201527f4f6e6c792061757468656e746963617465642061646472657373657320696e2060408201527f6f766d53746174654d616e616765722063616e2063616c6c20746869732066756060820152653731ba34b7b760d11b608082015260a00190565b6040518181016001600160401b0381118282101715612fd657fe5b604052919050565b60006001600160401b03821115612ff157fe5b50601f01601f191660200190565b60005b8381101561301a578181015183820152602001613002565b8381111561092b5750506000910152565b6001600160a01b038116811461065257600080fdfe5369676e61747572652070726f766964656420666f7220454f4120636f6e7472616374206372656174696f6e20697320696e76616c69642e436f6e7472616374206372656174696f6e20636f646520636f6e7461696e7320756e73616665206f70636f6465732e2044696420796f75207573652074686520726967687420636f6d70696c6572206f72207061737320616e20756e7361666520636f6e7374727563746f7220617267756d656e743f436f6e7374727563746f7220617474656d7074656420746f206465706c6f7920756e736166652062797465636f64652ea2646970667358221220fe0b47506ec2f40df111ba865323ee43ffbd7ef91f30eae2dfc209de19a78c0a64736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101fb5760003560e01c8063741a33eb1161011a578063996d79a5116100ad578063a8c4c5ec1161007c578063a8c4c5ec146103eb578063bdbf8c36146103f3578063c1fb2ea2146103fb578063f573102114610403578063ffe7391414610416576101fb565b8063996d79a5146103b557806399ccd98b146103bd5780639be3ad67146103d05780639dc9dc93146103e3576101fb565b80638435035b116100e95780638435035b146103745780638540661f1461038757806385979f761461039a57806390580256146103ad576101fb565b8063741a33eb14610326578063746c32f11461033957806376427cac146103595780637cebbe941461036c576101fb565b806322bd64c011610192578063461a447811610161578063461a4478146102e25780635a98c361146102f55780635b99d1c5146102fd578063735090641461031e576101fb565b806322bd64c01461029257806324749d5c146102a7578063299ca478146102ba5780632a2a7adb146102cf576101fb565b806314aa2ff7116101ce57806314aa2ff7146102595780631c4712a71461027a5780631f64338b1461028257806320160f3a1461028a576101fb565b806303daa9591461020057806308bf7dbf146102295780630a5635ae14610231578063101185a414610244575b600080fd5b61021361020e366004612924565b610429565b6040516102209190612dbe565b60405180910390f35b61021361046e565b61021361023f366004612898565b610480565b61024c610516565b6040516102209190612ed3565b61026c6102673660046129b6565b61051f565b604051610220929190612e39565b6102136105b1565b6102136105b7565b6102136105be565b6102a56102a0366004612954565b6105c4565b005b6102136102b5366004612898565b61061f565b6102c2610638565b6040516102209190612dc7565b6102a56102dd3660046129b6565b610647565b6102c26102f0366004612b16565b610655565b610213610731565b61031061030b366004612c4d565b610737565b604051610220929190612e5d565b6102c26107bd565b6102a5610334366004612975565b6107cc565b61034c6103473660046128d0565b610931565b6040516102209190612e96565b61034c610367366004612b8e565b61094e565b6102a5610a50565b610213610382366004612898565b610a9f565b610310610395366004612bf7565b610ab2565b6103106103a8366004612bf7565b610b39565b610213610b56565b6102c2610b5c565b61026c6103cb366004612a37565b610b6b565b61034c6103de366004612b5b565b610bf8565b6102c2610d5a565b610213610d69565b610213610d6f565b610213610d75565b6102a56104113660046129e8565b610d87565b610310610424366004612bf7565b610f50565b6000619c4060005a9050600061043d610b5c565b90506104498186610fa5565b93505060005a820390508083101561046657601280548483030190555b505050919050565b600061047b61023f610b5c565b905090565b600080826040516024016104949190612dc7565b60408051601f198184030181529190526020810180516001600160e01b03166370a0823160e01b17905290506000806104d55a6006602160991b0185610ab2565b915091508115806104e857508051602014155b156104f7576104f76000611033565b8080602001905181019061050b919061293c565b93505050505b919050565b60085460ff1690565b60115460009060609060ff1615156001141561053f5761053f6006611033565b619c4060005a90506000610551610b5c565b905061055c8161104c565b60006105708261056b846110e1565b61116c565b905061057e81886003611206565b95509550505060005a82039050808310156105a05760128054840190556105a9565b60128054820190555b505050915091565b60045490565b62015f9081565b600b5490565b60115460ff161515600114156105de576105de6006611033565b61ea6060005a905060006105f0610b5c565b90506105fd818686611290565b5060005a820390508083101561061857601280548483030190555b5050505050565b600061063261062d83611317565b6113a2565b92915050565b6000546001600160a01b031681565b6106526001826113a6565b50565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156106b557818101518382015260200161069d565b50505050905090810190601f1680156106e25780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156106ff57600080fd5b505afa158015610713573d6000803e3d6000fd5b505050506040513d602081101561072957600080fd5b505192915050565b600a5490565b60006060620186a060005a60408051608081018252600f5460115460ff16151560608301526001600160a01b0390811682528a166020820152908101889052909150610787818a8a8960006113bc565b945094505060005a82039050808310156107a85760128054840190556107b1565b60128054820190555b50505094509492505050565b600e546001600160a01b031690565b60115460ff161515600114156107e6576107e66006611033565b600060018585601b0185856040516000815260200160405260405161080e9493929190612e78565b6020604051602081039080840390855afa158015610830573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661086c5761086c60405180606001604052806038815260200161304160389139610647565b6108758161144d565b61087f575061092b565b610888816114d8565b600f80546001600160a01b038381166001600160a01b03198316179092551660006108e56108c16009602160991b018361034782610a9f565b6040516020016108d19190612d88565b60405160208183030381529060405261153f565b600f80546001600160a01b0319166001600160a01b038516179055905061091c838261091081611552565b80519060200120611568565b6109278360006115a5565b5050505b50505050565b606061094661093f85611317565b8484611616565b949350505050565b6060331561095b57600080fd5b600280546001600160a01b0319166001600160a01b03841617905561097f8561163a565b600019601355600f80546001600160a01b0319166001600160a01b0386811691909117909155608086015116158015610a1e576000806109c28860c0015161051f565b90925090506001600160a01b038216610a02576000816040516020016109e9929190612e5d565b6040516020818303038152906040529350505050610946565b6001610a0d83611552565b6040516020016109e9929190612e5d565b600080610a398860a001518960800151888b60c00151610737565b9150915081816040516020016109e9929190612e5d565b60115460ff16151560011415610a6a57610a6a6006611033565b6000610a74610b5c565b90506000610a81826110e1565b905080816001011115610a9b57610a9b82826001016115a5565b5050565b6000610632610aad83611317565b6116ac565b600060606201388060005a60408051608081018252600f546001600160a01b03908116825289166020820152600160608201819052600092820192909252919250610b049082908a908a908a906113bc565b945094505060005a8203905080831015610b25576012805484019055610b2e565b60128054820190555b505050935093915050565b60006060610b4a8585600086610737565b91509150935093915050565b60075490565b600f546001600160a01b031690565b60115460009060609060ff16151560011415610b8b57610b8b6006611033565b619c4060005a90506000610b9d610b5c565b9050610ba88161104c565b6000610bb58289896116b0565b9050610bc381896004611206565b95509550505060005a8203905080831015610be5576012805484019055610bee565b60128054820190555b5050509250929050565b600a546060907fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d14610c395750604080516020810190915260008152610632565b600280546001600160a01b0319166001600160a01b038481169190911791829055604051630d15d41560e41b815291169063d15d415090610c7e903390600401612dc7565b60206040518083038186803b158015610c9657600080fd5b505afa158015610caa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cce9190612904565b610cf35760405162461bcd60e51b8152600401610cea90612f4f565b60405180910390fd5b610cfc8361163a565b610d05836116f6565b610d2657610d11611752565b50604080516020810190915260008152610632565b6000610d486003600001548560a0015103856080015160008760c00151610737565b915050610d53611752565b9392505050565b600d546001600160a01b031690565b60105490565b60095490565b600061047b610d82610b5c565b6110e1565b333014610d9357610a9b565b610d9c8161144d565b610daa57610daa6005611033565b6001546040516352275acd60e11b81526001600160a01b039091169063a44eb59a90610dda908590600401612e96565b60206040518083038186803b158015610df257600080fd5b505afa158015610e06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2a9190612904565b610e5957610e596004610e546040518060a0016040528060768152602001613079607691396117f4565b6113a6565b610e62816114d8565b6000610e6d8361153f565b90506001600160a01b038116610e87573d6000803e3d6000fd5b6000610e9282611552565b6001546040516352275acd60e11b81529192506001600160a01b03169063a44eb59a90610ec3908490600401612e96565b60206040518083038186803b158015610edb57600080fd5b505afa158015610eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f139190612904565b610f3d57610f3d6004610e546040518060600160405280603081526020016130ef603091396117f4565b61092b8383610f4b856113a2565b611568565b60006060619c4060005a60408051608081018252600e546001600160a01b039081168252600f541660208201526010549181019190915260115460ff1615156060820152909150610b048189898960026113bc565b6000610fb18383611837565b600254604051631aaf392f60e01b81526001600160a01b0390911690631aaf392f90610fe39086908690600401612dff565b60206040518083038186803b158015610ffb57600080fd5b505afa15801561100f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d53919061293c565b61065281604051806020016040528060008152506113a6565b6000806110ab5a6002602160991b0163b1540a0160e01b866040516024016110749190612dc7565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610ab2565b915091506000818060200190518101906110c59190612904565b90508015806110d2575082155b1561092b5761092b6007611033565b60006110ec82611972565b60025460405163d126199f60e01b81526001600160a01b039091169063d126199f9061111c908590600401612dc7565b60206040518083038186803b15801561113457600080fd5b505afa158015611148573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610632919061293c565b60408051600280825260608201909252600091829190816020015b60608152602001906001900390816111875790505090506111a784611ab9565b816000815181106111b457fe5b60200260200101819052506111c883611ae3565b816001815181106111d557fe5b602002602001018190525060006111eb82611af6565b90506111fd8180519060200120611b3a565b95945050505050565b60006060611228611215610b5c565b611220610d82610b5c565b6001016115a5565b60408051608081018252600f546010549282019290925260115460ff16151560608201526001600160a01b0391821681529086166020820152600080611271835a8a8a8a611b3d565b9150915081611281576000611283565b875b9890975095505050505050565b8061129b8484610fa5565b14156112a657611312565b6112b08383611e9a565b600254604051635c17d62960e01b81526001600160a01b0390911690635c17d629906112e490869086908690600401612e18565b600060405180830381600087803b1580156112fe57600080fd5b505af1158015610927573d6000803e3d6000fd5b505050565b600061132282611972565b600254604051637c8ee70360e01b81526001600160a01b0390911690637c8ee70390611352908590600401612dc7565b60206040518083038186803b15801561136a57600080fd5b505afa15801561137e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063291906128b4565b3f90565b60006113b28383611fac565b9050805160208201fd5b6000606073ffffffffffffffffffffffffffffffffffff0000851673deaddeaddeaddeaddeaddeaddeaddeaddead0000141561140b575050604080516020810190915260008152600190611443565b60006064866001600160a01b03161061142c5761142786611317565b61142e565b855b905061143d8888838888611b3d565b92509250505b9550959350505050565b600061145882611972565b6002546040516307a1294560e01b81526001600160a01b03909116906307a1294590611488908590600401612dc7565b60206040518083038186803b1580156114a057600080fd5b505afa1580156114b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106329190612904565b6114e181611972565b600254604051637e78a4d160e11b81526001600160a01b039091169063fcf149a290611511908490600401612dc7565b600060405180830381600087803b15801561152b57600080fd5b505af1158015610618573d6000803e3d6000fd5b6000808251602084016000f09392505050565b6060610632826000611563856116ac565b611616565b61157183612055565b6002546040516368510af960e11b81526001600160a01b039091169063d0a215f2906112e490869086908690600401612ddb565b6115ae82612055565b6002546040516374855dc360e11b81526001600160a01b039091169063e90abb86906115e09085908590600401612dff565b600060405180830381600087803b1580156115fa57600080fd5b505af115801561160e573d6000803e3d6000fd5b505050505050565b6060806040519050602083018101604052828152828460208301873c949350505050565b80516009556020810151600a5560a0810151600c5560408101516008805460ff19166001838181111561166957fe5b02179055506060810151600d80546001600160a01b0319166001600160a01b03909216919091179055600554600b5560a08101516116a690612164565b60135550565b3b90565b60008060ff60f81b858486805190602001206040516020016116d59493929190612d04565b6040516020818303038152906040528051906020012090506111fd81611b3a565b60007fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d8260200151141561172c57506000610511565b61173e8260a001518360400151612177565b61174a57506000610511565b506001919050565b600d805473defa017defa017defa017defa017defa017defa06001600160a01b031991821681179092557fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d6009819055600a819055600b819055600c8190556008805460ff199081169091556012829055600e8054841685179055600f8054841690941790935560118054909316909255601391909155600280549091169055565b6060816040516024016118079190612e96565b60408051601f198184030181529190526020810180516001600160e01b031662461bcd60e51b1790529050919050565b6175305a101561184b5761184b6000611033565b600254604051630ad2267960e01b81526001600160a01b0390911690630ad226799061187d9085908590600401612dff565b60206040518083038186803b15801561189557600080fd5b505afa1580156118a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118cd9190612904565b6118db576118db6003611033565b600254604051632bcdee1960e21b81526000916001600160a01b03169063af37b8649061190e9086908690600401612dff565b602060405180830381600087803b15801561192857600080fd5b505af115801561193c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119609190612904565b90508061131257611312614e206121a7565b6175305a1015611986576119866000611033565b60025460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf906119b6908490600401612dc7565b60206040518083038186803b1580156119ce57600080fd5b505afa1580156119e2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a069190612904565b611a1457611a146003611033565b600254604051633ecdecc760e21b81526000916001600160a01b03169063fb37b31c90611a45908590600401612dc7565b602060405180830381600087803b158015611a5f57600080fd5b505af1158015611a73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a979190612904565b905080610a9b57610a9b6175306064611ab2610aad86611317565b02016121a7565b606061063282604051602001611acf9190612ce7565b6040516020818303038152906040526121c7565b6060610632611af183612219565b6121c7565b60606000611b038361231d565b9050611b11815160c061241d565b81604051602001611b23929190612d59565b604051602081830303815290604052915050919050565b90565b60408501516000906060908015801590611b5b5750611b5b8461256d565b15611bcb5762015f905a1015611b84575050604080516020810190915260008082529150611443565b611b938762015f905a036125af565b96506000611ba58960200151836125c5565b905080611bc957600060405180602001604052806000815250935093505050611443565b505b60408051608081018252600e546001600160a01b039081168252600f541660208201526010549181019190915260115460ff1615156060820152611c0f818a612627565b6013546000611c1d8a612164565b6013819055905060006060611c31896126e8565b15611ce857306001600160a01b03168c63f573102160e01b8c8e604051602401611c5c929190612ea9565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051611c9a9190612d3d565b60006040518083038160008787f1925050503d8060008114611cd8576040519150601f19603f3d011682016040523d82523d6000602084013e611cdd565b606091505b509092509050611d4b565b8a6001600160a01b03168c8b604051611d019190612d3d565b60006040518083038160008787f1925050503d8060008114611d3f576040519150601f19603f3d011682016040523d82523d6000602084013e611d44565b606091505b5090925090505b600086118015611d5f5750611d5f8961256d565b8015611d69575081155b15611d91576000611d7e8660200151886125c5565b905080611d8f57611d8f6000611033565b505b611d9b8d86612627565b60135482611e8157600080600080611db2866126f1565b929650909450925090506003846007811115611dca57fe5b1415611dd957611dd984611033565b6001846007811115611de757fe5b1480611dfe57506004846007811115611dfc57fe5b145b80611e1457506006846007811115611e1257fe5b145b80611e2a57506007846007811115611e2857fe5b145b15611e355760128290555b6001846007811115611e4357fe5b1480611e5a57506004846007811115611e5857fe5b145b15611e6757809550611e7a565b6040518060200160405280600081525095505b5090925050505b909203909203601355909a909950975050505050505050565b611ea48282611837565b60025460405163af3dc01160e01b81526000916001600160a01b03169063af3dc01190611ed79086908690600401612dff565b602060405180830381600087803b158015611ef157600080fd5b505af1158015611f05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f299190612904565b90508061131257611f3983612055565b600260009054906101000a90046001600160a01b03166001600160a01b031663c3fd9b256040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611f8957600080fd5b505af1158015611f9d573d6000803e3d6000fd5b50505050611312614e206121a7565b60606000836007811115611fbc57fe5b1415611fd75750604080516020810190915260008152610632565b6003836007811115611fe557fe5b14156120235760408051602080820183526000808352925161200d9387939092839201612ee7565b6040516020818303038152906040529050610632565b60135460125460405161203e92869290918690602001612f23565b604051602081830303815290604052905092915050565b61205e81611972565b60025460405163011b1f7960e41b81526000916001600160a01b0316906311b1f7909061208f908590600401612dc7565b602060405180830381600087803b1580156120a957600080fd5b505af11580156120bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120e19190612904565b905080610a9b57600260009054906101000a90046001600160a01b03166001600160a01b03166333f943056040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561213857600080fd5b505af115801561214c573d6000803e3d6000fd5b50505050610a9b6175306064611ab2610aad86611317565b60005a8210612173575a610632565b5090565b60045460009083111561218c57506000610632565b60035483101561219e57506000610632565b50600192915050565b6013548111156121bb576121bb6002611033565b60138054919091039055565b606080825160011480156121ef57506080836000815181106121e557fe5b016020015160f81c105b156121fb575081610632565b6122078351608061241d565b8360405160200161203e929190612d59565b606060008260405160200161222e9190612dbe565b604051602081830303815290604052905060005b60208110156122785781818151811061225757fe5b01602001516001600160f81b0319161561227057612278565b600101612242565b6000816020036001600160401b038111801561229357600080fd5b506040519080825280601f01601f1916602001820160405280156122be576020820181803683370190505b50905060005b81518110156123145783516001840193859181106122de57fe5b602001015160f81c60f81b8282815181106122f557fe5b60200101906001600160f81b031916908160001a9053506001016122c4565b50949350505050565b606081516000141561233e5750604080516000815260208101909152610511565b6000805b83518110156123715783818151811061235757fe5b602002602001015151820191508080600101915050612342565b6000826001600160401b038111801561238957600080fd5b506040519080825280601f01601f1916602001820160405280156123b4576020820181803683370190505b50600092509050602081015b85518310156123145760008684815181106123d757fe5b6020026020010151905060006020820190506123f583828451612744565b87858151811061240157fe5b60200260200101515183019250505082806001019350506123c0565b6060806038841015612477576040805160018082528183019092529060208201818036833701905050905082840160f81b8160008151811061245b57fe5b60200101906001600160f81b031916908160001a905350610d53565b600060015b80868161248557fe5b041561249a576001909101906101000261247c565b816001016001600160401b03811180156124b357600080fd5b506040519080825280601f01601f1916602001820160405280156124de576020820181803683370190505b50925084820160370160f81b836000815181106124f757fe5b60200101906001600160f81b031916908160001a905350600190505b818111612563576101008183036101000a878161252c57fe5b048161253457fe5b0660f81b83828151811061254457fe5b60200101906001600160f81b031916908160001a905350600101612513565b5050905092915050565b60008082600481111561257c57fe5b1480612594575060035b82600481111561259257fe5b145b80610632575060048260048111156125a857fe5b1492915050565b60008183106125be5781610d53565b5090919050565b60008083836040516024016125db929190612dff565b60408051601f198184030181529190526020810180516001600160e01b031663a9059cbb60e01b1790529050600061261d5a6006602160991b01600085610737565b5095945050505050565b805182516001600160a01b0390811691161461265f578051600e80546001600160a01b0319166001600160a01b039092169190911790555b80602001516001600160a01b031682602001516001600160a01b0316146126a5576020810151600f80546001600160a01b0319166001600160a01b039092169190911790555b8060600151151582606001511515146126cf5760608101516011805460ff19169115159190911790555b8060400151826040015114610a9b576040015160105550565b60006003612586565b60008060006060845160001415612720575050604080516020810190915260008082529250829150819061273d565b848060200190518101906127349190612a79565b93509350935093505b9193509193565b8282825b60208110612767578151835260209283019290910190601f1901612748565b905182516020929092036101000a6000190180199091169116179052505050565b600061279b61279684612fde565b612fbb565b90508281528383830111156127af57600080fd5b828260208301376000602084830101529392505050565b80356105118161302b565b600082601f8301126127e1578081fd5b610d5383833560208501612788565b80356002811061051157600080fd5b600060e08284031215612810578081fd5b61281a60e0612fbb565b90508135815260208201356020820152612836604083016127f0565b6040820152612847606083016127c6565b6060820152612858608083016127c6565b608082015260a082013560a082015260c08201356001600160401b0381111561288057600080fd5b61288c848285016127d1565b60c08301525092915050565b6000602082840312156128a9578081fd5b8135610d538161302b565b6000602082840312156128c5578081fd5b8151610d538161302b565b6000806000606084860312156128e4578182fd5b83356128ef8161302b565b95602085013595506040909401359392505050565b600060208284031215612915578081fd5b81518015158114610d53578182fd5b600060208284031215612935578081fd5b5035919050565b60006020828403121561294d578081fd5b5051919050565b60008060408385031215612966578182fd5b50508035926020909101359150565b6000806000806080858703121561298a578081fd5b84359350602085013560ff811681146129a1578182fd5b93969395505050506040820135916060013590565b6000602082840312156129c7578081fd5b81356001600160401b038111156129dc578182fd5b610946848285016127d1565b600080604083850312156129fa578182fd5b82356001600160401b03811115612a0f578283fd5b612a1b858286016127d1565b9250506020830135612a2c8161302b565b809150509250929050565b60008060408385031215612a49578182fd5b82356001600160401b03811115612a5e578283fd5b612a6a858286016127d1565b95602094909401359450505050565b60008060008060808587031215612a8e578182fd5b845160088110612a9c578283fd5b80945050602085015192506040850151915060608501516001600160401b03811115612ac6578182fd5b8501601f81018713612ad6578182fd5b8051612ae461279682612fde565b818152886020838501011115612af8578384fd5b612b09826020830160208601612fff565b9598949750929550505050565b600060208284031215612b27578081fd5b81356001600160401b03811115612b3c578182fd5b8201601f81018413612b4c578182fd5b61094684823560208401612788565b60008060408385031215612b6d578182fd5b82356001600160401b03811115612b82578283fd5b612a1b858286016127ff565b60008060008060808587031215612ba3578182fd5b84356001600160401b03811115612bb8578283fd5b612bc4878288016127ff565b9450506020850135612bd58161302b565b9250604085013591506060850135612bec8161302b565b939692955090935050565b600080600060608486031215612c0b578081fd5b833592506020840135612c1d8161302b565b915060408401356001600160401b03811115612c37578182fd5b612c43868287016127d1565b9150509250925092565b60008060008060808587031215612c62578182fd5b843593506020850135612c748161302b565b92506040850135915060608501356001600160401b03811115612c95578182fd5b612ca1878288016127d1565b91505092959194509250565b60008151808452612cc5816020860160208601612fff565b601f01601f19169290920160200192915050565b60088110612ce357fe5b9052565b60609190911b6bffffffffffffffffffffffff1916815260140190565b6001600160f81b031994909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b60008251612d4f818460208701612fff565b9190910192915050565b60008351612d6b818460208801612fff565b835190830190612d7f818360208801612fff565b01949350505050565b6c600d380380600d6000396000f360981b81528151600090612db181600d850160208701612fff565b91909101600d0192915050565b90815260200190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b038316815260406020820181905260009061094690830184612cad565b60008315158252604060208301526109466040830184612cad565b93845260ff9290921660208401526040830152606082015260800190565b600060208252610d536020830184612cad565b600060408252612ebc6040830185612cad565b905060018060a01b03831660208301529392505050565b6020810160028310612ee157fe5b91905290565b6000612ef38287612cd9565b60ff8516602083015260ff8416604083015260806060830152612f196080830184612cad565b9695505050505050565b6000612f2f8287612cd9565b84602083015283604083015260806060830152612f196080830184612cad565b60208082526046908201527f4f6e6c792061757468656e746963617465642061646472657373657320696e2060408201527f6f766d53746174654d616e616765722063616e2063616c6c20746869732066756060820152653731ba34b7b760d11b608082015260a00190565b6040518181016001600160401b0381118282101715612fd657fe5b604052919050565b60006001600160401b03821115612ff157fe5b50601f01601f191660200190565b60005b8381101561301a578181015183820152602001613002565b8381111561092b5750506000910152565b6001600160a01b038116811461065257600080fdfe5369676e61747572652070726f766964656420666f7220454f4120636f6e7472616374206372656174696f6e20697320696e76616c69642e436f6e7472616374206372656174696f6e20636f646520636f6e7461696e7320756e73616665206f70636f6465732e2044696420796f75207573652074686520726967687420636f6d70696c6572206f72207061737320616e20756e7361666520636f6e7374727563746f7220617267756d656e743f436f6e7374727563746f7220617474656d7074656420746f206465706c6f7920756e736166652062797465636f64652ea2646970667358221220fe0b47506ec2f40df111ba865323ee43ffbd7ef91f30eae2dfc209de19a78c0a64736f6c63430007060033", "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", @@ -722,6 +814,14 @@ "_ADDRESS": "Active ADDRESS within the current message context." } }, + "ovmBALANCE(address)": { + "params": { + "_contract": "Address of the contract to query the OVM_ETH balance of." + }, + "returns": { + "_BALANCE": "OVM_ETH balance of the requested contract." + } + }, "ovmCALL(uint256,address,bytes)": { "params": { "_address": "Address of the contract to call.", @@ -733,11 +833,28 @@ "_success": "Whether or not the call returned (rather than reverted)." } }, + "ovmCALL(uint256,address,uint256,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.", + "_value": "ETH value to pass with the 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." } }, + "ovmCALLVALUE()": { + "returns": { + "_CALLVALUE": "Value sent along with the call according to the current message context." + } + }, "ovmCHAINID()": { "returns": { "_CHAINID": "Value of the chain's CHAINID within the global context." @@ -838,6 +955,11 @@ "_data": "Bytes data to pass along with the REVERT." } }, + "ovmSELFBALANCE()": { + "returns": { + "_BALANCE": "OVM_ETH balance of the requesting contract." + } + }, "ovmSLOAD(bytes32)": { "params": { "_key": "32 byte key of the storage slot to load." @@ -882,20 +1004,26 @@ "_transaction": "Transaction data to be executed." } }, - "safeCREATE(uint256,bytes,address)": { + "safeCREATE(bytes,address)": { "params": { "_address": "OVM address being deployed to.", - "_creationCode": "Code to pass into CREATE for deployment.", - "_gasLimit": "Amount of gas to be passed into this creation." + "_creationCode": "Code to pass into CREATE for deployment." } }, - "simulateMessage((uint256,uint256,uint8,address,address,uint256,bytes),address,address)": { + "simulateMessage((uint256,uint256,uint8,address,address,uint256,bytes),address,uint256,address)": { "params": { "_from": "the OVM account the simulated call should be from.", - "_transaction": "the message transaction to simulate." + "_ovmStateManager": "the address of the OVM_StateManager precompile in the L2 state.", + "_transaction": "the message transaction to simulate.", + "_value": "the amount of ETH value to send." } } }, + "stateVariables": { + "CONTAINER_CONTRACT_PREFIX": { + "details": "The Execution Manager and State Manager each have this 30 byte prefix, and are uncallable." + } + }, "title": "OVM_ExecutionManager", "version": 1 }, @@ -905,12 +1033,21 @@ "ovmADDRESS()": { "notice": "Overrides ADDRESS." }, + "ovmBALANCE(address)": { + "notice": "Overrides BALANCE. NOTE: In the future, this could be optimized to directly invoke EM._getContractStorage(...)." + }, "ovmCALL(uint256,address,bytes)": { + "notice": "Legacy ovmCALL function which did not support ETH value; this maintains backwards compatibility." + }, + "ovmCALL(uint256,address,uint256,bytes)": { "notice": "Overrides CALL." }, "ovmCALLER()": { "notice": "Overrides CALLER." }, + "ovmCALLVALUE()": { + "notice": "Overrides CALLVALUE." + }, "ovmCHAINID()": { "notice": "Overrides CHAINID." }, @@ -956,6 +1093,9 @@ "ovmREVERT(bytes)": { "notice": "Overrides REVERT." }, + "ovmSELFBALANCE()": { + "notice": "Overrides SELFBALANCE." + }, "ovmSLOAD(bytes32)": { "notice": "Overrides SLOAD." }, @@ -974,10 +1114,10 @@ "run((uint256,uint256,uint8,address,address,uint256,bytes),address)": { "notice": "Starts the execution of a transaction via the OVM_ExecutionManager." }, - "safeCREATE(uint256,bytes,address)": { + "safeCREATE(bytes,address)": { "notice": "Handles the creation-specific safety measures required for OVM contract deployment. This function sanitizes the return types for creation messages to match calls (bool, bytes), by being an external function which the EM can call, that mimics the success/fail case of the CREATE. This allows for consistent handling of both types of messages in _handleExternalMessage(). Having this step occur as a separate call frame also allows us to easily revert the contract deployment in the event that the code is unsafe." }, - "simulateMessage((uint256,uint256,uint8,address,address,uint256,bytes),address,address)": { + "simulateMessage((uint256,uint256,uint8,address,address,uint256,bytes),address,uint256,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." } }, @@ -986,76 +1126,76 @@ "storageLayout": { "storage": [ { - "astId": 12800, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12793" + "type": "t_contract(Lib_AddressManager)15296" }, { - "astId": 5184, + "astId": 6671, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmSafetyChecker", "offset": 0, "slot": "1", - "type": "t_contract(iOVM_SafetyChecker)11280" + "type": "t_contract(iOVM_SafetyChecker)13768" }, { - "astId": 5186, + "astId": 6673, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmStateManager", "offset": 0, "slot": "2", - "type": "t_contract(iOVM_StateManager)11512" + "type": "t_contract(iOVM_StateManager)14000" }, { - "astId": 5188, + "astId": 6675, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "gasMeterConfig", "offset": 0, "slot": "3", - "type": "t_struct(GasMeterConfig)11063_storage" + "type": "t_struct(GasMeterConfig)13517_storage" }, { - "astId": 5190, + "astId": 6677, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "globalContext", "offset": 0, "slot": "7", - "type": "t_struct(GlobalContext)11066_storage" + "type": "t_struct(GlobalContext)13520_storage" }, { - "astId": 5192, + "astId": 6679, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "transactionContext", "offset": 0, "slot": "8", - "type": "t_struct(TransactionContext)11079_storage" + "type": "t_struct(TransactionContext)13533_storage" }, { - "astId": 5194, + "astId": 6681, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "messageContext", "offset": 0, "slot": "14", - "type": "t_struct(MessageContext)11089_storage" + "type": "t_struct(MessageContext)13545_storage" }, { - "astId": 5196, + "astId": 6683, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "transactionRecord", "offset": 0, - "slot": "16", - "type": "t_struct(TransactionRecord)11082_storage" + "slot": "18", + "type": "t_struct(TransactionRecord)13536_storage" }, { - "astId": 5198, + "astId": 6685, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "messageRecord", "offset": 0, - "slot": "17", - "type": "t_struct(MessageRecord)11092_storage" + "slot": "19", + "type": "t_struct(MessageRecord)13548_storage" } ], "types": { @@ -1069,32 +1209,32 @@ "label": "bool", "numberOfBytes": "1" }, - "t_contract(Lib_AddressManager)12793": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" }, - "t_contract(iOVM_SafetyChecker)11280": { + "t_contract(iOVM_SafetyChecker)13768": { "encoding": "inplace", "label": "contract iOVM_SafetyChecker", "numberOfBytes": "20" }, - "t_contract(iOVM_StateManager)11512": { + "t_contract(iOVM_StateManager)14000": { "encoding": "inplace", "label": "contract iOVM_StateManager", "numberOfBytes": "20" }, - "t_enum(QueueOrigin)12433": { + "t_enum(QueueOrigin)14880": { "encoding": "inplace", "label": "enum Lib_OVMCodec.QueueOrigin", "numberOfBytes": "1" }, - "t_struct(GasMeterConfig)11063_storage": { + "t_struct(GasMeterConfig)13517_storage": { "encoding": "inplace", "label": "struct iOVM_ExecutionManager.GasMeterConfig", "members": [ { - "astId": 11056, + "astId": 13510, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "minTransactionGasLimit", "offset": 0, @@ -1102,7 +1242,7 @@ "type": "t_uint256" }, { - "astId": 11058, + "astId": 13512, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "maxTransactionGasLimit", "offset": 0, @@ -1110,7 +1250,7 @@ "type": "t_uint256" }, { - "astId": 11060, + "astId": 13514, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "maxGasPerQueuePerEpoch", "offset": 0, @@ -1118,7 +1258,7 @@ "type": "t_uint256" }, { - "astId": 11062, + "astId": 13516, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "secondsPerEpoch", "offset": 0, @@ -1128,12 +1268,12 @@ ], "numberOfBytes": "128" }, - "t_struct(GlobalContext)11066_storage": { + "t_struct(GlobalContext)13520_storage": { "encoding": "inplace", "label": "struct iOVM_ExecutionManager.GlobalContext", "members": [ { - "astId": 11065, + "astId": 13519, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmCHAINID", "offset": 0, @@ -1143,12 +1283,12 @@ ], "numberOfBytes": "32" }, - "t_struct(MessageContext)11089_storage": { + "t_struct(MessageContext)13545_storage": { "encoding": "inplace", "label": "struct iOVM_ExecutionManager.MessageContext", "members": [ { - "astId": 11084, + "astId": 13538, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmCALLER", "offset": 0, @@ -1156,7 +1296,7 @@ "type": "t_address" }, { - "astId": 11086, + "astId": 13540, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmADDRESS", "offset": 0, @@ -1164,22 +1304,30 @@ "type": "t_address" }, { - "astId": 11088, + "astId": 13542, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmCALLVALUE", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 13544, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "isStatic", - "offset": 20, - "slot": "1", + "offset": 0, + "slot": "3", "type": "t_bool" } ], - "numberOfBytes": "64" + "numberOfBytes": "128" }, - "t_struct(MessageRecord)11092_storage": { + "t_struct(MessageRecord)13548_storage": { "encoding": "inplace", "label": "struct iOVM_ExecutionManager.MessageRecord", "members": [ { - "astId": 11091, + "astId": 13547, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "nuisanceGasLeft", "offset": 0, @@ -1189,20 +1337,20 @@ ], "numberOfBytes": "32" }, - "t_struct(TransactionContext)11079_storage": { + "t_struct(TransactionContext)13533_storage": { "encoding": "inplace", "label": "struct iOVM_ExecutionManager.TransactionContext", "members": [ { - "astId": 11068, + "astId": 13522, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmL1QUEUEORIGIN", "offset": 0, "slot": "0", - "type": "t_enum(QueueOrigin)12433" + "type": "t_enum(QueueOrigin)14880" }, { - "astId": 11070, + "astId": 13524, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmTIMESTAMP", "offset": 0, @@ -1210,7 +1358,7 @@ "type": "t_uint256" }, { - "astId": 11072, + "astId": 13526, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmNUMBER", "offset": 0, @@ -1218,7 +1366,7 @@ "type": "t_uint256" }, { - "astId": 11074, + "astId": 13528, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmGASLIMIT", "offset": 0, @@ -1226,7 +1374,7 @@ "type": "t_uint256" }, { - "astId": 11076, + "astId": 13530, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmTXGASLIMIT", "offset": 0, @@ -1234,7 +1382,7 @@ "type": "t_uint256" }, { - "astId": 11078, + "astId": 13532, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmL1TXORIGIN", "offset": 0, @@ -1244,12 +1392,12 @@ ], "numberOfBytes": "192" }, - "t_struct(TransactionRecord)11082_storage": { + "t_struct(TransactionRecord)13536_storage": { "encoding": "inplace", "label": "struct iOVM_ExecutionManager.TransactionRecord", "members": [ { - "astId": 11081, + "astId": 13535, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmGasRefund", "offset": 0, diff --git a/packages/contracts/deployments/kovan/OVM_FraudVerifier.json b/packages/contracts/deployments/kovan/OVM_FraudVerifier.json index dafeec721864..5c082ee3958c 100644 --- a/packages/contracts/deployments/kovan/OVM_FraudVerifier.json +++ b/packages/contracts/deployments/kovan/OVM_FraudVerifier.json @@ -1,5 +1,5 @@ { - "address": "0x4B2F74938Ddb8742C33b46aD1a402c85e9dABC44", + "address": "0xaeEd60e029Eb435f960d78C355786060589738B3", "abi": [ { "inputs": [ @@ -437,29 +437,29 @@ "type": "function" } ], - "transactionHash": "0xb8082579bad0f835bc920bd0a9914c2579d22b880631c0d48e905bc30c4dc913", + "transactionHash": "0xb2b6d0646de18a5fe60095be9fcf58cc6b9872a175732f5efb37757eb8f479ee", "receipt": { "to": null, "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", - "contractAddress": "0x4B2F74938Ddb8742C33b46aD1a402c85e9dABC44", - "transactionIndex": 2, - "gasUsed": "1385698", + "contractAddress": "0xaeEd60e029Eb435f960d78C355786060589738B3", + "transactionIndex": 0, + "gasUsed": "1386998", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x064d3a146603fa300614898ab7c1d631f1f7bdda0144fa855991c6da4ce5103b", - "transactionHash": "0xb8082579bad0f835bc920bd0a9914c2579d22b880631c0d48e905bc30c4dc913", + "blockHash": "0xcd5f3526d96a5e100085a56e9c37247c353994879b9902443c1b56b4ec8cf1cf", + "transactionHash": "0xb2b6d0646de18a5fe60095be9fcf58cc6b9872a175732f5efb37757eb8f479ee", "logs": [], - "blockNumber": 24572850, - "cumulativeGasUsed": "1633498", + "blockNumber": 25502626, + "cumulativeGasUsed": "1386998", "status": 1, "byzantium": true }, "args": [ - "0xd56F695e73286ac252A37593DD4E7c14270eC1Df" + "0x100Dd3b414Df5BbA2B542864fF94aF8024aFdf3a" ], - "solcInputHash": "5ee8e508e2c54cb5ac6783b4855b1558", - "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\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}}},\"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.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"}},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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 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\\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\":\"0x879cef57019254ad958a75db64f0b58eb0a6fcf74f386ed958f75384b860dd35\",\"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 * 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\":\"0x2d7973a0ad84c23ec62624d3f1e3aeb198cc72686ff1e6cfa17155556b320c94\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x2ce671a0e004df88b136bea5a3c59d0732cea8887c8496da1d509e0200b03d7d\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xa5195afe32fb2cf104d156e8f4bd39df1ec79bf6ba232097b9e8e0ee14fbc298\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b5060405161184138038061184183398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b6117b0806100916000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063299ca4781461005c578063461a44781461007a57806398d8867d1461008d578063a286ba1c146100a2578063b48ec820146100b5575b600080fd5b6100646100c8565b6040516100719190611306565b60405180910390f35b610064610088366004611101565b6100d7565b6100a061009b366004611029565b6101b5565b005b6100a06100b0366004610f64565b6104f4565b6100646100c3366004610f43565b6108bb565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561013757818101518382015260200161011f565b50505050905090810190601f1680156101645780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561018157600080fd5b505afa158015610195573d6000803e3d6000fd5b505050506040513d60208110156101ab57600080fd5b505190505b919050565b866101bf8561090a565b60005a905060006101cf8861090a565b90506101db8b82610923565b156101e65750610432565b60006102216040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b905060006102636040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e0000008152506100d7565b9050816001600160a01b0316634d69ee578e8e8e6040518463ffffffff1660e01b81526004016102959392919061135f565b60206040518083038186803b1580156102ad57600080fd5b505afa1580156102c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102e59190610f0f565b61030a5760405162461bcd60e51b8152600401610301906115e7565b60405180910390fd5b6040516326f2b4e760e11b81526001600160a01b03821690634de569ce9061033c908d908d908d908d90600401611641565b60206040518083038186803b15801561035457600080fd5b505afa158015610368573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038c9190610f0f565b6103a85760405162461bcd60e51b815260040161030190611499565b86600001518860600151018b600001518d6060015101600101146103de5760405162461bcd60e51b815260040161030190611525565b6103ed8d848d60000151610942565b7f41a48bde2468fac6f670f39b66d7b91f311053e1f28eab9d75056546e6eaac958d8c6000015185336040516104269493929190611394565b60405180910390a15050505b60005a820390506104696040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b1580156104cf57600080fd5b505af11580156104e3573d6000803e3d6000fd5b505050505050505050505050505050565b868460005a905060006105078b896108bb565b905060006105446040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b9050816001600160a01b031663b2fa1c9e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561057f57600080fd5b505afa158015610593573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b79190610f0f565b15156001146105d85760405162461bcd60e51b8152600401610301906113b8565b89600001518b606001510160010186600001518860600151011461060e5760405162461bcd60e51b81526004016103019061141f565b604051634d69ee5760e01b81526001600160a01b03821690634d69ee579061063e908f908f908f9060040161135f565b60206040518083038186803b15801561065657600080fd5b505afa15801561066a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068e9190610f0f565b6106aa5760405162461bcd60e51b8152600401610301906115e7565b604051634d69ee5760e01b81526001600160a01b03821690634d69ee57906106da908b908b908b9060040161135f565b60206040518083038186803b1580156106f257600080fd5b505afa158015610706573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072a9190610f0f565b6107465760405162461bcd60e51b8152600401610301906114dd565b816001600160a01b031663c1c618b86040518163ffffffff1660e01b815260040160206040518083038186803b15801561077f57600080fd5b505afa158015610793573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b79190610f2b565b8814156107d65760405162461bcd60e51b815260040161030190611597565b6107e0878d610a6d565b6000600160008e8c6040516020016107f9929190611289565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507f1e5fff3c23daf51ea67aaa3bbc738bcedaa98be5a5503f0e63a336a004b075b18c8b600001518b3360405161087a9493929190611394565b60405180910390a1505060005a820390506104696040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b60006001600084846040516020016108d4929190611289565b60408051808303601f19018152918152815160209283012083529082019290925201600020546001600160a01b03169392505050565b600061091582610bc7565b805190602001209050919050565b60008061093084846108bb565b6001600160a01b031614159392505050565b6109806040518060400160405280601c81526020017f4f564d5f53746174655472616e736974696f6e6572466163746f7279000000008152506100d7565b600054604051631168a38160e11b81526001600160a01b03928316926322d14702926109b79291169085908890889060040161131a565b602060405180830381600087803b1580156109d157600080fd5b505af11580156109e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0991906110e5565b600160008585604051602001610a20929190611289565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550505050565b6000610aa86040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b90506000610adc6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b604051632e38626b60e21b81529091506001600160a01b0383169063b8e189ac90610b0b90879060040161162e565b600060405180830381600087803b158015610b2557600080fd5b505af1158015610b39573d6000803e3d6000fd5b505050506000808560800151806020019051810190610b58919061114f565b60405163abfbbe1360e01b815291935091506001600160a01b0384169063abfbbe1390610b8d90889085908790600401611340565b600060405180830381600087803b158015610ba757600080fd5b505af1158015610bbb573d6000803e3d6000fd5b50505050505050505050565b6060816000015182602001518360400151846060015185608001518660a001518760c00151604051602001610c029796959493929190611297565b6040516020818303038152906040529050919050565b600067ffffffffffffffff831115610c2c57fe5b610c3f601f8401601f1916602001611700565b9050828152838383011115610c5357600080fd5b828260208301376000602084830101529392505050565b80356101b081611754565b600082601f830112610c85578081fd5b610c9483833560208501610c18565b9392505050565b8035600281106101b057600080fd5b600060a08284031215610cbb578081fd5b60405160a0810167ffffffffffffffff8282108183111715610cd957fe5b81604052829350843583526020850135602084015260408501356040840152606085013560608401526080850135915080821115610d1657600080fd5b50610d2385828601610c75565b6080830152505092915050565b600060408284031215610d41578081fd5b6040516040810167ffffffffffffffff8282108183111715610d5f57fe5b8160405282935084358352602091508185013581811115610d7f57600080fd5b8501601f81018713610d9057600080fd5b803582811115610d9c57fe5b8381029250610dac848401611700565b8181528481019083860185850187018b1015610dc757600080fd5b600095505b83861015610dea578035835260019590950194918601918601610dcc565b5080868801525050505050505092915050565b600060a08284031215610e0e578081fd5b60405160a0810167ffffffffffffffff8282108183111715610e2c57fe5b8160405282935084359150610e408261176c565b8183526020850135602084015260408501356040840152606085013560608401526080850135915080821115610d1657600080fd5b600060e08284031215610e86578081fd5b610e9060e0611700565b90508135815260208201356020820152610eac60408301610c9b565b6040820152610ebd60608301610c6a565b6060820152610ece60808301610c6a565b608082015260a082013560a082015260c082013567ffffffffffffffff811115610ef757600080fd5b610f0384828501610c75565b60c08301525092915050565b600060208284031215610f20578081fd5b8151610c948161176c565b600060208284031215610f3c578081fd5b5051919050565b60008060408385031215610f55578081fd5b50508035926020909101359150565b600080600080600080600060e0888a031215610f7e578283fd5b87359650602088013567ffffffffffffffff80821115610f9c578485fd5b610fa88b838c01610caa565b975060408a0135915080821115610fbd578485fd5b610fc98b838c01610d30565b965060608a0135955060808a0135945060a08a0135915080821115610fec578384fd5b610ff88b838c01610caa565b935060c08a013591508082111561100d578283fd5b5061101a8a828b01610d30565b91505092959891949750929550565b600080600080600080600060e0888a031215611043578081fd5b87359650602088013567ffffffffffffffff80821115611061578283fd5b61106d8b838c01610caa565b975060408a0135915080821115611082578283fd5b61108e8b838c01610d30565b965060608a01359150808211156110a3578283fd5b6110af8b838c01610e75565b955060808a01359150808211156110c4578283fd5b6110d08b838c01610dfd565b945060a08a0135915080821115610fec578283fd5b6000602082840312156110f6578081fd5b8151610c9481611754565b600060208284031215611112578081fd5b813567ffffffffffffffff811115611128578182fd5b8201601f81018413611138578182fd5b61114784823560208401610c18565b949350505050565b60008060408385031215611161578182fd5b82519150602083015161117381611754565b809150509250929050565b6001600160a01b03169052565b600081518084526111a3816020860160208601611724565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261114760a085018261118b565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b8083101561123f578451825293830193600192909201919083019061121f565b509695505050505050565b6000815115158352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261114760a085018261118b565b918252602082015260400190565b6000888252876020830152600287106112ac57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b1660558401525083606983015282516112f3816089850160208701611724565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b9283526001600160a01b03919091166020830152604082015260600190565b60008482526060602083015261137860608301856111b7565b828103604084015261138a81856111f4565b9695505050505050565b938452602084019290925260408301526001600160a01b0316606082015260800190565b60208082526041908201527f5374617465207472616e736974696f6e2070726f63657373206d75737420626560408201527f20636f6d706c65746564207072696f7220746f2066696e616c697a6174696f6e6060820152601760f91b608082015260a00190565b60208082526054908201527f506f73742d737461746520726f6f7420676c6f62616c20696e646578206d757360408201527f7420657175616c20746f207468652070726520737461746520726f6f7420676c60608201527337b130b61034b73232bc1038363ab99037b7329760611b608082015260a00190565b60208082526024908201527f496e76616c6964207472616e73616374696f6e20696e636c7573696f6e20707260408201526337b7b31760e11b606082015260800190565b60208082526028908201527f496e76616c696420706f73742d737461746520726f6f7420696e636c7573696f6040820152673710383937b7b31760c11b606082015260800190565b6020808252604c908201527f5072652d737461746520726f6f7420676c6f62616c20696e646578206d75737460408201527f20657175616c20746f20746865207472616e73616374696f6e20726f6f74206760608201526b3637b130b61034b73232bc1760a11b608082015260a00190565b60208082526030908201527f5374617465207472616e736974696f6e20686173206e6f74206265656e20707260408201526f37bb32b710333930bab23ab632b73a1760811b606082015260800190565b60208082526027908201527f496e76616c6964207072652d737461746520726f6f7420696e636c7573696f6e60408201526610383937b7b31760c91b606082015260800190565b600060208252610c9460208301846111b7565b60006080825285516080830152602086015160a083015260408601516002811061166757fe5b60c083015260608601516001600160a01b031660e0830152608086015161169261010084018261117e565b5060a086015161012083015260c086015160e06101408401526116b961016084018261118b565b905082810360208401526116cd818761124a565b905082810360408401526116e181866111b7565b905082810360608401526116f581856111f4565b979650505050505050565b60405181810167ffffffffffffffff8111828210171561171c57fe5b604052919050565b60005b8381101561173f578181015183820152602001611727565b8381111561174e576000848401525b50505050565b6001600160a01b038116811461176957600080fd5b50565b801515811461176957600080fdfea26469706673582212205dbab94b86b7fa55149dd4efe74e8533d11e06735abd7d989856c9aa60c89c1064736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c8063299ca4781461005c578063461a44781461007a57806398d8867d1461008d578063a286ba1c146100a2578063b48ec820146100b5575b600080fd5b6100646100c8565b6040516100719190611306565b60405180910390f35b610064610088366004611101565b6100d7565b6100a061009b366004611029565b6101b5565b005b6100a06100b0366004610f64565b6104f4565b6100646100c3366004610f43565b6108bb565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561013757818101518382015260200161011f565b50505050905090810190601f1680156101645780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561018157600080fd5b505afa158015610195573d6000803e3d6000fd5b505050506040513d60208110156101ab57600080fd5b505190505b919050565b866101bf8561090a565b60005a905060006101cf8861090a565b90506101db8b82610923565b156101e65750610432565b60006102216040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b905060006102636040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e0000008152506100d7565b9050816001600160a01b0316634d69ee578e8e8e6040518463ffffffff1660e01b81526004016102959392919061135f565b60206040518083038186803b1580156102ad57600080fd5b505afa1580156102c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102e59190610f0f565b61030a5760405162461bcd60e51b8152600401610301906115e7565b60405180910390fd5b6040516326f2b4e760e11b81526001600160a01b03821690634de569ce9061033c908d908d908d908d90600401611641565b60206040518083038186803b15801561035457600080fd5b505afa158015610368573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038c9190610f0f565b6103a85760405162461bcd60e51b815260040161030190611499565b86600001518860600151018b600001518d6060015101600101146103de5760405162461bcd60e51b815260040161030190611525565b6103ed8d848d60000151610942565b7f41a48bde2468fac6f670f39b66d7b91f311053e1f28eab9d75056546e6eaac958d8c6000015185336040516104269493929190611394565b60405180910390a15050505b60005a820390506104696040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b1580156104cf57600080fd5b505af11580156104e3573d6000803e3d6000fd5b505050505050505050505050505050565b868460005a905060006105078b896108bb565b905060006105446040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b9050816001600160a01b031663b2fa1c9e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561057f57600080fd5b505afa158015610593573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b79190610f0f565b15156001146105d85760405162461bcd60e51b8152600401610301906113b8565b89600001518b606001510160010186600001518860600151011461060e5760405162461bcd60e51b81526004016103019061141f565b604051634d69ee5760e01b81526001600160a01b03821690634d69ee579061063e908f908f908f9060040161135f565b60206040518083038186803b15801561065657600080fd5b505afa15801561066a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068e9190610f0f565b6106aa5760405162461bcd60e51b8152600401610301906115e7565b604051634d69ee5760e01b81526001600160a01b03821690634d69ee57906106da908b908b908b9060040161135f565b60206040518083038186803b1580156106f257600080fd5b505afa158015610706573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072a9190610f0f565b6107465760405162461bcd60e51b8152600401610301906114dd565b816001600160a01b031663c1c618b86040518163ffffffff1660e01b815260040160206040518083038186803b15801561077f57600080fd5b505afa158015610793573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b79190610f2b565b8814156107d65760405162461bcd60e51b815260040161030190611597565b6107e0878d610a6d565b6000600160008e8c6040516020016107f9929190611289565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507f1e5fff3c23daf51ea67aaa3bbc738bcedaa98be5a5503f0e63a336a004b075b18c8b600001518b3360405161087a9493929190611394565b60405180910390a1505060005a820390506104696040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b60006001600084846040516020016108d4929190611289565b60408051808303601f19018152918152815160209283012083529082019290925201600020546001600160a01b03169392505050565b600061091582610bc7565b805190602001209050919050565b60008061093084846108bb565b6001600160a01b031614159392505050565b6109806040518060400160405280601c81526020017f4f564d5f53746174655472616e736974696f6e6572466163746f7279000000008152506100d7565b600054604051631168a38160e11b81526001600160a01b03928316926322d14702926109b79291169085908890889060040161131a565b602060405180830381600087803b1580156109d157600080fd5b505af11580156109e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0991906110e5565b600160008585604051602001610a20929190611289565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550505050565b6000610aa86040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b90506000610adc6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b604051632e38626b60e21b81529091506001600160a01b0383169063b8e189ac90610b0b90879060040161162e565b600060405180830381600087803b158015610b2557600080fd5b505af1158015610b39573d6000803e3d6000fd5b505050506000808560800151806020019051810190610b58919061114f565b60405163abfbbe1360e01b815291935091506001600160a01b0384169063abfbbe1390610b8d90889085908790600401611340565b600060405180830381600087803b158015610ba757600080fd5b505af1158015610bbb573d6000803e3d6000fd5b50505050505050505050565b6060816000015182602001518360400151846060015185608001518660a001518760c00151604051602001610c029796959493929190611297565b6040516020818303038152906040529050919050565b600067ffffffffffffffff831115610c2c57fe5b610c3f601f8401601f1916602001611700565b9050828152838383011115610c5357600080fd5b828260208301376000602084830101529392505050565b80356101b081611754565b600082601f830112610c85578081fd5b610c9483833560208501610c18565b9392505050565b8035600281106101b057600080fd5b600060a08284031215610cbb578081fd5b60405160a0810167ffffffffffffffff8282108183111715610cd957fe5b81604052829350843583526020850135602084015260408501356040840152606085013560608401526080850135915080821115610d1657600080fd5b50610d2385828601610c75565b6080830152505092915050565b600060408284031215610d41578081fd5b6040516040810167ffffffffffffffff8282108183111715610d5f57fe5b8160405282935084358352602091508185013581811115610d7f57600080fd5b8501601f81018713610d9057600080fd5b803582811115610d9c57fe5b8381029250610dac848401611700565b8181528481019083860185850187018b1015610dc757600080fd5b600095505b83861015610dea578035835260019590950194918601918601610dcc565b5080868801525050505050505092915050565b600060a08284031215610e0e578081fd5b60405160a0810167ffffffffffffffff8282108183111715610e2c57fe5b8160405282935084359150610e408261176c565b8183526020850135602084015260408501356040840152606085013560608401526080850135915080821115610d1657600080fd5b600060e08284031215610e86578081fd5b610e9060e0611700565b90508135815260208201356020820152610eac60408301610c9b565b6040820152610ebd60608301610c6a565b6060820152610ece60808301610c6a565b608082015260a082013560a082015260c082013567ffffffffffffffff811115610ef757600080fd5b610f0384828501610c75565b60c08301525092915050565b600060208284031215610f20578081fd5b8151610c948161176c565b600060208284031215610f3c578081fd5b5051919050565b60008060408385031215610f55578081fd5b50508035926020909101359150565b600080600080600080600060e0888a031215610f7e578283fd5b87359650602088013567ffffffffffffffff80821115610f9c578485fd5b610fa88b838c01610caa565b975060408a0135915080821115610fbd578485fd5b610fc98b838c01610d30565b965060608a0135955060808a0135945060a08a0135915080821115610fec578384fd5b610ff88b838c01610caa565b935060c08a013591508082111561100d578283fd5b5061101a8a828b01610d30565b91505092959891949750929550565b600080600080600080600060e0888a031215611043578081fd5b87359650602088013567ffffffffffffffff80821115611061578283fd5b61106d8b838c01610caa565b975060408a0135915080821115611082578283fd5b61108e8b838c01610d30565b965060608a01359150808211156110a3578283fd5b6110af8b838c01610e75565b955060808a01359150808211156110c4578283fd5b6110d08b838c01610dfd565b945060a08a0135915080821115610fec578283fd5b6000602082840312156110f6578081fd5b8151610c9481611754565b600060208284031215611112578081fd5b813567ffffffffffffffff811115611128578182fd5b8201601f81018413611138578182fd5b61114784823560208401610c18565b949350505050565b60008060408385031215611161578182fd5b82519150602083015161117381611754565b809150509250929050565b6001600160a01b03169052565b600081518084526111a3816020860160208601611724565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261114760a085018261118b565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b8083101561123f578451825293830193600192909201919083019061121f565b509695505050505050565b6000815115158352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261114760a085018261118b565b918252602082015260400190565b6000888252876020830152600287106112ac57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b1660558401525083606983015282516112f3816089850160208701611724565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b9283526001600160a01b03919091166020830152604082015260600190565b60008482526060602083015261137860608301856111b7565b828103604084015261138a81856111f4565b9695505050505050565b938452602084019290925260408301526001600160a01b0316606082015260800190565b60208082526041908201527f5374617465207472616e736974696f6e2070726f63657373206d75737420626560408201527f20636f6d706c65746564207072696f7220746f2066696e616c697a6174696f6e6060820152601760f91b608082015260a00190565b60208082526054908201527f506f73742d737461746520726f6f7420676c6f62616c20696e646578206d757360408201527f7420657175616c20746f207468652070726520737461746520726f6f7420676c60608201527337b130b61034b73232bc1038363ab99037b7329760611b608082015260a00190565b60208082526024908201527f496e76616c6964207472616e73616374696f6e20696e636c7573696f6e20707260408201526337b7b31760e11b606082015260800190565b60208082526028908201527f496e76616c696420706f73742d737461746520726f6f7420696e636c7573696f6040820152673710383937b7b31760c11b606082015260800190565b6020808252604c908201527f5072652d737461746520726f6f7420676c6f62616c20696e646578206d75737460408201527f20657175616c20746f20746865207472616e73616374696f6e20726f6f74206760608201526b3637b130b61034b73232bc1760a11b608082015260a00190565b60208082526030908201527f5374617465207472616e736974696f6e20686173206e6f74206265656e20707260408201526f37bb32b710333930bab23ab632b73a1760811b606082015260800190565b60208082526027908201527f496e76616c6964207072652d737461746520726f6f7420696e636c7573696f6e60408201526610383937b7b31760c91b606082015260800190565b600060208252610c9460208301846111b7565b60006080825285516080830152602086015160a083015260408601516002811061166757fe5b60c083015260608601516001600160a01b031660e0830152608086015161169261010084018261117e565b5060a086015161012083015260c086015160e06101408401526116b961016084018261118b565b905082810360208401526116cd818761124a565b905082810360408401526116e181866111b7565b905082810360608401526116f581856111f4565b979650505050505050565b60405181810167ffffffffffffffff8111828210171561171c57fe5b604052919050565b60005b8381101561173f578181015183820152602001611727565b8381111561174e576000848401525b50505050565b6001600160a01b038116811461176957600080fd5b50565b801515811461176957600080fdfea26469706673582212205dbab94b86b7fa55149dd4efe74e8533d11e06735abd7d989856c9aa60c89c1064736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}}},\"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.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"}},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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 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\\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\":\"0x879cef57019254ad958a75db64f0b58eb0a6fcf74f386ed958f75384b860dd35\",\"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 * 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\",\"keccak256\":\"0x180b9c347e20f1a6efa553b0f2b9a59aebceda92a7484ae6fca4da2bf1d960c3\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405161184138038061184183398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b6117b0806100916000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063299ca4781461005c578063461a44781461007a57806398d8867d1461008d578063a286ba1c146100a2578063b48ec820146100b5575b600080fd5b6100646100c8565b6040516100719190611306565b60405180910390f35b610064610088366004611101565b6100d7565b6100a061009b366004611029565b6101b5565b005b6100a06100b0366004610f64565b6104f4565b6100646100c3366004610f43565b6108bb565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561013757818101518382015260200161011f565b50505050905090810190601f1680156101645780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561018157600080fd5b505afa158015610195573d6000803e3d6000fd5b505050506040513d60208110156101ab57600080fd5b505190505b919050565b866101bf8561090a565b60005a905060006101cf8861090a565b90506101db8b82610923565b156101e65750610432565b60006102216040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b905060006102636040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e0000008152506100d7565b9050816001600160a01b0316634d69ee578e8e8e6040518463ffffffff1660e01b81526004016102959392919061135f565b60206040518083038186803b1580156102ad57600080fd5b505afa1580156102c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102e59190610f0f565b61030a5760405162461bcd60e51b8152600401610301906115e7565b60405180910390fd5b6040516326f2b4e760e11b81526001600160a01b03821690634de569ce9061033c908d908d908d908d90600401611641565b60206040518083038186803b15801561035457600080fd5b505afa158015610368573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038c9190610f0f565b6103a85760405162461bcd60e51b815260040161030190611499565b86600001518860600151018b600001518d6060015101600101146103de5760405162461bcd60e51b815260040161030190611525565b6103ed8d848d60000151610942565b7f41a48bde2468fac6f670f39b66d7b91f311053e1f28eab9d75056546e6eaac958d8c6000015185336040516104269493929190611394565b60405180910390a15050505b60005a820390506104696040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b1580156104cf57600080fd5b505af11580156104e3573d6000803e3d6000fd5b505050505050505050505050505050565b868460005a905060006105078b896108bb565b905060006105446040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b9050816001600160a01b031663b2fa1c9e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561057f57600080fd5b505afa158015610593573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b79190610f0f565b15156001146105d85760405162461bcd60e51b8152600401610301906113b8565b89600001518b606001510160010186600001518860600151011461060e5760405162461bcd60e51b81526004016103019061141f565b604051634d69ee5760e01b81526001600160a01b03821690634d69ee579061063e908f908f908f9060040161135f565b60206040518083038186803b15801561065657600080fd5b505afa15801561066a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068e9190610f0f565b6106aa5760405162461bcd60e51b8152600401610301906115e7565b604051634d69ee5760e01b81526001600160a01b03821690634d69ee57906106da908b908b908b9060040161135f565b60206040518083038186803b1580156106f257600080fd5b505afa158015610706573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072a9190610f0f565b6107465760405162461bcd60e51b8152600401610301906114dd565b816001600160a01b031663c1c618b86040518163ffffffff1660e01b815260040160206040518083038186803b15801561077f57600080fd5b505afa158015610793573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b79190610f2b565b8814156107d65760405162461bcd60e51b815260040161030190611597565b6107e0878d610a6d565b6000600160008e8c6040516020016107f9929190611289565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507f1e5fff3c23daf51ea67aaa3bbc738bcedaa98be5a5503f0e63a336a004b075b18c8b600001518b3360405161087a9493929190611394565b60405180910390a1505060005a820390506104696040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b60006001600084846040516020016108d4929190611289565b60408051808303601f19018152918152815160209283012083529082019290925201600020546001600160a01b03169392505050565b600061091582610bc7565b805190602001209050919050565b60008061093084846108bb565b6001600160a01b031614159392505050565b6109806040518060400160405280601c81526020017f4f564d5f53746174655472616e736974696f6e6572466163746f7279000000008152506100d7565b600054604051631168a38160e11b81526001600160a01b03928316926322d14702926109b79291169085908890889060040161131a565b602060405180830381600087803b1580156109d157600080fd5b505af11580156109e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0991906110e5565b600160008585604051602001610a20929190611289565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550505050565b6000610aa86040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b90506000610adc6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b604051632e38626b60e21b81529091506001600160a01b0383169063b8e189ac90610b0b90879060040161162e565b600060405180830381600087803b158015610b2557600080fd5b505af1158015610b39573d6000803e3d6000fd5b505050506000808560800151806020019051810190610b58919061114f565b60405163abfbbe1360e01b815291935091506001600160a01b0384169063abfbbe1390610b8d90889085908790600401611340565b600060405180830381600087803b158015610ba757600080fd5b505af1158015610bbb573d6000803e3d6000fd5b50505050505050505050565b6060816000015182602001518360400151846060015185608001518660a001518760c00151604051602001610c029796959493929190611297565b6040516020818303038152906040529050919050565b600067ffffffffffffffff831115610c2c57fe5b610c3f601f8401601f1916602001611700565b9050828152838383011115610c5357600080fd5b828260208301376000602084830101529392505050565b80356101b081611754565b600082601f830112610c85578081fd5b610c9483833560208501610c18565b9392505050565b8035600281106101b057600080fd5b600060a08284031215610cbb578081fd5b60405160a0810167ffffffffffffffff8282108183111715610cd957fe5b81604052829350843583526020850135602084015260408501356040840152606085013560608401526080850135915080821115610d1657600080fd5b50610d2385828601610c75565b6080830152505092915050565b600060408284031215610d41578081fd5b6040516040810167ffffffffffffffff8282108183111715610d5f57fe5b8160405282935084358352602091508185013581811115610d7f57600080fd5b8501601f81018713610d9057600080fd5b803582811115610d9c57fe5b8381029250610dac848401611700565b8181528481019083860185850187018b1015610dc757600080fd5b600095505b83861015610dea578035835260019590950194918601918601610dcc565b5080868801525050505050505092915050565b600060a08284031215610e0e578081fd5b60405160a0810167ffffffffffffffff8282108183111715610e2c57fe5b8160405282935084359150610e408261176c565b8183526020850135602084015260408501356040840152606085013560608401526080850135915080821115610d1657600080fd5b600060e08284031215610e86578081fd5b610e9060e0611700565b90508135815260208201356020820152610eac60408301610c9b565b6040820152610ebd60608301610c6a565b6060820152610ece60808301610c6a565b608082015260a082013560a082015260c082013567ffffffffffffffff811115610ef757600080fd5b610f0384828501610c75565b60c08301525092915050565b600060208284031215610f20578081fd5b8151610c948161176c565b600060208284031215610f3c578081fd5b5051919050565b60008060408385031215610f55578081fd5b50508035926020909101359150565b600080600080600080600060e0888a031215610f7e578283fd5b87359650602088013567ffffffffffffffff80821115610f9c578485fd5b610fa88b838c01610caa565b975060408a0135915080821115610fbd578485fd5b610fc98b838c01610d30565b965060608a0135955060808a0135945060a08a0135915080821115610fec578384fd5b610ff88b838c01610caa565b935060c08a013591508082111561100d578283fd5b5061101a8a828b01610d30565b91505092959891949750929550565b600080600080600080600060e0888a031215611043578081fd5b87359650602088013567ffffffffffffffff80821115611061578283fd5b61106d8b838c01610caa565b975060408a0135915080821115611082578283fd5b61108e8b838c01610d30565b965060608a01359150808211156110a3578283fd5b6110af8b838c01610e75565b955060808a01359150808211156110c4578283fd5b6110d08b838c01610dfd565b945060a08a0135915080821115610fec578283fd5b6000602082840312156110f6578081fd5b8151610c9481611754565b600060208284031215611112578081fd5b813567ffffffffffffffff811115611128578182fd5b8201601f81018413611138578182fd5b61114784823560208401610c18565b949350505050565b60008060408385031215611161578182fd5b82519150602083015161117381611754565b809150509250929050565b6001600160a01b03169052565b600081518084526111a3816020860160208601611724565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261114760a085018261118b565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b8083101561123f578451825293830193600192909201919083019061121f565b509695505050505050565b6000815115158352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261114760a085018261118b565b918252602082015260400190565b6000888252876020830152600287106112ac57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b1660558401525083606983015282516112f3816089850160208701611724565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b9283526001600160a01b03919091166020830152604082015260600190565b60008482526060602083015261137860608301856111b7565b828103604084015261138a81856111f4565b9695505050505050565b938452602084019290925260408301526001600160a01b0316606082015260800190565b60208082526041908201527f5374617465207472616e736974696f6e2070726f63657373206d75737420626560408201527f20636f6d706c65746564207072696f7220746f2066696e616c697a6174696f6e6060820152601760f91b608082015260a00190565b60208082526054908201527f506f73742d737461746520726f6f7420676c6f62616c20696e646578206d757360408201527f7420657175616c20746f207468652070726520737461746520726f6f7420676c60608201527337b130b61034b73232bc1038363ab99037b7329760611b608082015260a00190565b60208082526024908201527f496e76616c6964207472616e73616374696f6e20696e636c7573696f6e20707260408201526337b7b31760e11b606082015260800190565b60208082526028908201527f496e76616c696420706f73742d737461746520726f6f7420696e636c7573696f6040820152673710383937b7b31760c11b606082015260800190565b6020808252604c908201527f5072652d737461746520726f6f7420676c6f62616c20696e646578206d75737460408201527f20657175616c20746f20746865207472616e73616374696f6e20726f6f74206760608201526b3637b130b61034b73232bc1760a11b608082015260a00190565b60208082526030908201527f5374617465207472616e736974696f6e20686173206e6f74206265656e20707260408201526f37bb32b710333930bab23ab632b73a1760811b606082015260800190565b60208082526027908201527f496e76616c6964207072652d737461746520726f6f7420696e636c7573696f6e60408201526610383937b7b31760c91b606082015260800190565b600060208252610c9460208301846111b7565b60006080825285516080830152602086015160a083015260408601516002811061166757fe5b60c083015260608601516001600160a01b031660e0830152608086015161169261010084018261117e565b5060a086015161012083015260c086015160e06101408401526116b961016084018261118b565b905082810360208401526116cd818761124a565b905082810360408401526116e181866111b7565b905082810360608401526116f581856111f4565b979650505050505050565b60405181810167ffffffffffffffff8111828210171561171c57fe5b604052919050565b60005b8381101561173f578181015183820152602001611727565b8381111561174e576000848401525b50505050565b6001600160a01b038116811461176957600080fd5b50565b801515811461176957600080fdfea264697066735822122090fa94f972b734dd4c794ce3c199f593acb07d65d0fea3b0025bd8132b68bc7a64736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c8063299ca4781461005c578063461a44781461007a57806398d8867d1461008d578063a286ba1c146100a2578063b48ec820146100b5575b600080fd5b6100646100c8565b6040516100719190611306565b60405180910390f35b610064610088366004611101565b6100d7565b6100a061009b366004611029565b6101b5565b005b6100a06100b0366004610f64565b6104f4565b6100646100c3366004610f43565b6108bb565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561013757818101518382015260200161011f565b50505050905090810190601f1680156101645780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561018157600080fd5b505afa158015610195573d6000803e3d6000fd5b505050506040513d60208110156101ab57600080fd5b505190505b919050565b866101bf8561090a565b60005a905060006101cf8861090a565b90506101db8b82610923565b156101e65750610432565b60006102216040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b905060006102636040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e0000008152506100d7565b9050816001600160a01b0316634d69ee578e8e8e6040518463ffffffff1660e01b81526004016102959392919061135f565b60206040518083038186803b1580156102ad57600080fd5b505afa1580156102c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102e59190610f0f565b61030a5760405162461bcd60e51b8152600401610301906115e7565b60405180910390fd5b6040516326f2b4e760e11b81526001600160a01b03821690634de569ce9061033c908d908d908d908d90600401611641565b60206040518083038186803b15801561035457600080fd5b505afa158015610368573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038c9190610f0f565b6103a85760405162461bcd60e51b815260040161030190611499565b86600001518860600151018b600001518d6060015101600101146103de5760405162461bcd60e51b815260040161030190611525565b6103ed8d848d60000151610942565b7f41a48bde2468fac6f670f39b66d7b91f311053e1f28eab9d75056546e6eaac958d8c6000015185336040516104269493929190611394565b60405180910390a15050505b60005a820390506104696040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b1580156104cf57600080fd5b505af11580156104e3573d6000803e3d6000fd5b505050505050505050505050505050565b868460005a905060006105078b896108bb565b905060006105446040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b9050816001600160a01b031663b2fa1c9e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561057f57600080fd5b505afa158015610593573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b79190610f0f565b15156001146105d85760405162461bcd60e51b8152600401610301906113b8565b89600001518b606001510160010186600001518860600151011461060e5760405162461bcd60e51b81526004016103019061141f565b604051634d69ee5760e01b81526001600160a01b03821690634d69ee579061063e908f908f908f9060040161135f565b60206040518083038186803b15801561065657600080fd5b505afa15801561066a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068e9190610f0f565b6106aa5760405162461bcd60e51b8152600401610301906115e7565b604051634d69ee5760e01b81526001600160a01b03821690634d69ee57906106da908b908b908b9060040161135f565b60206040518083038186803b1580156106f257600080fd5b505afa158015610706573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072a9190610f0f565b6107465760405162461bcd60e51b8152600401610301906114dd565b816001600160a01b031663c1c618b86040518163ffffffff1660e01b815260040160206040518083038186803b15801561077f57600080fd5b505afa158015610793573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b79190610f2b565b8814156107d65760405162461bcd60e51b815260040161030190611597565b6107e0878d610a6d565b6000600160008e8c6040516020016107f9929190611289565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507f1e5fff3c23daf51ea67aaa3bbc738bcedaa98be5a5503f0e63a336a004b075b18c8b600001518b3360405161087a9493929190611394565b60405180910390a1505060005a820390506104696040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b60006001600084846040516020016108d4929190611289565b60408051808303601f19018152918152815160209283012083529082019290925201600020546001600160a01b03169392505050565b600061091582610bc7565b805190602001209050919050565b60008061093084846108bb565b6001600160a01b031614159392505050565b6109806040518060400160405280601c81526020017f4f564d5f53746174655472616e736974696f6e6572466163746f7279000000008152506100d7565b600054604051631168a38160e11b81526001600160a01b03928316926322d14702926109b79291169085908890889060040161131a565b602060405180830381600087803b1580156109d157600080fd5b505af11580156109e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0991906110e5565b600160008585604051602001610a20929190611289565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550505050565b6000610aa86040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b90506000610adc6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b604051632e38626b60e21b81529091506001600160a01b0383169063b8e189ac90610b0b90879060040161162e565b600060405180830381600087803b158015610b2557600080fd5b505af1158015610b39573d6000803e3d6000fd5b505050506000808560800151806020019051810190610b58919061114f565b60405163abfbbe1360e01b815291935091506001600160a01b0384169063abfbbe1390610b8d90889085908790600401611340565b600060405180830381600087803b158015610ba757600080fd5b505af1158015610bbb573d6000803e3d6000fd5b50505050505050505050565b6060816000015182602001518360400151846060015185608001518660a001518760c00151604051602001610c029796959493929190611297565b6040516020818303038152906040529050919050565b600067ffffffffffffffff831115610c2c57fe5b610c3f601f8401601f1916602001611700565b9050828152838383011115610c5357600080fd5b828260208301376000602084830101529392505050565b80356101b081611754565b600082601f830112610c85578081fd5b610c9483833560208501610c18565b9392505050565b8035600281106101b057600080fd5b600060a08284031215610cbb578081fd5b60405160a0810167ffffffffffffffff8282108183111715610cd957fe5b81604052829350843583526020850135602084015260408501356040840152606085013560608401526080850135915080821115610d1657600080fd5b50610d2385828601610c75565b6080830152505092915050565b600060408284031215610d41578081fd5b6040516040810167ffffffffffffffff8282108183111715610d5f57fe5b8160405282935084358352602091508185013581811115610d7f57600080fd5b8501601f81018713610d9057600080fd5b803582811115610d9c57fe5b8381029250610dac848401611700565b8181528481019083860185850187018b1015610dc757600080fd5b600095505b83861015610dea578035835260019590950194918601918601610dcc565b5080868801525050505050505092915050565b600060a08284031215610e0e578081fd5b60405160a0810167ffffffffffffffff8282108183111715610e2c57fe5b8160405282935084359150610e408261176c565b8183526020850135602084015260408501356040840152606085013560608401526080850135915080821115610d1657600080fd5b600060e08284031215610e86578081fd5b610e9060e0611700565b90508135815260208201356020820152610eac60408301610c9b565b6040820152610ebd60608301610c6a565b6060820152610ece60808301610c6a565b608082015260a082013560a082015260c082013567ffffffffffffffff811115610ef757600080fd5b610f0384828501610c75565b60c08301525092915050565b600060208284031215610f20578081fd5b8151610c948161176c565b600060208284031215610f3c578081fd5b5051919050565b60008060408385031215610f55578081fd5b50508035926020909101359150565b600080600080600080600060e0888a031215610f7e578283fd5b87359650602088013567ffffffffffffffff80821115610f9c578485fd5b610fa88b838c01610caa565b975060408a0135915080821115610fbd578485fd5b610fc98b838c01610d30565b965060608a0135955060808a0135945060a08a0135915080821115610fec578384fd5b610ff88b838c01610caa565b935060c08a013591508082111561100d578283fd5b5061101a8a828b01610d30565b91505092959891949750929550565b600080600080600080600060e0888a031215611043578081fd5b87359650602088013567ffffffffffffffff80821115611061578283fd5b61106d8b838c01610caa565b975060408a0135915080821115611082578283fd5b61108e8b838c01610d30565b965060608a01359150808211156110a3578283fd5b6110af8b838c01610e75565b955060808a01359150808211156110c4578283fd5b6110d08b838c01610dfd565b945060a08a0135915080821115610fec578283fd5b6000602082840312156110f6578081fd5b8151610c9481611754565b600060208284031215611112578081fd5b813567ffffffffffffffff811115611128578182fd5b8201601f81018413611138578182fd5b61114784823560208401610c18565b949350505050565b60008060408385031215611161578182fd5b82519150602083015161117381611754565b809150509250929050565b6001600160a01b03169052565b600081518084526111a3816020860160208601611724565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261114760a085018261118b565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b8083101561123f578451825293830193600192909201919083019061121f565b509695505050505050565b6000815115158352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261114760a085018261118b565b918252602082015260400190565b6000888252876020830152600287106112ac57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b1660558401525083606983015282516112f3816089850160208701611724565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b9283526001600160a01b03919091166020830152604082015260600190565b60008482526060602083015261137860608301856111b7565b828103604084015261138a81856111f4565b9695505050505050565b938452602084019290925260408301526001600160a01b0316606082015260800190565b60208082526041908201527f5374617465207472616e736974696f6e2070726f63657373206d75737420626560408201527f20636f6d706c65746564207072696f7220746f2066696e616c697a6174696f6e6060820152601760f91b608082015260a00190565b60208082526054908201527f506f73742d737461746520726f6f7420676c6f62616c20696e646578206d757360408201527f7420657175616c20746f207468652070726520737461746520726f6f7420676c60608201527337b130b61034b73232bc1038363ab99037b7329760611b608082015260a00190565b60208082526024908201527f496e76616c6964207472616e73616374696f6e20696e636c7573696f6e20707260408201526337b7b31760e11b606082015260800190565b60208082526028908201527f496e76616c696420706f73742d737461746520726f6f7420696e636c7573696f6040820152673710383937b7b31760c11b606082015260800190565b6020808252604c908201527f5072652d737461746520726f6f7420676c6f62616c20696e646578206d75737460408201527f20657175616c20746f20746865207472616e73616374696f6e20726f6f74206760608201526b3637b130b61034b73232bc1760a11b608082015260a00190565b60208082526030908201527f5374617465207472616e736974696f6e20686173206e6f74206265656e20707260408201526f37bb32b710333930bab23ab632b73a1760811b606082015260800190565b60208082526027908201527f496e76616c6964207072652d737461746520726f6f7420696e636c7573696f6e60408201526610383937b7b31760c91b606082015260800190565b600060208252610c9460208301846111b7565b60006080825285516080830152602086015160a083015260408601516002811061166757fe5b60c083015260608601516001600160a01b031660e0830152608086015161169261010084018261117e565b5060a086015161012083015260c086015160e06101408401526116b961016084018261118b565b905082810360208401526116cd818761124a565b905082810360408401526116e181866111b7565b905082810360608401526116f581856111f4565b979650505050505050565b60405181810167ffffffffffffffff8111828210171561171c57fe5b604052919050565b60005b8381101561173f578181015183820152602001611727565b8381111561174e576000848401525b50505050565b6001600160a01b038116811461176957600080fd5b50565b801515811461176957600080fdfea264697066735822122090fa94f972b734dd4c794ce3c199f593acb07d65d0fea3b0025bd8132b68bc7a64736f6c63430007060033", "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", @@ -532,20 +532,20 @@ "storageLayout": { "storage": [ { - "astId": 12800, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_FraudVerifier.sol:OVM_FraudVerifier", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12793" + "type": "t_contract(Lib_AddressManager)15296" }, { - "astId": 9391, + "astId": 11750, "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)11962)" + "type": "t_mapping(t_bytes32,t_contract(iOVM_StateTransitioner)14378)" } ], "types": { @@ -554,22 +554,22 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(Lib_AddressManager)12793": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" }, - "t_contract(iOVM_StateTransitioner)11962": { + "t_contract(iOVM_StateTransitioner)14378": { "encoding": "inplace", "label": "contract iOVM_StateTransitioner", "numberOfBytes": "20" }, - "t_mapping(t_bytes32,t_contract(iOVM_StateTransitioner)11962)": { + "t_mapping(t_bytes32,t_contract(iOVM_StateTransitioner)14378)": { "encoding": "mapping", "key": "t_bytes32", "label": "mapping(bytes32 => contract iOVM_StateTransitioner)", "numberOfBytes": "32", - "value": "t_contract(iOVM_StateTransitioner)11962" + "value": "t_contract(iOVM_StateTransitioner)14378" } } } diff --git a/packages/contracts/deployments/kovan/OVM_L1CrossDomainMessenger.json b/packages/contracts/deployments/kovan/OVM_L1CrossDomainMessenger.json index ceb42bc0a576..2ab482ee1763 100644 --- a/packages/contracts/deployments/kovan/OVM_L1CrossDomainMessenger.json +++ b/packages/contracts/deployments/kovan/OVM_L1CrossDomainMessenger.json @@ -1,5 +1,5 @@ { - "address": "0xa9D9045E4A753c856Fc0053369E780f23559E0A1", + "address": "0xa172330C2E6Ec2bF04662Bb9b67ae857910b7f7f", "abi": [ { "inputs": [], @@ -187,19 +187,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "messageNonce", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "owner", @@ -377,7 +364,7 @@ }, { "internalType": "uint256", - "name": "_messageNonce", + "name": "_queueIndex", "type": "uint256" }, { @@ -433,25 +420,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "sentMessages", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -498,27 +466,27 @@ "type": "function" } ], - "transactionHash": "0x1fb0b55a40eda69d78843a052c4874a608d32099c0bea4eefd52a100543ae5ed", + "transactionHash": "0x5f3b206cb31d6360fb14f166531c43a98f97620cd75521ee2721bba9e39ea036", "receipt": { "to": null, "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", - "contractAddress": "0xa9D9045E4A753c856Fc0053369E780f23559E0A1", + "contractAddress": "0xa172330C2E6Ec2bF04662Bb9b67ae857910b7f7f", "transactionIndex": 0, - "gasUsed": "2795220", + "gasUsed": "2900721", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xea435110780744f5598fc90e58d58c96add2c612a30faface1580cf6aaf66882", - "transactionHash": "0x1fb0b55a40eda69d78843a052c4874a608d32099c0bea4eefd52a100543ae5ed", + "blockHash": "0x79b1dc963036abc95a80cd1fd900d5c5a97ce30981d17507c562874575e5359b", + "transactionHash": "0x5f3b206cb31d6360fb14f166531c43a98f97620cd75521ee2721bba9e39ea036", "logs": [], - "blockNumber": 24572827, - "cumulativeGasUsed": "2795220", + "blockNumber": 25502605, + "cumulativeGasUsed": "2900721", "status": 1, "byzantium": true }, "args": [], - "solcInputHash": "5ee8e508e2c54cb5ac6783b4855b1558", - "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\":\"FailedRelayedMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"_xDomainCalldataHash\",\"type\":\"bytes32\"}],\"name\":\"MessageAllowed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"_xDomainCalldataHash\",\"type\":\"bytes32\"}],\"name\":\"MessageBlocked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_xDomainCalldataHash\",\"type\":\"bytes32\"}],\"name\":\"allowMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_xDomainCalldataHash\",\"type\":\"bytes32\"}],\"name\":\"blockMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"blockedMessages\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"messageNonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"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\"},{\"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\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"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\":\"\",\"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\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"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\":{\"allowMessage(bytes32)\":{\"params\":{\"_xDomainCalldataHash\":\"Hash of the message to block.\"}},\"blockMessage(bytes32)\":{\"params\":{\"_xDomainCalldataHash\":\"Hash of the message to block.\"}},\"initialize(address)\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"paused()\":{\"details\":\"Returns true if the contract is paused, and false otherwise.\"},\"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.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"sendMessage(address,bytes,uint32)\":{\"params\":{\"_gasLimit\":\"Gas limit for the provided message.\",\"_message\":\"Message to send to the target.\",\"_target\":\"Target contract address.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"OVM_L1CrossDomainMessenger\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"allowMessage(bytes32)\":{\"notice\":\"Allow a message.\"},\"blockMessage(bytes32)\":{\"notice\":\"Block a message.\"},\"constructor\":{\"notice\":\"This contract is intended to be behind a delegate proxy. We pass the zero address to the address resolver just to satisfy the constructor. We still need to set this value in initialize().\"},\"pause()\":{\"notice\":\"Pause relaying.\"},\"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.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"sendMessage(address,bytes,uint32)\":{\"notice\":\"Sends a cross domain message to the target messenger.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol\":\"OVM_L1CrossDomainMessenger\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/Initializable.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal initializer {\\n __Context_init_unchained();\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal initializer {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xb419e68addcb82ecda3ad3974b0d2db76435ce9b08435a04d5b119a0c5d45ea5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n// solhint-disable-next-line compiler-version\\npragma solidity >=0.4.24 <0.8.0;\\n\\nimport \\\"../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n */\\nabstract contract Initializable {\\n\\n /**\\n * @dev Indicates that the contract has been initialized.\\n */\\n bool private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Modifier to protect an initializer function from being invoked twice.\\n */\\n modifier initializer() {\\n require(_initializing || _isConstructor() || !_initialized, \\\"Initializable: contract is already initialized\\\");\\n\\n bool isTopLevelCall = !_initializing;\\n if (isTopLevelCall) {\\n _initializing = true;\\n _initialized = true;\\n }\\n\\n _;\\n\\n if (isTopLevelCall) {\\n _initializing = false;\\n }\\n }\\n\\n /// @dev Returns true if and only if the function is running in the constructor\\n function _isConstructor() private view returns (bool) {\\n return !AddressUpgradeable.isContract(address(this));\\n }\\n}\\n\",\"keccak256\":\"0xd8e4eb08dcc1d1860fb347ba5ffd595242b9a1b66d49a47f2b4cb51c3f35017e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.2 <0.8.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { size := extcodesize(account) }\\n return size > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\n (bool success, ) = recipient.call{ value: amount }(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain`call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: value }(data);\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfc5ea91fa9ceb1961023b2a6c978b902888c52b90847ac7813fe3b79524165f6\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\nimport \\\"../proxy/Initializable.sol\\\";\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal initializer {\\n __Context_init_unchained();\\n }\\n\\n function __Context_init_unchained() internal initializer {\\n }\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0xbbf8a21b9a66c48d45ff771b8563c6df19ba451d63dfb8380a865c1e1f29d1a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"./ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which allows children to implement an emergency stop\\n * mechanism that can be triggered by an authorized account.\\n *\\n * This module is used through inheritance. It will make available the\\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\\n * the functions of your contract. Note that they will not be pausable by\\n * simply including this module, only once the modifiers are put in place.\\n */\\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\\n /**\\n * @dev Emitted when the pause is triggered by `account`.\\n */\\n event Paused(address account);\\n\\n /**\\n * @dev Emitted when the pause is lifted by `account`.\\n */\\n event Unpaused(address account);\\n\\n bool private _paused;\\n\\n /**\\n * @dev Initializes the contract in unpaused state.\\n */\\n function __Pausable_init() internal initializer {\\n __Context_init_unchained();\\n __Pausable_init_unchained();\\n }\\n\\n function __Pausable_init_unchained() internal initializer {\\n _paused = false;\\n }\\n\\n /**\\n * @dev Returns true if the contract is paused, and false otherwise.\\n */\\n function paused() public view virtual returns (bool) {\\n return _paused;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is not paused.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n modifier whenNotPaused() {\\n require(!paused(), \\\"Pausable: paused\\\");\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is paused.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n modifier whenPaused() {\\n require(paused(), \\\"Pausable: not paused\\\");\\n _;\\n }\\n\\n /**\\n * @dev Triggers stopped state.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n function _pause() internal virtual whenNotPaused {\\n _paused = true;\\n emit Paused(_msgSender());\\n }\\n\\n /**\\n * @dev Returns to normal state.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n function _unpause() internal virtual whenPaused {\\n _paused = false;\\n emit Unpaused(_msgSender());\\n }\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x73bef0a5dec3efde8183c4858d90f683ed2771656c4329647b4d5b0f89498fd5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\nimport \\\"../proxy/Initializable.sol\\\";\\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 ReentrancyGuardUpgradeable is Initializable {\\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 function __ReentrancyGuard_init() internal initializer {\\n __ReentrancyGuard_init_unchained();\\n }\\n\\n function __ReentrancyGuard_init_unchained() internal initializer {\\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 uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x46034cd5cca740f636345c8f7aebae0f78adfd4b70e31e6f888cccbe1086586e\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/bridge/messaging/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/messaging/iAbs_BaseCrossDomainMessenger.sol\\\";\\n\\n/**\\n * @title Abs_BaseCrossDomainMessenger\\n * @dev The Base Cross Domain Messenger is an abstract contract providing the interface and common\\n * functionality used in the L1 and L2 Cross Domain Messengers. It can also serve as a template for\\n * developers wishing to implement a custom bridge 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 {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n // The default x-domain message sender being set to a non-zero value makes\\n // deployment a bit more expensive, but in exchange the refund on every call to\\n // `relayMessage` by the L1 and L2 messengers will be higher.\\n address internal constant DEFAULT_XDOMAIN_SENDER = 0x000000000000000000000000000000000000dEaD;\\n\\n\\n /*************\\n * 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 internal xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() {}\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function xDomainMessageSender()\\n public\\n override\\n view\\n returns (\\n address\\n )\\n {\\n require(xDomainMsgSender != DEFAULT_XDOMAIN_SENDER, \\\"xDomainMessageSender is not set\\\");\\n return xDomainMsgSender;\\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 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 /**********************\\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 to send.\\n * param // 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\":\"0xed5dafa41fadfd461e33c042da3a721f2cce73e0d2418d170a44161f7714a439\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/bridge/messaging/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\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_L1CrossDomainMessenger } from \\\"../../../iOVM/bridge/messaging/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/* External Imports */\\nimport { OwnableUpgradeable } from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport { PausableUpgradeable } from \\\"@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol\\\";\\nimport { ReentrancyGuardUpgradeable } from \\\"@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol\\\";\\n\\n/**\\n * @title OVM_L1CrossDomainMessenger\\n * @dev The L1 Cross Domain Messenger contract sends messages from L1 to L2, and relays messages\\n * from L2 onto L1. In the event that a message sent from L1 to L2 is rejected for exceeding the L2\\n * epoch gas limit, it can be resubmitted via this contract's replay function.\\n *\\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_L1CrossDomainMessenger is\\n iOVM_L1CrossDomainMessenger,\\n Abs_BaseCrossDomainMessenger,\\n Lib_AddressResolver,\\n OwnableUpgradeable,\\n PausableUpgradeable,\\n ReentrancyGuardUpgradeable\\n{\\n\\n /**********\\n * Events *\\n **********/\\n\\n event MessageBlocked(\\n bytes32 indexed _xDomainCalldataHash\\n );\\n\\n event MessageAllowed(\\n bytes32 indexed _xDomainCalldataHash\\n );\\n\\n /**********************\\n * Contract Variables *\\n **********************/\\n\\n mapping (bytes32 => bool) public blockedMessages;\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * This contract is intended to be behind a delegate proxy.\\n * We pass the zero address to the address resolver just to satisfy the constructor.\\n * We still need to set this value in initialize().\\n */\\n constructor()\\n Lib_AddressResolver(address(0))\\n {}\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Modifier to enforce that, if configured, only the OVM_L2MessageRelayer contract may\\n * 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 * @param _libAddressManager Address of the Address Manager.\\n */\\n function initialize(\\n address _libAddressManager\\n )\\n public\\n initializer\\n {\\n require(\\n address(libAddressManager) == address(0),\\n \\\"L1CrossDomainMessenger already intialized.\\\"\\n );\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\\n\\n // Initialize upgradable OZ contracts\\n __Context_init_unchained(); // Context is a dependency for both Ownable and Pausable\\n __Ownable_init_unchained();\\n __Pausable_init_unchained();\\n __ReentrancyGuard_init_unchained();\\n }\\n\\n /**\\n * Pause relaying.\\n */\\n function pause()\\n external\\n onlyOwner\\n {\\n _pause();\\n }\\n\\n /**\\n * Block a message.\\n * @param _xDomainCalldataHash Hash of the message to block.\\n */\\n function blockMessage(\\n bytes32 _xDomainCalldataHash\\n )\\n external\\n onlyOwner\\n {\\n blockedMessages[_xDomainCalldataHash] = true;\\n emit MessageBlocked(_xDomainCalldataHash);\\n }\\n\\n /**\\n * Allow a message.\\n * @param _xDomainCalldataHash Hash of the message to block.\\n */\\n function allowMessage(\\n bytes32 _xDomainCalldataHash\\n )\\n external\\n onlyOwner\\n {\\n blockedMessages[_xDomainCalldataHash] = false;\\n emit MessageAllowed(_xDomainCalldataHash);\\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 whenNotPaused\\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 require(\\n blockedMessages[xDomainCalldataHash] == false,\\n \\\"Provided message has been blocked.\\\"\\n );\\n\\n xDomainMsgSender = _sender;\\n (bool success, ) = _target.call(_message);\\n xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\\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 } else {\\n emit FailedRelayedMessage(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(\\n resolve(\\\"OVM_StateCommitmentChain\\\")\\n );\\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 predeploy 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\":\"0xba49f550a93c91448340fdb85ad8e4d4dff523532eb1524add38ee2825cc0442\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/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\\n event SentMessage(bytes message);\\n event RelayedMessage(bytes32 msgHash);\\n event FailedRelayedMessage(bytes32 msgHash);\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n function xDomainMessageSender() external view returns (address);\\n\\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\":\"0x89981ed48e99d6939cc6cdef827d484fa3e2292d66c0ba5056c7050cb6282d7e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/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 * 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\":\"0x2d7973a0ad84c23ec62624d3f1e3aeb198cc72686ff1e6cfa17155556b320c94\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x2ce671a0e004df88b136bea5a3c59d0732cea8887c8496da1d509e0200b03d7d\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 abi.encodePacked(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\":\"0x161f65220b8c5cf295232f8c58c2744fbc898bf77da5f9d9c5b2dd673dafc6f6\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xa5195afe32fb2cf104d156e8f4bd39df1ec79bf6ba232097b9e8e0ee14fbc298\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x6080604052600480546001600160a01b03191661dead17905534801561002457600080fd5b50600580546001600160a01b031916905561312f806100446000396000f3fe608060405234801561001057600080fd5b50600436106101215760003560e01c806381ada46c116100ad578063c4d66de811610071578063c4d66de814610213578063c6b94ab014610226578063d7fd19dd14610239578063ecc704281461024c578063f2fde38b1461026157610121565b806381ada46c146101ca57806382e3702d146101dd5780638456cb59146101f05780638da5cb5b146101f8578063b1b1b2091461020057610121565b8063461a4478116100f4578063461a44781461018c5780635c975abb1461019f5780636e296e45146101a7578063706ceab6146101af578063715018a6146101c257610121565b80630ecf2eea1461012657806321d800ec1461013b578063299ca478146101645780633dbb202b14610179575b600080fd5b610139610134366004612aba565b610274565b005b61014e610149366004612aba565b610319565b60405161015b9190612cd0565b60405180910390f35b61016c61032e565b60405161015b9190612c58565b610139610187366004612a3e565b61033d565b61016c61019a366004612ad2565b6103cc565b61014e6104a8565b61016c6104b1565b6101396101bd3660046129c7565b6104fa565b610139610561565b6101396101d8366004612aba565b61060d565b61014e6101eb366004612aba565b6106af565b6101396106c4565b61016c610730565b61014e61020e366004612aba565b61073f565b61013961022136600461287e565b610754565b61014e610234366004612aba565b610882565b610139610247366004612898565b610897565b610254610bd6565b60405161015b9190612ba1565b61013961026f36600461287e565b610bdc565b61027c610cdf565b6001600160a01b031661028d610730565b6001600160a01b0316146102d6576040805162461bcd60e51b815260206004820181905260248201526000805160206130da833981519152604482015290519081900360640190fd5b600081815260ce6020526040808220805460ff191660011790555182917ff52508d5339edf0d7e5060a416df98db067af561bdc60872d29c0439eaa13a0291a250565b60006020819052908152604090205460ff1681565b6005546001600160a01b031681565b600061034d843385600354610ce3565b60038054600190810190915581516020808401919091206000908152600290915260409020805460ff19169091179055905061038f8163ffffffff8416610d30565b7f0ee9ffdb2334d78de97ffb066b23a352a4d35180cefb36589d663fbb1eb6f326816040516103be9190612d52565b60405180910390a150505050565b60055460405163bf40fac160e01b81526020600482018181528451602484015284516000946001600160a01b03169363bf40fac1938793928392604401918501908083838b5b8381101561042a578181015183820152602001610412565b50505050905090810190601f1680156104575780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561047457600080fd5b505afa158015610488573d6000803e3d6000fd5b505050506040513d602081101561049e57600080fd5b505190505b919050565b606a5460ff1690565b6004546000906001600160a01b031661dead14156104ea5760405162461bcd60e51b81526004016104e190612d65565b60405180910390fd5b506004546001600160a01b031690565b600061050886868686610ce3565b805160208083019190912060009081526002909152604090205490915060ff1615156001146105495760405162461bcd60e51b81526004016104e190612e5a565b610559818363ffffffff16610d30565b505050505050565b610569610cdf565b6001600160a01b031661057a610730565b6001600160a01b0316146105c3576040805162461bcd60e51b815260206004820181905260248201526000805160206130da833981519152604482015290519081900360640190fd5b6038546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3603880546001600160a01b0319169055565b610615610cdf565b6001600160a01b0316610626610730565b6001600160a01b03161461066f576040805162461bcd60e51b815260206004820181905260248201526000805160206130da833981519152604482015290519081900360640190fd5b600081815260ce6020526040808220805460ff191690555182917f52c8a2680a9f4cc0ad0bf88f32096eadbebf0646ea611d93a0ce6a29a024040591a250565b60026020526000908152604090205460ff1681565b6106cc610cdf565b6001600160a01b03166106dd610730565b6001600160a01b031614610726576040805162461bcd60e51b815260206004820181905260248201526000805160206130da833981519152604482015290519081900360640190fd5b61072e610e08565b565b6038546001600160a01b031690565b60016020526000908152604090205460ff1681565b600554600160a81b900460ff168061076f575061076f610ea8565b806107845750600554600160a01b900460ff16155b6107bf5760405162461bcd60e51b815260040180806020018281038252602e815260200180613086602e913960400191505060405180910390fd5b600554600160a81b900460ff161580156107f6576005805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b6005546001600160a01b03161561081f5760405162461bcd60e51b81526004016104e190612f84565b600580546001600160a01b0384166001600160a01b0319918216179091556004805490911661dead179055610852610eb9565b61085a610f72565b610862611082565b61086a611144565b801561087e576005805460ff60a81b191690555b5050565b60ce6020526000908152604090205460ff1681565b6002609c5414156108ef576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002609c5560408051808201909152601481527327ab26afa61926b2b9b9b0b3b2a932b630bcb2b960611b602082015260009061092b906103cc565b90506001600160a01b0381161561096457336001600160a01b038216146109645760405162461bcd60e51b81526004016104e190612ee7565b61096c6104a8565b156109b1576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b60006109bf87878787610ce3565b90506109cb8184611201565b15156001146109ec5760405162461bcd60e51b81526004016104e190612f3d565b80516020808301919091206000818152600190925260409091205460ff1615610a275760405162461bcd60e51b81526004016104e190612d9c565b600081815260ce602052604090205460ff1615610a565760405162461bcd60e51b81526004016104e190612ea5565b600480546001600160a01b0319166001600160a01b03898116919091179091556040516000918a1690610a8a908990612bb8565b6000604051808303816000865af19150503d8060008114610ac7576040519150601f19603f3d011682016040523d82523d6000602084013e610acc565b606091505b5050600480546001600160a01b03191661dead179055905080151560011415610b4757600082815260016020819052604091829020805460ff19169091179055517f4641df4a962071e12719d8c8c8e5ac7fc4d97b927346a3d7a335b1f7517e133c90610b3a908490612ba1565b60405180910390a1610b7f565b7f99d0e048484baa1b1540b1367cb128acd7ab2946d1ed91ec10e3c85e4bf51b8f82604051610b769190612ba1565b60405180910390a15b6000833343604051602001610b9693929190612c06565b60408051601f1981840301815291815281516020928301206000908152918290529020805460ff19166001908117909155609c5550505050505050505050565b60035481565b610be4610cdf565b6001600160a01b0316610bf5610730565b6001600160a01b031614610c3e576040805162461bcd60e51b815260206004820181905260248201526000805160206130da833981519152604482015290519081900360640190fd5b6001600160a01b038116610c835760405162461bcd60e51b81526004018080602001828103825260268152602001806130366026913960400191505060405180910390fd5b6038546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3603880546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b606084848484604051602401610cfc9493929190612c6c565b60408051601f198184030181529190526020810180516001600160e01b031663cbd4ece960e01b1790529050949350505050565b610d6e6040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e0000008152506103cc565b6001600160a01b0316636fee07e0610dba6040518060400160405280601a81526020017f4f564d5f4c3243726f7373446f6d61696e4d657373656e6765720000000000008152506103cc565b83856040518463ffffffff1660e01b8152600401610dda93929190612ca9565b600060405180830381600087803b158015610df457600080fd5b505af1158015610559573d6000803e3d6000fd5b610e106104a8565b15610e55576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b606a805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610e8b610cdf565b604080516001600160a01b039092168252519081900360200190a1565b6000610eb330611226565b15905090565b600554600160a81b900460ff1680610ed45750610ed4610ea8565b80610ee95750600554600160a01b900460ff16155b610f245760405162461bcd60e51b815260040180806020018281038252602e815260200180613086602e913960400191505060405180910390fd5b600554600160a81b900460ff16158015610f5b576005805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b8015610f6f576005805460ff60a81b191690555b50565b600554600160a81b900460ff1680610f8d5750610f8d610ea8565b80610fa25750600554600160a01b900460ff16155b610fdd5760405162461bcd60e51b815260040180806020018281038252602e815260200180613086602e913960400191505060405180910390fd5b600554600160a81b900460ff16158015611014576005805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b600061101e610cdf565b603880546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3508015610f6f576005805460ff60a81b1916905550565b600554600160a81b900460ff168061109d575061109d610ea8565b806110b25750600554600160a01b900460ff16155b6110ed5760405162461bcd60e51b815260040180806020018281038252602e815260200180613086602e913960400191505060405180910390fd5b600554600160a81b900460ff16158015611124576005805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b606a805460ff191690558015610f6f576005805460ff60a81b1916905550565b600554600160a81b900460ff168061115f575061115f610ea8565b806111745750600554600160a01b900460ff16155b6111af5760405162461bcd60e51b815260040180806020018281038252602e815260200180613086602e913960400191505060405180910390fd5b600554600160a81b900460ff161580156111e6576005805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b6001609c558015610f6f576005805460ff60a81b1916905550565b600061120c8261122c565b801561121d575061121d8383611389565b90505b92915050565b3b151590565b60008061126d6040518060400160405280601881526020017f4f564d5f5374617465436f6d6d69746d656e74436861696e00000000000000008152506103cc565b6020840151604051639418bddd60e01b81529192506001600160a01b03831691639418bddd9161129f91600401612fce565b60206040518083038186803b1580156112b757600080fd5b505afa1580156112cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ef9190612a9a565b1580156113825750825160208401516040808601519051634d69ee5760e01b81526001600160a01b03851693634d69ee5793611332939192909190600401612cdb565b60206040518083038186803b15801561134a57600080fd5b505afa15801561135e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113829190612a9a565b9392505050565b600080836113cb6040518060400160405280601a81526020017f4f564d5f4c3243726f7373446f6d61696e4d657373656e6765720000000000008152506103cc565b6040516020016113dc929190612bd4565b604051602081830303815290604052805190602001206000604051602001611405929190612baa565b604051602081830303815290604052805190602001209050600080611454602160991b6040516020016114389190612b89565b60408051601f19818403018152919052606087015187516114e6565b909250905060018215151461147b5760405162461bcd60e51b81526004016104e190612de7565b60006114868261150f565b90506114db8460405160200161149c9190612ba1565b60405160208183030381529060405260016040516020016114bd9190612c40565b604051602081830303815290604052886080015184604001516115a1565b979650505050505050565b6000606060006114f5866115c5565b90506115028186866115f5565b9250925050935093915050565b611517612634565b6000611522836116c8565b9050604051806080016040528061154c8360008151811061153f57fe5b60200260200101516116db565b81526020016115618360018151811061153f57fe5b81526020016115838360028151811061157657fe5b60200260200101516116e2565b81526020016115988360038151811061157657fe5b90529392505050565b6000806115ad866115c5565b90506115bb818686866117db565b9695505050505050565b606081805190602001206040516020016115df9190612ba1565b6040516020818303038152906040529050919050565b60006060600061160485611801565b90506000806000611616848a896118d8565b8151929550909350915015808061162a5750815b61167b576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b60008161169757604051806020016040528060008152506116b6565b6116b68660018703815181106116a957fe5b6020026020010151611c7b565b919b919a509098505050505050505050565b60606112206116d683611c97565b611cbc565b6000611220825b600060218260000151111561173e576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b600080600061174c85611e32565b91945092509050600081600181111561176157fe5b146117b3576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6020808601518401805190918410156115bb5760208490036101000a90049695505050505050565b60008060006117eb8786866115f5565b915091508180156114db57506114db868261215b565b6060600061180e836116c8565b90506000815167ffffffffffffffff8111801561182a57600080fd5b5060405190808252806020026020018201604052801561186457816020015b61185161265b565b8152602001906001900390816118495790505b50905060005b82518110156118d057600061189184838151811061188457fe5b6020026020010151612171565b905060405180604001604052808281526020016118ad836116c8565b8152508383815181106118bc57fe5b60209081029190910101525060010161186a565b509392505050565b600060608180806118e887612200565b9050856000806118f661265b565b60005b8c51811015611c53578c818151811061190e57fe5b60200260200101519150828401935060018701965083600014156119825781518051602090910120851461197d576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b611a49565b8151516020116119e95781518051602090910120851461197d576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b846119f783600001516122fd565b14611a49576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b60208201515160111415611ab8578551841415611a6557611c53565b6000868581518110611a7357fe5b602001015160f81c60f81b60f81c9050600083602001518260ff1681518110611a9857fe5b60200260200101519050611aab81612329565b9650600194505050611c4b565b60028260200151511415611bfe576000611ad18361235f565b9050600081600081518110611ae257fe5b016020015160f81c9050600181166002036000611b028460ff841661237d565b90506000611b108b8a61237d565b90506000611b1e83836123ae565b905060ff851660021480611b35575060ff85166003145b15611b6757808351148015611b4a5750808251145b15611b5457988901985b50600160ff1b9950611c53945050505050565b60ff85161580611b7a575060ff85166001145b15611bc75780611b975750600160ff1b9950611c53945050505050565b611bb88860200151600181518110611bab57fe5b6020026020010151612329565b9a509750611c4b945050505050565b60405162461bcd60e51b81526004018080602001828103825260268152602001806130b46026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b6001016118f9565b50600160ff1b841486611c66878661237d565b909e909d50909b509950505050505050505050565b6020810151805160609161122091600019810190811061188457fe5b611c9f612675565b506040805180820190915281518152602082810190820152919050565b6060600080611cca84611e32565b91935090915060019050816001811115611ce057fe5b14611d32576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b611d53612675565b815260200190600190039081611d4b5790505090506000835b8651811015611e275760208210611db45760405162461bcd60e51b815260040180806020018281038252602a81526020018061305c602a913960400191505060405180910390fd5b600080611de06040518060400160405280858c60000151038152602001858c6020015101815250611e32565b509150915060405180604001604052808383018152602001848b6020015101815250858581518110611e0e57fe5b6020908102919091010152600193909301920101611d6c565b508152949350505050565b600080600080846000015111611e8f576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f8111611eb4576000600160009450945094505050612154565b60b78111611f29578551607f198201908110611f17576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b60019550935060009250612154915050565b60bf811161200d57855160b6198201908110611f8c576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111611ff8576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b60019091019550935060009250612154915050565b60f7811161208157855160bf198201908110612070576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b600195509350849250612154915050565b855160f61982019081106120dc576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111612141576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b6001918201965094509250612154915050565b9193909250565b8051602091820120825192909101919091201490565b6060600080600061218185611e32565b91945092509050600081600181111561219657fe5b146121e8576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b6121f785602001518484612414565b95945050505050565b60606000825160020267ffffffffffffffff8111801561221f57600080fd5b506040519080825280601f01601f19166020018201604052801561224a576020820181803683370190505b50905060005b83518110156122f657600484828151811061226757fe5b602001015160f81c60f81b6001600160f81b031916901c82826002028151811061228d57fe5b60200101906001600160f81b031916908160001a90535060108482815181106122b257fe5b016020015160f81c816122c157fe5b0660f81b8282600202600101815181106122d757fe5b60200101906001600160f81b031916908160001a905350600101612250565b5092915050565b6000602082511015612314575060208101516104a3565b81806020019051602081101561049e57600080fd5b6000606060208360000151101561234a57612343836124c2565b9050612356565b61235383612171565b90505b611382816122fd565b6060611220612378836020015160008151811061188457fe5b612200565b606081835103600014156123a05750604080516020810190915260008152611220565b61121d8383848651036124cd565b6000805b8084511180156123c25750808351115b801561240757508281815181106123d557fe5b602001015160f81c60f81b6001600160f81b0319168482815181106123f657fe5b01602001516001600160f81b031916145b1561121d576001016123b2565b606060008267ffffffffffffffff8111801561242f57600080fd5b506040519080825280601f01601f19166020018201604052801561245a576020820181803683370190505b50905080516000141561246e579050611382565b8484016020820160005b60208604811015612499578251825260209283019290910190600101612478565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b60606112208261261e565b60608182601f011015612518576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b828284011015612560576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b818301845110156125ac576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b6060821580156125cb5760405191506000825260208201604052612615565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156126045780518352602092830192016125ec565b5050858452601f01601f1916604052505b50949350505050565b6060611220826020015160008460000151612414565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060608152602001606081525090565b604051806040016040528060008152602001600081525090565b600067ffffffffffffffff8311156126a357fe5b6126b6601f8401601f1916602001612fe1565b90508281528383830111156126ca57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146104a357600080fd5b600082601f830112612708578081fd5b61121d8383356020850161268f565b600060a08284031215612728578081fd5b60405160a0810167ffffffffffffffff828210818311171561274657fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561278357600080fd5b50612790858286016126f8565b6080830152505092915050565b6000604082840312156127ae578081fd5b6040516040810167ffffffffffffffff82821081831117156127cc57fe5b81604052829350843583526020915081850135818111156127ec57600080fd5b8501601f810187136127fd57600080fd5b80358281111561280957fe5b8381029250612819848401612fe1565b8181528481019083860185850187018b101561283457600080fd5b600095505b83861015612857578035835260019590950194918601918601612839565b5080868801525050505050505092915050565b803563ffffffff811681146104a357600080fd5b60006020828403121561288f578081fd5b61121d826126e1565b600080600080600060a086880312156128af578081fd5b6128b8866126e1565b94506128c6602087016126e1565b9350604086013567ffffffffffffffff808211156128e2578283fd5b6128ee89838a016126f8565b945060608801359350608088013591508082111561290a578283fd5b9087019060a0828a03121561291d578283fd5b61292760a0612fe1565b8235815260208301358281111561293c578485fd5b6129488b828601612717565b60208301525060408301358281111561295f578485fd5b61296b8b82860161279d565b604083015250606083013582811115612982578485fd5b61298e8b8286016126f8565b6060830152506080830135828111156129a5578485fd5b6129b18b8286016126f8565b6080830152508093505050509295509295909350565b600080600080600060a086880312156129de578081fd5b6129e7866126e1565b94506129f5602087016126e1565b9350604086013567ffffffffffffffff811115612a10578182fd5b612a1c888289016126f8565b93505060608601359150612a326080870161286a565b90509295509295909350565b600080600060608486031215612a52578283fd5b612a5b846126e1565b9250602084013567ffffffffffffffff811115612a76578283fd5b612a82868287016126f8565b925050612a916040850161286a565b90509250925092565b600060208284031215612aab578081fd5b8151801515811461121d578182fd5b600060208284031215612acb578081fd5b5035919050565b600060208284031215612ae3578081fd5b813567ffffffffffffffff811115612af9578182fd5b8201601f81018413612b09578182fd5b612b188482356020840161268f565b949350505050565b60008151808452612b38816020860160208601613005565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a06080850152612b1860a0850182612b20565b60609190911b6001600160601b031916815260140190565b90815260200190565b918252602082015260400190565b60008251612bca818460208701613005565b9190910192915050565b60008351612be6818460208801613005565b60609390931b6001600160601b0319169190920190815260140192915050565b60008451612c18818460208901613005565b60609490941b6001600160601b03191691909301908152601481019190915260340192915050565b60f89190911b6001600160f81b031916815260010190565b6001600160a01b0391909116815260200190565b6001600160a01b03858116825284166020820152608060408201819052600090612c9890830185612b20565b905082606083015295945050505050565b600060018060a01b0385168252836020830152606060408301526121f76060830184612b20565b901515815260200190565b60008482526020606081840152612cf56060840186612b4c565b838103604085015260408101855182528286015160408484015281815180845260608501915085830194508693505b80841015612d445784518252938501936001939093019290850190612d24565b509998505050505050505050565b60006020825261121d6020830184612b20565b6020808252601f908201527f78446f6d61696e4d65737361676553656e646572206973206e6f742073657400604082015260600190565b6020808252602b908201527f50726f7669646564206d6573736167652068617320616c72656164792062656560408201526a37103932b1b2b4bb32b21760a91b606082015260800190565b6020808252604d908201527f4d6573736167652070617373696e67207072656465706c6f7920686173206e6f60408201527f74206265656e20696e697469616c697a6564206f7220696e76616c696420707260608201526c37b7b310383937bb34b232b21760991b608082015260a00190565b6020808252602b908201527f50726f7669646564206d65737361676520686173206e6f7420616c726561647960408201526a103132b2b71039b2b73a1760a91b606082015260800190565b60208082526022908201527f50726f7669646564206d65737361676520686173206265656e20626c6f636b65604082015261321760f11b606082015260800190565b60208082526036908201527f4f6e6c79204f564d5f4c324d65737361676552656c617965722063616e2072656040820152753630bc90261916ba3796a6189036b2b9b9b0b3b2b99760511b606082015260800190565b60208082526027908201527f50726f7669646564206d65737361676520636f756c64206e6f742062652076656040820152663934b334b2b21760c91b606082015260800190565b6020808252602a908201527f4c3143726f7373446f6d61696e4d657373656e67657220616c72656164792069604082015269373a34b0b634bd32b21760b11b606082015260800190565b60006020825261121d6020830184612b4c565b60405181810167ffffffffffffffff81118282101715612ffd57fe5b604052919050565b60005b83811015613020578181015183820152602001613008565b8381111561302f576000848401525b5050505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737350726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a656452656365697665642061206e6f6465207769746820616e20756e6b6e6f776e207072656669784f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a2646970667358221220c8b08248358fc9118d8d145603700ec8109487e93128f8f4b5dafd0a63cf3bad64736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101215760003560e01c806381ada46c116100ad578063c4d66de811610071578063c4d66de814610213578063c6b94ab014610226578063d7fd19dd14610239578063ecc704281461024c578063f2fde38b1461026157610121565b806381ada46c146101ca57806382e3702d146101dd5780638456cb59146101f05780638da5cb5b146101f8578063b1b1b2091461020057610121565b8063461a4478116100f4578063461a44781461018c5780635c975abb1461019f5780636e296e45146101a7578063706ceab6146101af578063715018a6146101c257610121565b80630ecf2eea1461012657806321d800ec1461013b578063299ca478146101645780633dbb202b14610179575b600080fd5b610139610134366004612aba565b610274565b005b61014e610149366004612aba565b610319565b60405161015b9190612cd0565b60405180910390f35b61016c61032e565b60405161015b9190612c58565b610139610187366004612a3e565b61033d565b61016c61019a366004612ad2565b6103cc565b61014e6104a8565b61016c6104b1565b6101396101bd3660046129c7565b6104fa565b610139610561565b6101396101d8366004612aba565b61060d565b61014e6101eb366004612aba565b6106af565b6101396106c4565b61016c610730565b61014e61020e366004612aba565b61073f565b61013961022136600461287e565b610754565b61014e610234366004612aba565b610882565b610139610247366004612898565b610897565b610254610bd6565b60405161015b9190612ba1565b61013961026f36600461287e565b610bdc565b61027c610cdf565b6001600160a01b031661028d610730565b6001600160a01b0316146102d6576040805162461bcd60e51b815260206004820181905260248201526000805160206130da833981519152604482015290519081900360640190fd5b600081815260ce6020526040808220805460ff191660011790555182917ff52508d5339edf0d7e5060a416df98db067af561bdc60872d29c0439eaa13a0291a250565b60006020819052908152604090205460ff1681565b6005546001600160a01b031681565b600061034d843385600354610ce3565b60038054600190810190915581516020808401919091206000908152600290915260409020805460ff19169091179055905061038f8163ffffffff8416610d30565b7f0ee9ffdb2334d78de97ffb066b23a352a4d35180cefb36589d663fbb1eb6f326816040516103be9190612d52565b60405180910390a150505050565b60055460405163bf40fac160e01b81526020600482018181528451602484015284516000946001600160a01b03169363bf40fac1938793928392604401918501908083838b5b8381101561042a578181015183820152602001610412565b50505050905090810190601f1680156104575780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561047457600080fd5b505afa158015610488573d6000803e3d6000fd5b505050506040513d602081101561049e57600080fd5b505190505b919050565b606a5460ff1690565b6004546000906001600160a01b031661dead14156104ea5760405162461bcd60e51b81526004016104e190612d65565b60405180910390fd5b506004546001600160a01b031690565b600061050886868686610ce3565b805160208083019190912060009081526002909152604090205490915060ff1615156001146105495760405162461bcd60e51b81526004016104e190612e5a565b610559818363ffffffff16610d30565b505050505050565b610569610cdf565b6001600160a01b031661057a610730565b6001600160a01b0316146105c3576040805162461bcd60e51b815260206004820181905260248201526000805160206130da833981519152604482015290519081900360640190fd5b6038546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3603880546001600160a01b0319169055565b610615610cdf565b6001600160a01b0316610626610730565b6001600160a01b03161461066f576040805162461bcd60e51b815260206004820181905260248201526000805160206130da833981519152604482015290519081900360640190fd5b600081815260ce6020526040808220805460ff191690555182917f52c8a2680a9f4cc0ad0bf88f32096eadbebf0646ea611d93a0ce6a29a024040591a250565b60026020526000908152604090205460ff1681565b6106cc610cdf565b6001600160a01b03166106dd610730565b6001600160a01b031614610726576040805162461bcd60e51b815260206004820181905260248201526000805160206130da833981519152604482015290519081900360640190fd5b61072e610e08565b565b6038546001600160a01b031690565b60016020526000908152604090205460ff1681565b600554600160a81b900460ff168061076f575061076f610ea8565b806107845750600554600160a01b900460ff16155b6107bf5760405162461bcd60e51b815260040180806020018281038252602e815260200180613086602e913960400191505060405180910390fd5b600554600160a81b900460ff161580156107f6576005805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b6005546001600160a01b03161561081f5760405162461bcd60e51b81526004016104e190612f84565b600580546001600160a01b0384166001600160a01b0319918216179091556004805490911661dead179055610852610eb9565b61085a610f72565b610862611082565b61086a611144565b801561087e576005805460ff60a81b191690555b5050565b60ce6020526000908152604090205460ff1681565b6002609c5414156108ef576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002609c5560408051808201909152601481527327ab26afa61926b2b9b9b0b3b2a932b630bcb2b960611b602082015260009061092b906103cc565b90506001600160a01b0381161561096457336001600160a01b038216146109645760405162461bcd60e51b81526004016104e190612ee7565b61096c6104a8565b156109b1576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b60006109bf87878787610ce3565b90506109cb8184611201565b15156001146109ec5760405162461bcd60e51b81526004016104e190612f3d565b80516020808301919091206000818152600190925260409091205460ff1615610a275760405162461bcd60e51b81526004016104e190612d9c565b600081815260ce602052604090205460ff1615610a565760405162461bcd60e51b81526004016104e190612ea5565b600480546001600160a01b0319166001600160a01b03898116919091179091556040516000918a1690610a8a908990612bb8565b6000604051808303816000865af19150503d8060008114610ac7576040519150601f19603f3d011682016040523d82523d6000602084013e610acc565b606091505b5050600480546001600160a01b03191661dead179055905080151560011415610b4757600082815260016020819052604091829020805460ff19169091179055517f4641df4a962071e12719d8c8c8e5ac7fc4d97b927346a3d7a335b1f7517e133c90610b3a908490612ba1565b60405180910390a1610b7f565b7f99d0e048484baa1b1540b1367cb128acd7ab2946d1ed91ec10e3c85e4bf51b8f82604051610b769190612ba1565b60405180910390a15b6000833343604051602001610b9693929190612c06565b60408051601f1981840301815291815281516020928301206000908152918290529020805460ff19166001908117909155609c5550505050505050505050565b60035481565b610be4610cdf565b6001600160a01b0316610bf5610730565b6001600160a01b031614610c3e576040805162461bcd60e51b815260206004820181905260248201526000805160206130da833981519152604482015290519081900360640190fd5b6001600160a01b038116610c835760405162461bcd60e51b81526004018080602001828103825260268152602001806130366026913960400191505060405180910390fd5b6038546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3603880546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b606084848484604051602401610cfc9493929190612c6c565b60408051601f198184030181529190526020810180516001600160e01b031663cbd4ece960e01b1790529050949350505050565b610d6e6040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e0000008152506103cc565b6001600160a01b0316636fee07e0610dba6040518060400160405280601a81526020017f4f564d5f4c3243726f7373446f6d61696e4d657373656e6765720000000000008152506103cc565b83856040518463ffffffff1660e01b8152600401610dda93929190612ca9565b600060405180830381600087803b158015610df457600080fd5b505af1158015610559573d6000803e3d6000fd5b610e106104a8565b15610e55576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b606a805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610e8b610cdf565b604080516001600160a01b039092168252519081900360200190a1565b6000610eb330611226565b15905090565b600554600160a81b900460ff1680610ed45750610ed4610ea8565b80610ee95750600554600160a01b900460ff16155b610f245760405162461bcd60e51b815260040180806020018281038252602e815260200180613086602e913960400191505060405180910390fd5b600554600160a81b900460ff16158015610f5b576005805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b8015610f6f576005805460ff60a81b191690555b50565b600554600160a81b900460ff1680610f8d5750610f8d610ea8565b80610fa25750600554600160a01b900460ff16155b610fdd5760405162461bcd60e51b815260040180806020018281038252602e815260200180613086602e913960400191505060405180910390fd5b600554600160a81b900460ff16158015611014576005805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b600061101e610cdf565b603880546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3508015610f6f576005805460ff60a81b1916905550565b600554600160a81b900460ff168061109d575061109d610ea8565b806110b25750600554600160a01b900460ff16155b6110ed5760405162461bcd60e51b815260040180806020018281038252602e815260200180613086602e913960400191505060405180910390fd5b600554600160a81b900460ff16158015611124576005805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b606a805460ff191690558015610f6f576005805460ff60a81b1916905550565b600554600160a81b900460ff168061115f575061115f610ea8565b806111745750600554600160a01b900460ff16155b6111af5760405162461bcd60e51b815260040180806020018281038252602e815260200180613086602e913960400191505060405180910390fd5b600554600160a81b900460ff161580156111e6576005805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b6001609c558015610f6f576005805460ff60a81b1916905550565b600061120c8261122c565b801561121d575061121d8383611389565b90505b92915050565b3b151590565b60008061126d6040518060400160405280601881526020017f4f564d5f5374617465436f6d6d69746d656e74436861696e00000000000000008152506103cc565b6020840151604051639418bddd60e01b81529192506001600160a01b03831691639418bddd9161129f91600401612fce565b60206040518083038186803b1580156112b757600080fd5b505afa1580156112cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ef9190612a9a565b1580156113825750825160208401516040808601519051634d69ee5760e01b81526001600160a01b03851693634d69ee5793611332939192909190600401612cdb565b60206040518083038186803b15801561134a57600080fd5b505afa15801561135e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113829190612a9a565b9392505050565b600080836113cb6040518060400160405280601a81526020017f4f564d5f4c3243726f7373446f6d61696e4d657373656e6765720000000000008152506103cc565b6040516020016113dc929190612bd4565b604051602081830303815290604052805190602001206000604051602001611405929190612baa565b604051602081830303815290604052805190602001209050600080611454602160991b6040516020016114389190612b89565b60408051601f19818403018152919052606087015187516114e6565b909250905060018215151461147b5760405162461bcd60e51b81526004016104e190612de7565b60006114868261150f565b90506114db8460405160200161149c9190612ba1565b60405160208183030381529060405260016040516020016114bd9190612c40565b604051602081830303815290604052886080015184604001516115a1565b979650505050505050565b6000606060006114f5866115c5565b90506115028186866115f5565b9250925050935093915050565b611517612634565b6000611522836116c8565b9050604051806080016040528061154c8360008151811061153f57fe5b60200260200101516116db565b81526020016115618360018151811061153f57fe5b81526020016115838360028151811061157657fe5b60200260200101516116e2565b81526020016115988360038151811061157657fe5b90529392505050565b6000806115ad866115c5565b90506115bb818686866117db565b9695505050505050565b606081805190602001206040516020016115df9190612ba1565b6040516020818303038152906040529050919050565b60006060600061160485611801565b90506000806000611616848a896118d8565b8151929550909350915015808061162a5750815b61167b576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b60008161169757604051806020016040528060008152506116b6565b6116b68660018703815181106116a957fe5b6020026020010151611c7b565b919b919a509098505050505050505050565b60606112206116d683611c97565b611cbc565b6000611220825b600060218260000151111561173e576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b600080600061174c85611e32565b91945092509050600081600181111561176157fe5b146117b3576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6020808601518401805190918410156115bb5760208490036101000a90049695505050505050565b60008060006117eb8786866115f5565b915091508180156114db57506114db868261215b565b6060600061180e836116c8565b90506000815167ffffffffffffffff8111801561182a57600080fd5b5060405190808252806020026020018201604052801561186457816020015b61185161265b565b8152602001906001900390816118495790505b50905060005b82518110156118d057600061189184838151811061188457fe5b6020026020010151612171565b905060405180604001604052808281526020016118ad836116c8565b8152508383815181106118bc57fe5b60209081029190910101525060010161186a565b509392505050565b600060608180806118e887612200565b9050856000806118f661265b565b60005b8c51811015611c53578c818151811061190e57fe5b60200260200101519150828401935060018701965083600014156119825781518051602090910120851461197d576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b611a49565b8151516020116119e95781518051602090910120851461197d576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b846119f783600001516122fd565b14611a49576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b60208201515160111415611ab8578551841415611a6557611c53565b6000868581518110611a7357fe5b602001015160f81c60f81b60f81c9050600083602001518260ff1681518110611a9857fe5b60200260200101519050611aab81612329565b9650600194505050611c4b565b60028260200151511415611bfe576000611ad18361235f565b9050600081600081518110611ae257fe5b016020015160f81c9050600181166002036000611b028460ff841661237d565b90506000611b108b8a61237d565b90506000611b1e83836123ae565b905060ff851660021480611b35575060ff85166003145b15611b6757808351148015611b4a5750808251145b15611b5457988901985b50600160ff1b9950611c53945050505050565b60ff85161580611b7a575060ff85166001145b15611bc75780611b975750600160ff1b9950611c53945050505050565b611bb88860200151600181518110611bab57fe5b6020026020010151612329565b9a509750611c4b945050505050565b60405162461bcd60e51b81526004018080602001828103825260268152602001806130b46026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b6001016118f9565b50600160ff1b841486611c66878661237d565b909e909d50909b509950505050505050505050565b6020810151805160609161122091600019810190811061188457fe5b611c9f612675565b506040805180820190915281518152602082810190820152919050565b6060600080611cca84611e32565b91935090915060019050816001811115611ce057fe5b14611d32576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b611d53612675565b815260200190600190039081611d4b5790505090506000835b8651811015611e275760208210611db45760405162461bcd60e51b815260040180806020018281038252602a81526020018061305c602a913960400191505060405180910390fd5b600080611de06040518060400160405280858c60000151038152602001858c6020015101815250611e32565b509150915060405180604001604052808383018152602001848b6020015101815250858581518110611e0e57fe5b6020908102919091010152600193909301920101611d6c565b508152949350505050565b600080600080846000015111611e8f576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f8111611eb4576000600160009450945094505050612154565b60b78111611f29578551607f198201908110611f17576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b60019550935060009250612154915050565b60bf811161200d57855160b6198201908110611f8c576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111611ff8576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b60019091019550935060009250612154915050565b60f7811161208157855160bf198201908110612070576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b600195509350849250612154915050565b855160f61982019081106120dc576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111612141576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b6001918201965094509250612154915050565b9193909250565b8051602091820120825192909101919091201490565b6060600080600061218185611e32565b91945092509050600081600181111561219657fe5b146121e8576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b6121f785602001518484612414565b95945050505050565b60606000825160020267ffffffffffffffff8111801561221f57600080fd5b506040519080825280601f01601f19166020018201604052801561224a576020820181803683370190505b50905060005b83518110156122f657600484828151811061226757fe5b602001015160f81c60f81b6001600160f81b031916901c82826002028151811061228d57fe5b60200101906001600160f81b031916908160001a90535060108482815181106122b257fe5b016020015160f81c816122c157fe5b0660f81b8282600202600101815181106122d757fe5b60200101906001600160f81b031916908160001a905350600101612250565b5092915050565b6000602082511015612314575060208101516104a3565b81806020019051602081101561049e57600080fd5b6000606060208360000151101561234a57612343836124c2565b9050612356565b61235383612171565b90505b611382816122fd565b6060611220612378836020015160008151811061188457fe5b612200565b606081835103600014156123a05750604080516020810190915260008152611220565b61121d8383848651036124cd565b6000805b8084511180156123c25750808351115b801561240757508281815181106123d557fe5b602001015160f81c60f81b6001600160f81b0319168482815181106123f657fe5b01602001516001600160f81b031916145b1561121d576001016123b2565b606060008267ffffffffffffffff8111801561242f57600080fd5b506040519080825280601f01601f19166020018201604052801561245a576020820181803683370190505b50905080516000141561246e579050611382565b8484016020820160005b60208604811015612499578251825260209283019290910190600101612478565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b60606112208261261e565b60608182601f011015612518576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b828284011015612560576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b818301845110156125ac576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b6060821580156125cb5760405191506000825260208201604052612615565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156126045780518352602092830192016125ec565b5050858452601f01601f1916604052505b50949350505050565b6060611220826020015160008460000151612414565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060608152602001606081525090565b604051806040016040528060008152602001600081525090565b600067ffffffffffffffff8311156126a357fe5b6126b6601f8401601f1916602001612fe1565b90508281528383830111156126ca57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146104a357600080fd5b600082601f830112612708578081fd5b61121d8383356020850161268f565b600060a08284031215612728578081fd5b60405160a0810167ffffffffffffffff828210818311171561274657fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561278357600080fd5b50612790858286016126f8565b6080830152505092915050565b6000604082840312156127ae578081fd5b6040516040810167ffffffffffffffff82821081831117156127cc57fe5b81604052829350843583526020915081850135818111156127ec57600080fd5b8501601f810187136127fd57600080fd5b80358281111561280957fe5b8381029250612819848401612fe1565b8181528481019083860185850187018b101561283457600080fd5b600095505b83861015612857578035835260019590950194918601918601612839565b5080868801525050505050505092915050565b803563ffffffff811681146104a357600080fd5b60006020828403121561288f578081fd5b61121d826126e1565b600080600080600060a086880312156128af578081fd5b6128b8866126e1565b94506128c6602087016126e1565b9350604086013567ffffffffffffffff808211156128e2578283fd5b6128ee89838a016126f8565b945060608801359350608088013591508082111561290a578283fd5b9087019060a0828a03121561291d578283fd5b61292760a0612fe1565b8235815260208301358281111561293c578485fd5b6129488b828601612717565b60208301525060408301358281111561295f578485fd5b61296b8b82860161279d565b604083015250606083013582811115612982578485fd5b61298e8b8286016126f8565b6060830152506080830135828111156129a5578485fd5b6129b18b8286016126f8565b6080830152508093505050509295509295909350565b600080600080600060a086880312156129de578081fd5b6129e7866126e1565b94506129f5602087016126e1565b9350604086013567ffffffffffffffff811115612a10578182fd5b612a1c888289016126f8565b93505060608601359150612a326080870161286a565b90509295509295909350565b600080600060608486031215612a52578283fd5b612a5b846126e1565b9250602084013567ffffffffffffffff811115612a76578283fd5b612a82868287016126f8565b925050612a916040850161286a565b90509250925092565b600060208284031215612aab578081fd5b8151801515811461121d578182fd5b600060208284031215612acb578081fd5b5035919050565b600060208284031215612ae3578081fd5b813567ffffffffffffffff811115612af9578182fd5b8201601f81018413612b09578182fd5b612b188482356020840161268f565b949350505050565b60008151808452612b38816020860160208601613005565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a06080850152612b1860a0850182612b20565b60609190911b6001600160601b031916815260140190565b90815260200190565b918252602082015260400190565b60008251612bca818460208701613005565b9190910192915050565b60008351612be6818460208801613005565b60609390931b6001600160601b0319169190920190815260140192915050565b60008451612c18818460208901613005565b60609490941b6001600160601b03191691909301908152601481019190915260340192915050565b60f89190911b6001600160f81b031916815260010190565b6001600160a01b0391909116815260200190565b6001600160a01b03858116825284166020820152608060408201819052600090612c9890830185612b20565b905082606083015295945050505050565b600060018060a01b0385168252836020830152606060408301526121f76060830184612b20565b901515815260200190565b60008482526020606081840152612cf56060840186612b4c565b838103604085015260408101855182528286015160408484015281815180845260608501915085830194508693505b80841015612d445784518252938501936001939093019290850190612d24565b509998505050505050505050565b60006020825261121d6020830184612b20565b6020808252601f908201527f78446f6d61696e4d65737361676553656e646572206973206e6f742073657400604082015260600190565b6020808252602b908201527f50726f7669646564206d6573736167652068617320616c72656164792062656560408201526a37103932b1b2b4bb32b21760a91b606082015260800190565b6020808252604d908201527f4d6573736167652070617373696e67207072656465706c6f7920686173206e6f60408201527f74206265656e20696e697469616c697a6564206f7220696e76616c696420707260608201526c37b7b310383937bb34b232b21760991b608082015260a00190565b6020808252602b908201527f50726f7669646564206d65737361676520686173206e6f7420616c726561647960408201526a103132b2b71039b2b73a1760a91b606082015260800190565b60208082526022908201527f50726f7669646564206d65737361676520686173206265656e20626c6f636b65604082015261321760f11b606082015260800190565b60208082526036908201527f4f6e6c79204f564d5f4c324d65737361676552656c617965722063616e2072656040820152753630bc90261916ba3796a6189036b2b9b9b0b3b2b99760511b606082015260800190565b60208082526027908201527f50726f7669646564206d65737361676520636f756c64206e6f742062652076656040820152663934b334b2b21760c91b606082015260800190565b6020808252602a908201527f4c3143726f7373446f6d61696e4d657373656e67657220616c72656164792069604082015269373a34b0b634bd32b21760b11b606082015260800190565b60006020825261121d6020830184612b4c565b60405181810167ffffffffffffffff81118282101715612ffd57fe5b604052919050565b60005b83811015613020578181015183820152602001613008565b8381111561302f576000848401525b5050505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737350726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a656452656365697665642061206e6f6465207769746820616e20756e6b6e6f776e207072656669784f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a2646970667358221220c8b08248358fc9118d8d145603700ec8109487e93128f8f4b5dafd0a63cf3bad64736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"FailedRelayedMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"_xDomainCalldataHash\",\"type\":\"bytes32\"}],\"name\":\"MessageAllowed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"_xDomainCalldataHash\",\"type\":\"bytes32\"}],\"name\":\"MessageBlocked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_xDomainCalldataHash\",\"type\":\"bytes32\"}],\"name\":\"allowMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_xDomainCalldataHash\",\"type\":\"bytes32\"}],\"name\":\"blockMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"blockedMessages\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"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\"},{\"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\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_target\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_message\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_queueIndex\",\"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\":\"\",\"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\":\"successfulMessages\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"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\":{\"allowMessage(bytes32)\":{\"params\":{\"_xDomainCalldataHash\":\"Hash of the message to block.\"}},\"blockMessage(bytes32)\":{\"params\":{\"_xDomainCalldataHash\":\"Hash of the message to block.\"}},\"initialize(address)\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"paused()\":{\"details\":\"Returns true if the contract is paused, and false otherwise.\"},\"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.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"replayMessage(address,address,bytes,uint256,uint32)\":{\"params\":{\"_gasLimit\":\"Gas limit for the provided message.\",\"_message\":\"Message to send to the target.\",\"_queueIndex\":\"CTC Queue index for the message to replay.\",\"_sender\":\"Original sender address.\",\"_target\":\"Target contract address.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"sendMessage(address,bytes,uint32)\":{\"params\":{\"_gasLimit\":\"Gas limit for the provided message.\",\"_message\":\"Message to send to the target.\",\"_target\":\"Target contract address.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"OVM_L1CrossDomainMessenger\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"allowMessage(bytes32)\":{\"notice\":\"Allow a message.\"},\"blockMessage(bytes32)\":{\"notice\":\"Block a message.\"},\"constructor\":{\"notice\":\"This contract is intended to be behind a delegate proxy. We pass the zero address to the address resolver just to satisfy the constructor. We still need to set this value in initialize().\"},\"pause()\":{\"notice\":\"Pause relaying.\"},\"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.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"sendMessage(address,bytes,uint32)\":{\"notice\":\"Sends a cross domain message to the target messenger.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol\":\"OVM_L1CrossDomainMessenger\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/Initializable.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal initializer {\\n __Context_init_unchained();\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal initializer {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xb419e68addcb82ecda3ad3974b0d2db76435ce9b08435a04d5b119a0c5d45ea5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n// solhint-disable-next-line compiler-version\\npragma solidity >=0.4.24 <0.8.0;\\n\\nimport \\\"../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n */\\nabstract contract Initializable {\\n\\n /**\\n * @dev Indicates that the contract has been initialized.\\n */\\n bool private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Modifier to protect an initializer function from being invoked twice.\\n */\\n modifier initializer() {\\n require(_initializing || _isConstructor() || !_initialized, \\\"Initializable: contract is already initialized\\\");\\n\\n bool isTopLevelCall = !_initializing;\\n if (isTopLevelCall) {\\n _initializing = true;\\n _initialized = true;\\n }\\n\\n _;\\n\\n if (isTopLevelCall) {\\n _initializing = false;\\n }\\n }\\n\\n /// @dev Returns true if and only if the function is running in the constructor\\n function _isConstructor() private view returns (bool) {\\n return !AddressUpgradeable.isContract(address(this));\\n }\\n}\\n\",\"keccak256\":\"0xd8e4eb08dcc1d1860fb347ba5ffd595242b9a1b66d49a47f2b4cb51c3f35017e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.2 <0.8.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { size := extcodesize(account) }\\n return size > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\n (bool success, ) = recipient.call{ value: amount }(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain`call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: value }(data);\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfc5ea91fa9ceb1961023b2a6c978b902888c52b90847ac7813fe3b79524165f6\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\nimport \\\"../proxy/Initializable.sol\\\";\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal initializer {\\n __Context_init_unchained();\\n }\\n\\n function __Context_init_unchained() internal initializer {\\n }\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0xbbf8a21b9a66c48d45ff771b8563c6df19ba451d63dfb8380a865c1e1f29d1a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"./ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which allows children to implement an emergency stop\\n * mechanism that can be triggered by an authorized account.\\n *\\n * This module is used through inheritance. It will make available the\\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\\n * the functions of your contract. Note that they will not be pausable by\\n * simply including this module, only once the modifiers are put in place.\\n */\\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\\n /**\\n * @dev Emitted when the pause is triggered by `account`.\\n */\\n event Paused(address account);\\n\\n /**\\n * @dev Emitted when the pause is lifted by `account`.\\n */\\n event Unpaused(address account);\\n\\n bool private _paused;\\n\\n /**\\n * @dev Initializes the contract in unpaused state.\\n */\\n function __Pausable_init() internal initializer {\\n __Context_init_unchained();\\n __Pausable_init_unchained();\\n }\\n\\n function __Pausable_init_unchained() internal initializer {\\n _paused = false;\\n }\\n\\n /**\\n * @dev Returns true if the contract is paused, and false otherwise.\\n */\\n function paused() public view virtual returns (bool) {\\n return _paused;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is not paused.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n modifier whenNotPaused() {\\n require(!paused(), \\\"Pausable: paused\\\");\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is paused.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n modifier whenPaused() {\\n require(paused(), \\\"Pausable: not paused\\\");\\n _;\\n }\\n\\n /**\\n * @dev Triggers stopped state.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n function _pause() internal virtual whenNotPaused {\\n _paused = true;\\n emit Paused(_msgSender());\\n }\\n\\n /**\\n * @dev Returns to normal state.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n function _unpause() internal virtual whenPaused {\\n _paused = false;\\n emit Unpaused(_msgSender());\\n }\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x73bef0a5dec3efde8183c4858d90f683ed2771656c4329647b4d5b0f89498fd5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\nimport \\\"../proxy/Initializable.sol\\\";\\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 ReentrancyGuardUpgradeable is Initializable {\\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 function __ReentrancyGuard_init() internal initializer {\\n __ReentrancyGuard_init_unchained();\\n }\\n\\n function __ReentrancyGuard_init_unchained() internal initializer {\\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 uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x46034cd5cca740f636345c8f7aebae0f78adfd4b70e31e6f888cccbe1086586e\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/bridge/messaging/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_AddressResolver } from \\\"../../../libraries/resolver/Lib_AddressResolver.sol\\\";\\nimport { Lib_OVMCodec } from \\\"../../../libraries/codec/Lib_OVMCodec.sol\\\";\\nimport { Lib_AddressManager } from \\\"../../../libraries/resolver/Lib_AddressManager.sol\\\";\\nimport { Lib_SecureMerkleTrie } from \\\"../../../libraries/trie/Lib_SecureMerkleTrie.sol\\\";\\nimport { Lib_PredeployAddresses } from \\\"../../../libraries/constants/Lib_PredeployAddresses.sol\\\";\\nimport { Lib_CrossDomainUtils } from \\\"../../../libraries/bridge/Lib_CrossDomainUtils.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_L1CrossDomainMessenger } from \\\"../../../iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol\\\";\\nimport { iOVM_CanonicalTransactionChain } from \\\"../../../iOVM/chain/iOVM_CanonicalTransactionChain.sol\\\";\\nimport { iOVM_StateCommitmentChain } from \\\"../../../iOVM/chain/iOVM_StateCommitmentChain.sol\\\";\\n\\n/* External Imports */\\nimport { OwnableUpgradeable } from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport { PausableUpgradeable } from \\\"@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol\\\";\\nimport { ReentrancyGuardUpgradeable } from \\\"@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol\\\";\\n\\n/**\\n * @title OVM_L1CrossDomainMessenger\\n * @dev The L1 Cross Domain Messenger contract sends messages from L1 to L2, and relays messages\\n * from L2 onto L1. In the event that a message sent from L1 to L2 is rejected for exceeding the L2\\n * epoch gas limit, it can be resubmitted via this contract's replay function.\\n *\\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_L1CrossDomainMessenger is\\n iOVM_L1CrossDomainMessenger,\\n Lib_AddressResolver,\\n OwnableUpgradeable,\\n PausableUpgradeable,\\n ReentrancyGuardUpgradeable\\n{\\n\\n /**********\\n * Events *\\n **********/\\n\\n event MessageBlocked(\\n bytes32 indexed _xDomainCalldataHash\\n );\\n\\n event MessageAllowed(\\n bytes32 indexed _xDomainCalldataHash\\n );\\n\\n /*************\\n * Constants *\\n *************/\\n\\n // The default x-domain message sender being set to a non-zero value makes\\n // deployment a bit more expensive, but in exchange the refund on every call to\\n // `relayMessage` by the L1 and L2 messengers will be higher.\\n address internal constant DEFAULT_XDOMAIN_SENDER = 0x000000000000000000000000000000000000dEaD;\\n\\n /**********************\\n * Contract Variables *\\n **********************/\\n\\n mapping (bytes32 => bool) public blockedMessages;\\n mapping (bytes32 => bool) public relayedMessages;\\n mapping (bytes32 => bool) public successfulMessages;\\n\\n address internal xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * This contract is intended to be behind a delegate proxy.\\n * We pass the zero address to the address resolver just to satisfy the constructor.\\n * We still need to set this value in initialize().\\n */\\n constructor()\\n Lib_AddressResolver(address(0))\\n {}\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Modifier to enforce that, if configured, only the OVM_L2MessageRelayer contract may\\n * 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 * @param _libAddressManager Address of the Address Manager.\\n */\\n function initialize(\\n address _libAddressManager\\n )\\n public\\n initializer\\n {\\n require(\\n address(libAddressManager) == address(0),\\n \\\"L1CrossDomainMessenger already intialized.\\\"\\n );\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\\n\\n // Initialize upgradable OZ contracts\\n __Context_init_unchained(); // Context is a dependency for both Ownable and Pausable\\n __Ownable_init_unchained();\\n __Pausable_init_unchained();\\n __ReentrancyGuard_init_unchained();\\n }\\n\\n /**\\n * Pause relaying.\\n */\\n function pause()\\n external\\n onlyOwner\\n {\\n _pause();\\n }\\n\\n /**\\n * Block a message.\\n * @param _xDomainCalldataHash Hash of the message to block.\\n */\\n function blockMessage(\\n bytes32 _xDomainCalldataHash\\n )\\n external\\n onlyOwner\\n {\\n blockedMessages[_xDomainCalldataHash] = true;\\n emit MessageBlocked(_xDomainCalldataHash);\\n }\\n\\n /**\\n * Allow a message.\\n * @param _xDomainCalldataHash Hash of the message to block.\\n */\\n function allowMessage(\\n bytes32 _xDomainCalldataHash\\n )\\n external\\n onlyOwner\\n {\\n blockedMessages[_xDomainCalldataHash] = false;\\n emit MessageAllowed(_xDomainCalldataHash);\\n }\\n\\n function xDomainMessageSender()\\n public\\n override\\n view\\n returns (\\n address\\n )\\n {\\n require(xDomainMsgSender != DEFAULT_XDOMAIN_SENDER, \\\"xDomainMessageSender is not set\\\");\\n return xDomainMsgSender;\\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 memory _message,\\n uint32 _gasLimit\\n )\\n override\\n public\\n {\\n address ovmCanonicalTransactionChain = resolve(\\\"OVM_CanonicalTransactionChain\\\");\\n // Use the CTC queue length as nonce\\n uint40 nonce = iOVM_CanonicalTransactionChain(ovmCanonicalTransactionChain).getQueueLength();\\n\\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\\n _target,\\n msg.sender,\\n _message,\\n nonce\\n );\\n\\n address l2CrossDomainMessenger = resolve(\\\"OVM_L2CrossDomainMessenger\\\");\\n _sendXDomainMessage(ovmCanonicalTransactionChain, l2CrossDomainMessenger, xDomainCalldata, _gasLimit);\\n emit SentMessage(xDomainCalldata);\\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 whenNotPaused\\n {\\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\\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 require(\\n blockedMessages[xDomainCalldataHash] == false,\\n \\\"Provided message has been blocked.\\\"\\n );\\n\\n xDomainMsgSender = _sender;\\n (bool success, ) = _target.call(_message);\\n xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\\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 } else {\\n emit FailedRelayedMessage(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 _queueIndex,\\n uint32 _gasLimit\\n )\\n override\\n public\\n {\\n // Verify that the message is in the queue:\\n address canonicalTransactionChain = resolve(\\\"OVM_CanonicalTransactionChain\\\");\\n Lib_OVMCodec.QueueElement memory element = iOVM_CanonicalTransactionChain(canonicalTransactionChain).getQueueElement(_queueIndex);\\n\\n address l2CrossDomainMessenger = resolve(\\\"OVM_L2CrossDomainMessenger\\\");\\n // Compute the transactionHash\\n bytes32 transactionHash = keccak256(\\n abi.encode(\\n address(this),\\n l2CrossDomainMessenger,\\n _gasLimit,\\n _message\\n )\\n );\\n\\n require(\\n transactionHash == element.transactionHash,\\n \\\"Provided message has not been enqueued.\\\"\\n );\\n\\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\\n _target,\\n _sender,\\n _message,\\n _queueIndex\\n );\\n\\n _sendXDomainMessage(canonicalTransactionChain, l2CrossDomainMessenger, 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(\\n resolve(\\\"OVM_StateCommitmentChain\\\")\\n );\\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(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER),\\n _proof.stateTrieWitness,\\n _proof.stateRoot\\n );\\n\\n require(\\n exists == true,\\n \\\"Message passing predeploy 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 _canonicalTransactionChain Address of the OVM_CanonicalTransactionChain instance.\\n * @param _l2CrossDomainMessenger Address of the OVM_L2CrossDomainMessenger instance.\\n * @param _message Message to send.\\n * @param _gasLimit OVM gas limit for the message.\\n */\\n function _sendXDomainMessage(\\n address _canonicalTransactionChain,\\n address _l2CrossDomainMessenger,\\n bytes memory _message,\\n uint256 _gasLimit\\n )\\n internal\\n {\\n iOVM_CanonicalTransactionChain(_canonicalTransactionChain).enqueue(\\n _l2CrossDomainMessenger,\\n _gasLimit,\\n _message\\n );\\n }\\n}\\n\",\"keccak256\":\"0x627ab8efc23a85497fccbbf465890b88cadb12326299295ec4c567ddea9a7a7e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_CrossDomainMessenger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/**\\n * @title iOVM_CrossDomainMessenger\\n */\\ninterface iOVM_CrossDomainMessenger {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event SentMessage(bytes message);\\n event RelayedMessage(bytes32 msgHash);\\n event FailedRelayedMessage(bytes32 msgHash);\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n function xDomainMessageSender() external view returns (address);\\n\\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\":\"0x03dd576abe8e562cca646dd59b5c038291dffa9a5e43e4e3765d38cf1406fa62\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/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 { iOVM_CrossDomainMessenger } from \\\"./iOVM_CrossDomainMessenger.sol\\\";\\n\\n/**\\n * @title iOVM_L1CrossDomainMessenger\\n */\\ninterface iOVM_L1CrossDomainMessenger is iOVM_CrossDomainMessenger {\\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 _queueIndex CTC Queue index for the message to replay.\\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 _queueIndex,\\n uint32 _gasLimit\\n ) external;\\n}\\n\",\"keccak256\":\"0xd278237bb588a45208d8ed57c7766386cddd1dc1e4f31867c9cb356939dfd49a\",\"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 * 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\",\"keccak256\":\"0x180b9c347e20f1a6efa553b0f2b9a59aebceda92a7484ae6fca4da2bf1d960c3\",\"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/bridge/Lib_CrossDomainUtils.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\\\";\\n\\n/**\\n * @title Lib_CrossDomainUtils\\n */\\nlibrary Lib_CrossDomainUtils {\\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 encodeXDomainCalldata(\\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\",\"keccak256\":\"0x019940ce688f689f30ce43da1f58dc6d6742ad9bcb6cccaaf7c6bb0a16c48f9f\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_PredeployAddresses\\n */\\nlibrary Lib_PredeployAddresses {\\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\\n address internal constant ECDSA_CONTRACT_ACCOUNT = 0x4200000000000000000000000000000000000003;\\n address internal constant SEQUENCER_ENTRYPOINT = 0x4200000000000000000000000000000000000005;\\n address payable internal constant OVM_ETH = 0x4200000000000000000000000000000000000006;\\n address internal constant L2_CROSS_DOMAIN_MESSENGER = 0x4200000000000000000000000000000000000007;\\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\\n address internal constant EXECUTION_MANAGER_WRAPPER = 0x420000000000000000000000000000000000000B;\\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\\n address internal constant ERC1820_REGISTRY = 0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24;\\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\\n}\\n\",\"keccak256\":\"0x798dd3fe47c172880978c8e4d35573b25d5135be29a77584e9fac45845748695\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 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, _key, 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 != pathRemainder.length) {\\n // Our extension node is not identical to the remainder.\\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 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 path may include\\n * additional nodes (e.g., it comes directly from a proof) and we can't resize in-memory\\n * arrays without costly duplication.\\n * @param _key Full original key.\\n * @param _keyRemainder Portion of the initial key that must be inserted 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 _key,\\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 // Reference: https://github.com/ethereumjs/merkle-patricia-tree/blob/c0a10395aab37d42c175a47114ebfcbd7efcf059/src/baseTrie.ts#L294-L313\\n bool matchLeaf = false;\\n if (lastNodeType == NodeType.LeafNode) {\\n uint256 l = 0;\\n if (_path.length > 0) {\\n for (uint256 i = 0; i < _path.length - 1; i++) {\\n if (_getNodeType(_path[i]) == NodeType.BranchNode) {\\n l++;\\n } else {\\n l += _getNodeKey(_path[i]).length;\\n }\\n }\\n }\\n\\n if (\\n _getSharedNibbleLength(\\n _getNodeKey(lastNode),\\n Lib_BytesUtils.slice(Lib_BytesUtils.toNibbles(_key), l)\\n ) == _getNodeKey(lastNode).length\\n && keyRemainder.length == 0\\n ) {\\n matchLeaf = true;\\n }\\n }\\n\\n if (matchLeaf) {\\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 = _editExtensionNodeValue(currentNode, 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 * Creates a new extension node with the same key but a different value.\\n * @param _node Extension node to copy and modify.\\n * @param _value New value for the extension node.\\n * @return New node with the same key and different value.\\n */\\n function _editExtensionNodeValue(\\n TrieNode memory _node,\\n bytes memory _value\\n )\\n private\\n pure\\n returns (\\n TrieNode memory\\n )\\n {\\n bytes[] memory raw = new bytes[](2);\\n bytes memory key = _addHexPrefix(_getNodeKey(_node), false);\\n raw[0] = Lib_RLPWriter.writeBytes(Lib_BytesUtils.fromNibbles(key));\\n if (_value.length < 32) {\\n raw[1] = _value;\\n } else {\\n raw[1] = Lib_RLPWriter.writeBytes(_value);\\n }\\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 abi.encodePacked(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\":\"0x4bb09d0b4f965b57cdc6b3ace49967bcfe7f2580fa0b7863dfe288081247d876\",\"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 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\":\"0xbbdd600165307d2131340599afa9dc0991f8f63727ba3a834bca5a3d7f501da8\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405260cc80546001600160a01b03191661dead17905534801561002457600080fd5b50600080546001600160a01b0319169055613310806100446000396000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c8063715018a6116100a2578063b1b1b20911610071578063b1b1b209146101d7578063c4d66de8146101ea578063c6b94ab0146101fd578063d7fd19dd14610210578063f2fde38b146102235761010b565b8063715018a6146101ac57806381ada46c146101b45780638456cb59146101c75780638da5cb5b146101cf5761010b565b8063461a4478116100de578063461a4478146101765780635c975abb146101895780636e296e4514610191578063706ceab6146101995761010b565b80630ecf2eea1461011057806321d800ec14610125578063299ca4781461014e5780633dbb202b14610163575b600080fd5b61012361011e366004612bef565b610236565b005b610138610133366004612bef565b6102db565b6040516101459190612eb5565b60405180910390f35b6101566102f0565b6040516101459190612e05565b610123610171366004612b73565b6102ff565b610156610184366004612c07565b61045e565b61013861053c565b610156610545565b6101236101a7366004612afc565b61058e565b610123610711565b6101236101c2366004612bef565b6107bd565b61012361085f565b6101566108cb565b6101386101e5366004612bef565b6108da565b6101236101f83660046129b3565b6108ef565b61013861020b366004612bef565b610a1d565b61012361021e3660046129cd565b610a32565b6101236102313660046129b3565b610d70565b61023e610e73565b6001600160a01b031661024f6108cb565b6001600160a01b031614610298576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b600081815260c96020526040808220805460ff191660011790555182917ff52508d5339edf0d7e5060a416df98db067af561bdc60872d29c0439eaa13a0291a250565b60ca6020526000908152604090205460ff1681565b6000546001600160a01b031681565b600061033f6040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e00000081525061045e565b90506000816001600160a01b031663b8f770056040518163ffffffff1660e01b815260040160206040518083038186803b15801561037c57600080fd5b505afa158015610390573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103b49190612cb3565b905060006103cb8633878564ffffffffff16610e77565b9050600061040a6040518060400160405280601a81526020017927ab26afa61921b937b9b9a237b6b0b4b726b2b9b9b2b733b2b960311b81525061045e565b905061041e8482848863ffffffff16610ec4565b7f0ee9ffdb2334d78de97ffb066b23a352a4d35180cefb36589d663fbb1eb6f3268260405161044d9190612f37565b60405180910390a150505050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156104be5781810151838201526020016104a6565b50505050905090810190601f1680156104eb5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561050857600080fd5b505afa15801561051c573d6000803e3d6000fd5b505050506040513d602081101561053257600080fd5b505190505b919050565b60655460ff1690565b60cc546000906001600160a01b031661dead141561057e5760405162461bcd60e51b815260040161057590612f4a565b60405180910390fd5b5060cc546001600160a01b031690565b60006105ce6040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e00000081525061045e565b90506000816001600160a01b0316632a7f18be856040518263ffffffff1660e01b81526004016105fe9190612d4e565b60606040518083038186803b15801561061657600080fd5b505afa15801561062a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064e9190612c55565b9050600061068d6040518060400160405280601a81526020017927ab26afa61921b937b9b9a237b6b0b4b726b2b9b9b2b733b2b960311b81525061045e565b90506000308286896040516020016106a89493929190612e56565b604051602081830303815290604052805190602001209050826000015181146106e35760405162461bcd60e51b815260040161057590613168565b60006106f18a8a8a8a610e77565b90506107058584838963ffffffff16610ec4565b50505050505050505050565b610719610e73565b6001600160a01b031661072a6108cb565b6001600160a01b031614610773576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b6033546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3603380546001600160a01b0319169055565b6107c5610e73565b6001600160a01b03166107d66108cb565b6001600160a01b03161461081f576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b600081815260c96020526040808220805460ff191690555182917f52c8a2680a9f4cc0ad0bf88f32096eadbebf0646ea611d93a0ce6a29a024040591a250565b610867610e73565b6001600160a01b03166108786108cb565b6001600160a01b0316146108c1576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b6108c9610f2c565b565b6033546001600160a01b031690565b60cb6020526000908152604090205460ff1681565b600054600160a81b900460ff168061090a575061090a610fcc565b8061091f5750600054600160a01b900460ff16155b61095a5760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff16158015610991576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b6000546001600160a01b0316156109ba5760405162461bcd60e51b81526004016105759061311e565b600080546001600160a01b0384166001600160a01b03199182161790915560cc805490911661dead1790556109ed610fdd565b6109f5611096565b6109fd6111a6565b610a05611268565b8015610a19576000805460ff60a81b191690555b5050565b60c96020526000908152604090205460ff1681565b60026097541415610a8a576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260975560408051808201909152601481527327ab26afa61926b2b9b9b0b3b2a932b630bcb2b960611b6020820152600090610ac69061045e565b90506001600160a01b03811615610aff57336001600160a01b03821614610aff5760405162461bcd60e51b815260040161057590613081565b610b0761053c565b15610b4c576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6000610b5a87878787610e77565b9050610b668184611325565b1515600114610b875760405162461bcd60e51b8152600401610575906130d7565b8051602080830191909120600081815260cb90925260409091205460ff1615610bc25760405162461bcd60e51b815260040161057590612f81565b600081815260c9602052604090205460ff1615610bf15760405162461bcd60e51b81526004016105759061303f565b60cc80546001600160a01b0319166001600160a01b03898116919091179091556040516000918a1690610c25908990612d65565b6000604051808303816000865af19150503d8060008114610c62576040519150601f19603f3d011682016040523d82523d6000602084013e610c67565b606091505b505060cc80546001600160a01b03191661dead179055905080151560011415610ce057600082815260cb602052604090819020805460ff19166001179055517f4641df4a962071e12719d8c8c8e5ac7fc4d97b927346a3d7a335b1f7517e133c90610cd3908490612d4e565b60405180910390a1610d18565b7f99d0e048484baa1b1540b1367cb128acd7ab2946d1ed91ec10e3c85e4bf51b8f82604051610d0f9190612d4e565b60405180910390a15b6000833343604051602001610d2f93929190612db3565b60408051601f198184030181529181528151602092830120600090815260ca9092529020805460ff1916600190811790915560975550505050505050505050565b610d78610e73565b6001600160a01b0316610d896108cb565b6001600160a01b031614610dd2576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b6001600160a01b038116610e175760405162461bcd60e51b81526004018080602001828103825260268152602001806132176026913960400191505060405180910390fd5b6033546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3603380546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b606084848484604051602401610e909493929190612e19565b60408051601f198184030181529190526020810180516001600160e01b031663cbd4ece960e01b1790529050949350505050565b60405163037f703f60e51b81526001600160a01b03851690636fee07e090610ef490869085908790600401612e8e565b600060405180830381600087803b158015610f0e57600080fd5b505af1158015610f22573d6000803e3d6000fd5b5050505050505050565b610f3461053c565b15610f79576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610faf610e73565b604080516001600160a01b039092168252519081900360200190a1565b6000610fd73061134a565b15905090565b600054600160a81b900460ff1680610ff85750610ff8610fcc565b8061100d5750600054600160a01b900460ff16155b6110485760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff1615801561107f576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b8015611093576000805460ff60a81b191690555b50565b600054600160a81b900460ff16806110b157506110b1610fcc565b806110c65750600054600160a01b900460ff16155b6111015760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff16158015611138576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b6000611142610e73565b603380546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3508015611093576000805460ff60a81b1916905550565b600054600160a81b900460ff16806111c157506111c1610fcc565b806111d65750600054600160a01b900460ff16155b6112115760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff16158015611248576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b6065805460ff191690558015611093576000805460ff60a81b1916905550565b600054600160a81b900460ff16806112835750611283610fcc565b806112985750600054600160a01b900460ff16155b6112d35760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff1615801561130a576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b60016097558015611093576000805460ff60a81b1916905550565b600061133082611350565b8015611341575061134183836114ad565b90505b92915050565b3b151590565b6000806113916040518060400160405280601881526020017f4f564d5f5374617465436f6d6d69746d656e74436861696e000000000000000081525061045e565b6020840151604051639418bddd60e01b81529192506001600160a01b03831691639418bddd916113c3916004016131af565b60206040518083038186803b1580156113db57600080fd5b505afa1580156113ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114139190612bcf565b1580156114a65750825160208401516040808601519051634d69ee5760e01b81526001600160a01b03851693634d69ee5793611456939192909190600401612ec0565b60206040518083038186803b15801561146e57600080fd5b505afa158015611482573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a69190612bcf565b9392505050565b600080836114ec6040518060400160405280601a81526020017927ab26afa61921b937b9b9a237b6b0b4b726b2b9b9b2b733b2b960311b81525061045e565b6040516020016114fd929190612d81565b604051602081830303815290604052805190602001206000604051602001611526929190612d57565b604051602081830303815290604052805190602001209050600080611575602160991b6040516020016115599190612d36565b60408051601f1981840301815291905260608701518751611607565b909250905060018215151461159c5760405162461bcd60e51b815260040161057590612fcc565b60006115a782611630565b90506115fc846040516020016115bd9190612d4e565b60405160208183030381529060405260016040516020016115de9190612ded565b604051602081830303815290604052886080015184604001516116c2565b979650505050505050565b600060606000611616866116e6565b9050611623818686611716565b9250925050935093915050565b611638612754565b6000611643836117e9565b9050604051806080016040528061166d8360008151811061166057fe5b60200260200101516117fc565b81526020016116828360018151811061166057fe5b81526020016116a48360028151811061169757fe5b6020026020010151611803565b81526020016116b98360038151811061169757fe5b90529392505050565b6000806116ce866116e6565b90506116dc818686866118fc565b9695505050505050565b606081805190602001206040516020016117009190612d4e565b6040516020818303038152906040529050919050565b60006060600061172585611922565b90506000806000611737848a896119f9565b8151929550909350915015808061174b5750815b61179c576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b6000816117b857604051806020016040528060008152506117d7565b6117d78660018703815181106117ca57fe5b6020026020010151611d9f565b919b919a509098505050505050505050565b60606113446117f783611dbb565b611de0565b6000611344825b600060218260000151111561185f576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b600080600061186d85611f56565b91945092509050600081600181111561188257fe5b146118d4576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6020808601518401805190918410156116dc5760208490036101000a90049695505050505050565b600080600061190c878686611716565b915091508180156115fc57506115fc868261227f565b6060600061192f836117e9565b90506000815167ffffffffffffffff8111801561194b57600080fd5b5060405190808252806020026020018201604052801561198557816020015b61197261277b565b81526020019060019003908161196a5790505b50905060005b82518110156119f15760006119b28483815181106119a557fe5b6020026020010151612295565b905060405180604001604052808281526020016119ce836117e9565b8152508383815181106119dd57fe5b60209081029190910101525060010161198b565b509392505050565b60006060818080611a0987612324565b905085600080611a1761277b565b60005b8c51811015611d77578c8181518110611a2f57fe5b6020026020010151915082840193506001870196508360001415611aa357815180516020909101208514611a9e576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b611b6a565b815151602011611b0a57815180516020909101208514611a9e576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b84611b188360000151612421565b14611b6a576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b60208201515160111415611bd9578551841415611b8657611d77565b6000868581518110611b9457fe5b602001015160f81c60f81b60f81c9050600083602001518260ff1681518110611bb957fe5b60200260200101519050611bcc8161244d565b9650600194505050611d6f565b60028260200151511415611d22576000611bf283612483565b9050600081600081518110611c0357fe5b016020015160f81c9050600181166002036000611c238460ff84166124a1565b90506000611c318b8a6124a1565b90506000611c3f83836124ce565b905060ff851660021480611c56575060ff85166003145b15611c8857808351148015611c6b5750808251145b15611c7557988901985b50600160ff1b9950611d77945050505050565b60ff85161580611c9b575060ff85166001145b15611ceb5782518114611cbb5750600160ff1b9950611d77945050505050565b611cdc8860200151600181518110611ccf57fe5b602002602001015161244d565b9a509750611d6f945050505050565b60405162461bcd60e51b81526004018080602001828103825260268152602001806132956026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b600101611a1a565b50600160ff1b841486611d8a87866124a1565b909e909d50909b509950505050505050505050565b602081015180516060916113449160001981019081106119a557fe5b611dc3612795565b506040805180820190915281518152602082810190820152919050565b6060600080611dee84611f56565b91935090915060019050816001811115611e0457fe5b14611e56576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b611e77612795565b815260200190600190039081611e6f5790505090506000835b8651811015611f4b5760208210611ed85760405162461bcd60e51b815260040180806020018281038252602a81526020018061323d602a913960400191505060405180910390fd5b600080611f046040518060400160405280858c60000151038152602001858c6020015101815250611f56565b509150915060405180604001604052808383018152602001848b6020015101815250858581518110611f3257fe5b6020908102919091010152600193909301920101611e90565b508152949350505050565b600080600080846000015111611fb3576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f8111611fd8576000600160009450945094505050612278565b60b7811161204d578551607f19820190811061203b576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b60019550935060009250612278915050565b60bf811161213157855160b61982019081106120b0576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a600185015104905080820188600001511161211c576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b60019091019550935060009250612278915050565b60f781116121a557855160bf198201908110612194576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b600195509350849250612278915050565b855160f6198201908110612200576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111612265576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b6001918201965094509250612278915050565b9193909250565b8051602091820120825192909101919091201490565b606060008060006122a585611f56565b9194509250905060008160018111156122ba57fe5b1461230c576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b61231b85602001518484612534565b95945050505050565b60606000825160020267ffffffffffffffff8111801561234357600080fd5b506040519080825280601f01601f19166020018201604052801561236e576020820181803683370190505b50905060005b835181101561241a57600484828151811061238b57fe5b602001015160f81c60f81b6001600160f81b031916901c8282600202815181106123b157fe5b60200101906001600160f81b031916908160001a90535060108482815181106123d657fe5b016020015160f81c816123e557fe5b0660f81b8282600202600101815181106123fb57fe5b60200101906001600160f81b031916908160001a905350600101612374565b5092915050565b600060208251101561243857506020810151610537565b81806020019051602081101561053257600080fd5b6000606060208360000151101561246e57612467836125e2565b905061247a565b61247783612295565b90505b6114a681612421565b606061134461249c83602001516000815181106119a557fe5b612324565b6060825182106124c05750604080516020810190915260008152611344565b6113418383848651036125ed565b6000805b8084511180156124e25750808351115b801561252757508281815181106124f557fe5b602001015160f81c60f81b6001600160f81b03191684828151811061251657fe5b01602001516001600160f81b031916145b15611341576001016124d2565b606060008267ffffffffffffffff8111801561254f57600080fd5b506040519080825280601f01601f19166020018201604052801561257a576020820181803683370190505b50905080516000141561258e5790506114a6565b8484016020820160005b602086048110156125b9578251825260209283019290910190600101612598565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b60606113448261273e565b60608182601f011015612638576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b828284011015612680576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b818301845110156126cc576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b6060821580156126eb5760405191506000825260208201604052612735565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561272457805183526020928301920161270c565b5050858452601f01601f1916604052505b50949350505050565b6060611344826020015160008460000151612534565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060608152602001606081525090565b604051806040016040528060008152602001600081525090565b600067ffffffffffffffff8311156127c357fe5b6127d6601f8401601f19166020016131c2565b90508281528383830111156127ea57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b038116811461053757600080fd5b600082601f830112612828578081fd5b611341838335602085016127af565b600060a08284031215612848578081fd5b60405160a0810167ffffffffffffffff828210818311171561286657fe5b816040528293508435835260208501356020840152604085013560408401526060850135606084015260808501359150808211156128a357600080fd5b506128b085828601612818565b6080830152505092915050565b6000604082840312156128ce578081fd5b6040516040810167ffffffffffffffff82821081831117156128ec57fe5b816040528293508435835260209150818501358181111561290c57600080fd5b8501601f8101871361291d57600080fd5b80358281111561292957fe5b83810292506129398484016131c2565b8181528481019083860185850187018b101561295457600080fd5b600095505b83861015612977578035835260019590950194918601918601612959565b5080868801525050505050505092915050565b803563ffffffff8116811461053757600080fd5b805164ffffffffff8116811461053757600080fd5b6000602082840312156129c4578081fd5b61134182612801565b600080600080600060a086880312156129e4578081fd5b6129ed86612801565b94506129fb60208701612801565b9350604086013567ffffffffffffffff80821115612a17578283fd5b612a2389838a01612818565b9450606088013593506080880135915080821115612a3f578283fd5b9087019060a0828a031215612a52578283fd5b612a5c60a06131c2565b82358152602083013582811115612a71578485fd5b612a7d8b828601612837565b602083015250604083013582811115612a94578485fd5b612aa08b8286016128bd565b604083015250606083013582811115612ab7578485fd5b612ac38b828601612818565b606083015250608083013582811115612ada578485fd5b612ae68b828601612818565b6080830152508093505050509295509295909350565b600080600080600060a08688031215612b13578081fd5b612b1c86612801565b9450612b2a60208701612801565b9350604086013567ffffffffffffffff811115612b45578182fd5b612b5188828901612818565b93505060608601359150612b676080870161298a565b90509295509295909350565b600080600060608486031215612b87578283fd5b612b9084612801565b9250602084013567ffffffffffffffff811115612bab578283fd5b612bb786828701612818565b925050612bc66040850161298a565b90509250925092565b600060208284031215612be0578081fd5b81518015158114611341578182fd5b600060208284031215612c00578081fd5b5035919050565b600060208284031215612c18578081fd5b813567ffffffffffffffff811115612c2e578182fd5b8201601f81018413612c3e578182fd5b612c4d848235602084016127af565b949350505050565b600060608284031215612c66578081fd5b6040516060810181811067ffffffffffffffff82111715612c8357fe5b60405282518152612c966020840161299e565b6020820152612ca76040840161299e565b60408201529392505050565b600060208284031215612cc4578081fd5b6113418261299e565b60008151808452612ce58160208601602086016131e6565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a06080850152612c4d60a0850182612ccd565b60609190911b6001600160601b031916815260140190565b90815260200190565b918252602082015260400190565b60008251612d778184602087016131e6565b9190910192915050565b60008351612d938184602088016131e6565b60609390931b6001600160601b0319169190920190815260140192915050565b60008451612dc58184602089016131e6565b60609490941b6001600160601b03191691909301908152601481019190915260340192915050565b60f89190911b6001600160f81b031916815260010190565b6001600160a01b0391909116815260200190565b6001600160a01b03858116825284166020820152608060408201819052600090612e4590830185612ccd565b905082606083015295945050505050565b6001600160a01b0385811682528416602082015263ffffffff831660408201526080606082018190526000906116dc90830184612ccd565b600060018060a01b03851682528360208301526060604083015261231b6060830184612ccd565b901515815260200190565b60008482526020606081840152612eda6060840186612cf9565b838103604085015260408101855182528286015160408484015281815180845260608501915085830194508693505b80841015612f295784518252938501936001939093019290850190612f09565b509998505050505050505050565b6000602082526113416020830184612ccd565b6020808252601f908201527f78446f6d61696e4d65737361676553656e646572206973206e6f742073657400604082015260600190565b6020808252602b908201527f50726f7669646564206d6573736167652068617320616c72656164792062656560408201526a37103932b1b2b4bb32b21760a91b606082015260800190565b6020808252604d908201527f4d6573736167652070617373696e67207072656465706c6f7920686173206e6f60408201527f74206265656e20696e697469616c697a6564206f7220696e76616c696420707260608201526c37b7b310383937bb34b232b21760991b608082015260a00190565b60208082526022908201527f50726f7669646564206d65737361676520686173206265656e20626c6f636b65604082015261321760f11b606082015260800190565b60208082526036908201527f4f6e6c79204f564d5f4c324d65737361676552656c617965722063616e2072656040820152753630bc90261916ba3796a6189036b2b9b9b0b3b2b99760511b606082015260800190565b60208082526027908201527f50726f7669646564206d65737361676520636f756c64206e6f742062652076656040820152663934b334b2b21760c91b606082015260800190565b6020808252602a908201527f4c3143726f7373446f6d61696e4d657373656e67657220616c72656164792069604082015269373a34b0b634bd32b21760b11b606082015260800190565b60208082526027908201527f50726f7669646564206d65737361676520686173206e6f74206265656e20656e60408201526638bab2bab2b21760c91b606082015260800190565b6000602082526113416020830184612cf9565b60405181810167ffffffffffffffff811182821017156131de57fe5b604052919050565b60005b838110156132015781810151838201526020016131e9565b83811115613210576000848401525b5050505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737350726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a656452656365697665642061206e6f6465207769746820616e20756e6b6e6f776e207072656669784f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a26469706673582212203a1cd12f46684c95bb11e17fac1702e7dc0fea4c9f70f060e2b6070b1731d33764736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061010b5760003560e01c8063715018a6116100a2578063b1b1b20911610071578063b1b1b209146101d7578063c4d66de8146101ea578063c6b94ab0146101fd578063d7fd19dd14610210578063f2fde38b146102235761010b565b8063715018a6146101ac57806381ada46c146101b45780638456cb59146101c75780638da5cb5b146101cf5761010b565b8063461a4478116100de578063461a4478146101765780635c975abb146101895780636e296e4514610191578063706ceab6146101995761010b565b80630ecf2eea1461011057806321d800ec14610125578063299ca4781461014e5780633dbb202b14610163575b600080fd5b61012361011e366004612bef565b610236565b005b610138610133366004612bef565b6102db565b6040516101459190612eb5565b60405180910390f35b6101566102f0565b6040516101459190612e05565b610123610171366004612b73565b6102ff565b610156610184366004612c07565b61045e565b61013861053c565b610156610545565b6101236101a7366004612afc565b61058e565b610123610711565b6101236101c2366004612bef565b6107bd565b61012361085f565b6101566108cb565b6101386101e5366004612bef565b6108da565b6101236101f83660046129b3565b6108ef565b61013861020b366004612bef565b610a1d565b61012361021e3660046129cd565b610a32565b6101236102313660046129b3565b610d70565b61023e610e73565b6001600160a01b031661024f6108cb565b6001600160a01b031614610298576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b600081815260c96020526040808220805460ff191660011790555182917ff52508d5339edf0d7e5060a416df98db067af561bdc60872d29c0439eaa13a0291a250565b60ca6020526000908152604090205460ff1681565b6000546001600160a01b031681565b600061033f6040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e00000081525061045e565b90506000816001600160a01b031663b8f770056040518163ffffffff1660e01b815260040160206040518083038186803b15801561037c57600080fd5b505afa158015610390573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103b49190612cb3565b905060006103cb8633878564ffffffffff16610e77565b9050600061040a6040518060400160405280601a81526020017927ab26afa61921b937b9b9a237b6b0b4b726b2b9b9b2b733b2b960311b81525061045e565b905061041e8482848863ffffffff16610ec4565b7f0ee9ffdb2334d78de97ffb066b23a352a4d35180cefb36589d663fbb1eb6f3268260405161044d9190612f37565b60405180910390a150505050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156104be5781810151838201526020016104a6565b50505050905090810190601f1680156104eb5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561050857600080fd5b505afa15801561051c573d6000803e3d6000fd5b505050506040513d602081101561053257600080fd5b505190505b919050565b60655460ff1690565b60cc546000906001600160a01b031661dead141561057e5760405162461bcd60e51b815260040161057590612f4a565b60405180910390fd5b5060cc546001600160a01b031690565b60006105ce6040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e00000081525061045e565b90506000816001600160a01b0316632a7f18be856040518263ffffffff1660e01b81526004016105fe9190612d4e565b60606040518083038186803b15801561061657600080fd5b505afa15801561062a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064e9190612c55565b9050600061068d6040518060400160405280601a81526020017927ab26afa61921b937b9b9a237b6b0b4b726b2b9b9b2b733b2b960311b81525061045e565b90506000308286896040516020016106a89493929190612e56565b604051602081830303815290604052805190602001209050826000015181146106e35760405162461bcd60e51b815260040161057590613168565b60006106f18a8a8a8a610e77565b90506107058584838963ffffffff16610ec4565b50505050505050505050565b610719610e73565b6001600160a01b031661072a6108cb565b6001600160a01b031614610773576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b6033546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3603380546001600160a01b0319169055565b6107c5610e73565b6001600160a01b03166107d66108cb565b6001600160a01b03161461081f576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b600081815260c96020526040808220805460ff191690555182917f52c8a2680a9f4cc0ad0bf88f32096eadbebf0646ea611d93a0ce6a29a024040591a250565b610867610e73565b6001600160a01b03166108786108cb565b6001600160a01b0316146108c1576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b6108c9610f2c565b565b6033546001600160a01b031690565b60cb6020526000908152604090205460ff1681565b600054600160a81b900460ff168061090a575061090a610fcc565b8061091f5750600054600160a01b900460ff16155b61095a5760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff16158015610991576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b6000546001600160a01b0316156109ba5760405162461bcd60e51b81526004016105759061311e565b600080546001600160a01b0384166001600160a01b03199182161790915560cc805490911661dead1790556109ed610fdd565b6109f5611096565b6109fd6111a6565b610a05611268565b8015610a19576000805460ff60a81b191690555b5050565b60c96020526000908152604090205460ff1681565b60026097541415610a8a576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260975560408051808201909152601481527327ab26afa61926b2b9b9b0b3b2a932b630bcb2b960611b6020820152600090610ac69061045e565b90506001600160a01b03811615610aff57336001600160a01b03821614610aff5760405162461bcd60e51b815260040161057590613081565b610b0761053c565b15610b4c576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6000610b5a87878787610e77565b9050610b668184611325565b1515600114610b875760405162461bcd60e51b8152600401610575906130d7565b8051602080830191909120600081815260cb90925260409091205460ff1615610bc25760405162461bcd60e51b815260040161057590612f81565b600081815260c9602052604090205460ff1615610bf15760405162461bcd60e51b81526004016105759061303f565b60cc80546001600160a01b0319166001600160a01b03898116919091179091556040516000918a1690610c25908990612d65565b6000604051808303816000865af19150503d8060008114610c62576040519150601f19603f3d011682016040523d82523d6000602084013e610c67565b606091505b505060cc80546001600160a01b03191661dead179055905080151560011415610ce057600082815260cb602052604090819020805460ff19166001179055517f4641df4a962071e12719d8c8c8e5ac7fc4d97b927346a3d7a335b1f7517e133c90610cd3908490612d4e565b60405180910390a1610d18565b7f99d0e048484baa1b1540b1367cb128acd7ab2946d1ed91ec10e3c85e4bf51b8f82604051610d0f9190612d4e565b60405180910390a15b6000833343604051602001610d2f93929190612db3565b60408051601f198184030181529181528151602092830120600090815260ca9092529020805460ff1916600190811790915560975550505050505050505050565b610d78610e73565b6001600160a01b0316610d896108cb565b6001600160a01b031614610dd2576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b6001600160a01b038116610e175760405162461bcd60e51b81526004018080602001828103825260268152602001806132176026913960400191505060405180910390fd5b6033546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3603380546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b606084848484604051602401610e909493929190612e19565b60408051601f198184030181529190526020810180516001600160e01b031663cbd4ece960e01b1790529050949350505050565b60405163037f703f60e51b81526001600160a01b03851690636fee07e090610ef490869085908790600401612e8e565b600060405180830381600087803b158015610f0e57600080fd5b505af1158015610f22573d6000803e3d6000fd5b5050505050505050565b610f3461053c565b15610f79576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610faf610e73565b604080516001600160a01b039092168252519081900360200190a1565b6000610fd73061134a565b15905090565b600054600160a81b900460ff1680610ff85750610ff8610fcc565b8061100d5750600054600160a01b900460ff16155b6110485760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff1615801561107f576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b8015611093576000805460ff60a81b191690555b50565b600054600160a81b900460ff16806110b157506110b1610fcc565b806110c65750600054600160a01b900460ff16155b6111015760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff16158015611138576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b6000611142610e73565b603380546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3508015611093576000805460ff60a81b1916905550565b600054600160a81b900460ff16806111c157506111c1610fcc565b806111d65750600054600160a01b900460ff16155b6112115760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff16158015611248576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b6065805460ff191690558015611093576000805460ff60a81b1916905550565b600054600160a81b900460ff16806112835750611283610fcc565b806112985750600054600160a01b900460ff16155b6112d35760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff1615801561130a576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b60016097558015611093576000805460ff60a81b1916905550565b600061133082611350565b8015611341575061134183836114ad565b90505b92915050565b3b151590565b6000806113916040518060400160405280601881526020017f4f564d5f5374617465436f6d6d69746d656e74436861696e000000000000000081525061045e565b6020840151604051639418bddd60e01b81529192506001600160a01b03831691639418bddd916113c3916004016131af565b60206040518083038186803b1580156113db57600080fd5b505afa1580156113ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114139190612bcf565b1580156114a65750825160208401516040808601519051634d69ee5760e01b81526001600160a01b03851693634d69ee5793611456939192909190600401612ec0565b60206040518083038186803b15801561146e57600080fd5b505afa158015611482573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a69190612bcf565b9392505050565b600080836114ec6040518060400160405280601a81526020017927ab26afa61921b937b9b9a237b6b0b4b726b2b9b9b2b733b2b960311b81525061045e565b6040516020016114fd929190612d81565b604051602081830303815290604052805190602001206000604051602001611526929190612d57565b604051602081830303815290604052805190602001209050600080611575602160991b6040516020016115599190612d36565b60408051601f1981840301815291905260608701518751611607565b909250905060018215151461159c5760405162461bcd60e51b815260040161057590612fcc565b60006115a782611630565b90506115fc846040516020016115bd9190612d4e565b60405160208183030381529060405260016040516020016115de9190612ded565b604051602081830303815290604052886080015184604001516116c2565b979650505050505050565b600060606000611616866116e6565b9050611623818686611716565b9250925050935093915050565b611638612754565b6000611643836117e9565b9050604051806080016040528061166d8360008151811061166057fe5b60200260200101516117fc565b81526020016116828360018151811061166057fe5b81526020016116a48360028151811061169757fe5b6020026020010151611803565b81526020016116b98360038151811061169757fe5b90529392505050565b6000806116ce866116e6565b90506116dc818686866118fc565b9695505050505050565b606081805190602001206040516020016117009190612d4e565b6040516020818303038152906040529050919050565b60006060600061172585611922565b90506000806000611737848a896119f9565b8151929550909350915015808061174b5750815b61179c576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b6000816117b857604051806020016040528060008152506117d7565b6117d78660018703815181106117ca57fe5b6020026020010151611d9f565b919b919a509098505050505050505050565b60606113446117f783611dbb565b611de0565b6000611344825b600060218260000151111561185f576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b600080600061186d85611f56565b91945092509050600081600181111561188257fe5b146118d4576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6020808601518401805190918410156116dc5760208490036101000a90049695505050505050565b600080600061190c878686611716565b915091508180156115fc57506115fc868261227f565b6060600061192f836117e9565b90506000815167ffffffffffffffff8111801561194b57600080fd5b5060405190808252806020026020018201604052801561198557816020015b61197261277b565b81526020019060019003908161196a5790505b50905060005b82518110156119f15760006119b28483815181106119a557fe5b6020026020010151612295565b905060405180604001604052808281526020016119ce836117e9565b8152508383815181106119dd57fe5b60209081029190910101525060010161198b565b509392505050565b60006060818080611a0987612324565b905085600080611a1761277b565b60005b8c51811015611d77578c8181518110611a2f57fe5b6020026020010151915082840193506001870196508360001415611aa357815180516020909101208514611a9e576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b611b6a565b815151602011611b0a57815180516020909101208514611a9e576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b84611b188360000151612421565b14611b6a576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b60208201515160111415611bd9578551841415611b8657611d77565b6000868581518110611b9457fe5b602001015160f81c60f81b60f81c9050600083602001518260ff1681518110611bb957fe5b60200260200101519050611bcc8161244d565b9650600194505050611d6f565b60028260200151511415611d22576000611bf283612483565b9050600081600081518110611c0357fe5b016020015160f81c9050600181166002036000611c238460ff84166124a1565b90506000611c318b8a6124a1565b90506000611c3f83836124ce565b905060ff851660021480611c56575060ff85166003145b15611c8857808351148015611c6b5750808251145b15611c7557988901985b50600160ff1b9950611d77945050505050565b60ff85161580611c9b575060ff85166001145b15611ceb5782518114611cbb5750600160ff1b9950611d77945050505050565b611cdc8860200151600181518110611ccf57fe5b602002602001015161244d565b9a509750611d6f945050505050565b60405162461bcd60e51b81526004018080602001828103825260268152602001806132956026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b600101611a1a565b50600160ff1b841486611d8a87866124a1565b909e909d50909b509950505050505050505050565b602081015180516060916113449160001981019081106119a557fe5b611dc3612795565b506040805180820190915281518152602082810190820152919050565b6060600080611dee84611f56565b91935090915060019050816001811115611e0457fe5b14611e56576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b611e77612795565b815260200190600190039081611e6f5790505090506000835b8651811015611f4b5760208210611ed85760405162461bcd60e51b815260040180806020018281038252602a81526020018061323d602a913960400191505060405180910390fd5b600080611f046040518060400160405280858c60000151038152602001858c6020015101815250611f56565b509150915060405180604001604052808383018152602001848b6020015101815250858581518110611f3257fe5b6020908102919091010152600193909301920101611e90565b508152949350505050565b600080600080846000015111611fb3576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f8111611fd8576000600160009450945094505050612278565b60b7811161204d578551607f19820190811061203b576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b60019550935060009250612278915050565b60bf811161213157855160b61982019081106120b0576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a600185015104905080820188600001511161211c576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b60019091019550935060009250612278915050565b60f781116121a557855160bf198201908110612194576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b600195509350849250612278915050565b855160f6198201908110612200576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111612265576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b6001918201965094509250612278915050565b9193909250565b8051602091820120825192909101919091201490565b606060008060006122a585611f56565b9194509250905060008160018111156122ba57fe5b1461230c576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b61231b85602001518484612534565b95945050505050565b60606000825160020267ffffffffffffffff8111801561234357600080fd5b506040519080825280601f01601f19166020018201604052801561236e576020820181803683370190505b50905060005b835181101561241a57600484828151811061238b57fe5b602001015160f81c60f81b6001600160f81b031916901c8282600202815181106123b157fe5b60200101906001600160f81b031916908160001a90535060108482815181106123d657fe5b016020015160f81c816123e557fe5b0660f81b8282600202600101815181106123fb57fe5b60200101906001600160f81b031916908160001a905350600101612374565b5092915050565b600060208251101561243857506020810151610537565b81806020019051602081101561053257600080fd5b6000606060208360000151101561246e57612467836125e2565b905061247a565b61247783612295565b90505b6114a681612421565b606061134461249c83602001516000815181106119a557fe5b612324565b6060825182106124c05750604080516020810190915260008152611344565b6113418383848651036125ed565b6000805b8084511180156124e25750808351115b801561252757508281815181106124f557fe5b602001015160f81c60f81b6001600160f81b03191684828151811061251657fe5b01602001516001600160f81b031916145b15611341576001016124d2565b606060008267ffffffffffffffff8111801561254f57600080fd5b506040519080825280601f01601f19166020018201604052801561257a576020820181803683370190505b50905080516000141561258e5790506114a6565b8484016020820160005b602086048110156125b9578251825260209283019290910190600101612598565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b60606113448261273e565b60608182601f011015612638576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b828284011015612680576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b818301845110156126cc576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b6060821580156126eb5760405191506000825260208201604052612735565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561272457805183526020928301920161270c565b5050858452601f01601f1916604052505b50949350505050565b6060611344826020015160008460000151612534565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060608152602001606081525090565b604051806040016040528060008152602001600081525090565b600067ffffffffffffffff8311156127c357fe5b6127d6601f8401601f19166020016131c2565b90508281528383830111156127ea57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b038116811461053757600080fd5b600082601f830112612828578081fd5b611341838335602085016127af565b600060a08284031215612848578081fd5b60405160a0810167ffffffffffffffff828210818311171561286657fe5b816040528293508435835260208501356020840152604085013560408401526060850135606084015260808501359150808211156128a357600080fd5b506128b085828601612818565b6080830152505092915050565b6000604082840312156128ce578081fd5b6040516040810167ffffffffffffffff82821081831117156128ec57fe5b816040528293508435835260209150818501358181111561290c57600080fd5b8501601f8101871361291d57600080fd5b80358281111561292957fe5b83810292506129398484016131c2565b8181528481019083860185850187018b101561295457600080fd5b600095505b83861015612977578035835260019590950194918601918601612959565b5080868801525050505050505092915050565b803563ffffffff8116811461053757600080fd5b805164ffffffffff8116811461053757600080fd5b6000602082840312156129c4578081fd5b61134182612801565b600080600080600060a086880312156129e4578081fd5b6129ed86612801565b94506129fb60208701612801565b9350604086013567ffffffffffffffff80821115612a17578283fd5b612a2389838a01612818565b9450606088013593506080880135915080821115612a3f578283fd5b9087019060a0828a031215612a52578283fd5b612a5c60a06131c2565b82358152602083013582811115612a71578485fd5b612a7d8b828601612837565b602083015250604083013582811115612a94578485fd5b612aa08b8286016128bd565b604083015250606083013582811115612ab7578485fd5b612ac38b828601612818565b606083015250608083013582811115612ada578485fd5b612ae68b828601612818565b6080830152508093505050509295509295909350565b600080600080600060a08688031215612b13578081fd5b612b1c86612801565b9450612b2a60208701612801565b9350604086013567ffffffffffffffff811115612b45578182fd5b612b5188828901612818565b93505060608601359150612b676080870161298a565b90509295509295909350565b600080600060608486031215612b87578283fd5b612b9084612801565b9250602084013567ffffffffffffffff811115612bab578283fd5b612bb786828701612818565b925050612bc66040850161298a565b90509250925092565b600060208284031215612be0578081fd5b81518015158114611341578182fd5b600060208284031215612c00578081fd5b5035919050565b600060208284031215612c18578081fd5b813567ffffffffffffffff811115612c2e578182fd5b8201601f81018413612c3e578182fd5b612c4d848235602084016127af565b949350505050565b600060608284031215612c66578081fd5b6040516060810181811067ffffffffffffffff82111715612c8357fe5b60405282518152612c966020840161299e565b6020820152612ca76040840161299e565b60408201529392505050565b600060208284031215612cc4578081fd5b6113418261299e565b60008151808452612ce58160208601602086016131e6565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a06080850152612c4d60a0850182612ccd565b60609190911b6001600160601b031916815260140190565b90815260200190565b918252602082015260400190565b60008251612d778184602087016131e6565b9190910192915050565b60008351612d938184602088016131e6565b60609390931b6001600160601b0319169190920190815260140192915050565b60008451612dc58184602089016131e6565b60609490941b6001600160601b03191691909301908152601481019190915260340192915050565b60f89190911b6001600160f81b031916815260010190565b6001600160a01b0391909116815260200190565b6001600160a01b03858116825284166020820152608060408201819052600090612e4590830185612ccd565b905082606083015295945050505050565b6001600160a01b0385811682528416602082015263ffffffff831660408201526080606082018190526000906116dc90830184612ccd565b600060018060a01b03851682528360208301526060604083015261231b6060830184612ccd565b901515815260200190565b60008482526020606081840152612eda6060840186612cf9565b838103604085015260408101855182528286015160408484015281815180845260608501915085830194508693505b80841015612f295784518252938501936001939093019290850190612f09565b509998505050505050505050565b6000602082526113416020830184612ccd565b6020808252601f908201527f78446f6d61696e4d65737361676553656e646572206973206e6f742073657400604082015260600190565b6020808252602b908201527f50726f7669646564206d6573736167652068617320616c72656164792062656560408201526a37103932b1b2b4bb32b21760a91b606082015260800190565b6020808252604d908201527f4d6573736167652070617373696e67207072656465706c6f7920686173206e6f60408201527f74206265656e20696e697469616c697a6564206f7220696e76616c696420707260608201526c37b7b310383937bb34b232b21760991b608082015260a00190565b60208082526022908201527f50726f7669646564206d65737361676520686173206265656e20626c6f636b65604082015261321760f11b606082015260800190565b60208082526036908201527f4f6e6c79204f564d5f4c324d65737361676552656c617965722063616e2072656040820152753630bc90261916ba3796a6189036b2b9b9b0b3b2b99760511b606082015260800190565b60208082526027908201527f50726f7669646564206d65737361676520636f756c64206e6f742062652076656040820152663934b334b2b21760c91b606082015260800190565b6020808252602a908201527f4c3143726f7373446f6d61696e4d657373656e67657220616c72656164792069604082015269373a34b0b634bd32b21760b11b606082015260800190565b60208082526027908201527f50726f7669646564206d65737361676520686173206e6f74206265656e20656e60408201526638bab2bab2b21760c91b606082015260800190565b6000602082526113416020830184612cf9565b60405181810167ffffffffffffffff811182821017156131de57fe5b604052919050565b60005b838110156132015781810151838201526020016131e9565b83811115613210576000848401525b5050505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737350726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a656452656365697665642061206e6f6465207769746820616e20756e6b6e6f776e207072656669784f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a26469706673582212203a1cd12f46684c95bb11e17fac1702e7dc0fea4c9f70f060e2b6070b1731d33764736f6c63430007060033", "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", @@ -560,7 +528,7 @@ "params": { "_gasLimit": "Gas limit for the provided message.", "_message": "Message to send to the target.", - "_messageNonce": "Nonce for the provided message.", + "_queueIndex": "CTC Queue index for the message to replay.", "_sender": "Original sender address.", "_target": "Target contract address." } @@ -620,59 +588,19 @@ "storageLayout": { "storage": [ { - "astId": 1272, - "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", - "label": "relayedMessages", - "offset": 0, - "slot": "0", - "type": "t_mapping(t_bytes32,t_bool)" - }, - { - "astId": 1276, - "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", - "label": "successfulMessages", - "offset": 0, - "slot": "1", - "type": "t_mapping(t_bytes32,t_bool)" - }, - { - "astId": 1280, - "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", - "label": "sentMessages", - "offset": 0, - "slot": "2", - "type": "t_mapping(t_bytes32,t_bool)" - }, - { - "astId": 1282, - "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", - "label": "messageNonce", - "offset": 0, - "slot": "3", - "type": "t_uint256" - }, - { - "astId": 1285, - "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", - "label": "xDomainMsgSender", - "offset": 0, - "slot": "4", - "type": "t_address" - }, - { - "astId": 12800, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", "label": "libAddressManager", "offset": 0, - "slot": "5", - "type": "t_contract(Lib_AddressManager)12793" + "slot": "0", + "type": "t_contract(Lib_AddressManager)15296" }, { "astId": 137, "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", "label": "_initialized", "offset": 20, - "slot": "5", + "slot": "0", "type": "t_bool" }, { @@ -680,7 +608,7 @@ "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", "label": "_initializing", "offset": 21, - "slot": "5", + "slot": "0", "type": "t_bool" }, { @@ -688,7 +616,7 @@ "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", "label": "__gap", "offset": 0, - "slot": "6", + "slot": "1", "type": "t_array(t_uint256)50_storage" }, { @@ -696,7 +624,7 @@ "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", "label": "_owner", "offset": 0, - "slot": "56", + "slot": "51", "type": "t_address" }, { @@ -704,7 +632,7 @@ "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", "label": "__gap", "offset": 0, - "slot": "57", + "slot": "52", "type": "t_array(t_uint256)49_storage" }, { @@ -712,7 +640,7 @@ "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", "label": "_paused", "offset": 0, - "slot": "106", + "slot": "101", "type": "t_bool" }, { @@ -720,7 +648,7 @@ "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", "label": "__gap", "offset": 0, - "slot": "107", + "slot": "102", "type": "t_array(t_uint256)49_storage" }, { @@ -728,7 +656,7 @@ "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", "label": "_status", "offset": 0, - "slot": "156", + "slot": "151", "type": "t_uint256" }, { @@ -736,16 +664,40 @@ "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", "label": "__gap", "offset": 0, - "slot": "157", + "slot": "152", "type": "t_array(t_uint256)49_storage" }, { - "astId": 1436, + "astId": 2756, "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", "label": "blockedMessages", "offset": 0, - "slot": "206", + "slot": "201", "type": "t_mapping(t_bytes32,t_bool)" + }, + { + "astId": 2760, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "relayedMessages", + "offset": 0, + "slot": "202", + "type": "t_mapping(t_bytes32,t_bool)" + }, + { + "astId": 2764, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "successfulMessages", + "offset": 0, + "slot": "203", + "type": "t_mapping(t_bytes32,t_bool)" + }, + { + "astId": 2767, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "xDomainMsgSender", + "offset": 0, + "slot": "204", + "type": "t_address" } ], "types": { @@ -776,7 +728,7 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(Lib_AddressManager)12793": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" diff --git a/packages/contracts/deployments/kovan/OVM_L1MultiMessageRelayer.json b/packages/contracts/deployments/kovan/OVM_L1MultiMessageRelayer.json index 62ca79e117c0..6f73175ea200 100644 --- a/packages/contracts/deployments/kovan/OVM_L1MultiMessageRelayer.json +++ b/packages/contracts/deployments/kovan/OVM_L1MultiMessageRelayer.json @@ -1,5 +1,5 @@ { - "address": "0x942b1B1CaF9e7654318CbfCfD1bca6727C716638", + "address": "0x5818840763Ee28ff0A3E3e8CB9eDeDd07Fb1Cd3f", "abi": [ { "inputs": [ @@ -151,29 +151,29 @@ "type": "function" } ], - "transactionHash": "0xd93f806d3c8503f36c537f09883e9165dd32239e00b881f705a3441e13a3d510", + "transactionHash": "0xc250359b3e8056c0886c3496ea28111fdbbc9cc73b177f262aaca18a099a72e0", "receipt": { "to": null, "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", - "contractAddress": "0x942b1B1CaF9e7654318CbfCfD1bca6727C716638", - "transactionIndex": 1, - "gasUsed": "605189", + "contractAddress": "0x5818840763Ee28ff0A3E3e8CB9eDeDd07Fb1Cd3f", + "transactionIndex": 2, + "gasUsed": "606477", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xc85c83fe27b2839cc9aee380d27e1fab4612af37f0d80a87aea6047caec2a0e1", - "transactionHash": "0xd93f806d3c8503f36c537f09883e9165dd32239e00b881f705a3441e13a3d510", + "blockHash": "0x2317e2aaafefd398ee0a9f423bbc35b93e09646b4a804b812cfda4ddc8b5ec77", + "transactionHash": "0xc250359b3e8056c0886c3496ea28111fdbbc9cc73b177f262aaca18a099a72e0", "logs": [], - "blockNumber": 24572884, - "cumulativeGasUsed": "674512", + "blockNumber": 25502641, + "cumulativeGasUsed": "696610", "status": 1, "byzantium": true }, "args": [ - "0xd56F695e73286ac252A37593DD4E7c14270eC1Df" + "0x100Dd3b414Df5BbA2B542864fF94aF8024aFdf3a" ], - "solcInputHash": "5ee8e508e2c54cb5ac6783b4855b1558", - "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\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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\"}},\"constructor\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}}},\"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\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1MultiMessageRelayer.sol\":\"OVM_L1MultiMessageRelayer\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1MultiMessageRelayer.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_L1CrossDomainMessenger } from \\\"../../../iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol\\\";\\nimport { iOVM_L1MultiMessageRelayer } from \\\"../../../iOVM/bridge/messaging/iOVM_L1MultiMessageRelayer.sol\\\";\\n\\n/* Library Imports */\\nimport { Lib_AddressResolver } from \\\"../../../libraries/resolver/Lib_AddressResolver.sol\\\";\\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\\n /**\\n * @param _libAddressManager Address of the Address Manager.\\n */\\n constructor(\\n address _libAddressManager\\n )\\n Lib_AddressResolver(_libAddressManager)\\n {}\\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 /********************\\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(\\n L2ToL1Message[] calldata _messages\\n ) \\n override\\n external\\n onlyBatchRelayer\\n {\\n iOVM_L1CrossDomainMessenger messenger = iOVM_L1CrossDomainMessenger(\\n resolve(\\\"Proxy__OVM_L1CrossDomainMessenger\\\")\\n );\\n\\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\":\"0xe698b8dbdcecd055ee77cc553963f966faebcdefbed1e586f7fd603fa816d9c6\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/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\\n event SentMessage(bytes message);\\n event RelayedMessage(bytes32 msgHash);\\n event FailedRelayedMessage(bytes32 msgHash);\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n function xDomainMessageSender() external view returns (address);\\n\\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\":\"0x89981ed48e99d6939cc6cdef827d484fa3e2292d66c0ba5056c7050cb6282d7e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/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/messaging/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/messaging/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\":\"0x8bc1fb2a33dcac59ec307195f8b8358d1ae2ab021c70a1589038b366d1b949d7\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x2ce671a0e004df88b136bea5a3c59d0732cea8887c8496da1d509e0200b03d7d\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xa5195afe32fb2cf104d156e8f4bd39df1ec79bf6ba232097b9e8e0ee14fbc298\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50604051610a22380380610a2283398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b610991806100916000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806316e9cd9b14610046578063299ca4781461005b578063461a447814610079575b600080fd5b61005961005436600461057d565b61008c565b005b6100636101ea565b60405161007091906106db565b60405180910390f35b6100636100873660046105ec565b6101f9565b6100ca6040518060400160405280601981526020017f4f564d5f4c3242617463684d65737361676552656c61796572000000000000008152506101f9565b6001600160a01b0316336001600160a01b0316146101035760405162461bcd60e51b81526004016100fa906107d7565b60405180910390fd5b600061012660405180606001604052806021815260200161093b602191396101f9565b905060005b828110156101e457600084848381811061014157fe5b9050602002810190610153919061085a565b61015c9061089d565b8051602082015160408084015160608501516080860151925163d7fd19dd60e01b81529596506001600160a01b0389169563d7fd19dd956101a5959094909392916004016106ef565b600060405180830381600087803b1580156101bf57600080fd5b505af11580156101d3573d6000803e3d6000fd5b50506001909301925061012b915050565b50505050565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610259578181015183820152602001610241565b50505050905090810190601f1680156102865780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102a357600080fd5b505afa1580156102b7573d6000803e3d6000fd5b505050506040513d60208110156102cd57600080fd5b505190505b919050565b600067ffffffffffffffff8311156102eb57fe5b6102fe601f8401601f1916602001610879565b905082815283838301111561031257600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102d257600080fd5b600082601f830112610350578081fd5b61035f838335602085016102d7565b9392505050565b600060a08284031215610377578081fd5b60405160a0810167ffffffffffffffff828210818311171561039557fe5b816040528293508435835260208501356020840152604085013560408401526060850135606084015260808501359150808211156103d257600080fd5b506103df85828601610340565b6080830152505092915050565b6000604082840312156103fd578081fd5b6040516040810167ffffffffffffffff828210818311171561041b57fe5b816040528293508435835260209150818501358181111561043b57600080fd5b8501601f8101871361044c57600080fd5b80358281111561045857fe5b8381029250610468848401610879565b8181528481019083860185850187018b101561048357600080fd5b600095505b838610156104a6578035835260019590950194918601918601610488565b5080868801525050505050505092915050565b600060a082840312156104ca578081fd5b6104d460a0610879565b905081358152602082013567ffffffffffffffff808211156104f557600080fd5b61050185838601610366565b6020840152604084013591508082111561051a57600080fd5b610526858386016103ec565b6040840152606084013591508082111561053f57600080fd5b61054b85838601610340565b6060840152608084013591508082111561056457600080fd5b5061057184828501610340565b60808301525092915050565b6000806020838503121561058f578182fd5b823567ffffffffffffffff808211156105a6578384fd5b818501915085601f8301126105b9578384fd5b8135818111156105c7578485fd5b86602080830285010111156105da578485fd5b60209290920196919550909350505050565b6000602082840312156105fd578081fd5b813567ffffffffffffffff811115610613578182fd5b8201601f81018413610623578182fd5b610632848235602084016102d7565b949350505050565b60008151808452815b8181101561065f57602081850181015186830182015201610643565b818111156106705782602083870101525b50601f01601f19169290920160200192915050565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b808310156106d057845182529383019360019290920191908301906106b0565b509695505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0386811682528516602082015260a06040820181905260009061071b9083018661063a565b846060840152828103608084015283518152602084015160a06020830152805160a0830152602081015160c0830152604081015160e083015260608101516101008301526080810151905060a061012083015261077c61014083018261063a565b9050604085015182820360408401526107958282610685565b915050606085015182820360608401526107af828261063a565b915050608085015182820360808401526107c9828261063a565b9a9950505050505050505050565b60208082526057908201527f4f564d5f4c314d756c74694d65737361676552656c617965723a2046756e637460408201527f696f6e2063616e206f6e6c792062652063616c6c656420627920746865204f5660608201527f4d5f4c3242617463684d65737361676552656c61796572000000000000000000608082015260a00190565b60008235609e1983360301811261086f578182fd5b9190910192915050565b60405181810167ffffffffffffffff8111828210171561089557fe5b604052919050565b600060a082360312156108ae578081fd5b60405160a0810167ffffffffffffffff82821081831117156108cc57fe5b816040526108d985610329565b83526108e760208601610329565b602084015260408501359150808211156108ff578384fd5b61090b36838701610340565b604084015260608501356060840152608085013591508082111561092d578384fd5b50610571368286016104b956fe50726f78795f5f4f564d5f4c3143726f7373446f6d61696e4d657373656e676572a264697066735822122054e57719bdaae865a83549e03668e0558acc8a0d1d5ba65034f61a02d9a35c6264736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c806316e9cd9b14610046578063299ca4781461005b578063461a447814610079575b600080fd5b61005961005436600461057d565b61008c565b005b6100636101ea565b60405161007091906106db565b60405180910390f35b6100636100873660046105ec565b6101f9565b6100ca6040518060400160405280601981526020017f4f564d5f4c3242617463684d65737361676552656c61796572000000000000008152506101f9565b6001600160a01b0316336001600160a01b0316146101035760405162461bcd60e51b81526004016100fa906107d7565b60405180910390fd5b600061012660405180606001604052806021815260200161093b602191396101f9565b905060005b828110156101e457600084848381811061014157fe5b9050602002810190610153919061085a565b61015c9061089d565b8051602082015160408084015160608501516080860151925163d7fd19dd60e01b81529596506001600160a01b0389169563d7fd19dd956101a5959094909392916004016106ef565b600060405180830381600087803b1580156101bf57600080fd5b505af11580156101d3573d6000803e3d6000fd5b50506001909301925061012b915050565b50505050565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610259578181015183820152602001610241565b50505050905090810190601f1680156102865780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102a357600080fd5b505afa1580156102b7573d6000803e3d6000fd5b505050506040513d60208110156102cd57600080fd5b505190505b919050565b600067ffffffffffffffff8311156102eb57fe5b6102fe601f8401601f1916602001610879565b905082815283838301111561031257600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102d257600080fd5b600082601f830112610350578081fd5b61035f838335602085016102d7565b9392505050565b600060a08284031215610377578081fd5b60405160a0810167ffffffffffffffff828210818311171561039557fe5b816040528293508435835260208501356020840152604085013560408401526060850135606084015260808501359150808211156103d257600080fd5b506103df85828601610340565b6080830152505092915050565b6000604082840312156103fd578081fd5b6040516040810167ffffffffffffffff828210818311171561041b57fe5b816040528293508435835260209150818501358181111561043b57600080fd5b8501601f8101871361044c57600080fd5b80358281111561045857fe5b8381029250610468848401610879565b8181528481019083860185850187018b101561048357600080fd5b600095505b838610156104a6578035835260019590950194918601918601610488565b5080868801525050505050505092915050565b600060a082840312156104ca578081fd5b6104d460a0610879565b905081358152602082013567ffffffffffffffff808211156104f557600080fd5b61050185838601610366565b6020840152604084013591508082111561051a57600080fd5b610526858386016103ec565b6040840152606084013591508082111561053f57600080fd5b61054b85838601610340565b6060840152608084013591508082111561056457600080fd5b5061057184828501610340565b60808301525092915050565b6000806020838503121561058f578182fd5b823567ffffffffffffffff808211156105a6578384fd5b818501915085601f8301126105b9578384fd5b8135818111156105c7578485fd5b86602080830285010111156105da578485fd5b60209290920196919550909350505050565b6000602082840312156105fd578081fd5b813567ffffffffffffffff811115610613578182fd5b8201601f81018413610623578182fd5b610632848235602084016102d7565b949350505050565b60008151808452815b8181101561065f57602081850181015186830182015201610643565b818111156106705782602083870101525b50601f01601f19169290920160200192915050565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b808310156106d057845182529383019360019290920191908301906106b0565b509695505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0386811682528516602082015260a06040820181905260009061071b9083018661063a565b846060840152828103608084015283518152602084015160a06020830152805160a0830152602081015160c0830152604081015160e083015260608101516101008301526080810151905060a061012083015261077c61014083018261063a565b9050604085015182820360408401526107958282610685565b915050606085015182820360608401526107af828261063a565b915050608085015182820360808401526107c9828261063a565b9a9950505050505050505050565b60208082526057908201527f4f564d5f4c314d756c74694d65737361676552656c617965723a2046756e637460408201527f696f6e2063616e206f6e6c792062652063616c6c656420627920746865204f5660608201527f4d5f4c3242617463684d65737361676552656c61796572000000000000000000608082015260a00190565b60008235609e1983360301811261086f578182fd5b9190910192915050565b60405181810167ffffffffffffffff8111828210171561089557fe5b604052919050565b600060a082360312156108ae578081fd5b60405160a0810167ffffffffffffffff82821081831117156108cc57fe5b816040526108d985610329565b83526108e760208601610329565b602084015260408501359150808211156108ff578384fd5b61090b36838701610340565b604084015260608501356060840152608085013591508082111561092d578384fd5b50610571368286016104b956fe50726f78795f5f4f564d5f4c3143726f7373446f6d61696e4d657373656e676572a264697066735822122054e57719bdaae865a83549e03668e0558acc8a0d1d5ba65034f61a02d9a35c6264736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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\"}},\"constructor\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}}},\"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\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1MultiMessageRelayer.sol\":\"OVM_L1MultiMessageRelayer\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1MultiMessageRelayer.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_L1CrossDomainMessenger } from \\\"../../../iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol\\\";\\nimport { iOVM_L1MultiMessageRelayer } from \\\"../../../iOVM/bridge/messaging/iOVM_L1MultiMessageRelayer.sol\\\";\\n\\n/* Library Imports */\\nimport { Lib_AddressResolver } from \\\"../../../libraries/resolver/Lib_AddressResolver.sol\\\";\\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\\n /**\\n * @param _libAddressManager Address of the Address Manager.\\n */\\n constructor(\\n address _libAddressManager\\n )\\n Lib_AddressResolver(_libAddressManager)\\n {}\\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 /********************\\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(\\n L2ToL1Message[] calldata _messages\\n ) \\n override\\n external\\n onlyBatchRelayer\\n {\\n iOVM_L1CrossDomainMessenger messenger = iOVM_L1CrossDomainMessenger(\\n resolve(\\\"Proxy__OVM_L1CrossDomainMessenger\\\")\\n );\\n\\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\":\"0xe698b8dbdcecd055ee77cc553963f966faebcdefbed1e586f7fd603fa816d9c6\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_CrossDomainMessenger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/**\\n * @title iOVM_CrossDomainMessenger\\n */\\ninterface iOVM_CrossDomainMessenger {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event SentMessage(bytes message);\\n event RelayedMessage(bytes32 msgHash);\\n event FailedRelayedMessage(bytes32 msgHash);\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n function xDomainMessageSender() external view returns (address);\\n\\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\":\"0x03dd576abe8e562cca646dd59b5c038291dffa9a5e43e4e3765d38cf1406fa62\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/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 { iOVM_CrossDomainMessenger } from \\\"./iOVM_CrossDomainMessenger.sol\\\";\\n\\n/**\\n * @title iOVM_L1CrossDomainMessenger\\n */\\ninterface iOVM_L1CrossDomainMessenger is iOVM_CrossDomainMessenger {\\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 _queueIndex CTC Queue index for the message to replay.\\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 _queueIndex,\\n uint32 _gasLimit\\n ) external;\\n}\\n\",\"keccak256\":\"0xd278237bb588a45208d8ed57c7766386cddd1dc1e4f31867c9cb356939dfd49a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/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/messaging/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\":\"0x8bc1fb2a33dcac59ec307195f8b8358d1ae2ab021c70a1589038b366d1b949d7\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50604051610a22380380610a2283398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b610991806100916000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806316e9cd9b14610046578063299ca4781461005b578063461a447814610079575b600080fd5b61005961005436600461057d565b61008c565b005b6100636101ea565b60405161007091906106db565b60405180910390f35b6100636100873660046105ec565b6101f9565b6100ca6040518060400160405280601981526020017f4f564d5f4c3242617463684d65737361676552656c61796572000000000000008152506101f9565b6001600160a01b0316336001600160a01b0316146101035760405162461bcd60e51b81526004016100fa906107d7565b60405180910390fd5b600061012660405180606001604052806021815260200161093b602191396101f9565b905060005b828110156101e457600084848381811061014157fe5b9050602002810190610153919061085a565b61015c9061089d565b8051602082015160408084015160608501516080860151925163d7fd19dd60e01b81529596506001600160a01b0389169563d7fd19dd956101a5959094909392916004016106ef565b600060405180830381600087803b1580156101bf57600080fd5b505af11580156101d3573d6000803e3d6000fd5b50506001909301925061012b915050565b50505050565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610259578181015183820152602001610241565b50505050905090810190601f1680156102865780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102a357600080fd5b505afa1580156102b7573d6000803e3d6000fd5b505050506040513d60208110156102cd57600080fd5b505190505b919050565b600067ffffffffffffffff8311156102eb57fe5b6102fe601f8401601f1916602001610879565b905082815283838301111561031257600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102d257600080fd5b600082601f830112610350578081fd5b61035f838335602085016102d7565b9392505050565b600060a08284031215610377578081fd5b60405160a0810167ffffffffffffffff828210818311171561039557fe5b816040528293508435835260208501356020840152604085013560408401526060850135606084015260808501359150808211156103d257600080fd5b506103df85828601610340565b6080830152505092915050565b6000604082840312156103fd578081fd5b6040516040810167ffffffffffffffff828210818311171561041b57fe5b816040528293508435835260209150818501358181111561043b57600080fd5b8501601f8101871361044c57600080fd5b80358281111561045857fe5b8381029250610468848401610879565b8181528481019083860185850187018b101561048357600080fd5b600095505b838610156104a6578035835260019590950194918601918601610488565b5080868801525050505050505092915050565b600060a082840312156104ca578081fd5b6104d460a0610879565b905081358152602082013567ffffffffffffffff808211156104f557600080fd5b61050185838601610366565b6020840152604084013591508082111561051a57600080fd5b610526858386016103ec565b6040840152606084013591508082111561053f57600080fd5b61054b85838601610340565b6060840152608084013591508082111561056457600080fd5b5061057184828501610340565b60808301525092915050565b6000806020838503121561058f578182fd5b823567ffffffffffffffff808211156105a6578384fd5b818501915085601f8301126105b9578384fd5b8135818111156105c7578485fd5b86602080830285010111156105da578485fd5b60209290920196919550909350505050565b6000602082840312156105fd578081fd5b813567ffffffffffffffff811115610613578182fd5b8201601f81018413610623578182fd5b610632848235602084016102d7565b949350505050565b60008151808452815b8181101561065f57602081850181015186830182015201610643565b818111156106705782602083870101525b50601f01601f19169290920160200192915050565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b808310156106d057845182529383019360019290920191908301906106b0565b509695505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0386811682528516602082015260a06040820181905260009061071b9083018661063a565b846060840152828103608084015283518152602084015160a06020830152805160a0830152602081015160c0830152604081015160e083015260608101516101008301526080810151905060a061012083015261077c61014083018261063a565b9050604085015182820360408401526107958282610685565b915050606085015182820360608401526107af828261063a565b915050608085015182820360808401526107c9828261063a565b9a9950505050505050505050565b60208082526057908201527f4f564d5f4c314d756c74694d65737361676552656c617965723a2046756e637460408201527f696f6e2063616e206f6e6c792062652063616c6c656420627920746865204f5660608201527f4d5f4c3242617463684d65737361676552656c61796572000000000000000000608082015260a00190565b60008235609e1983360301811261086f578182fd5b9190910192915050565b60405181810167ffffffffffffffff8111828210171561089557fe5b604052919050565b600060a082360312156108ae578081fd5b60405160a0810167ffffffffffffffff82821081831117156108cc57fe5b816040526108d985610329565b83526108e760208601610329565b602084015260408501359150808211156108ff578384fd5b61090b36838701610340565b604084015260608501356060840152608085013591508082111561092d578384fd5b50610571368286016104b956fe50726f78795f5f4f564d5f4c3143726f7373446f6d61696e4d657373656e676572a2646970667358221220ca6bebf589e0e196a7eecc58e0f8a7270f00ec6d1a5d6a61d75748f6e061f36f64736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c806316e9cd9b14610046578063299ca4781461005b578063461a447814610079575b600080fd5b61005961005436600461057d565b61008c565b005b6100636101ea565b60405161007091906106db565b60405180910390f35b6100636100873660046105ec565b6101f9565b6100ca6040518060400160405280601981526020017f4f564d5f4c3242617463684d65737361676552656c61796572000000000000008152506101f9565b6001600160a01b0316336001600160a01b0316146101035760405162461bcd60e51b81526004016100fa906107d7565b60405180910390fd5b600061012660405180606001604052806021815260200161093b602191396101f9565b905060005b828110156101e457600084848381811061014157fe5b9050602002810190610153919061085a565b61015c9061089d565b8051602082015160408084015160608501516080860151925163d7fd19dd60e01b81529596506001600160a01b0389169563d7fd19dd956101a5959094909392916004016106ef565b600060405180830381600087803b1580156101bf57600080fd5b505af11580156101d3573d6000803e3d6000fd5b50506001909301925061012b915050565b50505050565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610259578181015183820152602001610241565b50505050905090810190601f1680156102865780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102a357600080fd5b505afa1580156102b7573d6000803e3d6000fd5b505050506040513d60208110156102cd57600080fd5b505190505b919050565b600067ffffffffffffffff8311156102eb57fe5b6102fe601f8401601f1916602001610879565b905082815283838301111561031257600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102d257600080fd5b600082601f830112610350578081fd5b61035f838335602085016102d7565b9392505050565b600060a08284031215610377578081fd5b60405160a0810167ffffffffffffffff828210818311171561039557fe5b816040528293508435835260208501356020840152604085013560408401526060850135606084015260808501359150808211156103d257600080fd5b506103df85828601610340565b6080830152505092915050565b6000604082840312156103fd578081fd5b6040516040810167ffffffffffffffff828210818311171561041b57fe5b816040528293508435835260209150818501358181111561043b57600080fd5b8501601f8101871361044c57600080fd5b80358281111561045857fe5b8381029250610468848401610879565b8181528481019083860185850187018b101561048357600080fd5b600095505b838610156104a6578035835260019590950194918601918601610488565b5080868801525050505050505092915050565b600060a082840312156104ca578081fd5b6104d460a0610879565b905081358152602082013567ffffffffffffffff808211156104f557600080fd5b61050185838601610366565b6020840152604084013591508082111561051a57600080fd5b610526858386016103ec565b6040840152606084013591508082111561053f57600080fd5b61054b85838601610340565b6060840152608084013591508082111561056457600080fd5b5061057184828501610340565b60808301525092915050565b6000806020838503121561058f578182fd5b823567ffffffffffffffff808211156105a6578384fd5b818501915085601f8301126105b9578384fd5b8135818111156105c7578485fd5b86602080830285010111156105da578485fd5b60209290920196919550909350505050565b6000602082840312156105fd578081fd5b813567ffffffffffffffff811115610613578182fd5b8201601f81018413610623578182fd5b610632848235602084016102d7565b949350505050565b60008151808452815b8181101561065f57602081850181015186830182015201610643565b818111156106705782602083870101525b50601f01601f19169290920160200192915050565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b808310156106d057845182529383019360019290920191908301906106b0565b509695505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0386811682528516602082015260a06040820181905260009061071b9083018661063a565b846060840152828103608084015283518152602084015160a06020830152805160a0830152602081015160c0830152604081015160e083015260608101516101008301526080810151905060a061012083015261077c61014083018261063a565b9050604085015182820360408401526107958282610685565b915050606085015182820360608401526107af828261063a565b915050608085015182820360808401526107c9828261063a565b9a9950505050505050505050565b60208082526057908201527f4f564d5f4c314d756c74694d65737361676552656c617965723a2046756e637460408201527f696f6e2063616e206f6e6c792062652063616c6c656420627920746865204f5660608201527f4d5f4c3242617463684d65737361676552656c61796572000000000000000000608082015260a00190565b60008235609e1983360301811261086f578182fd5b9190910192915050565b60405181810167ffffffffffffffff8111828210171561089557fe5b604052919050565b600060a082360312156108ae578081fd5b60405160a0810167ffffffffffffffff82821081831117156108cc57fe5b816040526108d985610329565b83526108e760208601610329565b602084015260408501359150808211156108ff578384fd5b61090b36838701610340565b604084015260608501356060840152608085013591508082111561092d578384fd5b50610571368286016104b956fe50726f78795f5f4f564d5f4c3143726f7373446f6d61696e4d657373656e676572a2646970667358221220ca6bebf589e0e196a7eecc58e0f8a7270f00ec6d1a5d6a61d75748f6e061f36f64736f6c63430007060033", "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", @@ -215,16 +215,16 @@ "storageLayout": { "storage": [ { - "astId": 12800, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1MultiMessageRelayer.sol:OVM_L1MultiMessageRelayer", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12793" + "type": "t_contract(Lib_AddressManager)15296" } ], "types": { - "t_contract(Lib_AddressManager)12793": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" diff --git a/packages/contracts/deployments/kovan/OVM_StateCommitmentChain.json b/packages/contracts/deployments/kovan/OVM_StateCommitmentChain.json index 1e3467717475..2df9b9823a82 100644 --- a/packages/contracts/deployments/kovan/OVM_StateCommitmentChain.json +++ b/packages/contracts/deployments/kovan/OVM_StateCommitmentChain.json @@ -1,5 +1,5 @@ { - "address": "0xdB1367bB36C34618778D492725C3eD11B508aC54", + "address": "0xa2487713665AC596b0b3E4881417f276834473d2", "abi": [ { "inputs": [ @@ -361,31 +361,31 @@ "type": "function" } ], - "transactionHash": "0x8c4c4052dc351f960e93b01fdd1e39be3b8dab99459b1be05254609d70df6c9f", + "transactionHash": "0x680c925d7f96072aba69503e06f695394e7e3e4fe03eed5bac8b9545311bf929", "receipt": { "to": null, "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", - "contractAddress": "0xdB1367bB36C34618778D492725C3eD11B508aC54", + "contractAddress": "0xa2487713665AC596b0b3E4881417f276834473d2", "transactionIndex": 1, - "gasUsed": "1624653", + "gasUsed": "1630153", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x82d155659e443e841339b8422848b42afa81a4fcb8e285c6e423b3e266ee431b", - "transactionHash": "0x8c4c4052dc351f960e93b01fdd1e39be3b8dab99459b1be05254609d70df6c9f", + "blockHash": "0xdc772f9fc0afa8ea9bd5767f6480d1558eacaba3cb7a0237abbed186ae541195", + "transactionHash": "0x680c925d7f96072aba69503e06f695394e7e3e4fe03eed5bac8b9545311bf929", "logs": [], - "blockNumber": 24572817, - "cumulativeGasUsed": "1667041", + "blockNumber": 25502597, + "cumulativeGasUsed": "1685181", "status": 1, "byzantium": true }, "args": [ - "0xd56F695e73286ac252A37593DD4E7c14270eC1Df", + "0x100Dd3b414Df5BbA2B542864fF94aF8024aFdf3a", 60, 15769999 ], - "solcInputHash": "5ee8e508e2c54cb5ac6783b4855b1558", - "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\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"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/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@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\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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 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_Proposer\\\");\\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 // For efficiency reasons getMerkleRoot modifies the `_batch` argument in place\\n // while calculating the root hash therefore any arguments passed to it must not\\n // be used again afterwards\\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\":\"0x5b72c845f856a06c978880d3cb2db40dafebaebf399df100c6ac832eaf41d7bd\",\"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 * 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\":\"0x2d7973a0ad84c23ec62624d3f1e3aeb198cc72686ff1e6cfa17155556b320c94\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x2ce671a0e004df88b136bea5a3c59d0732cea8887c8496da1d509e0200b03d7d\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xa5195afe32fb2cf104d156e8f4bd39df1ec79bf6ba232097b9e8e0ee14fbc298\",\"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 * Note that the _elements argument is modified, therefore it must not be used again afterwards\\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 pure\\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 == 1) {\\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 (uint256 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\":\"0xa78edb9fbd34712771a1ebff05bc5e1abec7fc1e9a1bfb709d183099b44fa62a\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50604051611bee380380611bee83398101604081905261002f9161005b565b600080546001600160a01b0319166001600160a01b03949094169390931790925560015560025561009c565b60008060006060848603121561006f578283fd5b83516001600160a01b0381168114610085578384fd5b602085015160409095015190969495509392505050565b611b43806100ab6000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80638ca5cbb9116100715780638ca5cbb91461012f5780639418bddd14610144578063b8e189ac14610157578063c17b291b1461016a578063cfdf677e14610172578063e561dddc1461017a576100b4565b8063299ca478146100b9578063461a4478146100d75780634d69ee57146100ea5780637aa63a861461010a5780637ad168a01461011f57806381eb62ef14610127575b600080fd5b6100c1610182565b6040516100ce919061159f565b60405180910390f35b6100c16100e53660046114e3565b610191565b6100fd6100f8366004611431565b61026f565b6040516100ce91906115b3565b6101126102e2565b6040516100ce91906115be565b6101126102fb565b610112610314565b61014261013d366004611390565b61031a565b005b6100fd610152366004611531565b61052e565b610142610165366004611531565b61057e565b610112610636565b6100c161063c565b610112610664565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156101f15781810151838201526020016101d9565b50505050905090810190601f16801561021e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561023b57600080fd5b505afa15801561024f573d6000803e3d6000fd5b505050506040513d602081101561026557600080fd5b505190505b919050565b600061027a836106de565b61029f5760405162461bcd60e51b815260040161029690611749565b60405180910390fd5b6102bc836020015185846000015185602001518760400151610776565b6102d85760405162461bcd60e51b8152600401610296906116b5565b5060019392505050565b6000806102ed6108fb565b5064ffffffffff1691505090565b6000806103066108fb565b64ffffffffff169250505090565b60025481565b6103226102e2565b81146103405760405162461bcd60e51b8152600401610296906116ec565b6103706040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b815250610191565b6001600160a01b03166302ad4d2a336040518263ffffffff1660e01b815260040161039b919061159f565b60206040518083038186803b1580156103b357600080fd5b505afa1580156103c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103eb91906113d3565b6104075760405162461bcd60e51b8152600401610296906118bb565b60008251116104285760405162461bcd60e51b815260040161029690611878565b6104666040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e000000815250610191565b6001600160a01b0316637aa63a866040518163ffffffff1660e01b815260040160206040518083038186803b15801561049e57600080fd5b505afa1580156104b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d69190611419565b82516104e06102e2565b0111156104ff5760405162461bcd60e51b815260040161029690611646565b61052a8242336040516020016105169291906119a1565b604051602081830303815290604052610990565b5050565b60008082608001518060200190518101906105499190611564565b509050806105695760405162461bcd60e51b815260040161029690611833565b4261057682600154610b31565b119392505050565b6105b06040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b815250610191565b6001600160a01b0316336001600160a01b0316146105e05760405162461bcd60e51b8152600401610296906117d6565b6105e9816106de565b6106055760405162461bcd60e51b815260040161029690611749565b61060e8161052e565b61062a5760405162461bcd60e51b815260040161029690611778565b61063381610b92565b50565b60015481565b600061065f604051806060016040528060258152602001611ab560259139610191565b905090565b600061066e61063c565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156106a657600080fd5b505afa1580156106ba573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065f9190611419565b60006106e861063c565b8251604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a91610716916004016115be565b60206040518083038186803b15801561072e57600080fd5b505afa158015610742573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107669190611419565b61076f83610d0a565b1492915050565b60008082116107b65760405162461bcd60e51b8152600401808060200182810382526037815260200180611a316037913960400191505060405180910390fd5b8184106107f45760405162461bcd60e51b81526004018080602001828103825260248152602001806119dd6024913960400191505060405180910390fd5b6107fd82610d50565b83511461083b5760405162461bcd60e51b815260040180806020018281038252604d815260200180611a68604d913960600191505060405180910390fd5b8460005b84518110156108ee57856001166001141561089d5784818151811061086057fe5b60200260200101518260405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091506108e2565b818582815181106108aa57fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c950161083f565b5090951495945050505050565b600080600061090861063c565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b15801561094057600080fd5b505afa158015610954573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097891906113f3565b64ffffffffff602882901c16935060501c9150509091565b60006109bf6040518060400160405280600c81526020016b27ab26afa83937b837b9b2b960a11b815250610191565b90506000806109cc6108fb565b9092509050336001600160a01b03841614156109e9575042610a13565b426002548264ffffffffff160110610a135760405162461bcd60e51b81526004016102969061190a565b60006040518060a00160405280610a28610664565b8152602001610a3688610de6565b8152602001875181526020018464ffffffffff16815260200186815250905080600001517f16be4c5129a4e03cf3350262e181dc02ddfb4a6008d925368c0899fcd97ca9c58260200151836040015184606001518560800151604051610a9f94939291906115dd565b60405180910390a2610aaf61063c565b6001600160a01b0316632015276c610ac683610d0a565b610ada84604001518560600151018661121a565b6040518363ffffffff1660e01b8152600401610af79291906115c7565b600060405180830381600087803b158015610b1157600080fd5b505af1158015610b25573d6000803e3d6000fd5b50505050505050505050565b600082820183811015610b8b576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b610b9a61063c565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610bd257600080fd5b505afa158015610be6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0a9190611419565b815110610c295760405162461bcd60e51b815260040161029690611973565b610c32816106de565b610c4e5760405162461bcd60e51b815260040161029690611749565b610c5661063c565b6001600160a01b031663167fd6818260000151610c788460600151600061121a565b6040518363ffffffff1660e01b8152600401610c959291906115c7565b600060405180830381600087803b158015610caf57600080fd5b505af1158015610cc3573d6000803e3d6000fd5b5050505080600001517f8747b69ce8fdb31c3b9b0a67bd8049ad8c1a69ea417b69b12174068abd9cbd648260200151604051610cff91906115be565b60405180910390a250565b60008160200151826040015183606001518460800151604051602001610d3394939291906115dd565b604051602081830303815290604052805190602001209050919050565b6000808211610d905760405162461bcd60e51b8152600401808060200182810382526030815260200180611a016030913960400191505060405180910390fd5b8160011415610da15750600061026a565b81600060805b60018110610dd1576000196001821b01811b831615610dc95791821c91908101905b60011c610da7565b506001811b8414610b8b576001019392505050565b600080825111610e275760405162461bcd60e51b8152600401808060200182810382526034815260200180611ada6034913960400191505060405180910390fd5b815160011415610e4d5781600081518110610e3e57fe5b6020026020010151905061026a565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b60018411156111f65750506002820460018084161460005b82811015611172578a816002028151811061111957fe5b602002602001015196508a816002026001018151811061113557fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061115f57fe5b6020908102919091010152600101611102565b5080156111d55789600185038151811061118857fe5b6020026020010151955087836010811061119e57fe5b602002015160001b945085602088015284604088015286805190602001208a83815181106111c857fe5b6020026020010181815250505b806111e15760006111e4565b60015b60ff16820193506001909201916110ea565b8960008151811061120357fe5b602002602001015198505050505050505050919050565b602890811b91909117901b90565b600067ffffffffffffffff83111561123c57fe5b61124f601f8401601f19166020016119b8565b905082815283838301111561126357600080fd5b828260208301376000602084830101529392505050565b600082601f83011261128a578081fd5b8135602067ffffffffffffffff8211156112a057fe5b8082026112ae8282016119b8565b8381528281019086840183880185018910156112c8578687fd5b8693505b858410156112ea5780358352600193909301929184019184016112cc565b50979650505050505050565b600060a08284031215611307578081fd5b60405160a0810167ffffffffffffffff828210818311171561132557fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561136257600080fd5b508301601f8101851361137457600080fd5b61138385823560208401611228565b6080830152505092915050565b600080604083850312156113a2578182fd5b823567ffffffffffffffff8111156113b8578283fd5b6113c48582860161127a565b95602094909401359450505050565b6000602082840312156113e4578081fd5b81518015158114610b8b578182fd5b600060208284031215611404578081fd5b815164ffffffffff1981168114610b8b578182fd5b60006020828403121561142a578081fd5b5051919050565b600080600060608486031215611445578081fd5b83359250602084013567ffffffffffffffff80821115611463578283fd5b61146f878388016112f6565b93506040860135915080821115611484578283fd5b9085019060408288031215611497578283fd5b6040516040810181811083821117156114ac57fe5b604052823581526020830135828111156114c4578485fd5b6114d08982860161127a565b6020830152508093505050509250925092565b6000602082840312156114f4578081fd5b813567ffffffffffffffff81111561150a578182fd5b8201601f8101841361151a578182fd5b61152984823560208401611228565b949350505050565b600060208284031215611542578081fd5b813567ffffffffffffffff811115611558578182fd5b611529848285016112f6565b60008060408385031215611576578182fd5b825160208401519092506001600160a01b0381168114611594578182fd5b809150509250929050565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b91825264ffffffffff1916602082015260400190565b600085825260208581840152846040840152608060608401528351806080850152825b8181101561161c5785810183015185820160a001528201611600565b8181111561162d578360a083870101525b50601f01601f19169290920160a0019695505050505050565b60208082526049908201527f4e756d626572206f6620737461746520726f6f74732063616e6e6f742065786360408201527f65656420746865206e756d626572206f662063616e6f6e6963616c207472616e60608201526839b0b1ba34b7b7399760b91b608082015260a00190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b602080825260409082018190527f537461746520626174636865732063616e206f6e6c792062652064656c657465908201527f642077697468696e207468652066726175642070726f6f662077696e646f772e606082015260800190565b6020808252603b908201527f537461746520626174636865732063616e206f6e6c792062652064656c65746560408201527f6420627920746865204f564d5f467261756456657269666965722e0000000000606082015260800190565b60208082526025908201527f4261746368206865616465722074696d657374616d702063616e6e6f74206265604082015264207a65726f60d81b606082015260800190565b60208082526023908201527f43616e6e6f74207375626d697420616e20656d7074792073746174652062617460408201526231b41760e91b606082015260800190565b6020808252602f908201527f50726f706f73657220646f6573206e6f74206861766520656e6f75676820636f60408201526e1b1b185d195c985b081c1bdcdd1959608a1b606082015260800190565b60208082526043908201527f43616e6e6f74207075626c69736820737461746520726f6f747320776974686960408201527f6e207468652073657175656e636572207075626c69636174696f6e2077696e6460608201526237bb9760e91b608082015260a00190565b60208082526014908201527324b73b30b634b2103130ba31b41034b73232bc1760611b604082015260600190565b9182526001600160a01b0316602082015260400190565b60405181810167ffffffffffffffff811182821017156119d457fe5b60405291905056fe4c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4f564d5f436861696e53746f72616765436f6e7461696e65723a5343433a626174636865734c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea26469706673582212209a79aee928c48a8e868127cc94d1fe1eb4eea95e98e6709cd65bda19d650209064736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80638ca5cbb9116100715780638ca5cbb91461012f5780639418bddd14610144578063b8e189ac14610157578063c17b291b1461016a578063cfdf677e14610172578063e561dddc1461017a576100b4565b8063299ca478146100b9578063461a4478146100d75780634d69ee57146100ea5780637aa63a861461010a5780637ad168a01461011f57806381eb62ef14610127575b600080fd5b6100c1610182565b6040516100ce919061159f565b60405180910390f35b6100c16100e53660046114e3565b610191565b6100fd6100f8366004611431565b61026f565b6040516100ce91906115b3565b6101126102e2565b6040516100ce91906115be565b6101126102fb565b610112610314565b61014261013d366004611390565b61031a565b005b6100fd610152366004611531565b61052e565b610142610165366004611531565b61057e565b610112610636565b6100c161063c565b610112610664565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156101f15781810151838201526020016101d9565b50505050905090810190601f16801561021e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561023b57600080fd5b505afa15801561024f573d6000803e3d6000fd5b505050506040513d602081101561026557600080fd5b505190505b919050565b600061027a836106de565b61029f5760405162461bcd60e51b815260040161029690611749565b60405180910390fd5b6102bc836020015185846000015185602001518760400151610776565b6102d85760405162461bcd60e51b8152600401610296906116b5565b5060019392505050565b6000806102ed6108fb565b5064ffffffffff1691505090565b6000806103066108fb565b64ffffffffff169250505090565b60025481565b6103226102e2565b81146103405760405162461bcd60e51b8152600401610296906116ec565b6103706040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b815250610191565b6001600160a01b03166302ad4d2a336040518263ffffffff1660e01b815260040161039b919061159f565b60206040518083038186803b1580156103b357600080fd5b505afa1580156103c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103eb91906113d3565b6104075760405162461bcd60e51b8152600401610296906118bb565b60008251116104285760405162461bcd60e51b815260040161029690611878565b6104666040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e000000815250610191565b6001600160a01b0316637aa63a866040518163ffffffff1660e01b815260040160206040518083038186803b15801561049e57600080fd5b505afa1580156104b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d69190611419565b82516104e06102e2565b0111156104ff5760405162461bcd60e51b815260040161029690611646565b61052a8242336040516020016105169291906119a1565b604051602081830303815290604052610990565b5050565b60008082608001518060200190518101906105499190611564565b509050806105695760405162461bcd60e51b815260040161029690611833565b4261057682600154610b31565b119392505050565b6105b06040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b815250610191565b6001600160a01b0316336001600160a01b0316146105e05760405162461bcd60e51b8152600401610296906117d6565b6105e9816106de565b6106055760405162461bcd60e51b815260040161029690611749565b61060e8161052e565b61062a5760405162461bcd60e51b815260040161029690611778565b61063381610b92565b50565b60015481565b600061065f604051806060016040528060258152602001611ab560259139610191565b905090565b600061066e61063c565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156106a657600080fd5b505afa1580156106ba573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065f9190611419565b60006106e861063c565b8251604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a91610716916004016115be565b60206040518083038186803b15801561072e57600080fd5b505afa158015610742573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107669190611419565b61076f83610d0a565b1492915050565b60008082116107b65760405162461bcd60e51b8152600401808060200182810382526037815260200180611a316037913960400191505060405180910390fd5b8184106107f45760405162461bcd60e51b81526004018080602001828103825260248152602001806119dd6024913960400191505060405180910390fd5b6107fd82610d50565b83511461083b5760405162461bcd60e51b815260040180806020018281038252604d815260200180611a68604d913960600191505060405180910390fd5b8460005b84518110156108ee57856001166001141561089d5784818151811061086057fe5b60200260200101518260405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091506108e2565b818582815181106108aa57fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c950161083f565b5090951495945050505050565b600080600061090861063c565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b15801561094057600080fd5b505afa158015610954573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097891906113f3565b64ffffffffff602882901c16935060501c9150509091565b60006109bf6040518060400160405280600c81526020016b27ab26afa83937b837b9b2b960a11b815250610191565b90506000806109cc6108fb565b9092509050336001600160a01b03841614156109e9575042610a13565b426002548264ffffffffff160110610a135760405162461bcd60e51b81526004016102969061190a565b60006040518060a00160405280610a28610664565b8152602001610a3688610de6565b8152602001875181526020018464ffffffffff16815260200186815250905080600001517f16be4c5129a4e03cf3350262e181dc02ddfb4a6008d925368c0899fcd97ca9c58260200151836040015184606001518560800151604051610a9f94939291906115dd565b60405180910390a2610aaf61063c565b6001600160a01b0316632015276c610ac683610d0a565b610ada84604001518560600151018661121a565b6040518363ffffffff1660e01b8152600401610af79291906115c7565b600060405180830381600087803b158015610b1157600080fd5b505af1158015610b25573d6000803e3d6000fd5b50505050505050505050565b600082820183811015610b8b576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b610b9a61063c565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610bd257600080fd5b505afa158015610be6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0a9190611419565b815110610c295760405162461bcd60e51b815260040161029690611973565b610c32816106de565b610c4e5760405162461bcd60e51b815260040161029690611749565b610c5661063c565b6001600160a01b031663167fd6818260000151610c788460600151600061121a565b6040518363ffffffff1660e01b8152600401610c959291906115c7565b600060405180830381600087803b158015610caf57600080fd5b505af1158015610cc3573d6000803e3d6000fd5b5050505080600001517f8747b69ce8fdb31c3b9b0a67bd8049ad8c1a69ea417b69b12174068abd9cbd648260200151604051610cff91906115be565b60405180910390a250565b60008160200151826040015183606001518460800151604051602001610d3394939291906115dd565b604051602081830303815290604052805190602001209050919050565b6000808211610d905760405162461bcd60e51b8152600401808060200182810382526030815260200180611a016030913960400191505060405180910390fd5b8160011415610da15750600061026a565b81600060805b60018110610dd1576000196001821b01811b831615610dc95791821c91908101905b60011c610da7565b506001811b8414610b8b576001019392505050565b600080825111610e275760405162461bcd60e51b8152600401808060200182810382526034815260200180611ada6034913960400191505060405180910390fd5b815160011415610e4d5781600081518110610e3e57fe5b6020026020010151905061026a565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b60018411156111f65750506002820460018084161460005b82811015611172578a816002028151811061111957fe5b602002602001015196508a816002026001018151811061113557fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061115f57fe5b6020908102919091010152600101611102565b5080156111d55789600185038151811061118857fe5b6020026020010151955087836010811061119e57fe5b602002015160001b945085602088015284604088015286805190602001208a83815181106111c857fe5b6020026020010181815250505b806111e15760006111e4565b60015b60ff16820193506001909201916110ea565b8960008151811061120357fe5b602002602001015198505050505050505050919050565b602890811b91909117901b90565b600067ffffffffffffffff83111561123c57fe5b61124f601f8401601f19166020016119b8565b905082815283838301111561126357600080fd5b828260208301376000602084830101529392505050565b600082601f83011261128a578081fd5b8135602067ffffffffffffffff8211156112a057fe5b8082026112ae8282016119b8565b8381528281019086840183880185018910156112c8578687fd5b8693505b858410156112ea5780358352600193909301929184019184016112cc565b50979650505050505050565b600060a08284031215611307578081fd5b60405160a0810167ffffffffffffffff828210818311171561132557fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561136257600080fd5b508301601f8101851361137457600080fd5b61138385823560208401611228565b6080830152505092915050565b600080604083850312156113a2578182fd5b823567ffffffffffffffff8111156113b8578283fd5b6113c48582860161127a565b95602094909401359450505050565b6000602082840312156113e4578081fd5b81518015158114610b8b578182fd5b600060208284031215611404578081fd5b815164ffffffffff1981168114610b8b578182fd5b60006020828403121561142a578081fd5b5051919050565b600080600060608486031215611445578081fd5b83359250602084013567ffffffffffffffff80821115611463578283fd5b61146f878388016112f6565b93506040860135915080821115611484578283fd5b9085019060408288031215611497578283fd5b6040516040810181811083821117156114ac57fe5b604052823581526020830135828111156114c4578485fd5b6114d08982860161127a565b6020830152508093505050509250925092565b6000602082840312156114f4578081fd5b813567ffffffffffffffff81111561150a578182fd5b8201601f8101841361151a578182fd5b61152984823560208401611228565b949350505050565b600060208284031215611542578081fd5b813567ffffffffffffffff811115611558578182fd5b611529848285016112f6565b60008060408385031215611576578182fd5b825160208401519092506001600160a01b0381168114611594578182fd5b809150509250929050565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b91825264ffffffffff1916602082015260400190565b600085825260208581840152846040840152608060608401528351806080850152825b8181101561161c5785810183015185820160a001528201611600565b8181111561162d578360a083870101525b50601f01601f19169290920160a0019695505050505050565b60208082526049908201527f4e756d626572206f6620737461746520726f6f74732063616e6e6f742065786360408201527f65656420746865206e756d626572206f662063616e6f6e6963616c207472616e60608201526839b0b1ba34b7b7399760b91b608082015260a00190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b602080825260409082018190527f537461746520626174636865732063616e206f6e6c792062652064656c657465908201527f642077697468696e207468652066726175642070726f6f662077696e646f772e606082015260800190565b6020808252603b908201527f537461746520626174636865732063616e206f6e6c792062652064656c65746560408201527f6420627920746865204f564d5f467261756456657269666965722e0000000000606082015260800190565b60208082526025908201527f4261746368206865616465722074696d657374616d702063616e6e6f74206265604082015264207a65726f60d81b606082015260800190565b60208082526023908201527f43616e6e6f74207375626d697420616e20656d7074792073746174652062617460408201526231b41760e91b606082015260800190565b6020808252602f908201527f50726f706f73657220646f6573206e6f74206861766520656e6f75676820636f60408201526e1b1b185d195c985b081c1bdcdd1959608a1b606082015260800190565b60208082526043908201527f43616e6e6f74207075626c69736820737461746520726f6f747320776974686960408201527f6e207468652073657175656e636572207075626c69636174696f6e2077696e6460608201526237bb9760e91b608082015260a00190565b60208082526014908201527324b73b30b634b2103130ba31b41034b73232bc1760611b604082015260600190565b9182526001600160a01b0316602082015260400190565b60405181810167ffffffffffffffff811182821017156119d457fe5b60405291905056fe4c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4f564d5f436861696e53746f72616765436f6e7461696e65723a5343433a626174636865734c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea26469706673582212209a79aee928c48a8e868127cc94d1fe1eb4eea95e98e6709cd65bda19d650209064736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"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/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@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\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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 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_Proposer\\\");\\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 // For efficiency reasons getMerkleRoot modifies the `_batch` argument in place\\n // while calculating the root hash therefore any arguments passed to it must not\\n // be used again afterwards\\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\":\"0x12cc020811ca6a41cbad48c2e6b812c1eeaca1dde65e09b4b51a1891e0872d92\",\"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 * 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\",\"keccak256\":\"0x180b9c347e20f1a6efa553b0f2b9a59aebceda92a7484ae6fca4da2bf1d960c3\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"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 * Note that the _elements argument is modified, therefore it must not be used again afterwards\\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 pure\\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 == 1) {\\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 (uint256 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\":\"0xa78edb9fbd34712771a1ebff05bc5e1abec7fc1e9a1bfb709d183099b44fa62a\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50604051611bee380380611bee83398101604081905261002f9161005b565b600080546001600160a01b0319166001600160a01b03949094169390931790925560015560025561009c565b60008060006060848603121561006f578283fd5b83516001600160a01b0381168114610085578384fd5b602085015160409095015190969495509392505050565b611b43806100ab6000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80638ca5cbb9116100715780638ca5cbb91461012f5780639418bddd14610144578063b8e189ac14610157578063c17b291b1461016a578063cfdf677e14610172578063e561dddc1461017a576100b4565b8063299ca478146100b9578063461a4478146100d75780634d69ee57146100ea5780637aa63a861461010a5780637ad168a01461011f57806381eb62ef14610127575b600080fd5b6100c1610182565b6040516100ce919061159f565b60405180910390f35b6100c16100e53660046114e3565b610191565b6100fd6100f8366004611431565b61026f565b6040516100ce91906115b3565b6101126102e2565b6040516100ce91906115be565b6101126102fb565b610112610314565b61014261013d366004611390565b61031a565b005b6100fd610152366004611531565b61052e565b610142610165366004611531565b61057e565b610112610636565b6100c161063c565b610112610664565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156101f15781810151838201526020016101d9565b50505050905090810190601f16801561021e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561023b57600080fd5b505afa15801561024f573d6000803e3d6000fd5b505050506040513d602081101561026557600080fd5b505190505b919050565b600061027a836106de565b61029f5760405162461bcd60e51b815260040161029690611749565b60405180910390fd5b6102bc836020015185846000015185602001518760400151610776565b6102d85760405162461bcd60e51b8152600401610296906116b5565b5060019392505050565b6000806102ed6108fb565b5064ffffffffff1691505090565b6000806103066108fb565b64ffffffffff169250505090565b60025481565b6103226102e2565b81146103405760405162461bcd60e51b8152600401610296906116ec565b6103706040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b815250610191565b6001600160a01b03166302ad4d2a336040518263ffffffff1660e01b815260040161039b919061159f565b60206040518083038186803b1580156103b357600080fd5b505afa1580156103c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103eb91906113d3565b6104075760405162461bcd60e51b8152600401610296906118bb565b60008251116104285760405162461bcd60e51b815260040161029690611878565b6104666040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e000000815250610191565b6001600160a01b0316637aa63a866040518163ffffffff1660e01b815260040160206040518083038186803b15801561049e57600080fd5b505afa1580156104b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d69190611419565b82516104e06102e2565b0111156104ff5760405162461bcd60e51b815260040161029690611646565b61052a8242336040516020016105169291906119a1565b604051602081830303815290604052610990565b5050565b60008082608001518060200190518101906105499190611564565b509050806105695760405162461bcd60e51b815260040161029690611833565b4261057682600154610b31565b119392505050565b6105b06040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b815250610191565b6001600160a01b0316336001600160a01b0316146105e05760405162461bcd60e51b8152600401610296906117d6565b6105e9816106de565b6106055760405162461bcd60e51b815260040161029690611749565b61060e8161052e565b61062a5760405162461bcd60e51b815260040161029690611778565b61063381610b92565b50565b60015481565b600061065f604051806060016040528060258152602001611a6860259139610191565b905090565b600061066e61063c565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156106a657600080fd5b505afa1580156106ba573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065f9190611419565b60006106e861063c565b8251604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a91610716916004016115be565b60206040518083038186803b15801561072e57600080fd5b505afa158015610742573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107669190611419565b61076f83610d0a565b1492915050565b60008082116107b65760405162461bcd60e51b8152600401808060200182810382526037815260200180611a316037913960400191505060405180910390fd5b8184106107f45760405162461bcd60e51b81526004018080602001828103825260248152602001806119dd6024913960400191505060405180910390fd5b6107fd82610d50565b83511461083b5760405162461bcd60e51b815260040180806020018281038252604d815260200180611a8d604d913960600191505060405180910390fd5b8460005b84518110156108ee57856001166001141561089d5784818151811061086057fe5b60200260200101518260405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091506108e2565b818582815181106108aa57fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c950161083f565b5090951495945050505050565b600080600061090861063c565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b15801561094057600080fd5b505afa158015610954573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097891906113f3565b64ffffffffff602882901c16935060501c9150509091565b60006109bf6040518060400160405280600c81526020016b27ab26afa83937b837b9b2b960a11b815250610191565b90506000806109cc6108fb565b9092509050336001600160a01b03841614156109e9575042610a13565b426002548264ffffffffff160110610a135760405162461bcd60e51b81526004016102969061190a565b60006040518060a00160405280610a28610664565b8152602001610a3688610de6565b8152602001875181526020018464ffffffffff16815260200186815250905080600001517f16be4c5129a4e03cf3350262e181dc02ddfb4a6008d925368c0899fcd97ca9c58260200151836040015184606001518560800151604051610a9f94939291906115dd565b60405180910390a2610aaf61063c565b6001600160a01b0316632015276c610ac683610d0a565b610ada84604001518560600151018661121a565b6040518363ffffffff1660e01b8152600401610af79291906115c7565b600060405180830381600087803b158015610b1157600080fd5b505af1158015610b25573d6000803e3d6000fd5b50505050505050505050565b600082820183811015610b8b576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b610b9a61063c565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610bd257600080fd5b505afa158015610be6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0a9190611419565b815110610c295760405162461bcd60e51b815260040161029690611973565b610c32816106de565b610c4e5760405162461bcd60e51b815260040161029690611749565b610c5661063c565b6001600160a01b031663167fd6818260000151610c788460600151600061121a565b6040518363ffffffff1660e01b8152600401610c959291906115c7565b600060405180830381600087803b158015610caf57600080fd5b505af1158015610cc3573d6000803e3d6000fd5b5050505080600001517f8747b69ce8fdb31c3b9b0a67bd8049ad8c1a69ea417b69b12174068abd9cbd648260200151604051610cff91906115be565b60405180910390a250565b60008160200151826040015183606001518460800151604051602001610d3394939291906115dd565b604051602081830303815290604052805190602001209050919050565b6000808211610d905760405162461bcd60e51b8152600401808060200182810382526030815260200180611a016030913960400191505060405180910390fd5b8160011415610da15750600061026a565b81600060805b60018110610dd1576000196001821b01811b831615610dc95791821c91908101905b60011c610da7565b506001811b8414610b8b576001019392505050565b600080825111610e275760405162461bcd60e51b8152600401808060200182810382526034815260200180611ada6034913960400191505060405180910390fd5b815160011415610e4d5781600081518110610e3e57fe5b6020026020010151905061026a565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b60018411156111f65750506002820460018084161460005b82811015611172578a816002028151811061111957fe5b602002602001015196508a816002026001018151811061113557fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061115f57fe5b6020908102919091010152600101611102565b5080156111d55789600185038151811061118857fe5b6020026020010151955087836010811061119e57fe5b602002015160001b945085602088015284604088015286805190602001208a83815181106111c857fe5b6020026020010181815250505b806111e15760006111e4565b60015b60ff16820193506001909201916110ea565b8960008151811061120357fe5b602002602001015198505050505050505050919050565b602890811b91909117901b90565b600067ffffffffffffffff83111561123c57fe5b61124f601f8401601f19166020016119b8565b905082815283838301111561126357600080fd5b828260208301376000602084830101529392505050565b600082601f83011261128a578081fd5b8135602067ffffffffffffffff8211156112a057fe5b8082026112ae8282016119b8565b8381528281019086840183880185018910156112c8578687fd5b8693505b858410156112ea5780358352600193909301929184019184016112cc565b50979650505050505050565b600060a08284031215611307578081fd5b60405160a0810167ffffffffffffffff828210818311171561132557fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561136257600080fd5b508301601f8101851361137457600080fd5b61138385823560208401611228565b6080830152505092915050565b600080604083850312156113a2578182fd5b823567ffffffffffffffff8111156113b8578283fd5b6113c48582860161127a565b95602094909401359450505050565b6000602082840312156113e4578081fd5b81518015158114610b8b578182fd5b600060208284031215611404578081fd5b815164ffffffffff1981168114610b8b578182fd5b60006020828403121561142a578081fd5b5051919050565b600080600060608486031215611445578081fd5b83359250602084013567ffffffffffffffff80821115611463578283fd5b61146f878388016112f6565b93506040860135915080821115611484578283fd5b9085019060408288031215611497578283fd5b6040516040810181811083821117156114ac57fe5b604052823581526020830135828111156114c4578485fd5b6114d08982860161127a565b6020830152508093505050509250925092565b6000602082840312156114f4578081fd5b813567ffffffffffffffff81111561150a578182fd5b8201601f8101841361151a578182fd5b61152984823560208401611228565b949350505050565b600060208284031215611542578081fd5b813567ffffffffffffffff811115611558578182fd5b611529848285016112f6565b60008060408385031215611576578182fd5b825160208401519092506001600160a01b0381168114611594578182fd5b809150509250929050565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b91825264ffffffffff1916602082015260400190565b600085825260208581840152846040840152608060608401528351806080850152825b8181101561161c5785810183015185820160a001528201611600565b8181111561162d578360a083870101525b50601f01601f19169290920160a0019695505050505050565b60208082526049908201527f4e756d626572206f6620737461746520726f6f74732063616e6e6f742065786360408201527f65656420746865206e756d626572206f662063616e6f6e6963616c207472616e60608201526839b0b1ba34b7b7399760b91b608082015260a00190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b602080825260409082018190527f537461746520626174636865732063616e206f6e6c792062652064656c657465908201527f642077697468696e207468652066726175642070726f6f662077696e646f772e606082015260800190565b6020808252603b908201527f537461746520626174636865732063616e206f6e6c792062652064656c65746560408201527f6420627920746865204f564d5f467261756456657269666965722e0000000000606082015260800190565b60208082526025908201527f4261746368206865616465722074696d657374616d702063616e6e6f74206265604082015264207a65726f60d81b606082015260800190565b60208082526023908201527f43616e6e6f74207375626d697420616e20656d7074792073746174652062617460408201526231b41760e91b606082015260800190565b6020808252602f908201527f50726f706f73657220646f6573206e6f74206861766520656e6f75676820636f60408201526e1b1b185d195c985b081c1bdcdd1959608a1b606082015260800190565b60208082526043908201527f43616e6e6f74207075626c69736820737461746520726f6f747320776974686960408201527f6e207468652073657175656e636572207075626c69636174696f6e2077696e6460608201526237bb9760e91b608082015260a00190565b60208082526014908201527324b73b30b634b2103130ba31b41034b73232bc1760611b604082015260600190565b9182526001600160a01b0316602082015260400190565b60405181810167ffffffffffffffff811182821017156119d457fe5b60405291905056fe4c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4f564d5f436861696e53746f72616765436f6e7461696e65722d5343432d626174636865734c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea2646970667358221220fe58eec60e1130e9f94565e6ea97ae3f590e96eeda1a972687d27ab93f7f7df464736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80638ca5cbb9116100715780638ca5cbb91461012f5780639418bddd14610144578063b8e189ac14610157578063c17b291b1461016a578063cfdf677e14610172578063e561dddc1461017a576100b4565b8063299ca478146100b9578063461a4478146100d75780634d69ee57146100ea5780637aa63a861461010a5780637ad168a01461011f57806381eb62ef14610127575b600080fd5b6100c1610182565b6040516100ce919061159f565b60405180910390f35b6100c16100e53660046114e3565b610191565b6100fd6100f8366004611431565b61026f565b6040516100ce91906115b3565b6101126102e2565b6040516100ce91906115be565b6101126102fb565b610112610314565b61014261013d366004611390565b61031a565b005b6100fd610152366004611531565b61052e565b610142610165366004611531565b61057e565b610112610636565b6100c161063c565b610112610664565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156101f15781810151838201526020016101d9565b50505050905090810190601f16801561021e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561023b57600080fd5b505afa15801561024f573d6000803e3d6000fd5b505050506040513d602081101561026557600080fd5b505190505b919050565b600061027a836106de565b61029f5760405162461bcd60e51b815260040161029690611749565b60405180910390fd5b6102bc836020015185846000015185602001518760400151610776565b6102d85760405162461bcd60e51b8152600401610296906116b5565b5060019392505050565b6000806102ed6108fb565b5064ffffffffff1691505090565b6000806103066108fb565b64ffffffffff169250505090565b60025481565b6103226102e2565b81146103405760405162461bcd60e51b8152600401610296906116ec565b6103706040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b815250610191565b6001600160a01b03166302ad4d2a336040518263ffffffff1660e01b815260040161039b919061159f565b60206040518083038186803b1580156103b357600080fd5b505afa1580156103c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103eb91906113d3565b6104075760405162461bcd60e51b8152600401610296906118bb565b60008251116104285760405162461bcd60e51b815260040161029690611878565b6104666040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e000000815250610191565b6001600160a01b0316637aa63a866040518163ffffffff1660e01b815260040160206040518083038186803b15801561049e57600080fd5b505afa1580156104b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d69190611419565b82516104e06102e2565b0111156104ff5760405162461bcd60e51b815260040161029690611646565b61052a8242336040516020016105169291906119a1565b604051602081830303815290604052610990565b5050565b60008082608001518060200190518101906105499190611564565b509050806105695760405162461bcd60e51b815260040161029690611833565b4261057682600154610b31565b119392505050565b6105b06040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b815250610191565b6001600160a01b0316336001600160a01b0316146105e05760405162461bcd60e51b8152600401610296906117d6565b6105e9816106de565b6106055760405162461bcd60e51b815260040161029690611749565b61060e8161052e565b61062a5760405162461bcd60e51b815260040161029690611778565b61063381610b92565b50565b60015481565b600061065f604051806060016040528060258152602001611a6860259139610191565b905090565b600061066e61063c565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156106a657600080fd5b505afa1580156106ba573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065f9190611419565b60006106e861063c565b8251604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a91610716916004016115be565b60206040518083038186803b15801561072e57600080fd5b505afa158015610742573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107669190611419565b61076f83610d0a565b1492915050565b60008082116107b65760405162461bcd60e51b8152600401808060200182810382526037815260200180611a316037913960400191505060405180910390fd5b8184106107f45760405162461bcd60e51b81526004018080602001828103825260248152602001806119dd6024913960400191505060405180910390fd5b6107fd82610d50565b83511461083b5760405162461bcd60e51b815260040180806020018281038252604d815260200180611a8d604d913960600191505060405180910390fd5b8460005b84518110156108ee57856001166001141561089d5784818151811061086057fe5b60200260200101518260405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091506108e2565b818582815181106108aa57fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c950161083f565b5090951495945050505050565b600080600061090861063c565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b15801561094057600080fd5b505afa158015610954573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097891906113f3565b64ffffffffff602882901c16935060501c9150509091565b60006109bf6040518060400160405280600c81526020016b27ab26afa83937b837b9b2b960a11b815250610191565b90506000806109cc6108fb565b9092509050336001600160a01b03841614156109e9575042610a13565b426002548264ffffffffff160110610a135760405162461bcd60e51b81526004016102969061190a565b60006040518060a00160405280610a28610664565b8152602001610a3688610de6565b8152602001875181526020018464ffffffffff16815260200186815250905080600001517f16be4c5129a4e03cf3350262e181dc02ddfb4a6008d925368c0899fcd97ca9c58260200151836040015184606001518560800151604051610a9f94939291906115dd565b60405180910390a2610aaf61063c565b6001600160a01b0316632015276c610ac683610d0a565b610ada84604001518560600151018661121a565b6040518363ffffffff1660e01b8152600401610af79291906115c7565b600060405180830381600087803b158015610b1157600080fd5b505af1158015610b25573d6000803e3d6000fd5b50505050505050505050565b600082820183811015610b8b576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b610b9a61063c565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610bd257600080fd5b505afa158015610be6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0a9190611419565b815110610c295760405162461bcd60e51b815260040161029690611973565b610c32816106de565b610c4e5760405162461bcd60e51b815260040161029690611749565b610c5661063c565b6001600160a01b031663167fd6818260000151610c788460600151600061121a565b6040518363ffffffff1660e01b8152600401610c959291906115c7565b600060405180830381600087803b158015610caf57600080fd5b505af1158015610cc3573d6000803e3d6000fd5b5050505080600001517f8747b69ce8fdb31c3b9b0a67bd8049ad8c1a69ea417b69b12174068abd9cbd648260200151604051610cff91906115be565b60405180910390a250565b60008160200151826040015183606001518460800151604051602001610d3394939291906115dd565b604051602081830303815290604052805190602001209050919050565b6000808211610d905760405162461bcd60e51b8152600401808060200182810382526030815260200180611a016030913960400191505060405180910390fd5b8160011415610da15750600061026a565b81600060805b60018110610dd1576000196001821b01811b831615610dc95791821c91908101905b60011c610da7565b506001811b8414610b8b576001019392505050565b600080825111610e275760405162461bcd60e51b8152600401808060200182810382526034815260200180611ada6034913960400191505060405180910390fd5b815160011415610e4d5781600081518110610e3e57fe5b6020026020010151905061026a565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b60018411156111f65750506002820460018084161460005b82811015611172578a816002028151811061111957fe5b602002602001015196508a816002026001018151811061113557fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061115f57fe5b6020908102919091010152600101611102565b5080156111d55789600185038151811061118857fe5b6020026020010151955087836010811061119e57fe5b602002015160001b945085602088015284604088015286805190602001208a83815181106111c857fe5b6020026020010181815250505b806111e15760006111e4565b60015b60ff16820193506001909201916110ea565b8960008151811061120357fe5b602002602001015198505050505050505050919050565b602890811b91909117901b90565b600067ffffffffffffffff83111561123c57fe5b61124f601f8401601f19166020016119b8565b905082815283838301111561126357600080fd5b828260208301376000602084830101529392505050565b600082601f83011261128a578081fd5b8135602067ffffffffffffffff8211156112a057fe5b8082026112ae8282016119b8565b8381528281019086840183880185018910156112c8578687fd5b8693505b858410156112ea5780358352600193909301929184019184016112cc565b50979650505050505050565b600060a08284031215611307578081fd5b60405160a0810167ffffffffffffffff828210818311171561132557fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561136257600080fd5b508301601f8101851361137457600080fd5b61138385823560208401611228565b6080830152505092915050565b600080604083850312156113a2578182fd5b823567ffffffffffffffff8111156113b8578283fd5b6113c48582860161127a565b95602094909401359450505050565b6000602082840312156113e4578081fd5b81518015158114610b8b578182fd5b600060208284031215611404578081fd5b815164ffffffffff1981168114610b8b578182fd5b60006020828403121561142a578081fd5b5051919050565b600080600060608486031215611445578081fd5b83359250602084013567ffffffffffffffff80821115611463578283fd5b61146f878388016112f6565b93506040860135915080821115611484578283fd5b9085019060408288031215611497578283fd5b6040516040810181811083821117156114ac57fe5b604052823581526020830135828111156114c4578485fd5b6114d08982860161127a565b6020830152508093505050509250925092565b6000602082840312156114f4578081fd5b813567ffffffffffffffff81111561150a578182fd5b8201601f8101841361151a578182fd5b61152984823560208401611228565b949350505050565b600060208284031215611542578081fd5b813567ffffffffffffffff811115611558578182fd5b611529848285016112f6565b60008060408385031215611576578182fd5b825160208401519092506001600160a01b0381168114611594578182fd5b809150509250929050565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b91825264ffffffffff1916602082015260400190565b600085825260208581840152846040840152608060608401528351806080850152825b8181101561161c5785810183015185820160a001528201611600565b8181111561162d578360a083870101525b50601f01601f19169290920160a0019695505050505050565b60208082526049908201527f4e756d626572206f6620737461746520726f6f74732063616e6e6f742065786360408201527f65656420746865206e756d626572206f662063616e6f6e6963616c207472616e60608201526839b0b1ba34b7b7399760b91b608082015260a00190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b602080825260409082018190527f537461746520626174636865732063616e206f6e6c792062652064656c657465908201527f642077697468696e207468652066726175642070726f6f662077696e646f772e606082015260800190565b6020808252603b908201527f537461746520626174636865732063616e206f6e6c792062652064656c65746560408201527f6420627920746865204f564d5f467261756456657269666965722e0000000000606082015260800190565b60208082526025908201527f4261746368206865616465722074696d657374616d702063616e6e6f74206265604082015264207a65726f60d81b606082015260800190565b60208082526023908201527f43616e6e6f74207375626d697420616e20656d7074792073746174652062617460408201526231b41760e91b606082015260800190565b6020808252602f908201527f50726f706f73657220646f6573206e6f74206861766520656e6f75676820636f60408201526e1b1b185d195c985b081c1bdcdd1959608a1b606082015260800190565b60208082526043908201527f43616e6e6f74207075626c69736820737461746520726f6f747320776974686960408201527f6e207468652073657175656e636572207075626c69636174696f6e2077696e6460608201526237bb9760e91b608082015260a00190565b60208082526014908201527324b73b30b634b2103130ba31b41034b73232bc1760611b604082015260600190565b9182526001600160a01b0316602082015260400190565b60405181810167ffffffffffffffff811182821017156119d457fe5b60405291905056fe4c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4f564d5f436861696e53746f72616765436f6e7461696e65722d5343432d626174636865734c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea2646970667358221220fe58eec60e1130e9f94565e6ea97ae3f590e96eeda1a972687d27ab93f7f7df464736f6c63430007060033", "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", @@ -489,15 +489,15 @@ "storageLayout": { "storage": [ { - "astId": 12800, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol:OVM_StateCommitmentChain", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12793" + "type": "t_contract(Lib_AddressManager)15296" }, { - "astId": 4678, + "astId": 6159, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol:OVM_StateCommitmentChain", "label": "FRAUD_PROOF_WINDOW", "offset": 0, @@ -505,7 +505,7 @@ "type": "t_uint256" }, { - "astId": 4680, + "astId": 6161, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol:OVM_StateCommitmentChain", "label": "SEQUENCER_PUBLISH_WINDOW", "offset": 0, @@ -514,7 +514,7 @@ } ], "types": { - "t_contract(Lib_AddressManager)12793": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" diff --git a/packages/contracts/deployments/kovan/OVM_StateManagerFactory.json b/packages/contracts/deployments/kovan/OVM_StateManagerFactory.json index bda9b91247e6..05a8e5b5fea5 100644 --- a/packages/contracts/deployments/kovan/OVM_StateManagerFactory.json +++ b/packages/contracts/deployments/kovan/OVM_StateManagerFactory.json @@ -1,5 +1,5 @@ { - "address": "0x3b96673C9e24D362501e87B239F60543e20beD50", + "address": "0xBcca22E9F5579193E27dD39aD821A03778C44EFA", "abi": [ { "inputs": [ @@ -21,27 +21,27 @@ "type": "function" } ], - "transactionHash": "0x9926548d5337a7b624a7c7aa3d4ea80c4e9a2fc3afaef0bfc634b19145bb56c1", + "transactionHash": "0xbefc4a1ae11208ff417f3167fcabd956d94f4fd8ae832129c13e5d394b303932", "receipt": { "to": null, "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", - "contractAddress": "0x3b96673C9e24D362501e87B239F60543e20beD50", - "transactionIndex": 1, + "contractAddress": "0xBcca22E9F5579193E27dD39aD821A03778C44EFA", + "transactionIndex": 2, "gasUsed": "1170970", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x20e3b8b73d8c3667eed92aa3bc04339f6a2c45f7d7bc3e7887163bed2bde2240", - "transactionHash": "0x9926548d5337a7b624a7c7aa3d4ea80c4e9a2fc3afaef0bfc634b19145bb56c1", + "blockHash": "0xb0130c9836442cb4f4c73c270246496ba977f812b52c56872ab995ee92f5f234", + "transactionHash": "0xbefc4a1ae11208ff417f3167fcabd956d94f4fd8ae832129c13e5d394b303932", "logs": [], - "blockNumber": 24572858, - "cumulativeGasUsed": "1215716", + "blockNumber": 25502632, + "cumulativeGasUsed": "1357067", "status": 1, "byzantium": true }, "args": [], - "solcInputHash": "5ee8e508e2c54cb5ac6783b4855b1558", - "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\":\"\",\"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\":{\"_0\":\"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 * 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 * Variables *\\n *************/\\n\\n address override public owner;\\n address override public ovmExecutionManager;\\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 {\\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 *\\n ********************/\\n\\n /**\\n * Checks whether a given address is allowed to modify this contract.\\n * @param _address Address to check.\\n * @return Whether or not the address can modify this contract.\\n */\\n function isAuthenticated(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n bool\\n )\\n {\\n return (_address == owner || _address == ovmExecutionManager);\\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 * 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 for the given address.\\n */\\n function getAccount(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n Lib_OVMCodec.Account memory\\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 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\\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 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\\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 of the account.\\n */\\n function getAccountNonce(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n uint256\\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 Corresponding Ethereum address.\\n */\\n function getAccountEthAddress(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n address\\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 Corresponding storage root.\\n */\\n function getAccountStorageRoot(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n bytes32\\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 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\\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 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\\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 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\\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 uncommitted accounts.\\n */\\n function getTotalUncommittedAccounts()\\n override\\n public\\n view\\n returns (\\n uint256\\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 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\\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 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\\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 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\\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 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\\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 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\\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 uncommitted storage slots.\\n */\\n function getTotalUncommittedContractStorage()\\n override\\n public\\n view\\n returns (\\n uint256\\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 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\\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\":\"0x0df9654f9f958038435c2b2a2c7793b20fa16afe866a69cbed32a371aaa4c78b\",\"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 *\\n ********************/\\n\\n /**\\n * Creates a new OVM_StateManager\\n * @param _owner Owner of the created contract.\\n * @return New OVM_StateManager instance.\\n */\\n function create(\\n address _owner\\n )\\n override\\n public\\n returns (\\n iOVM_StateManager\\n )\\n {\\n return new OVM_StateManager(_owner);\\n }\\n}\\n\",\"keccak256\":\"0xc557f05b8a82eee7b36a389795fe4acc0803bcf5ae33e15e9cba8226e9ab49fc\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xa5195afe32fb2cf104d156e8f4bd39df1ec79bf6ba232097b9e8e0ee14fbc298\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50611437806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80639ed9331814610030575b600080fd5b6100566004803603602081101561004657600080fd5b50356001600160a01b0316610072565b604080516001600160a01b039092168252519081900360200190f35b600081604051610081906100b5565b6001600160a01b03909116815260405190819003602001906000f0801580156100ae573d6000803e3d6000fd5b5092915050565b61133f806100c38339019056fe608060405234801561001057600080fd5b5060405161133f38038061133f83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b6112ae806100916000396000f3fe608060405234801561001057600080fd5b50600436106101f05760003560e01c80638f3b96471161010f578063d126199f116100a2578063e90abb8611610071578063e90abb86146103f9578063fb37b31c1461040c578063fbcbc0f11461041f578063fcf149a21461043f576101f0565b8063d126199f146103b8578063d15d4150146103cb578063d54414c8146103de578063d7bd4a2a146103f1576101f0565b8063c3fd9b25116100de578063c3fd9b2514610377578063c7650bf21461037f578063c8e40fbf14610392578063d0a215f2146103a5576101f0565b80638f3b96471461033657806399056ba914610349578063af37b86414610351578063af3dc01114610364576101f0565b806333f94305116101875780636f3c75af116101565780636f3c75af146102f55780637c8ee703146103085780637e86faa81461031b5780638da5cb5b1461032e576101f0565b806333f94305146102b25780635c17d629146102ba5780636b18e4e8146102cd5780636c87ad20146102e0576101f0565b8063167020d2116101c3578063167020d2146102595780631aaf392f1461026c5780631b208a5a1461028c57806326dc5b121461029f576101f0565b806307a12945146101f55780630ad226791461021e57806311b1f790146102315780631381ba4d14610244575b600080fd5b61020861020336600461101d565b610452565b60405161021591906111c4565b60405180910390f35b61020861022c366004611072565b6104ba565b61020861023f36600461101d565b610517565b61025761025236600461101d565b610573565b005b61020861026736600461101d565b6105d4565b61027f61027a366004611072565b610679565b60405161021591906111cf565b61020861029a36600461101d565b610727565b61027f6102ad36600461101d565b61075e565b61025761077d565b6102576102c836600461109b565b6107c7565b6102576102db36600461101d565b61089a565b6102e8610944565b60405161021591906111b0565b610208610303366004611072565b610953565b6102e861031636600461101d565b61098c565b610208610329366004611072565b6109ad565b6102e86109c3565b6102576103443660046110cd565b6109d2565b61027f610a88565b61020861035f366004611072565b610a8e565b610208610372366004611072565b610ae2565b610257610b2f565b61020861038d366004611072565b610b79565b6102086103a036600461101d565b610c20565b6102576103b3366004611037565b610c40565b61027f6103c636600461101d565b610cb9565b6102086103d936600461101d565b610cd4565b6102086103ec36600461101d565b610d01565b61027f610d16565b610257610407366004611072565b610d1c565b61020861041a36600461101d565b610d77565b61043261042d36600461101d565b610dc3565b604051610215919061122e565b61025761044d36600461101d565b610e37565b6001600160a01b0381166000908152600260205260408120600301547fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4701480156104b257506001600160a01b038216600090815260026020526040902054155b90505b919050565b6001600160a01b038216600090815260046020908152604080832084845290915281205460ff168061050e57506001600160a01b038316600090815260026020526040902060040154600160a01b900460ff165b90505b92915050565b600080546001600160a01b031633148061053b57506001546001600160a01b031633145b6105605760405162461bcd60e51b8152600401610557906111d8565b60405180910390fd5b6104b261056c83610ef8565b6002610f28565b6000546001600160a01b031633148061059657506001546001600160a01b031633145b6105b25760405162461bcd60e51b8152600401610557906111d8565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b03163314806105f857506001546001600160a01b031633145b6106145760405162461bcd60e51b8152600401610557906111d8565b600061061f83610ef8565b9050600260008281526005602052604090205460ff16600381111561064057fe5b1461064f5760009150506104b5565b6000908152600560205260409020805460ff19166003179055505060068054600019019055600190565b6001600160a01b038216600090815260046020908152604080832084845290915281205460ff161580156106cf57506001600160a01b038316600090815260026020526040902060040154600160a01b900460ff165b156106dc57506000610511565b506001600160a01b0391909116600090815260036020908152604080832093835292905220547ffeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef1890565b60008061073383610ef8565b905060025b60008281526005602052604090205460ff16600381111561075557fe5b10159392505050565b6001600160a01b03166000908152600260208190526040909120015490565b6000546001600160a01b03163314806107a057506001546001600160a01b031633145b6107bc5760405162461bcd60e51b8152600401610557906111d8565b600680546001019055565b6000546001600160a01b03163314806107ea57506001546001600160a01b031633145b6108065760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b038316600081815260036020908152604080832086845282528083207ffeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef86189055928252600481528282208583529052205460ff16610895576001600160a01b03831660009081526004602090815260408083208584529091529020805460ff191660011790555b505050565b6000546001600160a01b03163314806108bd57506001546001600160a01b031633145b6108d95760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b031660009081526002602081905260409091207f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421918101919091557fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470600390910155565b6001546001600160a01b031681565b6000806109608484610f8e565b905060025b60008281526005602052604090205460ff16600381111561098257fe5b1015949350505050565b6001600160a01b039081166000908152600260205260409020600401541690565b6000806109ba8484610f8e565b90506003610965565b6000546001600160a01b031681565b6000546001600160a01b03163314806109f557506001546001600160a01b031633145b610a115760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b039182166000908152600260208181526040928390208451815590840151600182015591830151908201556060820151600382015560808201516004909101805460a0909301516001600160a01b0319909316919093161760ff60a01b1916600160a01b91151591909102179055565b60075490565b600080546001600160a01b0316331480610ab257506001546001600160a01b031633145b610ace5760405162461bcd60e51b8152600401610557906111d8565b61050e610adb8484610f8e565b6001610f28565b600080546001600160a01b0316331480610b0657506001546001600160a01b031633145b610b225760405162461bcd60e51b8152600401610557906111d8565b61050e61056c8484610f8e565b6000546001600160a01b0316331480610b5257506001546001600160a01b031633145b610b6e5760405162461bcd60e51b8152600401610557906111d8565b600780546001019055565b600080546001600160a01b0316331480610b9d57506001546001600160a01b031633145b610bb95760405162461bcd60e51b8152600401610557906111d8565b6000610bc58484610f8e565b9050600260008281526005602052604090205460ff166003811115610be657fe5b14610bf5576000915050610511565b6000908152600560205260409020805460ff1916600317905550506007805460001901905550600190565b6001600160a01b0316600090815260026020526040902060030154151590565b6000546001600160a01b0316331480610c6357506001546001600160a01b031633145b610c7f5760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b0392831660009081526002602052604090206004810180546001600160a01b031916939094169290921790925560030155565b6001600160a01b031660009081526002602052604090205490565b600080546001600160a01b03838116911614806104b25750506001546001600160a01b0390811691161490565b600080610d0d83610ef8565b90506003610738565b60065490565b6000546001600160a01b0316331480610d3f57506001546001600160a01b031633145b610d5b5760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b03909116600090815260026020526040902055565b600080546001600160a01b0316331480610d9b57506001546001600160a01b031633145b610db75760405162461bcd60e51b8152600401610557906111d8565b6104b2610adb83610ef8565b610dcb610fc1565b506001600160a01b03908116600090815260026020818152604092839020835160c08101855281548152600182015492810192909252918201549281019290925260038101546060830152600401549182166080820152600160a01b90910460ff16151560a082015290565b6000546001600160a01b0316331480610e5a57506001546001600160a01b031633145b610e765760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b03166000908152600260208190526040909120600181557f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421918101919091557fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4706003820155600401805460ff60a01b1916600160a01b179055565b600081604051602001610f0b9190611171565b604051602081830303815290604052805190602001209050919050565b600080826003811115610f3757fe5b60008581526005602052604090205460ff166003811115610f5457fe5b101590508061050e576000848152600560205260409020805484919060ff19166001836003811115610f8257fe5b02179055509392505050565b60008282604051602001610fa392919061118e565b60405160208183030381529060405280519060200120905092915050565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a081019190915290565b80356001600160a01b03811681146104b557600080fd5b803580151581146104b557600080fd5b60006020828403121561102e578081fd5b61050e82610ff6565b60008060006060848603121561104b578182fd5b61105484610ff6565b925061106260208501610ff6565b9150604084013590509250925092565b60008060408385031215611084578182fd5b61108d83610ff6565b946020939093013593505050565b6000806000606084860312156110af578283fd5b6110b884610ff6565b95602085013595506040909401359392505050565b60008082840360e08112156110e0578283fd5b6110e984610ff6565b925060c0601f19820112156110fc578182fd5b5060405160c0810181811067ffffffffffffffff8211171561111a57fe5b80604052506020840135815260408401356020820152606084013560408201526080840135606082015261115060a08501610ff6565b608082015261116160c0850161100d565b60a0820152809150509250929050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b60609290921b6bffffffffffffffffffffffff19168252601482015260340190565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b60208082526036908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c65642062792061604082015275757468656e746963617465642061646472657373657360501b606082015260800190565b815181526020808301519082015260408083015190820152606080830151908201526080808301516001600160a01b03169082015260a09182015115159181019190915260c0019056fea26469706673582212205bac84845119d44a384d804ab40cf5b8661877b394d879fd05cdd049485222d964736f6c63430007060033a264697066735822122049d6bdb64f1e5e1bffb7aba87ce3a0db62412188b801b3e899b8b558b75755a364736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80639ed9331814610030575b600080fd5b6100566004803603602081101561004657600080fd5b50356001600160a01b0316610072565b604080516001600160a01b039092168252519081900360200190f35b600081604051610081906100b5565b6001600160a01b03909116815260405190819003602001906000f0801580156100ae573d6000803e3d6000fd5b5092915050565b61133f806100c38339019056fe608060405234801561001057600080fd5b5060405161133f38038061133f83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b6112ae806100916000396000f3fe608060405234801561001057600080fd5b50600436106101f05760003560e01c80638f3b96471161010f578063d126199f116100a2578063e90abb8611610071578063e90abb86146103f9578063fb37b31c1461040c578063fbcbc0f11461041f578063fcf149a21461043f576101f0565b8063d126199f146103b8578063d15d4150146103cb578063d54414c8146103de578063d7bd4a2a146103f1576101f0565b8063c3fd9b25116100de578063c3fd9b2514610377578063c7650bf21461037f578063c8e40fbf14610392578063d0a215f2146103a5576101f0565b80638f3b96471461033657806399056ba914610349578063af37b86414610351578063af3dc01114610364576101f0565b806333f94305116101875780636f3c75af116101565780636f3c75af146102f55780637c8ee703146103085780637e86faa81461031b5780638da5cb5b1461032e576101f0565b806333f94305146102b25780635c17d629146102ba5780636b18e4e8146102cd5780636c87ad20146102e0576101f0565b8063167020d2116101c3578063167020d2146102595780631aaf392f1461026c5780631b208a5a1461028c57806326dc5b121461029f576101f0565b806307a12945146101f55780630ad226791461021e57806311b1f790146102315780631381ba4d14610244575b600080fd5b61020861020336600461101d565b610452565b60405161021591906111c4565b60405180910390f35b61020861022c366004611072565b6104ba565b61020861023f36600461101d565b610517565b61025761025236600461101d565b610573565b005b61020861026736600461101d565b6105d4565b61027f61027a366004611072565b610679565b60405161021591906111cf565b61020861029a36600461101d565b610727565b61027f6102ad36600461101d565b61075e565b61025761077d565b6102576102c836600461109b565b6107c7565b6102576102db36600461101d565b61089a565b6102e8610944565b60405161021591906111b0565b610208610303366004611072565b610953565b6102e861031636600461101d565b61098c565b610208610329366004611072565b6109ad565b6102e86109c3565b6102576103443660046110cd565b6109d2565b61027f610a88565b61020861035f366004611072565b610a8e565b610208610372366004611072565b610ae2565b610257610b2f565b61020861038d366004611072565b610b79565b6102086103a036600461101d565b610c20565b6102576103b3366004611037565b610c40565b61027f6103c636600461101d565b610cb9565b6102086103d936600461101d565b610cd4565b6102086103ec36600461101d565b610d01565b61027f610d16565b610257610407366004611072565b610d1c565b61020861041a36600461101d565b610d77565b61043261042d36600461101d565b610dc3565b604051610215919061122e565b61025761044d36600461101d565b610e37565b6001600160a01b0381166000908152600260205260408120600301547fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4701480156104b257506001600160a01b038216600090815260026020526040902054155b90505b919050565b6001600160a01b038216600090815260046020908152604080832084845290915281205460ff168061050e57506001600160a01b038316600090815260026020526040902060040154600160a01b900460ff165b90505b92915050565b600080546001600160a01b031633148061053b57506001546001600160a01b031633145b6105605760405162461bcd60e51b8152600401610557906111d8565b60405180910390fd5b6104b261056c83610ef8565b6002610f28565b6000546001600160a01b031633148061059657506001546001600160a01b031633145b6105b25760405162461bcd60e51b8152600401610557906111d8565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b03163314806105f857506001546001600160a01b031633145b6106145760405162461bcd60e51b8152600401610557906111d8565b600061061f83610ef8565b9050600260008281526005602052604090205460ff16600381111561064057fe5b1461064f5760009150506104b5565b6000908152600560205260409020805460ff19166003179055505060068054600019019055600190565b6001600160a01b038216600090815260046020908152604080832084845290915281205460ff161580156106cf57506001600160a01b038316600090815260026020526040902060040154600160a01b900460ff165b156106dc57506000610511565b506001600160a01b0391909116600090815260036020908152604080832093835292905220547ffeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef1890565b60008061073383610ef8565b905060025b60008281526005602052604090205460ff16600381111561075557fe5b10159392505050565b6001600160a01b03166000908152600260208190526040909120015490565b6000546001600160a01b03163314806107a057506001546001600160a01b031633145b6107bc5760405162461bcd60e51b8152600401610557906111d8565b600680546001019055565b6000546001600160a01b03163314806107ea57506001546001600160a01b031633145b6108065760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b038316600081815260036020908152604080832086845282528083207ffeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef86189055928252600481528282208583529052205460ff16610895576001600160a01b03831660009081526004602090815260408083208584529091529020805460ff191660011790555b505050565b6000546001600160a01b03163314806108bd57506001546001600160a01b031633145b6108d95760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b031660009081526002602081905260409091207f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421918101919091557fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470600390910155565b6001546001600160a01b031681565b6000806109608484610f8e565b905060025b60008281526005602052604090205460ff16600381111561098257fe5b1015949350505050565b6001600160a01b039081166000908152600260205260409020600401541690565b6000806109ba8484610f8e565b90506003610965565b6000546001600160a01b031681565b6000546001600160a01b03163314806109f557506001546001600160a01b031633145b610a115760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b039182166000908152600260208181526040928390208451815590840151600182015591830151908201556060820151600382015560808201516004909101805460a0909301516001600160a01b0319909316919093161760ff60a01b1916600160a01b91151591909102179055565b60075490565b600080546001600160a01b0316331480610ab257506001546001600160a01b031633145b610ace5760405162461bcd60e51b8152600401610557906111d8565b61050e610adb8484610f8e565b6001610f28565b600080546001600160a01b0316331480610b0657506001546001600160a01b031633145b610b225760405162461bcd60e51b8152600401610557906111d8565b61050e61056c8484610f8e565b6000546001600160a01b0316331480610b5257506001546001600160a01b031633145b610b6e5760405162461bcd60e51b8152600401610557906111d8565b600780546001019055565b600080546001600160a01b0316331480610b9d57506001546001600160a01b031633145b610bb95760405162461bcd60e51b8152600401610557906111d8565b6000610bc58484610f8e565b9050600260008281526005602052604090205460ff166003811115610be657fe5b14610bf5576000915050610511565b6000908152600560205260409020805460ff1916600317905550506007805460001901905550600190565b6001600160a01b0316600090815260026020526040902060030154151590565b6000546001600160a01b0316331480610c6357506001546001600160a01b031633145b610c7f5760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b0392831660009081526002602052604090206004810180546001600160a01b031916939094169290921790925560030155565b6001600160a01b031660009081526002602052604090205490565b600080546001600160a01b03838116911614806104b25750506001546001600160a01b0390811691161490565b600080610d0d83610ef8565b90506003610738565b60065490565b6000546001600160a01b0316331480610d3f57506001546001600160a01b031633145b610d5b5760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b03909116600090815260026020526040902055565b600080546001600160a01b0316331480610d9b57506001546001600160a01b031633145b610db75760405162461bcd60e51b8152600401610557906111d8565b6104b2610adb83610ef8565b610dcb610fc1565b506001600160a01b03908116600090815260026020818152604092839020835160c08101855281548152600182015492810192909252918201549281019290925260038101546060830152600401549182166080820152600160a01b90910460ff16151560a082015290565b6000546001600160a01b0316331480610e5a57506001546001600160a01b031633145b610e765760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b03166000908152600260208190526040909120600181557f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421918101919091557fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4706003820155600401805460ff60a01b1916600160a01b179055565b600081604051602001610f0b9190611171565b604051602081830303815290604052805190602001209050919050565b600080826003811115610f3757fe5b60008581526005602052604090205460ff166003811115610f5457fe5b101590508061050e576000848152600560205260409020805484919060ff19166001836003811115610f8257fe5b02179055509392505050565b60008282604051602001610fa392919061118e565b60405160208183030381529060405280519060200120905092915050565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a081019190915290565b80356001600160a01b03811681146104b557600080fd5b803580151581146104b557600080fd5b60006020828403121561102e578081fd5b61050e82610ff6565b60008060006060848603121561104b578182fd5b61105484610ff6565b925061106260208501610ff6565b9150604084013590509250925092565b60008060408385031215611084578182fd5b61108d83610ff6565b946020939093013593505050565b6000806000606084860312156110af578283fd5b6110b884610ff6565b95602085013595506040909401359392505050565b60008082840360e08112156110e0578283fd5b6110e984610ff6565b925060c0601f19820112156110fc578182fd5b5060405160c0810181811067ffffffffffffffff8211171561111a57fe5b80604052506020840135815260408401356020820152606084013560408201526080840135606082015261115060a08501610ff6565b608082015261116160c0850161100d565b60a0820152809150509250929050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b60609290921b6bffffffffffffffffffffffff19168252601482015260340190565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b60208082526036908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c65642062792061604082015275757468656e746963617465642061646472657373657360501b606082015260800190565b815181526020808301519082015260408083015190820152606080830151908201526080808301516001600160a01b03169082015260a09182015115159181019190915260c0019056fea26469706673582212205bac84845119d44a384d804ab40cf5b8661877b394d879fd05cdd049485222d964736f6c63430007060033a264697066735822122049d6bdb64f1e5e1bffb7aba87ce3a0db62412188b801b3e899b8b558b75755a364736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"\",\"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\":{\"_0\":\"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 * 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 * Variables *\\n *************/\\n\\n address override public owner;\\n address override public ovmExecutionManager;\\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 {\\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 *\\n ********************/\\n\\n /**\\n * Checks whether a given address is allowed to modify this contract.\\n * @param _address Address to check.\\n * @return Whether or not the address can modify this contract.\\n */\\n function isAuthenticated(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n bool\\n )\\n {\\n return (_address == owner || _address == ovmExecutionManager);\\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 * 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 for the given address.\\n */\\n function getAccount(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n Lib_OVMCodec.Account memory\\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 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\\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 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\\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 of the account.\\n */\\n function getAccountNonce(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n uint256\\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 Corresponding Ethereum address.\\n */\\n function getAccountEthAddress(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n address\\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 Corresponding storage root.\\n */\\n function getAccountStorageRoot(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n bytes32\\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 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\\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 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\\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 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\\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 uncommitted accounts.\\n */\\n function getTotalUncommittedAccounts()\\n override\\n public\\n view\\n returns (\\n uint256\\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 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\\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 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\\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 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\\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 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\\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 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\\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 uncommitted storage slots.\\n */\\n function getTotalUncommittedContractStorage()\\n override\\n public\\n view\\n returns (\\n uint256\\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 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\\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\":\"0x0df9654f9f958038435c2b2a2c7793b20fa16afe866a69cbed32a371aaa4c78b\",\"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 *\\n ********************/\\n\\n /**\\n * Creates a new OVM_StateManager\\n * @param _owner Owner of the created contract.\\n * @return New OVM_StateManager instance.\\n */\\n function create(\\n address _owner\\n )\\n override\\n public\\n returns (\\n iOVM_StateManager\\n )\\n {\\n return new OVM_StateManager(_owner);\\n }\\n}\\n\",\"keccak256\":\"0xc557f05b8a82eee7b36a389795fe4acc0803bcf5ae33e15e9cba8226e9ab49fc\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50611437806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80639ed9331814610030575b600080fd5b6100566004803603602081101561004657600080fd5b50356001600160a01b0316610072565b604080516001600160a01b039092168252519081900360200190f35b600081604051610081906100b5565b6001600160a01b03909116815260405190819003602001906000f0801580156100ae573d6000803e3d6000fd5b5092915050565b61133f806100c38339019056fe608060405234801561001057600080fd5b5060405161133f38038061133f83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b6112ae806100916000396000f3fe608060405234801561001057600080fd5b50600436106101f05760003560e01c80638f3b96471161010f578063d126199f116100a2578063e90abb8611610071578063e90abb86146103f9578063fb37b31c1461040c578063fbcbc0f11461041f578063fcf149a21461043f576101f0565b8063d126199f146103b8578063d15d4150146103cb578063d54414c8146103de578063d7bd4a2a146103f1576101f0565b8063c3fd9b25116100de578063c3fd9b2514610377578063c7650bf21461037f578063c8e40fbf14610392578063d0a215f2146103a5576101f0565b80638f3b96471461033657806399056ba914610349578063af37b86414610351578063af3dc01114610364576101f0565b806333f94305116101875780636f3c75af116101565780636f3c75af146102f55780637c8ee703146103085780637e86faa81461031b5780638da5cb5b1461032e576101f0565b806333f94305146102b25780635c17d629146102ba5780636b18e4e8146102cd5780636c87ad20146102e0576101f0565b8063167020d2116101c3578063167020d2146102595780631aaf392f1461026c5780631b208a5a1461028c57806326dc5b121461029f576101f0565b806307a12945146101f55780630ad226791461021e57806311b1f790146102315780631381ba4d14610244575b600080fd5b61020861020336600461101d565b610452565b60405161021591906111c4565b60405180910390f35b61020861022c366004611072565b6104ba565b61020861023f36600461101d565b610517565b61025761025236600461101d565b610573565b005b61020861026736600461101d565b6105d4565b61027f61027a366004611072565b610679565b60405161021591906111cf565b61020861029a36600461101d565b610727565b61027f6102ad36600461101d565b61075e565b61025761077d565b6102576102c836600461109b565b6107c7565b6102576102db36600461101d565b61089a565b6102e8610944565b60405161021591906111b0565b610208610303366004611072565b610953565b6102e861031636600461101d565b61098c565b610208610329366004611072565b6109ad565b6102e86109c3565b6102576103443660046110cd565b6109d2565b61027f610a88565b61020861035f366004611072565b610a8e565b610208610372366004611072565b610ae2565b610257610b2f565b61020861038d366004611072565b610b79565b6102086103a036600461101d565b610c20565b6102576103b3366004611037565b610c40565b61027f6103c636600461101d565b610cb9565b6102086103d936600461101d565b610cd4565b6102086103ec36600461101d565b610d01565b61027f610d16565b610257610407366004611072565b610d1c565b61020861041a36600461101d565b610d77565b61043261042d36600461101d565b610dc3565b604051610215919061122e565b61025761044d36600461101d565b610e37565b6001600160a01b0381166000908152600260205260408120600301547fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4701480156104b257506001600160a01b038216600090815260026020526040902054155b90505b919050565b6001600160a01b038216600090815260046020908152604080832084845290915281205460ff168061050e57506001600160a01b038316600090815260026020526040902060040154600160a01b900460ff165b90505b92915050565b600080546001600160a01b031633148061053b57506001546001600160a01b031633145b6105605760405162461bcd60e51b8152600401610557906111d8565b60405180910390fd5b6104b261056c83610ef8565b6002610f28565b6000546001600160a01b031633148061059657506001546001600160a01b031633145b6105b25760405162461bcd60e51b8152600401610557906111d8565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b03163314806105f857506001546001600160a01b031633145b6106145760405162461bcd60e51b8152600401610557906111d8565b600061061f83610ef8565b9050600260008281526005602052604090205460ff16600381111561064057fe5b1461064f5760009150506104b5565b6000908152600560205260409020805460ff19166003179055505060068054600019019055600190565b6001600160a01b038216600090815260046020908152604080832084845290915281205460ff161580156106cf57506001600160a01b038316600090815260026020526040902060040154600160a01b900460ff165b156106dc57506000610511565b506001600160a01b0391909116600090815260036020908152604080832093835292905220547ffeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef1890565b60008061073383610ef8565b905060025b60008281526005602052604090205460ff16600381111561075557fe5b10159392505050565b6001600160a01b03166000908152600260208190526040909120015490565b6000546001600160a01b03163314806107a057506001546001600160a01b031633145b6107bc5760405162461bcd60e51b8152600401610557906111d8565b600680546001019055565b6000546001600160a01b03163314806107ea57506001546001600160a01b031633145b6108065760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b038316600081815260036020908152604080832086845282528083207ffeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef86189055928252600481528282208583529052205460ff16610895576001600160a01b03831660009081526004602090815260408083208584529091529020805460ff191660011790555b505050565b6000546001600160a01b03163314806108bd57506001546001600160a01b031633145b6108d95760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b031660009081526002602081905260409091207f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421918101919091557fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470600390910155565b6001546001600160a01b031681565b6000806109608484610f8e565b905060025b60008281526005602052604090205460ff16600381111561098257fe5b1015949350505050565b6001600160a01b039081166000908152600260205260409020600401541690565b6000806109ba8484610f8e565b90506003610965565b6000546001600160a01b031681565b6000546001600160a01b03163314806109f557506001546001600160a01b031633145b610a115760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b039182166000908152600260208181526040928390208451815590840151600182015591830151908201556060820151600382015560808201516004909101805460a0909301516001600160a01b0319909316919093161760ff60a01b1916600160a01b91151591909102179055565b60075490565b600080546001600160a01b0316331480610ab257506001546001600160a01b031633145b610ace5760405162461bcd60e51b8152600401610557906111d8565b61050e610adb8484610f8e565b6001610f28565b600080546001600160a01b0316331480610b0657506001546001600160a01b031633145b610b225760405162461bcd60e51b8152600401610557906111d8565b61050e61056c8484610f8e565b6000546001600160a01b0316331480610b5257506001546001600160a01b031633145b610b6e5760405162461bcd60e51b8152600401610557906111d8565b600780546001019055565b600080546001600160a01b0316331480610b9d57506001546001600160a01b031633145b610bb95760405162461bcd60e51b8152600401610557906111d8565b6000610bc58484610f8e565b9050600260008281526005602052604090205460ff166003811115610be657fe5b14610bf5576000915050610511565b6000908152600560205260409020805460ff1916600317905550506007805460001901905550600190565b6001600160a01b0316600090815260026020526040902060030154151590565b6000546001600160a01b0316331480610c6357506001546001600160a01b031633145b610c7f5760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b0392831660009081526002602052604090206004810180546001600160a01b031916939094169290921790925560030155565b6001600160a01b031660009081526002602052604090205490565b600080546001600160a01b03838116911614806104b25750506001546001600160a01b0390811691161490565b600080610d0d83610ef8565b90506003610738565b60065490565b6000546001600160a01b0316331480610d3f57506001546001600160a01b031633145b610d5b5760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b03909116600090815260026020526040902055565b600080546001600160a01b0316331480610d9b57506001546001600160a01b031633145b610db75760405162461bcd60e51b8152600401610557906111d8565b6104b2610adb83610ef8565b610dcb610fc1565b506001600160a01b03908116600090815260026020818152604092839020835160c08101855281548152600182015492810192909252918201549281019290925260038101546060830152600401549182166080820152600160a01b90910460ff16151560a082015290565b6000546001600160a01b0316331480610e5a57506001546001600160a01b031633145b610e765760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b03166000908152600260208190526040909120600181557f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421918101919091557fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4706003820155600401805460ff60a01b1916600160a01b179055565b600081604051602001610f0b9190611171565b604051602081830303815290604052805190602001209050919050565b600080826003811115610f3757fe5b60008581526005602052604090205460ff166003811115610f5457fe5b101590508061050e576000848152600560205260409020805484919060ff19166001836003811115610f8257fe5b02179055509392505050565b60008282604051602001610fa392919061118e565b60405160208183030381529060405280519060200120905092915050565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a081019190915290565b80356001600160a01b03811681146104b557600080fd5b803580151581146104b557600080fd5b60006020828403121561102e578081fd5b61050e82610ff6565b60008060006060848603121561104b578182fd5b61105484610ff6565b925061106260208501610ff6565b9150604084013590509250925092565b60008060408385031215611084578182fd5b61108d83610ff6565b946020939093013593505050565b6000806000606084860312156110af578283fd5b6110b884610ff6565b95602085013595506040909401359392505050565b60008082840360e08112156110e0578283fd5b6110e984610ff6565b925060c0601f19820112156110fc578182fd5b5060405160c0810181811067ffffffffffffffff8211171561111a57fe5b80604052506020840135815260408401356020820152606084013560408201526080840135606082015261115060a08501610ff6565b608082015261116160c0850161100d565b60a0820152809150509250929050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b60609290921b6bffffffffffffffffffffffff19168252601482015260340190565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b60208082526036908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c65642062792061604082015275757468656e746963617465642061646472657373657360501b606082015260800190565b815181526020808301519082015260408083015190820152606080830151908201526080808301516001600160a01b03169082015260a09182015115159181019190915260c0019056fea2646970667358221220831108797bd578e5207b0f7717657875894fce501cf25b4109f65121461461ca64736f6c63430007060033a2646970667358221220c3b6fe114c6da51f019d7729cc2ec959a0decd1375f627f7e6327030359bac6264736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80639ed9331814610030575b600080fd5b6100566004803603602081101561004657600080fd5b50356001600160a01b0316610072565b604080516001600160a01b039092168252519081900360200190f35b600081604051610081906100b5565b6001600160a01b03909116815260405190819003602001906000f0801580156100ae573d6000803e3d6000fd5b5092915050565b61133f806100c38339019056fe608060405234801561001057600080fd5b5060405161133f38038061133f83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b6112ae806100916000396000f3fe608060405234801561001057600080fd5b50600436106101f05760003560e01c80638f3b96471161010f578063d126199f116100a2578063e90abb8611610071578063e90abb86146103f9578063fb37b31c1461040c578063fbcbc0f11461041f578063fcf149a21461043f576101f0565b8063d126199f146103b8578063d15d4150146103cb578063d54414c8146103de578063d7bd4a2a146103f1576101f0565b8063c3fd9b25116100de578063c3fd9b2514610377578063c7650bf21461037f578063c8e40fbf14610392578063d0a215f2146103a5576101f0565b80638f3b96471461033657806399056ba914610349578063af37b86414610351578063af3dc01114610364576101f0565b806333f94305116101875780636f3c75af116101565780636f3c75af146102f55780637c8ee703146103085780637e86faa81461031b5780638da5cb5b1461032e576101f0565b806333f94305146102b25780635c17d629146102ba5780636b18e4e8146102cd5780636c87ad20146102e0576101f0565b8063167020d2116101c3578063167020d2146102595780631aaf392f1461026c5780631b208a5a1461028c57806326dc5b121461029f576101f0565b806307a12945146101f55780630ad226791461021e57806311b1f790146102315780631381ba4d14610244575b600080fd5b61020861020336600461101d565b610452565b60405161021591906111c4565b60405180910390f35b61020861022c366004611072565b6104ba565b61020861023f36600461101d565b610517565b61025761025236600461101d565b610573565b005b61020861026736600461101d565b6105d4565b61027f61027a366004611072565b610679565b60405161021591906111cf565b61020861029a36600461101d565b610727565b61027f6102ad36600461101d565b61075e565b61025761077d565b6102576102c836600461109b565b6107c7565b6102576102db36600461101d565b61089a565b6102e8610944565b60405161021591906111b0565b610208610303366004611072565b610953565b6102e861031636600461101d565b61098c565b610208610329366004611072565b6109ad565b6102e86109c3565b6102576103443660046110cd565b6109d2565b61027f610a88565b61020861035f366004611072565b610a8e565b610208610372366004611072565b610ae2565b610257610b2f565b61020861038d366004611072565b610b79565b6102086103a036600461101d565b610c20565b6102576103b3366004611037565b610c40565b61027f6103c636600461101d565b610cb9565b6102086103d936600461101d565b610cd4565b6102086103ec36600461101d565b610d01565b61027f610d16565b610257610407366004611072565b610d1c565b61020861041a36600461101d565b610d77565b61043261042d36600461101d565b610dc3565b604051610215919061122e565b61025761044d36600461101d565b610e37565b6001600160a01b0381166000908152600260205260408120600301547fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4701480156104b257506001600160a01b038216600090815260026020526040902054155b90505b919050565b6001600160a01b038216600090815260046020908152604080832084845290915281205460ff168061050e57506001600160a01b038316600090815260026020526040902060040154600160a01b900460ff165b90505b92915050565b600080546001600160a01b031633148061053b57506001546001600160a01b031633145b6105605760405162461bcd60e51b8152600401610557906111d8565b60405180910390fd5b6104b261056c83610ef8565b6002610f28565b6000546001600160a01b031633148061059657506001546001600160a01b031633145b6105b25760405162461bcd60e51b8152600401610557906111d8565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b03163314806105f857506001546001600160a01b031633145b6106145760405162461bcd60e51b8152600401610557906111d8565b600061061f83610ef8565b9050600260008281526005602052604090205460ff16600381111561064057fe5b1461064f5760009150506104b5565b6000908152600560205260409020805460ff19166003179055505060068054600019019055600190565b6001600160a01b038216600090815260046020908152604080832084845290915281205460ff161580156106cf57506001600160a01b038316600090815260026020526040902060040154600160a01b900460ff165b156106dc57506000610511565b506001600160a01b0391909116600090815260036020908152604080832093835292905220547ffeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef1890565b60008061073383610ef8565b905060025b60008281526005602052604090205460ff16600381111561075557fe5b10159392505050565b6001600160a01b03166000908152600260208190526040909120015490565b6000546001600160a01b03163314806107a057506001546001600160a01b031633145b6107bc5760405162461bcd60e51b8152600401610557906111d8565b600680546001019055565b6000546001600160a01b03163314806107ea57506001546001600160a01b031633145b6108065760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b038316600081815260036020908152604080832086845282528083207ffeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef86189055928252600481528282208583529052205460ff16610895576001600160a01b03831660009081526004602090815260408083208584529091529020805460ff191660011790555b505050565b6000546001600160a01b03163314806108bd57506001546001600160a01b031633145b6108d95760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b031660009081526002602081905260409091207f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421918101919091557fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470600390910155565b6001546001600160a01b031681565b6000806109608484610f8e565b905060025b60008281526005602052604090205460ff16600381111561098257fe5b1015949350505050565b6001600160a01b039081166000908152600260205260409020600401541690565b6000806109ba8484610f8e565b90506003610965565b6000546001600160a01b031681565b6000546001600160a01b03163314806109f557506001546001600160a01b031633145b610a115760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b039182166000908152600260208181526040928390208451815590840151600182015591830151908201556060820151600382015560808201516004909101805460a0909301516001600160a01b0319909316919093161760ff60a01b1916600160a01b91151591909102179055565b60075490565b600080546001600160a01b0316331480610ab257506001546001600160a01b031633145b610ace5760405162461bcd60e51b8152600401610557906111d8565b61050e610adb8484610f8e565b6001610f28565b600080546001600160a01b0316331480610b0657506001546001600160a01b031633145b610b225760405162461bcd60e51b8152600401610557906111d8565b61050e61056c8484610f8e565b6000546001600160a01b0316331480610b5257506001546001600160a01b031633145b610b6e5760405162461bcd60e51b8152600401610557906111d8565b600780546001019055565b600080546001600160a01b0316331480610b9d57506001546001600160a01b031633145b610bb95760405162461bcd60e51b8152600401610557906111d8565b6000610bc58484610f8e565b9050600260008281526005602052604090205460ff166003811115610be657fe5b14610bf5576000915050610511565b6000908152600560205260409020805460ff1916600317905550506007805460001901905550600190565b6001600160a01b0316600090815260026020526040902060030154151590565b6000546001600160a01b0316331480610c6357506001546001600160a01b031633145b610c7f5760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b0392831660009081526002602052604090206004810180546001600160a01b031916939094169290921790925560030155565b6001600160a01b031660009081526002602052604090205490565b600080546001600160a01b03838116911614806104b25750506001546001600160a01b0390811691161490565b600080610d0d83610ef8565b90506003610738565b60065490565b6000546001600160a01b0316331480610d3f57506001546001600160a01b031633145b610d5b5760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b03909116600090815260026020526040902055565b600080546001600160a01b0316331480610d9b57506001546001600160a01b031633145b610db75760405162461bcd60e51b8152600401610557906111d8565b6104b2610adb83610ef8565b610dcb610fc1565b506001600160a01b03908116600090815260026020818152604092839020835160c08101855281548152600182015492810192909252918201549281019290925260038101546060830152600401549182166080820152600160a01b90910460ff16151560a082015290565b6000546001600160a01b0316331480610e5a57506001546001600160a01b031633145b610e765760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b03166000908152600260208190526040909120600181557f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421918101919091557fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4706003820155600401805460ff60a01b1916600160a01b179055565b600081604051602001610f0b9190611171565b604051602081830303815290604052805190602001209050919050565b600080826003811115610f3757fe5b60008581526005602052604090205460ff166003811115610f5457fe5b101590508061050e576000848152600560205260409020805484919060ff19166001836003811115610f8257fe5b02179055509392505050565b60008282604051602001610fa392919061118e565b60405160208183030381529060405280519060200120905092915050565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a081019190915290565b80356001600160a01b03811681146104b557600080fd5b803580151581146104b557600080fd5b60006020828403121561102e578081fd5b61050e82610ff6565b60008060006060848603121561104b578182fd5b61105484610ff6565b925061106260208501610ff6565b9150604084013590509250925092565b60008060408385031215611084578182fd5b61108d83610ff6565b946020939093013593505050565b6000806000606084860312156110af578283fd5b6110b884610ff6565b95602085013595506040909401359392505050565b60008082840360e08112156110e0578283fd5b6110e984610ff6565b925060c0601f19820112156110fc578182fd5b5060405160c0810181811067ffffffffffffffff8211171561111a57fe5b80604052506020840135815260408401356020820152606084013560408201526080840135606082015261115060a08501610ff6565b608082015261116160c0850161100d565b60a0820152809150509250929050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b60609290921b6bffffffffffffffffffffffff19168252601482015260340190565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b60208082526036908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c65642062792061604082015275757468656e746963617465642061646472657373657360501b606082015260800190565b815181526020808301519082015260408083015190820152606080830151908201526080808301516001600160a01b03169082015260a09182015115159181019190915260c0019056fea2646970667358221220831108797bd578e5207b0f7717657875894fce501cf25b4109f65121461461ca64736f6c63430007060033a2646970667358221220c3b6fe114c6da51f019d7729cc2ec959a0decd1375f627f7e6327030359bac6264736f6c63430007060033", "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", diff --git a/packages/contracts/deployments/kovan/OVM_StateTransitionerFactory.json b/packages/contracts/deployments/kovan/OVM_StateTransitionerFactory.json index 8c6de8d67c0c..383e4fce35d4 100644 --- a/packages/contracts/deployments/kovan/OVM_StateTransitionerFactory.json +++ b/packages/contracts/deployments/kovan/OVM_StateTransitionerFactory.json @@ -1,5 +1,5 @@ { - "address": "0xd6eDb16a89A2EE4484fa8fdCDb11B8B5633c3687", + "address": "0xFD7B9268e790837d393Fd371Ddeb42FE5EC45B54", "abi": [ { "inputs": [ @@ -79,29 +79,29 @@ "type": "function" } ], - "transactionHash": "0x36cca1310ad53537bb898174d480b15209ef5ad4c1be506c4516c6de43a39de9", + "transactionHash": "0x7d6df950e48cbb42a503d16b48540e876d2f4f472feaa78fa8da61824a40bae8", "receipt": { "to": null, "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", - "contractAddress": "0xd6eDb16a89A2EE4484fa8fdCDb11B8B5633c3687", - "transactionIndex": 0, - "gasUsed": "4127740", + "contractAddress": "0xFD7B9268e790837d393Fd371Ddeb42FE5EC45B54", + "transactionIndex": 4, + "gasUsed": "4209012", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x6d044d596657c12c5311fc0306f862a5f678a150f15ef785ab4546deb6f0e3b7", - "transactionHash": "0x36cca1310ad53537bb898174d480b15209ef5ad4c1be506c4516c6de43a39de9", + "blockHash": "0x4e764d560c47c9065bd8eb05d500337864c1d03c08b8bf3384c657ca7b56c388", + "transactionHash": "0x7d6df950e48cbb42a503d16b48540e876d2f4f472feaa78fa8da61824a40bae8", "logs": [], - "blockNumber": 24572864, - "cumulativeGasUsed": "4127740", + "blockNumber": 25502636, + "cumulativeGasUsed": "4540875", "status": 1, "byzantium": true }, "args": [ - "0xd56F695e73286ac252A37593DD4E7c14270eC1Df" + "0x100Dd3b414Df5BbA2B542864fF94aF8024aFdf3a" ], - "solcInputHash": "5ee8e508e2c54cb5ac6783b4855b1558", - "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\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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\":{\"_0\":\"New OVM_StateTransitioner instance.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}}},\"title\":\"OVM_StateTransitionerFactory\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"create(address,uint256,bytes32,bytes32)\":{\"notice\":\"Creates a new OVM_StateTransitioner\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"}},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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 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 // Prevent the Execution Manager from calling this SM again.\\n ovmStateManager.setExecutionManager(address(0));\\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\":\"0xc363807221625338a396c52a4bc3b7439e63972ac87521670c47745641e91fa6\",\"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 /***************\\n * Constructor *\\n ***************/\\n\\n constructor(\\n address _libAddressManager\\n )\\n Lib_AddressResolver(_libAddressManager)\\n {}\\n\\n\\n /********************\\n * Public Functions *\\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 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\\n )\\n {\\n require(\\n msg.sender == resolve(\\\"OVM_FraudVerifier\\\"),\\n \\\"Create can only be done by the OVM_FraudVerifier.\\\"\\n );\\n\\n return new OVM_StateTransitioner(\\n _libAddressManager,\\n _stateTransitionIndex,\\n _preStateRoot,\\n _transactionHash\\n );\\n }\\n}\\n\",\"keccak256\":\"0x65ef11334a2d6931b6d3a85e7b29c39c774d19443e7040e132a58be505e3b52c\",\"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 OUT_OF_GAS,\\n INTENTIONAL_REVERT,\\n EXCEEDS_NUISANCE_GAS,\\n INVALID_STATE_ACCESS,\\n UNSAFE_BYTECODE,\\n CREATE_COLLISION,\\n STATIC_VIOLATION,\\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 }\\n\\n\\n /************************************\\n * Transaction Execution Entrypoint *\\n ************************************/\\n\\n function run(\\n Lib_OVMCodec.Transaction calldata _transaction,\\n address _txStateManager\\n ) external returns (bytes memory);\\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, bytes memory _revertdata);\\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract, bytes memory _revertdata);\\n\\n\\n /*******************************\\n * Account Abstraction Opcodes *\\n ******************************/\\n\\n function ovmGETNONCE() external returns (uint256 _nonce);\\n function ovmINCREMENTNONCE() 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 Context *\\n ***************************************/\\n\\n function getMaxTransactionGasLimit() external view returns (uint _maxTransactionGasLimit);\\n}\\n\",\"keccak256\":\"0xf023d5d6fc6a03bd52f7a57af6e21076de77e8925d065bb79db062e73e43b684\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x2ce671a0e004df88b136bea5a3c59d0732cea8887c8496da1d509e0200b03d7d\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 abi.encodePacked(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\":\"0x161f65220b8c5cf295232f8c58c2744fbc898bf77da5f9d9c5b2dd673dafc6f6\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xa5195afe32fb2cf104d156e8f4bd39df1ec79bf6ba232097b9e8e0ee14fbc298\",\"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 *\\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 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\\n )\\n {\\n bytes memory code;\\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 Full code of the contract.\\n */\\n function getCode(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes memory\\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 Size of the contract's code in bytes.\\n */\\n function getCodeSize(\\n address _address\\n )\\n internal\\n view\\n returns (\\n uint256\\n )\\n {\\n uint256 codeSize;\\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 Hash of the contract's code.\\n */\\n function getCodeHash(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n bytes32 codeHash;\\n assembly {\\n codeHash := extcodehash(_address)\\n }\\n\\n return codeHash;\\n }\\n\\n /**\\n * Creates a contract with some given initialization code.\\n * @param _code Contract initialization code.\\n * @return Address of the created contract.\\n */\\n function createContract(\\n bytes memory _code\\n )\\n internal\\n returns (\\n address\\n )\\n {\\n address created;\\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 to be generated by CREATE.\\n */\\n function getAddressForCREATE(\\n address _creator,\\n uint256 _nonce\\n )\\n internal\\n pure\\n returns (\\n 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 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 (\\n address\\n )\\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\":\"0xf29a67d78e61cb472d524b779b32cfcb39a587f4096500d5419e6425ed367d49\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506040516149b93803806149b98339818101604052602081101561003357600080fd5b5051600080546001600160a01b039092166001600160a01b0319909216919091179055614954806100656000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806322d1470214610046578063299ca4781461009a578063461a4478146100a2575b600080fd5b61007e6004803603608081101561005c57600080fd5b506001600160a01b038135169060208101359060408101359060600135610148565b604080516001600160a01b039092168252519081900360200190f35b61007e610229565b61007e600480360360208110156100b857600080fd5b8101906020810181356401000000008111156100d357600080fd5b8201836020820111156100e557600080fd5b8035906020019184600183028401116401000000008311171561010757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610238945050505050565b600061017c6040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b815250610238565b6001600160a01b0316336001600160a01b0316146101cb5760405162461bcd60e51b81526004018080602001828103825260318152602001806148ee6031913960400191505060405180910390fd5b848484846040516101db90610314565b80856001600160a01b03168152602001848152602001838152602001828152602001945050505050604051809103906000f08015801561021f573d6000803e3d6000fd5b5095945050505050565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610298578181015183820152602001610280565b50505050905090810190601f1680156102c55780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102e257600080fd5b505afa1580156102f6573d6000803e3d6000fd5b505050506040513d602081101561030c57600080fd5b505192915050565b6145cc806103228339019056fe60806040523480156200001157600080fd5b50604051620045cc380380620045cc833981016040819052620000349162000232565b600080546001600160a01b0319166001600160a01b038616179055600583905560028290556003829055600681905560408051808201909152601781527f4f564d5f53746174654d616e61676572466163746f72790000000000000000006020820152620000a29062000150565b6001600160a01b0316639ed93318306040518263ffffffff1660e01b8152600401620000cf919062000299565b602060405180830381600087803b158015620000ea57600080fd5b505af1158015620000ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000125919062000273565b600180546001600160a01b0319166001600160a01b039290921691909117905550620002c692505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015620001b257818101518382015260200162000198565b50505050905090810190601f168015620001e05780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b158015620001fe57600080fd5b505afa15801562000213573d6000803e3d6000fd5b505050506040513d60208110156200022a57600080fd5b505192915050565b6000806000806080858703121562000248578384fd5b84516200025581620002ad565b60208601516040870151606090970151919890975090945092505050565b60006020828403121562000285578081fd5b81516200029281620002ad565b9392505050565b6001600160a01b0391909116815260200190565b6001600160a01b0381168114620002c357600080fd5b50565b6142f680620002d66000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063845fe7a31161008c578063b2fa1c9e11610066578063b2fa1c9e14610185578063b52805711461019a578063b9194310146101a2578063c1c618b8146101b5576100cf565b8063845fe7a314610155578063a244316a14610168578063b1c9fe6e14610170576100cf565b8063299ca478146100d45780632e1ac36c146100f25780632eb1375814610107578063461a44781461011a578063732f960b1461012d578063805e9d3014610140575b600080fd5b6100dc6101bd565b6040516100e99190613c74565b60405180910390f35b6101056101003660046138d0565b6101cc565b005b610105610115366004613910565b610565565b6100dc6101283660046139f8565b6108a1565b61010561013b366004613abc565b61097f565b610148610c6f565b6040516100e99190613bcd565b6101056101633660046138d0565b610c75565b610105610fa1565b610178611128565b6040516100e99190613d26565b61018d611131565b6040516100e99190613d1b565b6100dc61114c565b6101056101b0366004613871565b61115b565b610148611475565b6000546001600160a01b031681565b60018060045460ff1660028111156101e057fe5b146102065760405162461bcd60e51b81526004016101fd90614077565b60405180910390fd5b60025460065460005a6001546040516363b285f960e11b81529192506001600160a01b03169063c7650bf290610242908a908a90600401613c88565b602060405180830381600087803b15801561025c57600080fd5b505af1158015610270573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610294919061395d565b15156001146102b55760405162461bcd60e51b81526004016101fd90613e22565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f1906102e6908b90600401613c74565b60c06040518083038186803b1580156102fe57600080fd5b505afa158015610312573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103369190613a3d565b600154604051631aaf392f60e01b81529192506000916001600160a01b0390911690631aaf392f9061036e908c908c90600401613c88565b60206040518083038186803b15801561038657600080fd5b505afa15801561039a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103be9190613977565b90506103ff886040516020016103d49190613bcd565b6040516020818303038152906040526103f46103ef8461147b565b6114c4565b89856040015161152e565b6040808401919091526001549051638f3b964760e01b81526001600160a01b0390911690638f3b964790610439908c908690600401613cc2565b600060405180830381600087803b15801561045357600080fd5b505af1158015610467573d6000803e3d6000fd5b505050507f3e3ed1a676a2754a041b49bf752e0f167c8753495e36c320fe01d1ef7476253c898960405161049c929190613c88565b60405180910390a1505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561054357600080fd5b505af1158015610557573d6000803e3d6000fd5b505050505050505050505050565b60018060045460ff16600281111561057957fe5b146105965760405162461bcd60e51b81526004016101fd90614077565b60025460065460005a9050600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156105ef57600080fd5b505afa158015610603573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106279190613977565b156106445760405162461bcd60e51b81526004016101fd90613f03565b600154604051630b38106960e11b81526001600160a01b039091169063167020d290610674908990600401613c74565b602060405180830381600087803b15801561068e57600080fd5b505af11580156106a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c6919061395d565b15156001146106e75760405162461bcd60e51b81526004016101fd90613fbd565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f190610718908a90600401613c74565b60c06040518083038186803b15801561073057600080fd5b505afa158015610744573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107689190613a3d565b90506107a78760405160200161077e9190613bb0565b60405160208183030381529060405261079e61079984611554565b611594565b8860035461152e565b6003556040517fcec9ef675d775706a02b43afe48af52c5019bc50f99582e3208c6ff55d59c008906107da908990613c74565b60405180910390a15060005a8203905061081a6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561088057600080fd5b505af1158015610894573d6000803e3d6000fd5b5050505050505050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156109015781810151838201526020016108e9565b50505050905090810190601f16801561092e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561094b57600080fd5b505afa15801561095f573d6000803e3d6000fd5b505050506040513d602081101561097557600080fd5b505190505b919050565b60008060045460ff16600281111561099357fe5b146109b05760405162461bcd60e51b81526004016101fd90614077565b60025460065460005a90506006546109c78661169d565b146109e45760405162461bcd60e51b81526004016101fd906140c8565b6103e88560a0015161040802816109f757fe5b04620186a0015a1015610a1c5760405162461bcd60e51b81526004016101fd90613f60565b6000610a536040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b8152506108a1565b600154604051631381ba4d60e01b81529192506001600160a01b031690631381ba4d90610a84908490600401613c74565b600060405180830381600087803b158015610a9e57600080fd5b505af1158015610ab2573d6000803e3d6000fd5b5050600154604051639be3ad6760e01b81526001600160a01b038086169450639be3ad679350610ae9928b9291169060040161415c565b600060405180830381600087803b158015610b0357600080fd5b505af1158015610b17573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b3f919081019061398f565b50600154604051631381ba4d60e01b81526001600160a01b0390911690631381ba4d90610b7190600090600401613c74565b600060405180830381600087803b158015610b8b57600080fd5b505af1158015610b9f573d6000803e3d6000fd5b50506004805460ff191660011790555060009150505a82039050610be96040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b158015610c4f57600080fd5b505af1158015610c63573d6000803e3d6000fd5b50505050505050505050565b60025490565b60008060045460ff166002811115610c8957fe5b14610ca65760405162461bcd60e51b81526004016101fd90614077565b60025460065460005a600154604051630ad2267960e01b81529192506001600160a01b031690630ad2267990610ce2908a908a90600401613c88565b60206040518083038186803b158015610cfa57600080fd5b505afa158015610d0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d32919061395d565b15610d4f5760405162461bcd60e51b81526004016101fd90613d3a565b60015460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf90610d7f908a90600401613c74565b60206040518083038186803b158015610d9757600080fd5b505afa158015610dab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcf919061395d565b1515600114610df05760405162461bcd60e51b81526004016101fd906140ff565b60015460405163136e2d8960e11b81526000916001600160a01b0316906326dc5b1290610e21908b90600401613c74565b60206040518083038186803b158015610e3957600080fd5b505afa158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e719190613977565b905060007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421821415610ea557506000610f02565b600080610ed28a604051602001610ebc9190613bcd565b6040516020818303038152906040528a866116b6565b909250905060018215151415610efa57610ef3610eee826116df565b6116f2565b9250610eff565b600092505b50505b600154604051635c17d62960e01b81526001600160a01b0390911690635c17d62990610f36908c908c908690600401613ca1565b600060405180830381600087803b158015610f5057600080fd5b505af1158015610f64573d6000803e3d6000fd5b50505050505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b60018060045460ff166002811115610fb557fe5b14610fd25760405162461bcd60e51b81526004016101fd90614077565b600160009054906101000a90046001600160a01b03166001600160a01b031663d7bd4a2a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561102057600080fd5b505afa158015611034573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110589190613977565b156110755760405162461bcd60e51b81526004016101fd90613dc5565b600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156110c357600080fd5b505afa1580156110d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110fb9190613977565b156111185760405162461bcd60e51b81526004016101fd9061401a565b506004805460ff19166002179055565b60045460ff1681565b6000600260045460ff16600281111561114657fe5b14905090565b6001546001600160a01b031681565b60008060045460ff16600281111561116f57fe5b1461118c5760405162461bcd60e51b81526004016101fd90614077565b60025460065460005a60015460405163c8e40fbf60e01b81529192506001600160a01b03169063c8e40fbf906111c6908a90600401613c74565b60206040518083038186803b1580156111de57600080fd5b505afa1580156111f2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611216919061395d565b1580156112a057506001546040516307a1294560e01b81526001600160a01b03909116906307a129459061124e908a90600401613c74565b60206040518083038186803b15801561126657600080fd5b505afa15801561127a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129e919061395d565b155b6112bc5760405162461bcd60e51b81526004016101fd90613d7f565b6000806112eb896040516020016112d39190613bb0565b604051602081830303815290604052886002546116b6565b90925090506001821515141561140c57600061130682611721565b606081015190915089907fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470141561133f5750600061136a565b816060015161134d826117b3565b1461136a5760405162461bcd60e51b81526004016101fd90613e80565b6001546040805160c08101825284518152602080860151908201528482015181830152606080860151908201526001600160a01b038481166080830152600060a08301529151638f3b964760e01b81529190921691638f3b9647916113d3918f91600401613cc2565b600060405180830381600087803b1580156113ed57600080fd5b505af1158015611401573d6000803e3d6000fd5b50505050505061143c565b600154604051630d631c9d60e31b81526001600160a01b0390911690636b18e4e890610f36908c90600401613c74565b505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b60035490565b6060806000805b6020811085821a15161561149c5760019182019101611482565b5060405191506040820160405283600882021b60208301528060200382525080915050919050565b606080825160011480156114ec57506080836000815181106114e257fe5b016020015160f81c105b156114f8575081611528565b611504835160806117b7565b83604051602001611516929190613bd6565b60405160208183030381529060405290505b92915050565b60008061153a86611906565b905061154881868686611936565b9150505b949350505050565b61155c61378f565b604051806080016040528083600001518152602001836020015181526020018360400151815260200183606001518152509050919050565b60408051600480825260a0820190925260609160009190816020015b60608152602001906001900390816115b057505083519091506115d6906103ef9061147b565b816000815181106115e357fe5b60200260200101819052506116016103ef846020015160001b61147b565b8160018151811061160e57fe5b602002602001018190525061164583604001516040516020016116319190613bcd565b6040516020818303038152906040526114c4565b8160028151811061165257fe5b602002602001018190525061167583606001516040516020016116319190613bcd565b8160038151811061168257fe5b6020026020010181905250611696816119d1565b9392505050565b60006116a882611a15565b805190602001209050919050565b6000606060006116c586611906565b90506116d2818686611a50565b9250925050935093915050565b60606115286116ed83611b23565b611b48565b600080600060208451111561170857602061170b565b83515b6020858101519190036008021c92505050919050565b61172961378f565b600061173483611bd7565b9050604051806080016040528061175e8360008151811061175157fe5b6020026020010151611bea565b81526020016117738360018151811061175157fe5b81526020016117958360028151811061178857fe5b6020026020010151611bf1565b81526020016117aa8360038151811061178857fe5b90529392505050565b3f90565b6060806038841015611811576040805160018082528183019092529060208201818036833701905050905082840160f81b816000815181106117f557fe5b60200101906001600160f81b031916908160001a905350611696565b600060015b80868161181f57fe5b04156118345760019091019061010002611816565b816001016001600160401b038111801561184d57600080fd5b506040519080825280601f01601f191660200182016040528015611878576020820181803683370190505b50925084820160370160f81b8360008151811061189157fe5b60200101906001600160f81b031916908160001a905350600190505b8181116118fd576101008183036101000a87816118c657fe5b04816118ce57fe5b0660f81b8382815181106118de57fe5b60200101906001600160f81b031916908160001a9053506001016118ad565b50509392505050565b606081805190602001206040516020016119209190613bcd565b6040516020818303038152906040529050919050565b6040805180820190915260018152600160ff1b60209091015260007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42182141561198a576119838585611ceb565b905061154c565b600061199584611d0f565b90506000806119a5838987611de5565b509150915060006119b88484848b612188565b90506119c4818a6124a0565b9998505050505050505050565b606060006119de836125f9565b90506119ec815160c06117b7565b816040516020016119fe929190613bd6565b604051602081830303815290604052915050919050565b6060816000015182602001518360400151846060015185608001518660a001518760c001516040516020016119209796959493929190613c05565b600060606000611a5f85611d0f565b90506000806000611a71848a89611de5565b81519295509093509150158080611a855750815b611ad6576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b600081611af25760405180602001604052806000815250611b11565b611b11866001870381518110611b0457fe5b6020026020010151612702565b919b919a509098505050505050505050565b611b2b6137b6565b506040805180820190915281518152602082810190820152919050565b60606000806000611b588561271e565b919450925090506000816001811115611b6d57fe5b14611bbf576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b611bce85602001518484612a47565b95945050505050565b6060611528611be583611b23565b612af4565b6000611528825b6000602182600001511115611c4d576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6000806000611c5b8561271e565b919450925090506000816001811115611c7057fe5b14611cc2576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b602080860151840180519091841015611ce15760208490036101000a90045b9695505050505050565b6000611cff611cf984612c6a565b83612d66565b5180516020909101209392505050565b60606000611d1c83611bd7565b9050600081516001600160401b0381118015611d3757600080fd5b50604051908082528060200260200182016040528015611d7157816020015b611d5e6137d0565b815260200190600190039081611d565790505b50905060005b8251811015611ddd576000611d9e848381518110611d9157fe5b6020026020010151611b48565b90506040518060400160405280828152602001611dba83611bd7565b815250838381518110611dc957fe5b602090810291909101015250600101611d77565b509392505050565b60006060818080611df587612c6a565b905085600080611e036137d0565b60005b8c51811015612160578c8181518110611e1b57fe5b6020026020010151915082840193506001870196508360001415611e8f57815180516020909101208514611e8a576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b611f56565b815151602011611ef657815180516020909101208514611e8a576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b84611f048360000151612dfa565b14611f56576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b60208201515160111415611fc5578551841415611f7257612160565b6000868581518110611f8057fe5b602001015160f81c60f81b60f81c9050600083602001518260ff1681518110611fa557fe5b60200260200101519050611fb881612e26565b9650600194505050612158565b6002826020015151141561210b576000611fde83612e5c565b9050600081600081518110611fef57fe5b016020015160f81c905060018116600203600061200f8460ff8416612e7a565b9050600061201d8b8a612e7a565b9050600061202b8383612eab565b905060ff851660021480612042575060ff85166003145b15612074578083511480156120575750808251145b1561206157988901985b50600160ff1b9950612160945050505050565b60ff85161580612087575060ff85166001145b156120d457806120a45750600160ff1b9950612160945050505050565b6120c588602001516001815181106120b857fe5b6020026020010151612e26565b9a509750612158945050505050565b60405162461bcd60e51b815260040180806020018281038252602681526020018061429b6026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b600101611e06565b50600160ff1b8414866121738786612e7a565b909e909d50909b509950505050505050505050565b6060600083905060008660018703815181106121a057fe5b6020026020010151905060006121b582612f11565b6040805160038082526080820190925291925060009190816020015b6121d96137d0565b8152602001906001900390816121d157905050905060008451600014801561220c5750600283600281111561220a57fe5b145b156122425761222361221d85612fe7565b88612d66565b82828151811061222f57fe5b6020908102919091010152600101612483565b600083600281111561225057fe5b14156122b6578451612285576122668488612ffa565b82828151811061227257fe5b60209081029190910101526001016122b1565b8382828151811061229257fe5b602002602001018190525060018101905061222361221d866001612e7a565b612483565b60006122c185612fe7565b905060006122cf8288612eab565b905080156123305760006122e583600084613045565b90506122f9816122f48c613195565b6131d6565b85858151811061230557fe5b60200260200101819052506001840193506123208383612e7a565b925061232c8883612e7a565b9750505b600061233a61321a565b905082516000141561235f576123588161235389612702565b612ffa565b90506123f7565b60008360008151811061236e57fe5b016020015160f81c9050612383846001612e7a565b9350600287600281111561239357fe5b14156123ce5760006123ad856123a88b612702565b612d66565b90506123c683836123c18460000151613195565b6132a7565b9250506123f5565b8351156123e45760006123ad856122f48b612702565b6123f282826123c18b612702565b91505b505b875161242c57612407818b612ffa565b90508085858151811061241657fe5b602002602001018190525060018401935061247f565b612437886001612e7a565b97508085858151811061244657fe5b6020026020010181905250600184019350612461888b612d66565b85858151811061246d57fe5b60200260200101819052506001840193505b5050505b6124928a60018b038484613300565b9a9950505050505050505050565b6000806124ac83612c6a565b90506124b66137d0565b84516000906060905b80156125e4578760018203815181106124d457fe5b602002602001015193506124e784612f11565b925060028360028111156124f757fe5b141561252257600061250885612fe7565b905061251a8660008351895103613045565b9550506125ce565b600183600281111561253057fe5b141561257057600061254185612fe7565b90506125538660008351895103613045565b83519096501561256a5761256781846131d6565b94505b506125ce565b600083600281111561257e57fe5b14156125ce578151156125ce5760008560018751038151811061259d57fe5b602001015160f81c60f81b60f81c90506125bd8660006001895103613045565b95506125ca8582856132a7565b9450505b83516125d990613195565b9150600019016124bf565b50509051805160209091012095945050505050565b606081516000141561261a575060408051600081526020810190915261097a565b6000805b835181101561264d5783818151811061263357fe5b60200260200101515182019150808060010191505061261e565b6000826001600160401b038111801561266557600080fd5b506040519080825280601f01601f191660200182016040528015612690576020820181803683370190505b50600092509050602081015b85518310156126f95760008684815181106126b357fe5b6020026020010151905060006020820190506126d1838284516133e2565b8785815181106126dd57fe5b602002602001015151830192505050828060010193505061269c565b50949350505050565b60208101518051606091611528916000198101908110611d9157fe5b60008060008084600001511161277b576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f81116127a0576000600160009450945094505050612a40565b60b78111612815578551607f198201908110612803576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b60019550935060009250612a40915050565b60bf81116128f957855160b6198201908110612878576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a60018501510490508082018860000151116128e4576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b60019091019550935060009250612a40915050565b60f7811161296d57855160bf19820190811061295c576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b600195509350849250612a40915050565b855160f61982019081106129c8576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111612a2d576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b6001918201965094509250612a40915050565b9193909250565b60606000826001600160401b0381118015612a6157600080fd5b506040519080825280601f01601f191660200182016040528015612a8c576020820181803683370190505b509050805160001415612aa0579050611696565b8484016020820160005b60208604811015612acb578251825260209283019290910190600101612aaa565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b6060600080612b028461271e565b91935090915060019050816001811115612b1857fe5b14612b6a576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b612b8b6137b6565b815260200190600190039081612b835790505090506000835b8651811015612c5f5760208210612bec5760405162461bcd60e51b815260040180806020018281038252602a815260200180614271602a913960400191505060405180910390fd5b600080612c186040518060400160405280858c60000151038152602001858c602001510181525061271e565b509150915060405180604001604052808383018152602001848b6020015101815250858581518110612c4657fe5b6020908102919091010152600193909301920101612ba4565b508152949350505050565b6060600082516002026001600160401b0381118015612c8857600080fd5b506040519080825280601f01601f191660200182016040528015612cb3576020820181803683370190505b50905060005b8351811015612d5f576004848281518110612cd057fe5b602001015160f81c60f81b6001600160f81b031916901c828260020281518110612cf657fe5b60200101906001600160f81b031916908160001a9053506010848281518110612d1b57fe5b016020015160f81c81612d2a57fe5b0660f81b828260020260010181518110612d4057fe5b60200101906001600160f81b031916908160001a905350600101612cb9565b5092915050565b612d6e6137d0565b60408051600280825260608201909252600091816020015b6060815260200190600190039081612d865790505090506000612daa856001613426565b9050612db86103ef8261357d565b82600081518110612dc557fe5b6020026020010181905250612dd9846114c4565b82600181518110612de657fe5b6020026020010181905250611bce8261364d565b6000602082511015612e115750602081015161097a565b81806020019051602081101561097557600080fd5b60006060602083600001511015612e4757612e408361367c565b9050612e53565b612e5083611b48565b90505b61169681612dfa565b6060611528612e758360200151600081518110611d9157fe5b612c6a565b60608183510360001415612e9d5750604080516020810190915260008152611528565b611696838384865103613045565b6000805b808451118015612ebf5750808351115b8015612f045750828181518110612ed257fe5b602001015160f81c60f81b6001600160f81b031916848281518110612ef357fe5b01602001516001600160f81b031916145b1561169657600101612eaf565b60208101515160009060111415612f2a5750600061097a565b60028260200151511415612fa6576000612f4383612e5c565b9050600081600081518110612f5457fe5b016020015160f81c90506002811480612f70575060ff81166003145b15612f805760029250505061097a565b60ff81161580612f93575060ff81166001145b15612fa35760019250505061097a565b50505b6040805162461bcd60e51b8152602060048201526011602482015270496e76616c6964206e6f6465207479706560781b604482015290519081900360640190fd5b6060611528612ff583612e5c565b613687565b6130026137d0565b600061300d836114c4565b905061301881611b23565b60208501518051600019810190811061302d57fe5b602002602001018190525061154c84602001516136d0565b60608182601f011015613090576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b8282840110156130d8576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b81830184511015613124576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b60608215801561314357604051915060008252602082016040526126f9565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561317c578051835260209283019201613164565b5050858452601f01601f19166040525050949350505050565b60606020825110156131a857508061097a565b818051906020012060405160200180828152602001915050604051602081830303815290604052905061097a565b6131de6137d0565b60408051600280825260608201909252600091816020015b60608152602001906001900390816131f65790505090506000612daa856000613426565b6132226137d0565b6040805160118082526102408201909252600091816020015b606081526020019060019003908161323b57905050905060005b815181101561329757604051806040016040528060018152602001600160ff1b81525082828151811061328457fe5b6020908102919091010152600101613255565b506132a18161364d565b91505090565b6132af6137d0565b600060208351106132c8576132c3836114c4565b6132ca565b825b90506132d581611b23565b85602001518560ff16815181106132e857fe5b6020026020010181905250611bce85602001516136d0565b606060008285016001600160401b038111801561331c57600080fd5b5060405190808252806020026020018201604052801561335657816020015b6133436137d0565b81526020019060019003908161333b5790505b50905060005b858110156133975786818151811061337057fe5b602002602001015182828151811061338457fe5b602090810291909101015260010161335c565b5060005b838110156133d8578481815181106133af57fe5b602002602001015182878301815181106133c557fe5b602090810291909101015260010161339b565b5095945050505050565b8282825b60208110613405578151835260209283019290910190601f19016133e6565b905182516020929092036101000a6000190180199091169116179052505050565b6060600082613436576000613439565b60025b90506000600285518161344857fe5b06905060008160020360ff166001600160401b038111801561346957600080fd5b506040519080825280601f01601f191660200182016040528015613494576020820181803683370190505b50905081830160f81b816000815181106134aa57fe5b60200101906001600160f81b031916908160001a90535080866040516020018083805190602001908083835b602083106134f55780518252601f1990920191602091820191016134d6565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b6020831061353d5780518252601f19909201916020918201910161351e565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052935050505092915050565b60606000600283518161358c57fe5b046001600160401b03811180156135a257600080fd5b506040519080825280601f01601f1916602001820160405280156135cd576020820181803683370190505b50905060005b8151811015612d5f578381600202600101815181106135ee57fe5b602001015160f81c60f81b600485836002028151811061360a57fe5b602001015160f81c60f81b6001600160f81b031916901b1782828151811061362e57fe5b60200101906001600160f81b031916908160001a9053506001016135d3565b6136556137d0565b6000613660836119d1565b905060405180604001604052808281526020016117aa83611bd7565b606061152882613779565b606060028260008151811061369857fe5b016020015160f81c816136a757fe5b0660ff16600014156136c5576136be826002612e7a565b905061097a565b6136be826001612e7a565b6136d86137d0565b600082516001600160401b03811180156136f157600080fd5b5060405190808252806020026020018201604052801561372557816020015b60608152602001906001900390816137105790505b50905060005b835181101561376f5761375084828151811061374357fe5b602002602001015161367c565b82828151811061375c57fe5b602090810291909101015260010161372b565b506116968161364d565b6060611528826020015160008460000151612a47565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060008152602001600081525090565b604051806040016040528060608152602001606081525090565b60006137fd6137f884614207565b6141e4565b905082815283838301111561381157600080fd5b828260208301376000602084830101529392505050565b803561097a81614258565b8051801515811461097a57600080fd5b600082601f830112613853578081fd5b611696838335602085016137ea565b80356002811061097a57600080fd5b600080600060608486031215613885578283fd5b833561389081614258565b925060208401356138a081614258565b915060408401356001600160401b038111156138ba578182fd5b6138c686828701613843565b9150509250925092565b6000806000606084860312156138e4578283fd5b83356138ef81614258565b92506020840135915060408401356001600160401b038111156138ba578182fd5b60008060408385031215613922578182fd5b823561392d81614258565b915060208301356001600160401b03811115613947578182fd5b61395385828601613843565b9150509250929050565b60006020828403121561396e578081fd5b61169682613833565b600060208284031215613988578081fd5b5051919050565b6000602082840312156139a0578081fd5b81516001600160401b038111156139b5578182fd5b8201601f810184136139c5578182fd5b80516139d36137f882614207565b8181528560208385010111156139e7578384fd5b611bce826020830160208601614228565b600060208284031215613a09578081fd5b81356001600160401b03811115613a1e578182fd5b8201601f81018413613a2e578182fd5b61154c848235602084016137ea565b600060c08284031215613a4e578081fd5b60405160c081018181106001600160401b0382111715613a6a57fe5b8060405250825181526020830151602082015260408301516040820152606083015160608201526080830151613a9f81614258565b6080820152613ab060a08401613833565b60a08201529392505050565b600060208284031215613acd578081fd5b81356001600160401b0380821115613ae3578283fd5b9083019060e08286031215613af6578283fd5b613b0060e06141e4565b8235815260208301356020820152613b1a60408401613862565b6040820152613b2b60608401613828565b6060820152613b3c60808401613828565b608082015260a083013560a082015260c083013582811115613b5c578485fd5b613b6887828601613843565b60c08301525095945050505050565b6001600160a01b03169052565b60008151808452613b9c816020860160208601614228565b601f01601f19169290920160200192915050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b90815260200190565b60008351613be8818460208801614228565b835190830190613bfc818360208801614228565b01949350505050565b600088825287602083015260028710613c1a57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b166055840152508360698301528251613c61816089850160208701614228565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b600060e08201905060018060a01b038085168352835160208401526020840151604084015260408401516060840152606084015160808401528060808501511660a08401525060a0830151151560c08301529392505050565b901515815260200190565b6020810160038310613d3457fe5b91905290565b60208082526025908201527f53746f7261676520736c6f742068617320616c7265616479206265656e20707260408201526437bb32b71760d91b606082015260800190565b60208082526026908201527f4163636f756e742073746174652068617320616c7265616479206265656e20706040820152653937bb32b71760d11b606082015260800190565b6020808252603e908201527f416c6c206163636f756e7473206d75737420626520636f6d6d6974746564206260408201527f65666f726520636f6d706c6574696e672061207472616e736974696f6e2e0000606082015260800190565b602080825260409082018190527f53746f7261676520736c6f742076616c7565207761736e2774206368616e6765908201527f64206f722068617320616c7265616479206265656e20636f6d6d69747465642e606082015260800190565b6020808252605b908201527f4f564d5f53746174655472616e736974696f6e65723a2050726f76696465642060408201527f4c3120636f6e747261637420636f6465206861736820646f6573206e6f74206d60608201527f61746368204c3220636f6e747261637420636f646520686173682e0000000000608082015260a00190565b6020808252603f908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d6d697474696e67206163636f756e74207374617465732e00606082015260800190565b60208082526038908201527f4e6f7420656e6f7567682067617320746f2065786563757465207472616e736160408201527f6374696f6e2064657465726d696e6973746963616c6c792e0000000000000000606082015260800190565b6020808252603b908201527f4163636f756e74207374617465207761736e2774206368616e676564206f722060408201527f68617320616c7265616479206265656e20636f6d6d69747465642e0000000000606082015260800190565b6020808252603d908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d706c6574696e672061207472616e736974696f6e2e000000606082015260800190565b60208082526031908201527f46756e6374696f6e206d7573742062652063616c6c656420647572696e67207460408201527034329031b7b93932b1ba10383430b9b29760791b606082015260800190565b6020808252601d908201527f496e76616c6964207472616e73616374696f6e2070726f76696465642e000000604082015260600190565b60208082526038908201527f436f6e7472616374206d757374206265207665726966696564206265666f726560408201527f2070726f76696e6720612073746f7261676520736c6f742e0000000000000000606082015260800190565b600060408252835160408301526020840151606083015260408401516002811061418257fe5b60808381019190915260608501516001600160a01b031660a08401528401516141ae60c0840182613b77565b5060a084015160e083015260c084015160e06101008401526141d4610120840182613b84565b9150506116966020830184613b77565b6040518181016001600160401b03811182821017156141ff57fe5b604052919050565b60006001600160401b0382111561421a57fe5b50601f01601f191660200190565b60005b8381101561424357818101518382015260200161422b565b83811115614252576000848401525b50505050565b6001600160a01b038116811461426d57600080fd5b5056fe50726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e52656365697665642061206e6f6465207769746820616e20756e6b6e6f776e20707265666978a2646970667358221220ce5bdf188c3574b3ab8fd8d954100f14bc36e9cb42e1ca798a8f556d7ace41f564736f6c634300070600334372656174652063616e206f6e6c7920626520646f6e6520627920746865204f564d5f467261756456657269666965722ea26469706673582212200d398ad651c22ef8f9239e5104dc8b8e30dec6c479966de4f2382a136a81db4864736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c806322d1470214610046578063299ca4781461009a578063461a4478146100a2575b600080fd5b61007e6004803603608081101561005c57600080fd5b506001600160a01b038135169060208101359060408101359060600135610148565b604080516001600160a01b039092168252519081900360200190f35b61007e610229565b61007e600480360360208110156100b857600080fd5b8101906020810181356401000000008111156100d357600080fd5b8201836020820111156100e557600080fd5b8035906020019184600183028401116401000000008311171561010757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610238945050505050565b600061017c6040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b815250610238565b6001600160a01b0316336001600160a01b0316146101cb5760405162461bcd60e51b81526004018080602001828103825260318152602001806148ee6031913960400191505060405180910390fd5b848484846040516101db90610314565b80856001600160a01b03168152602001848152602001838152602001828152602001945050505050604051809103906000f08015801561021f573d6000803e3d6000fd5b5095945050505050565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610298578181015183820152602001610280565b50505050905090810190601f1680156102c55780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102e257600080fd5b505afa1580156102f6573d6000803e3d6000fd5b505050506040513d602081101561030c57600080fd5b505192915050565b6145cc806103228339019056fe60806040523480156200001157600080fd5b50604051620045cc380380620045cc833981016040819052620000349162000232565b600080546001600160a01b0319166001600160a01b038616179055600583905560028290556003829055600681905560408051808201909152601781527f4f564d5f53746174654d616e61676572466163746f72790000000000000000006020820152620000a29062000150565b6001600160a01b0316639ed93318306040518263ffffffff1660e01b8152600401620000cf919062000299565b602060405180830381600087803b158015620000ea57600080fd5b505af1158015620000ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000125919062000273565b600180546001600160a01b0319166001600160a01b039290921691909117905550620002c692505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015620001b257818101518382015260200162000198565b50505050905090810190601f168015620001e05780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b158015620001fe57600080fd5b505afa15801562000213573d6000803e3d6000fd5b505050506040513d60208110156200022a57600080fd5b505192915050565b6000806000806080858703121562000248578384fd5b84516200025581620002ad565b60208601516040870151606090970151919890975090945092505050565b60006020828403121562000285578081fd5b81516200029281620002ad565b9392505050565b6001600160a01b0391909116815260200190565b6001600160a01b0381168114620002c357600080fd5b50565b6142f680620002d66000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063845fe7a31161008c578063b2fa1c9e11610066578063b2fa1c9e14610185578063b52805711461019a578063b9194310146101a2578063c1c618b8146101b5576100cf565b8063845fe7a314610155578063a244316a14610168578063b1c9fe6e14610170576100cf565b8063299ca478146100d45780632e1ac36c146100f25780632eb1375814610107578063461a44781461011a578063732f960b1461012d578063805e9d3014610140575b600080fd5b6100dc6101bd565b6040516100e99190613c74565b60405180910390f35b6101056101003660046138d0565b6101cc565b005b610105610115366004613910565b610565565b6100dc6101283660046139f8565b6108a1565b61010561013b366004613abc565b61097f565b610148610c6f565b6040516100e99190613bcd565b6101056101633660046138d0565b610c75565b610105610fa1565b610178611128565b6040516100e99190613d26565b61018d611131565b6040516100e99190613d1b565b6100dc61114c565b6101056101b0366004613871565b61115b565b610148611475565b6000546001600160a01b031681565b60018060045460ff1660028111156101e057fe5b146102065760405162461bcd60e51b81526004016101fd90614077565b60405180910390fd5b60025460065460005a6001546040516363b285f960e11b81529192506001600160a01b03169063c7650bf290610242908a908a90600401613c88565b602060405180830381600087803b15801561025c57600080fd5b505af1158015610270573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610294919061395d565b15156001146102b55760405162461bcd60e51b81526004016101fd90613e22565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f1906102e6908b90600401613c74565b60c06040518083038186803b1580156102fe57600080fd5b505afa158015610312573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103369190613a3d565b600154604051631aaf392f60e01b81529192506000916001600160a01b0390911690631aaf392f9061036e908c908c90600401613c88565b60206040518083038186803b15801561038657600080fd5b505afa15801561039a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103be9190613977565b90506103ff886040516020016103d49190613bcd565b6040516020818303038152906040526103f46103ef8461147b565b6114c4565b89856040015161152e565b6040808401919091526001549051638f3b964760e01b81526001600160a01b0390911690638f3b964790610439908c908690600401613cc2565b600060405180830381600087803b15801561045357600080fd5b505af1158015610467573d6000803e3d6000fd5b505050507f3e3ed1a676a2754a041b49bf752e0f167c8753495e36c320fe01d1ef7476253c898960405161049c929190613c88565b60405180910390a1505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561054357600080fd5b505af1158015610557573d6000803e3d6000fd5b505050505050505050505050565b60018060045460ff16600281111561057957fe5b146105965760405162461bcd60e51b81526004016101fd90614077565b60025460065460005a9050600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156105ef57600080fd5b505afa158015610603573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106279190613977565b156106445760405162461bcd60e51b81526004016101fd90613f03565b600154604051630b38106960e11b81526001600160a01b039091169063167020d290610674908990600401613c74565b602060405180830381600087803b15801561068e57600080fd5b505af11580156106a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c6919061395d565b15156001146106e75760405162461bcd60e51b81526004016101fd90613fbd565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f190610718908a90600401613c74565b60c06040518083038186803b15801561073057600080fd5b505afa158015610744573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107689190613a3d565b90506107a78760405160200161077e9190613bb0565b60405160208183030381529060405261079e61079984611554565b611594565b8860035461152e565b6003556040517fcec9ef675d775706a02b43afe48af52c5019bc50f99582e3208c6ff55d59c008906107da908990613c74565b60405180910390a15060005a8203905061081a6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561088057600080fd5b505af1158015610894573d6000803e3d6000fd5b5050505050505050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156109015781810151838201526020016108e9565b50505050905090810190601f16801561092e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561094b57600080fd5b505afa15801561095f573d6000803e3d6000fd5b505050506040513d602081101561097557600080fd5b505190505b919050565b60008060045460ff16600281111561099357fe5b146109b05760405162461bcd60e51b81526004016101fd90614077565b60025460065460005a90506006546109c78661169d565b146109e45760405162461bcd60e51b81526004016101fd906140c8565b6103e88560a0015161040802816109f757fe5b04620186a0015a1015610a1c5760405162461bcd60e51b81526004016101fd90613f60565b6000610a536040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b8152506108a1565b600154604051631381ba4d60e01b81529192506001600160a01b031690631381ba4d90610a84908490600401613c74565b600060405180830381600087803b158015610a9e57600080fd5b505af1158015610ab2573d6000803e3d6000fd5b5050600154604051639be3ad6760e01b81526001600160a01b038086169450639be3ad679350610ae9928b9291169060040161415c565b600060405180830381600087803b158015610b0357600080fd5b505af1158015610b17573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b3f919081019061398f565b50600154604051631381ba4d60e01b81526001600160a01b0390911690631381ba4d90610b7190600090600401613c74565b600060405180830381600087803b158015610b8b57600080fd5b505af1158015610b9f573d6000803e3d6000fd5b50506004805460ff191660011790555060009150505a82039050610be96040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b158015610c4f57600080fd5b505af1158015610c63573d6000803e3d6000fd5b50505050505050505050565b60025490565b60008060045460ff166002811115610c8957fe5b14610ca65760405162461bcd60e51b81526004016101fd90614077565b60025460065460005a600154604051630ad2267960e01b81529192506001600160a01b031690630ad2267990610ce2908a908a90600401613c88565b60206040518083038186803b158015610cfa57600080fd5b505afa158015610d0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d32919061395d565b15610d4f5760405162461bcd60e51b81526004016101fd90613d3a565b60015460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf90610d7f908a90600401613c74565b60206040518083038186803b158015610d9757600080fd5b505afa158015610dab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcf919061395d565b1515600114610df05760405162461bcd60e51b81526004016101fd906140ff565b60015460405163136e2d8960e11b81526000916001600160a01b0316906326dc5b1290610e21908b90600401613c74565b60206040518083038186803b158015610e3957600080fd5b505afa158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e719190613977565b905060007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421821415610ea557506000610f02565b600080610ed28a604051602001610ebc9190613bcd565b6040516020818303038152906040528a866116b6565b909250905060018215151415610efa57610ef3610eee826116df565b6116f2565b9250610eff565b600092505b50505b600154604051635c17d62960e01b81526001600160a01b0390911690635c17d62990610f36908c908c908690600401613ca1565b600060405180830381600087803b158015610f5057600080fd5b505af1158015610f64573d6000803e3d6000fd5b50505050505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b60018060045460ff166002811115610fb557fe5b14610fd25760405162461bcd60e51b81526004016101fd90614077565b600160009054906101000a90046001600160a01b03166001600160a01b031663d7bd4a2a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561102057600080fd5b505afa158015611034573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110589190613977565b156110755760405162461bcd60e51b81526004016101fd90613dc5565b600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156110c357600080fd5b505afa1580156110d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110fb9190613977565b156111185760405162461bcd60e51b81526004016101fd9061401a565b506004805460ff19166002179055565b60045460ff1681565b6000600260045460ff16600281111561114657fe5b14905090565b6001546001600160a01b031681565b60008060045460ff16600281111561116f57fe5b1461118c5760405162461bcd60e51b81526004016101fd90614077565b60025460065460005a60015460405163c8e40fbf60e01b81529192506001600160a01b03169063c8e40fbf906111c6908a90600401613c74565b60206040518083038186803b1580156111de57600080fd5b505afa1580156111f2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611216919061395d565b1580156112a057506001546040516307a1294560e01b81526001600160a01b03909116906307a129459061124e908a90600401613c74565b60206040518083038186803b15801561126657600080fd5b505afa15801561127a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129e919061395d565b155b6112bc5760405162461bcd60e51b81526004016101fd90613d7f565b6000806112eb896040516020016112d39190613bb0565b604051602081830303815290604052886002546116b6565b90925090506001821515141561140c57600061130682611721565b606081015190915089907fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470141561133f5750600061136a565b816060015161134d826117b3565b1461136a5760405162461bcd60e51b81526004016101fd90613e80565b6001546040805160c08101825284518152602080860151908201528482015181830152606080860151908201526001600160a01b038481166080830152600060a08301529151638f3b964760e01b81529190921691638f3b9647916113d3918f91600401613cc2565b600060405180830381600087803b1580156113ed57600080fd5b505af1158015611401573d6000803e3d6000fd5b50505050505061143c565b600154604051630d631c9d60e31b81526001600160a01b0390911690636b18e4e890610f36908c90600401613c74565b505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b60035490565b6060806000805b6020811085821a15161561149c5760019182019101611482565b5060405191506040820160405283600882021b60208301528060200382525080915050919050565b606080825160011480156114ec57506080836000815181106114e257fe5b016020015160f81c105b156114f8575081611528565b611504835160806117b7565b83604051602001611516929190613bd6565b60405160208183030381529060405290505b92915050565b60008061153a86611906565b905061154881868686611936565b9150505b949350505050565b61155c61378f565b604051806080016040528083600001518152602001836020015181526020018360400151815260200183606001518152509050919050565b60408051600480825260a0820190925260609160009190816020015b60608152602001906001900390816115b057505083519091506115d6906103ef9061147b565b816000815181106115e357fe5b60200260200101819052506116016103ef846020015160001b61147b565b8160018151811061160e57fe5b602002602001018190525061164583604001516040516020016116319190613bcd565b6040516020818303038152906040526114c4565b8160028151811061165257fe5b602002602001018190525061167583606001516040516020016116319190613bcd565b8160038151811061168257fe5b6020026020010181905250611696816119d1565b9392505050565b60006116a882611a15565b805190602001209050919050565b6000606060006116c586611906565b90506116d2818686611a50565b9250925050935093915050565b60606115286116ed83611b23565b611b48565b600080600060208451111561170857602061170b565b83515b6020858101519190036008021c92505050919050565b61172961378f565b600061173483611bd7565b9050604051806080016040528061175e8360008151811061175157fe5b6020026020010151611bea565b81526020016117738360018151811061175157fe5b81526020016117958360028151811061178857fe5b6020026020010151611bf1565b81526020016117aa8360038151811061178857fe5b90529392505050565b3f90565b6060806038841015611811576040805160018082528183019092529060208201818036833701905050905082840160f81b816000815181106117f557fe5b60200101906001600160f81b031916908160001a905350611696565b600060015b80868161181f57fe5b04156118345760019091019061010002611816565b816001016001600160401b038111801561184d57600080fd5b506040519080825280601f01601f191660200182016040528015611878576020820181803683370190505b50925084820160370160f81b8360008151811061189157fe5b60200101906001600160f81b031916908160001a905350600190505b8181116118fd576101008183036101000a87816118c657fe5b04816118ce57fe5b0660f81b8382815181106118de57fe5b60200101906001600160f81b031916908160001a9053506001016118ad565b50509392505050565b606081805190602001206040516020016119209190613bcd565b6040516020818303038152906040529050919050565b6040805180820190915260018152600160ff1b60209091015260007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42182141561198a576119838585611ceb565b905061154c565b600061199584611d0f565b90506000806119a5838987611de5565b509150915060006119b88484848b612188565b90506119c4818a6124a0565b9998505050505050505050565b606060006119de836125f9565b90506119ec815160c06117b7565b816040516020016119fe929190613bd6565b604051602081830303815290604052915050919050565b6060816000015182602001518360400151846060015185608001518660a001518760c001516040516020016119209796959493929190613c05565b600060606000611a5f85611d0f565b90506000806000611a71848a89611de5565b81519295509093509150158080611a855750815b611ad6576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b600081611af25760405180602001604052806000815250611b11565b611b11866001870381518110611b0457fe5b6020026020010151612702565b919b919a509098505050505050505050565b611b2b6137b6565b506040805180820190915281518152602082810190820152919050565b60606000806000611b588561271e565b919450925090506000816001811115611b6d57fe5b14611bbf576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b611bce85602001518484612a47565b95945050505050565b6060611528611be583611b23565b612af4565b6000611528825b6000602182600001511115611c4d576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6000806000611c5b8561271e565b919450925090506000816001811115611c7057fe5b14611cc2576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b602080860151840180519091841015611ce15760208490036101000a90045b9695505050505050565b6000611cff611cf984612c6a565b83612d66565b5180516020909101209392505050565b60606000611d1c83611bd7565b9050600081516001600160401b0381118015611d3757600080fd5b50604051908082528060200260200182016040528015611d7157816020015b611d5e6137d0565b815260200190600190039081611d565790505b50905060005b8251811015611ddd576000611d9e848381518110611d9157fe5b6020026020010151611b48565b90506040518060400160405280828152602001611dba83611bd7565b815250838381518110611dc957fe5b602090810291909101015250600101611d77565b509392505050565b60006060818080611df587612c6a565b905085600080611e036137d0565b60005b8c51811015612160578c8181518110611e1b57fe5b6020026020010151915082840193506001870196508360001415611e8f57815180516020909101208514611e8a576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b611f56565b815151602011611ef657815180516020909101208514611e8a576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b84611f048360000151612dfa565b14611f56576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b60208201515160111415611fc5578551841415611f7257612160565b6000868581518110611f8057fe5b602001015160f81c60f81b60f81c9050600083602001518260ff1681518110611fa557fe5b60200260200101519050611fb881612e26565b9650600194505050612158565b6002826020015151141561210b576000611fde83612e5c565b9050600081600081518110611fef57fe5b016020015160f81c905060018116600203600061200f8460ff8416612e7a565b9050600061201d8b8a612e7a565b9050600061202b8383612eab565b905060ff851660021480612042575060ff85166003145b15612074578083511480156120575750808251145b1561206157988901985b50600160ff1b9950612160945050505050565b60ff85161580612087575060ff85166001145b156120d457806120a45750600160ff1b9950612160945050505050565b6120c588602001516001815181106120b857fe5b6020026020010151612e26565b9a509750612158945050505050565b60405162461bcd60e51b815260040180806020018281038252602681526020018061429b6026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b600101611e06565b50600160ff1b8414866121738786612e7a565b909e909d50909b509950505050505050505050565b6060600083905060008660018703815181106121a057fe5b6020026020010151905060006121b582612f11565b6040805160038082526080820190925291925060009190816020015b6121d96137d0565b8152602001906001900390816121d157905050905060008451600014801561220c5750600283600281111561220a57fe5b145b156122425761222361221d85612fe7565b88612d66565b82828151811061222f57fe5b6020908102919091010152600101612483565b600083600281111561225057fe5b14156122b6578451612285576122668488612ffa565b82828151811061227257fe5b60209081029190910101526001016122b1565b8382828151811061229257fe5b602002602001018190525060018101905061222361221d866001612e7a565b612483565b60006122c185612fe7565b905060006122cf8288612eab565b905080156123305760006122e583600084613045565b90506122f9816122f48c613195565b6131d6565b85858151811061230557fe5b60200260200101819052506001840193506123208383612e7a565b925061232c8883612e7a565b9750505b600061233a61321a565b905082516000141561235f576123588161235389612702565b612ffa565b90506123f7565b60008360008151811061236e57fe5b016020015160f81c9050612383846001612e7a565b9350600287600281111561239357fe5b14156123ce5760006123ad856123a88b612702565b612d66565b90506123c683836123c18460000151613195565b6132a7565b9250506123f5565b8351156123e45760006123ad856122f48b612702565b6123f282826123c18b612702565b91505b505b875161242c57612407818b612ffa565b90508085858151811061241657fe5b602002602001018190525060018401935061247f565b612437886001612e7a565b97508085858151811061244657fe5b6020026020010181905250600184019350612461888b612d66565b85858151811061246d57fe5b60200260200101819052506001840193505b5050505b6124928a60018b038484613300565b9a9950505050505050505050565b6000806124ac83612c6a565b90506124b66137d0565b84516000906060905b80156125e4578760018203815181106124d457fe5b602002602001015193506124e784612f11565b925060028360028111156124f757fe5b141561252257600061250885612fe7565b905061251a8660008351895103613045565b9550506125ce565b600183600281111561253057fe5b141561257057600061254185612fe7565b90506125538660008351895103613045565b83519096501561256a5761256781846131d6565b94505b506125ce565b600083600281111561257e57fe5b14156125ce578151156125ce5760008560018751038151811061259d57fe5b602001015160f81c60f81b60f81c90506125bd8660006001895103613045565b95506125ca8582856132a7565b9450505b83516125d990613195565b9150600019016124bf565b50509051805160209091012095945050505050565b606081516000141561261a575060408051600081526020810190915261097a565b6000805b835181101561264d5783818151811061263357fe5b60200260200101515182019150808060010191505061261e565b6000826001600160401b038111801561266557600080fd5b506040519080825280601f01601f191660200182016040528015612690576020820181803683370190505b50600092509050602081015b85518310156126f95760008684815181106126b357fe5b6020026020010151905060006020820190506126d1838284516133e2565b8785815181106126dd57fe5b602002602001015151830192505050828060010193505061269c565b50949350505050565b60208101518051606091611528916000198101908110611d9157fe5b60008060008084600001511161277b576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f81116127a0576000600160009450945094505050612a40565b60b78111612815578551607f198201908110612803576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b60019550935060009250612a40915050565b60bf81116128f957855160b6198201908110612878576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a60018501510490508082018860000151116128e4576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b60019091019550935060009250612a40915050565b60f7811161296d57855160bf19820190811061295c576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b600195509350849250612a40915050565b855160f61982019081106129c8576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111612a2d576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b6001918201965094509250612a40915050565b9193909250565b60606000826001600160401b0381118015612a6157600080fd5b506040519080825280601f01601f191660200182016040528015612a8c576020820181803683370190505b509050805160001415612aa0579050611696565b8484016020820160005b60208604811015612acb578251825260209283019290910190600101612aaa565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b6060600080612b028461271e565b91935090915060019050816001811115612b1857fe5b14612b6a576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b612b8b6137b6565b815260200190600190039081612b835790505090506000835b8651811015612c5f5760208210612bec5760405162461bcd60e51b815260040180806020018281038252602a815260200180614271602a913960400191505060405180910390fd5b600080612c186040518060400160405280858c60000151038152602001858c602001510181525061271e565b509150915060405180604001604052808383018152602001848b6020015101815250858581518110612c4657fe5b6020908102919091010152600193909301920101612ba4565b508152949350505050565b6060600082516002026001600160401b0381118015612c8857600080fd5b506040519080825280601f01601f191660200182016040528015612cb3576020820181803683370190505b50905060005b8351811015612d5f576004848281518110612cd057fe5b602001015160f81c60f81b6001600160f81b031916901c828260020281518110612cf657fe5b60200101906001600160f81b031916908160001a9053506010848281518110612d1b57fe5b016020015160f81c81612d2a57fe5b0660f81b828260020260010181518110612d4057fe5b60200101906001600160f81b031916908160001a905350600101612cb9565b5092915050565b612d6e6137d0565b60408051600280825260608201909252600091816020015b6060815260200190600190039081612d865790505090506000612daa856001613426565b9050612db86103ef8261357d565b82600081518110612dc557fe5b6020026020010181905250612dd9846114c4565b82600181518110612de657fe5b6020026020010181905250611bce8261364d565b6000602082511015612e115750602081015161097a565b81806020019051602081101561097557600080fd5b60006060602083600001511015612e4757612e408361367c565b9050612e53565b612e5083611b48565b90505b61169681612dfa565b6060611528612e758360200151600081518110611d9157fe5b612c6a565b60608183510360001415612e9d5750604080516020810190915260008152611528565b611696838384865103613045565b6000805b808451118015612ebf5750808351115b8015612f045750828181518110612ed257fe5b602001015160f81c60f81b6001600160f81b031916848281518110612ef357fe5b01602001516001600160f81b031916145b1561169657600101612eaf565b60208101515160009060111415612f2a5750600061097a565b60028260200151511415612fa6576000612f4383612e5c565b9050600081600081518110612f5457fe5b016020015160f81c90506002811480612f70575060ff81166003145b15612f805760029250505061097a565b60ff81161580612f93575060ff81166001145b15612fa35760019250505061097a565b50505b6040805162461bcd60e51b8152602060048201526011602482015270496e76616c6964206e6f6465207479706560781b604482015290519081900360640190fd5b6060611528612ff583612e5c565b613687565b6130026137d0565b600061300d836114c4565b905061301881611b23565b60208501518051600019810190811061302d57fe5b602002602001018190525061154c84602001516136d0565b60608182601f011015613090576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b8282840110156130d8576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b81830184511015613124576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b60608215801561314357604051915060008252602082016040526126f9565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561317c578051835260209283019201613164565b5050858452601f01601f19166040525050949350505050565b60606020825110156131a857508061097a565b818051906020012060405160200180828152602001915050604051602081830303815290604052905061097a565b6131de6137d0565b60408051600280825260608201909252600091816020015b60608152602001906001900390816131f65790505090506000612daa856000613426565b6132226137d0565b6040805160118082526102408201909252600091816020015b606081526020019060019003908161323b57905050905060005b815181101561329757604051806040016040528060018152602001600160ff1b81525082828151811061328457fe5b6020908102919091010152600101613255565b506132a18161364d565b91505090565b6132af6137d0565b600060208351106132c8576132c3836114c4565b6132ca565b825b90506132d581611b23565b85602001518560ff16815181106132e857fe5b6020026020010181905250611bce85602001516136d0565b606060008285016001600160401b038111801561331c57600080fd5b5060405190808252806020026020018201604052801561335657816020015b6133436137d0565b81526020019060019003908161333b5790505b50905060005b858110156133975786818151811061337057fe5b602002602001015182828151811061338457fe5b602090810291909101015260010161335c565b5060005b838110156133d8578481815181106133af57fe5b602002602001015182878301815181106133c557fe5b602090810291909101015260010161339b565b5095945050505050565b8282825b60208110613405578151835260209283019290910190601f19016133e6565b905182516020929092036101000a6000190180199091169116179052505050565b6060600082613436576000613439565b60025b90506000600285518161344857fe5b06905060008160020360ff166001600160401b038111801561346957600080fd5b506040519080825280601f01601f191660200182016040528015613494576020820181803683370190505b50905081830160f81b816000815181106134aa57fe5b60200101906001600160f81b031916908160001a90535080866040516020018083805190602001908083835b602083106134f55780518252601f1990920191602091820191016134d6565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b6020831061353d5780518252601f19909201916020918201910161351e565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052935050505092915050565b60606000600283518161358c57fe5b046001600160401b03811180156135a257600080fd5b506040519080825280601f01601f1916602001820160405280156135cd576020820181803683370190505b50905060005b8151811015612d5f578381600202600101815181106135ee57fe5b602001015160f81c60f81b600485836002028151811061360a57fe5b602001015160f81c60f81b6001600160f81b031916901b1782828151811061362e57fe5b60200101906001600160f81b031916908160001a9053506001016135d3565b6136556137d0565b6000613660836119d1565b905060405180604001604052808281526020016117aa83611bd7565b606061152882613779565b606060028260008151811061369857fe5b016020015160f81c816136a757fe5b0660ff16600014156136c5576136be826002612e7a565b905061097a565b6136be826001612e7a565b6136d86137d0565b600082516001600160401b03811180156136f157600080fd5b5060405190808252806020026020018201604052801561372557816020015b60608152602001906001900390816137105790505b50905060005b835181101561376f5761375084828151811061374357fe5b602002602001015161367c565b82828151811061375c57fe5b602090810291909101015260010161372b565b506116968161364d565b6060611528826020015160008460000151612a47565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060008152602001600081525090565b604051806040016040528060608152602001606081525090565b60006137fd6137f884614207565b6141e4565b905082815283838301111561381157600080fd5b828260208301376000602084830101529392505050565b803561097a81614258565b8051801515811461097a57600080fd5b600082601f830112613853578081fd5b611696838335602085016137ea565b80356002811061097a57600080fd5b600080600060608486031215613885578283fd5b833561389081614258565b925060208401356138a081614258565b915060408401356001600160401b038111156138ba578182fd5b6138c686828701613843565b9150509250925092565b6000806000606084860312156138e4578283fd5b83356138ef81614258565b92506020840135915060408401356001600160401b038111156138ba578182fd5b60008060408385031215613922578182fd5b823561392d81614258565b915060208301356001600160401b03811115613947578182fd5b61395385828601613843565b9150509250929050565b60006020828403121561396e578081fd5b61169682613833565b600060208284031215613988578081fd5b5051919050565b6000602082840312156139a0578081fd5b81516001600160401b038111156139b5578182fd5b8201601f810184136139c5578182fd5b80516139d36137f882614207565b8181528560208385010111156139e7578384fd5b611bce826020830160208601614228565b600060208284031215613a09578081fd5b81356001600160401b03811115613a1e578182fd5b8201601f81018413613a2e578182fd5b61154c848235602084016137ea565b600060c08284031215613a4e578081fd5b60405160c081018181106001600160401b0382111715613a6a57fe5b8060405250825181526020830151602082015260408301516040820152606083015160608201526080830151613a9f81614258565b6080820152613ab060a08401613833565b60a08201529392505050565b600060208284031215613acd578081fd5b81356001600160401b0380821115613ae3578283fd5b9083019060e08286031215613af6578283fd5b613b0060e06141e4565b8235815260208301356020820152613b1a60408401613862565b6040820152613b2b60608401613828565b6060820152613b3c60808401613828565b608082015260a083013560a082015260c083013582811115613b5c578485fd5b613b6887828601613843565b60c08301525095945050505050565b6001600160a01b03169052565b60008151808452613b9c816020860160208601614228565b601f01601f19169290920160200192915050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b90815260200190565b60008351613be8818460208801614228565b835190830190613bfc818360208801614228565b01949350505050565b600088825287602083015260028710613c1a57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b166055840152508360698301528251613c61816089850160208701614228565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b600060e08201905060018060a01b038085168352835160208401526020840151604084015260408401516060840152606084015160808401528060808501511660a08401525060a0830151151560c08301529392505050565b901515815260200190565b6020810160038310613d3457fe5b91905290565b60208082526025908201527f53746f7261676520736c6f742068617320616c7265616479206265656e20707260408201526437bb32b71760d91b606082015260800190565b60208082526026908201527f4163636f756e742073746174652068617320616c7265616479206265656e20706040820152653937bb32b71760d11b606082015260800190565b6020808252603e908201527f416c6c206163636f756e7473206d75737420626520636f6d6d6974746564206260408201527f65666f726520636f6d706c6574696e672061207472616e736974696f6e2e0000606082015260800190565b602080825260409082018190527f53746f7261676520736c6f742076616c7565207761736e2774206368616e6765908201527f64206f722068617320616c7265616479206265656e20636f6d6d69747465642e606082015260800190565b6020808252605b908201527f4f564d5f53746174655472616e736974696f6e65723a2050726f76696465642060408201527f4c3120636f6e747261637420636f6465206861736820646f6573206e6f74206d60608201527f61746368204c3220636f6e747261637420636f646520686173682e0000000000608082015260a00190565b6020808252603f908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d6d697474696e67206163636f756e74207374617465732e00606082015260800190565b60208082526038908201527f4e6f7420656e6f7567682067617320746f2065786563757465207472616e736160408201527f6374696f6e2064657465726d696e6973746963616c6c792e0000000000000000606082015260800190565b6020808252603b908201527f4163636f756e74207374617465207761736e2774206368616e676564206f722060408201527f68617320616c7265616479206265656e20636f6d6d69747465642e0000000000606082015260800190565b6020808252603d908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d706c6574696e672061207472616e736974696f6e2e000000606082015260800190565b60208082526031908201527f46756e6374696f6e206d7573742062652063616c6c656420647572696e67207460408201527034329031b7b93932b1ba10383430b9b29760791b606082015260800190565b6020808252601d908201527f496e76616c6964207472616e73616374696f6e2070726f76696465642e000000604082015260600190565b60208082526038908201527f436f6e7472616374206d757374206265207665726966696564206265666f726560408201527f2070726f76696e6720612073746f7261676520736c6f742e0000000000000000606082015260800190565b600060408252835160408301526020840151606083015260408401516002811061418257fe5b60808381019190915260608501516001600160a01b031660a08401528401516141ae60c0840182613b77565b5060a084015160e083015260c084015160e06101008401526141d4610120840182613b84565b9150506116966020830184613b77565b6040518181016001600160401b03811182821017156141ff57fe5b604052919050565b60006001600160401b0382111561421a57fe5b50601f01601f191660200190565b60005b8381101561424357818101518382015260200161422b565b83811115614252576000848401525b50505050565b6001600160a01b038116811461426d57600080fd5b5056fe50726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e52656365697665642061206e6f6465207769746820616e20756e6b6e6f776e20707265666978a2646970667358221220ce5bdf188c3574b3ab8fd8d954100f14bc36e9cb42e1ca798a8f556d7ace41f564736f6c634300070600334372656174652063616e206f6e6c7920626520646f6e6520627920746865204f564d5f467261756456657269666965722ea26469706673582212200d398ad651c22ef8f9239e5104dc8b8e30dec6c479966de4f2382a136a81db4864736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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\":{\"_0\":\"New OVM_StateTransitioner instance.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}}},\"title\":\"OVM_StateTransitionerFactory\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"create(address,uint256,bytes32,bytes32)\":{\"notice\":\"Creates a new OVM_StateTransitioner\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"}},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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 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 external\\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 external\\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 external\\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 external\\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 external\\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 external\\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 // Prevent the Execution Manager from calling this SM again.\\n ovmStateManager.setExecutionManager(address(0));\\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 external\\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 external\\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 external\\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\":\"0x53231f64d413623b2b8c4ba1b596c9cbbe4712c9b406a42198aeaa8387a293d9\",\"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 /***************\\n * Constructor *\\n ***************/\\n\\n constructor(\\n address _libAddressManager\\n )\\n Lib_AddressResolver(_libAddressManager)\\n {}\\n\\n\\n /********************\\n * Public Functions *\\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 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\\n )\\n {\\n require(\\n msg.sender == resolve(\\\"OVM_FraudVerifier\\\"),\\n \\\"Create can only be done by the OVM_FraudVerifier.\\\"\\n );\\n\\n return new OVM_StateTransitioner(\\n _libAddressManager,\\n _stateTransitionIndex,\\n _preStateRoot,\\n _transactionHash\\n );\\n }\\n}\\n\",\"keccak256\":\"0x65ef11334a2d6931b6d3a85e7b29c39c774d19443e7040e132a58be505e3b52c\",\"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 OUT_OF_GAS,\\n INTENTIONAL_REVERT,\\n EXCEEDS_NUISANCE_GAS,\\n INVALID_STATE_ACCESS,\\n UNSAFE_BYTECODE,\\n CREATE_COLLISION,\\n STATIC_VIOLATION,\\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 enum MessageType {\\n ovmCALL,\\n ovmSTATICCALL,\\n ovmDELEGATECALL,\\n ovmCREATE,\\n ovmCREATE2\\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 uint256 ovmCALLVALUE;\\n bool isStatic;\\n }\\n\\n struct MessageRecord {\\n uint256 nuisanceGasLeft;\\n }\\n\\n\\n /************************************\\n * Transaction Execution Entrypoint *\\n ************************************/\\n\\n function run(\\n Lib_OVMCodec.Transaction calldata _transaction,\\n address _txStateManager\\n ) external returns (bytes memory);\\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 ovmCALLVALUE() external view returns (uint _callValue);\\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, bytes memory _revertdata);\\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract, bytes memory _revertdata);\\n\\n\\n /*******************************\\n * Account Abstraction Opcodes *\\n ******************************/\\n\\n function ovmGETNONCE() external returns (uint256 _nonce);\\n function ovmINCREMENTNONCE() external;\\n function ovmCREATEEOA(bytes32 _messageHash, uint8 _v, bytes32 _r, bytes32 _s) external;\\n\\n\\n /****************************\\n * Contract Calling Opcodes *\\n ****************************/\\n\\n // Valueless ovmCALL for maintaining backwards compatibility with legacy OVM bytecode.\\n function ovmCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\\n function ovmCALL(uint256 _gasLimit, address _address, uint256 _value, 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 * ETH Value Opcodes *\\n *********************/\\n\\n function ovmBALANCE(address _contract) external returns (uint256 _balance);\\n function ovmSELFBALANCE() external returns (uint256 _balance);\\n\\n\\n /***************************************\\n * Public Functions: Execution Context *\\n ***************************************/\\n\\n function getMaxTransactionGasLimit() external view returns (uint _maxTransactionGasLimit);\\n}\\n\",\"keccak256\":\"0x87a056425696719488dbd06adbbf89280d86651e75e1f77d9e96b0632c8634cc\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 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, _key, 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 != pathRemainder.length) {\\n // Our extension node is not identical to the remainder.\\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 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 path may include\\n * additional nodes (e.g., it comes directly from a proof) and we can't resize in-memory\\n * arrays without costly duplication.\\n * @param _key Full original key.\\n * @param _keyRemainder Portion of the initial key that must be inserted 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 _key,\\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 // Reference: https://github.com/ethereumjs/merkle-patricia-tree/blob/c0a10395aab37d42c175a47114ebfcbd7efcf059/src/baseTrie.ts#L294-L313\\n bool matchLeaf = false;\\n if (lastNodeType == NodeType.LeafNode) {\\n uint256 l = 0;\\n if (_path.length > 0) {\\n for (uint256 i = 0; i < _path.length - 1; i++) {\\n if (_getNodeType(_path[i]) == NodeType.BranchNode) {\\n l++;\\n } else {\\n l += _getNodeKey(_path[i]).length;\\n }\\n }\\n }\\n\\n if (\\n _getSharedNibbleLength(\\n _getNodeKey(lastNode),\\n Lib_BytesUtils.slice(Lib_BytesUtils.toNibbles(_key), l)\\n ) == _getNodeKey(lastNode).length\\n && keyRemainder.length == 0\\n ) {\\n matchLeaf = true;\\n }\\n }\\n\\n if (matchLeaf) {\\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 = _editExtensionNodeValue(currentNode, 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 * Creates a new extension node with the same key but a different value.\\n * @param _node Extension node to copy and modify.\\n * @param _value New value for the extension node.\\n * @return New node with the same key and different value.\\n */\\n function _editExtensionNodeValue(\\n TrieNode memory _node,\\n bytes memory _value\\n )\\n private\\n pure\\n returns (\\n TrieNode memory\\n )\\n {\\n bytes[] memory raw = new bytes[](2);\\n bytes memory key = _addHexPrefix(_getNodeKey(_node), false);\\n raw[0] = Lib_RLPWriter.writeBytes(Lib_BytesUtils.fromNibbles(key));\\n if (_value.length < 32) {\\n raw[1] = _value;\\n } else {\\n raw[1] = Lib_RLPWriter.writeBytes(_value);\\n }\\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 abi.encodePacked(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\":\"0x4bb09d0b4f965b57cdc6b3ace49967bcfe7f2580fa0b7863dfe288081247d876\",\"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 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\":\"0xbbdd600165307d2131340599afa9dc0991f8f63727ba3a834bca5a3d7f501da8\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"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 *\\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 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\\n )\\n {\\n bytes memory code;\\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 Full code of the contract.\\n */\\n function getCode(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes memory\\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 Size of the contract's code in bytes.\\n */\\n function getCodeSize(\\n address _address\\n )\\n internal\\n view\\n returns (\\n uint256\\n )\\n {\\n uint256 codeSize;\\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 Hash of the contract's code.\\n */\\n function getCodeHash(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n bytes32 codeHash;\\n assembly {\\n codeHash := extcodehash(_address)\\n }\\n\\n return codeHash;\\n }\\n\\n /**\\n * Creates a contract with some given initialization code.\\n * @param _code Contract initialization code.\\n * @return Address of the created contract.\\n */\\n function createContract(\\n bytes memory _code\\n )\\n internal\\n returns (\\n address\\n )\\n {\\n address created;\\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 to be generated by CREATE.\\n */\\n function getAddressForCREATE(\\n address _creator,\\n uint256 _nonce\\n )\\n internal\\n pure\\n returns (\\n 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 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 (\\n address\\n )\\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\":\"0xf29a67d78e61cb472d524b779b32cfcb39a587f4096500d5419e6425ed367d49\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50604051614b2b380380614b2b8339818101604052602081101561003357600080fd5b5051600080546001600160a01b039092166001600160a01b0319909216919091179055614ac6806100656000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806322d1470214610046578063299ca4781461009a578063461a4478146100a2575b600080fd5b61007e6004803603608081101561005c57600080fd5b506001600160a01b038135169060208101359060408101359060600135610148565b604080516001600160a01b039092168252519081900360200190f35b61007e610229565b61007e600480360360208110156100b857600080fd5b8101906020810181356401000000008111156100d357600080fd5b8201836020820111156100e557600080fd5b8035906020019184600183028401116401000000008311171561010757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610238945050505050565b600061017c6040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b815250610238565b6001600160a01b0316336001600160a01b0316146101cb5760405162461bcd60e51b8152600401808060200182810382526031815260200180614a606031913960400191505060405180910390fd5b848484846040516101db90610314565b80856001600160a01b03168152602001848152602001838152602001828152602001945050505050604051809103906000f08015801561021f573d6000803e3d6000fd5b5095945050505050565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610298578181015183820152602001610280565b50505050905090810190601f1680156102c55780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102e257600080fd5b505afa1580156102f6573d6000803e3d6000fd5b505050506040513d602081101561030c57600080fd5b505192915050565b61473e806103228339019056fe60806040523480156200001157600080fd5b506040516200473e3803806200473e833981016040819052620000349162000232565b600080546001600160a01b0319166001600160a01b038616179055600583905560028290556003829055600681905560408051808201909152601781527f4f564d5f53746174654d616e61676572466163746f72790000000000000000006020820152620000a29062000150565b6001600160a01b0316639ed93318306040518263ffffffff1660e01b8152600401620000cf919062000299565b602060405180830381600087803b158015620000ea57600080fd5b505af1158015620000ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000125919062000273565b600180546001600160a01b0319166001600160a01b039290921691909117905550620002c692505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015620001b257818101518382015260200162000198565b50505050905090810190601f168015620001e05780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b158015620001fe57600080fd5b505afa15801562000213573d6000803e3d6000fd5b505050506040513d60208110156200022a57600080fd5b505192915050565b6000806000806080858703121562000248578384fd5b84516200025581620002ad565b60208601516040870151606090970151919890975090945092505050565b60006020828403121562000285578081fd5b81516200029281620002ad565b9392505050565b6001600160a01b0391909116815260200190565b6001600160a01b0381168114620002c357600080fd5b50565b61446880620002d66000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063845fe7a31161008c578063b2fa1c9e11610066578063b2fa1c9e14610185578063b52805711461019a578063b9194310146101a2578063c1c618b8146101b5576100cf565b8063845fe7a314610155578063a244316a14610168578063b1c9fe6e14610170576100cf565b8063299ca478146100d45780632e1ac36c146100f25780632eb1375814610107578063461a44781461011a578063732f960b1461012d578063805e9d3014610140575b600080fd5b6100dc6101bd565b6040516100e99190613de6565b60405180910390f35b610105610100366004613a42565b6101cc565b005b610105610115366004613a82565b610565565b6100dc610128366004613b6a565b6108a1565b61010561013b366004613c2e565b61097f565b610148610c6f565b6040516100e99190613d3f565b610105610163366004613a42565b610c75565b610105610fa1565b610178611128565b6040516100e99190613e98565b61018d611131565b6040516100e99190613e8d565b6100dc61114c565b6101056101b03660046139e3565b61115b565b610148611475565b6000546001600160a01b031681565b60018060045460ff1660028111156101e057fe5b146102065760405162461bcd60e51b81526004016101fd906141e9565b60405180910390fd5b60025460065460005a6001546040516363b285f960e11b81529192506001600160a01b03169063c7650bf290610242908a908a90600401613dfa565b602060405180830381600087803b15801561025c57600080fd5b505af1158015610270573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102949190613acf565b15156001146102b55760405162461bcd60e51b81526004016101fd90613f94565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f1906102e6908b90600401613de6565b60c06040518083038186803b1580156102fe57600080fd5b505afa158015610312573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103369190613baf565b600154604051631aaf392f60e01b81529192506000916001600160a01b0390911690631aaf392f9061036e908c908c90600401613dfa565b60206040518083038186803b15801561038657600080fd5b505afa15801561039a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103be9190613ae9565b90506103ff886040516020016103d49190613d3f565b6040516020818303038152906040526103f46103ef8461147b565b6114c4565b89856040015161152e565b6040808401919091526001549051638f3b964760e01b81526001600160a01b0390911690638f3b964790610439908c908690600401613e34565b600060405180830381600087803b15801561045357600080fd5b505af1158015610467573d6000803e3d6000fd5b505050507f3e3ed1a676a2754a041b49bf752e0f167c8753495e36c320fe01d1ef7476253c898960405161049c929190613dfa565b60405180910390a1505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561054357600080fd5b505af1158015610557573d6000803e3d6000fd5b505050505050505050505050565b60018060045460ff16600281111561057957fe5b146105965760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a9050600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156105ef57600080fd5b505afa158015610603573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106279190613ae9565b156106445760405162461bcd60e51b81526004016101fd90614075565b600154604051630b38106960e11b81526001600160a01b039091169063167020d290610674908990600401613de6565b602060405180830381600087803b15801561068e57600080fd5b505af11580156106a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c69190613acf565b15156001146106e75760405162461bcd60e51b81526004016101fd9061412f565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f190610718908a90600401613de6565b60c06040518083038186803b15801561073057600080fd5b505afa158015610744573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107689190613baf565b90506107a78760405160200161077e9190613d22565b60405160208183030381529060405261079e61079984611554565b611594565b8860035461152e565b6003556040517fcec9ef675d775706a02b43afe48af52c5019bc50f99582e3208c6ff55d59c008906107da908990613de6565b60405180910390a15060005a8203905061081a6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561088057600080fd5b505af1158015610894573d6000803e3d6000fd5b5050505050505050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156109015781810151838201526020016108e9565b50505050905090810190601f16801561092e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561094b57600080fd5b505afa15801561095f573d6000803e3d6000fd5b505050506040513d602081101561097557600080fd5b505190505b919050565b60008060045460ff16600281111561099357fe5b146109b05760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a90506006546109c78661169d565b146109e45760405162461bcd60e51b81526004016101fd9061423a565b6103e88560a0015161040802816109f757fe5b04620186a0015a1015610a1c5760405162461bcd60e51b81526004016101fd906140d2565b6000610a536040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b8152506108a1565b600154604051631381ba4d60e01b81529192506001600160a01b031690631381ba4d90610a84908490600401613de6565b600060405180830381600087803b158015610a9e57600080fd5b505af1158015610ab2573d6000803e3d6000fd5b5050600154604051639be3ad6760e01b81526001600160a01b038086169450639be3ad679350610ae9928b929116906004016142ce565b600060405180830381600087803b158015610b0357600080fd5b505af1158015610b17573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b3f9190810190613b01565b50600154604051631381ba4d60e01b81526001600160a01b0390911690631381ba4d90610b7190600090600401613de6565b600060405180830381600087803b158015610b8b57600080fd5b505af1158015610b9f573d6000803e3d6000fd5b50506004805460ff191660011790555060009150505a82039050610be96040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b158015610c4f57600080fd5b505af1158015610c63573d6000803e3d6000fd5b50505050505050505050565b60025490565b60008060045460ff166002811115610c8957fe5b14610ca65760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a600154604051630ad2267960e01b81529192506001600160a01b031690630ad2267990610ce2908a908a90600401613dfa565b60206040518083038186803b158015610cfa57600080fd5b505afa158015610d0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d329190613acf565b15610d4f5760405162461bcd60e51b81526004016101fd90613eac565b60015460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf90610d7f908a90600401613de6565b60206040518083038186803b158015610d9757600080fd5b505afa158015610dab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcf9190613acf565b1515600114610df05760405162461bcd60e51b81526004016101fd90614271565b60015460405163136e2d8960e11b81526000916001600160a01b0316906326dc5b1290610e21908b90600401613de6565b60206040518083038186803b158015610e3957600080fd5b505afa158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e719190613ae9565b905060007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421821415610ea557506000610f02565b600080610ed28a604051602001610ebc9190613d3f565b6040516020818303038152906040528a866116b6565b909250905060018215151415610efa57610ef3610eee826116df565b6116f2565b9250610eff565b600092505b50505b600154604051635c17d62960e01b81526001600160a01b0390911690635c17d62990610f36908c908c908690600401613e13565b600060405180830381600087803b158015610f5057600080fd5b505af1158015610f64573d6000803e3d6000fd5b50505050505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b60018060045460ff166002811115610fb557fe5b14610fd25760405162461bcd60e51b81526004016101fd906141e9565b600160009054906101000a90046001600160a01b03166001600160a01b031663d7bd4a2a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561102057600080fd5b505afa158015611034573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110589190613ae9565b156110755760405162461bcd60e51b81526004016101fd90613f37565b600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156110c357600080fd5b505afa1580156110d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110fb9190613ae9565b156111185760405162461bcd60e51b81526004016101fd9061418c565b506004805460ff19166002179055565b60045460ff1681565b6000600260045460ff16600281111561114657fe5b14905090565b6001546001600160a01b031681565b60008060045460ff16600281111561116f57fe5b1461118c5760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a60015460405163c8e40fbf60e01b81529192506001600160a01b03169063c8e40fbf906111c6908a90600401613de6565b60206040518083038186803b1580156111de57600080fd5b505afa1580156111f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112169190613acf565b1580156112a057506001546040516307a1294560e01b81526001600160a01b03909116906307a129459061124e908a90600401613de6565b60206040518083038186803b15801561126657600080fd5b505afa15801561127a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129e9190613acf565b155b6112bc5760405162461bcd60e51b81526004016101fd90613ef1565b6000806112eb896040516020016112d39190613d22565b604051602081830303815290604052886002546116b6565b90925090506001821515141561140c57600061130682611721565b606081015190915089907fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470141561133f5750600061136a565b816060015161134d826117b3565b1461136a5760405162461bcd60e51b81526004016101fd90613ff2565b6001546040805160c08101825284518152602080860151908201528482015181830152606080860151908201526001600160a01b038481166080830152600060a08301529151638f3b964760e01b81529190921691638f3b9647916113d3918f91600401613e34565b600060405180830381600087803b1580156113ed57600080fd5b505af1158015611401573d6000803e3d6000fd5b50505050505061143c565b600154604051630d631c9d60e31b81526001600160a01b0390911690636b18e4e890610f36908c90600401613de6565b505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b60035490565b6060806000805b6020811085821a15161561149c5760019182019101611482565b5060405191506040820160405283600882021b60208301528060200382525080915050919050565b606080825160011480156114ec57506080836000815181106114e257fe5b016020015160f81c105b156114f8575081611528565b611504835160806117b7565b83604051602001611516929190613d48565b60405160208183030381529060405290505b92915050565b60008061153a86611906565b905061154881868686611936565b9150505b949350505050565b61155c613901565b604051806080016040528083600001518152602001836020015181526020018360400151815260200183606001518152509050919050565b60408051600480825260a0820190925260609160009190816020015b60608152602001906001900390816115b057505083519091506115d6906103ef9061147b565b816000815181106115e357fe5b60200260200101819052506116016103ef846020015160001b61147b565b8160018151811061160e57fe5b602002602001018190525061164583604001516040516020016116319190613d3f565b6040516020818303038152906040526114c4565b8160028151811061165257fe5b602002602001018190525061167583606001516040516020016116319190613d3f565b8160038151811061168257fe5b6020026020010181905250611696816119d2565b9392505050565b60006116a882611a16565b805190602001209050919050565b6000606060006116c586611906565b90506116d2818686611a51565b9250925050935093915050565b60606115286116ed83611b24565b611b49565b600080600060208451111561170857602061170b565b83515b6020858101519190036008021c92505050919050565b611729613901565b600061173483611bd8565b9050604051806080016040528061175e8360008151811061175157fe5b6020026020010151611beb565b81526020016117738360018151811061175157fe5b81526020016117958360028151811061178857fe5b6020026020010151611bf2565b81526020016117aa8360038151811061178857fe5b90529392505050565b3f90565b6060806038841015611811576040805160018082528183019092529060208201818036833701905050905082840160f81b816000815181106117f557fe5b60200101906001600160f81b031916908160001a905350611696565b600060015b80868161181f57fe5b04156118345760019091019061010002611816565b816001016001600160401b038111801561184d57600080fd5b506040519080825280601f01601f191660200182016040528015611878576020820181803683370190505b50925084820160370160f81b8360008151811061189157fe5b60200101906001600160f81b031916908160001a905350600190505b8181116118fd576101008183036101000a87816118c657fe5b04816118ce57fe5b0660f81b8382815181106118de57fe5b60200101906001600160f81b031916908160001a9053506001016118ad565b50509392505050565b606081805190602001206040516020016119209190613d3f565b6040516020818303038152906040529050919050565b6040805180820190915260018152600160ff1b60209091015260007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42182141561198a576119838585611cec565b905061154c565b600061199584611d10565b90506000806119a5838987611de6565b509150915060006119b984848b858c61218c565b90506119c5818a61256a565b9998505050505050505050565b606060006119df836126c3565b90506119ed815160c06117b7565b816040516020016119ff929190613d48565b604051602081830303815290604052915050919050565b6060816000015182602001518360400151846060015185608001518660a001518760c001516040516020016119209796959493929190613d77565b600060606000611a6085611d10565b90506000806000611a72848a89611de6565b81519295509093509150158080611a865750815b611ad7576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b600081611af35760405180602001604052806000815250611b12565b611b12866001870381518110611b0557fe5b60200260200101516127cc565b919b919a509098505050505050505050565b611b2c613928565b506040805180820190915281518152602082810190820152919050565b60606000806000611b59856127e8565b919450925090506000816001811115611b6e57fe5b14611bc0576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b611bcf85602001518484612b11565b95945050505050565b6060611528611be683611b24565b612bbe565b6000611528825b6000602182600001511115611c4e576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6000806000611c5c856127e8565b919450925090506000816001811115611c7157fe5b14611cc3576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b602080860151840180519091841015611ce25760208490036101000a90045b9695505050505050565b6000611d00611cfa84612d34565b83612e30565b5180516020909101209392505050565b60606000611d1d83611bd8565b9050600081516001600160401b0381118015611d3857600080fd5b50604051908082528060200260200182016040528015611d7257816020015b611d5f613942565b815260200190600190039081611d575790505b50905060005b8251811015611dde576000611d9f848381518110611d9257fe5b6020026020010151611b49565b90506040518060400160405280828152602001611dbb83611bd8565b815250838381518110611dca57fe5b602090810291909101015250600101611d78565b509392505050565b60006060818080611df687612d34565b905085600080611e04613942565b60005b8c51811015612164578c8181518110611e1c57fe5b6020026020010151915082840193506001870196508360001415611e9057815180516020909101208514611e8b576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b611f57565b815151602011611ef757815180516020909101208514611e8b576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b84611f058360000151612ec4565b14611f57576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b60208201515160111415611fc6578551841415611f7357612164565b6000868581518110611f8157fe5b602001015160f81c60f81b60f81c9050600083602001518260ff1681518110611fa657fe5b60200260200101519050611fb981612ef0565b965060019450505061215c565b6002826020015151141561210f576000611fdf83612f26565b9050600081600081518110611ff057fe5b016020015160f81c90506001811660020360006120108460ff8416612f44565b9050600061201e8b8a612f44565b9050600061202c8383612f71565b905060ff851660021480612043575060ff85166003145b15612075578083511480156120585750808251145b1561206257988901985b50600160ff1b9950612164945050505050565b60ff85161580612088575060ff85166001145b156120d857825181146120a85750600160ff1b9950612164945050505050565b6120c988602001516001815181106120bc57fe5b6020026020010151612ef0565b9a50975061215c945050505050565b60405162461bcd60e51b815260040180806020018281038252602681526020018061440d6026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b600101611e07565b50600160ff1b8414866121778786612f44565b909e909d50909b509950505050505050505050565b6060600083905060008760018803815181106121a457fe5b6020026020010151905060006121b982612fd7565b6040805160038082526080820190925291925060009190816020015b6121dd613942565b8152602001906001900390816121d5579050509050600080600284600281111561220357fe5b14156122cd578b51600090156122885760005b60018e51038110156122865760006122408f838151811061223357fe5b6020026020010151612fd7565b600281111561224b57fe5b141561225c5760019091019061227e565b6122788e828151811061226b57fe5b60200260200101516130ad565b51820191505b600101612216565b505b612291866130ad565b516122b561229e886130ad565b6122b06122aa8f612d34565b85612f44565b612f71565b1480156122c157508651155b156122cb57600191505b505b8015612307576122e56122df866130ad565b89612e30565b8383815181106122f157fe5b602002602001018190525060018201915061254b565b600084600281111561231557fe5b141561237e57855161234d5761232b85896130c0565b83838151811061233757fe5b6020026020010181905250600182019150612379565b8483838151811061235a57fe5b60200260200101819052506001820191506122e56122df876001612f44565b61254b565b6000612389866130ad565b905060006123978289612f71565b905080156123f85760006123ad8360008461310b565b90506123c1816123bc8d61325b565b61329c565b8686815181106123cd57fe5b60200260200101819052506001850194506123e88383612f44565b92506123f48983612f44565b9850505b60006124026132e0565b9050825160001415612427576124208161241b8a6127cc565b6130c0565b90506124bf565b60008360008151811061243657fe5b016020015160f81c905061244b846001612f44565b9350600288600281111561245b57fe5b1415612496576000612475856124708c6127cc565b612e30565b905061248e8383612489846000015161325b565b61336d565b9250506124bd565b8351156124ac576000612475856123bc8c6127cc565b6124ba82826124898c6127cc565b91505b505b88516124f4576124cf818c6130c0565b9050808686815181106124de57fe5b6020026020010181905250600185019450612547565b6124ff896001612f44565b98508086868151811061250e57fe5b6020026020010181905250600185019450612529898c612e30565b86868151811061253557fe5b60200260200101819052506001850194505b5050505b61255a8c60018d0385856133c6565b9c9b505050505050505050505050565b60008061257683612d34565b9050612580613942565b84516000906060905b80156126ae5787600182038151811061259e57fe5b602002602001015193506125b184612fd7565b925060028360028111156125c157fe5b14156125ec5760006125d2856130ad565b90506125e4866000835189510361310b565b955050612698565b60018360028111156125fa57fe5b141561263a57600061260b856130ad565b905061261d866000835189510361310b565b8351909650156126345761263185846134a8565b94505b50612698565b600083600281111561264857fe5b1415612698578151156126985760008560018751038151811061266757fe5b602001015160f81c60f81b60f81c9050612687866000600189510361310b565b955061269485828561336d565b9450505b83516126a39061325b565b915060001901612589565b50509051805160209091012095945050505050565b60608151600014156126e4575060408051600081526020810190915261097a565b6000805b8351811015612717578381815181106126fd57fe5b6020026020010151518201915080806001019150506126e8565b6000826001600160401b038111801561272f57600080fd5b506040519080825280601f01601f19166020018201604052801561275a576020820181803683370190505b50600092509050602081015b85518310156127c357600086848151811061277d57fe5b60200260200101519050600060208201905061279b83828451613554565b8785815181106127a757fe5b6020026020010151518301925050508280600101935050612766565b50949350505050565b60208101518051606091611528916000198101908110611d9257fe5b600080600080846000015111612845576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f811161286a576000600160009450945094505050612b0a565b60b781116128df578551607f1982019081106128cd576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b60019550935060009250612b0a915050565b60bf81116129c357855160b6198201908110612942576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a60018501510490508082018860000151116129ae576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b60019091019550935060009250612b0a915050565b60f78111612a3757855160bf198201908110612a26576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b600195509350849250612b0a915050565b855160f6198201908110612a92576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111612af7576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b6001918201965094509250612b0a915050565b9193909250565b60606000826001600160401b0381118015612b2b57600080fd5b506040519080825280601f01601f191660200182016040528015612b56576020820181803683370190505b509050805160001415612b6a579050611696565b8484016020820160005b60208604811015612b95578251825260209283019290910190600101612b74565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b6060600080612bcc846127e8565b91935090915060019050816001811115612be257fe5b14612c34576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b612c55613928565b815260200190600190039081612c4d5790505090506000835b8651811015612d295760208210612cb65760405162461bcd60e51b815260040180806020018281038252602a8152602001806143e3602a913960400191505060405180910390fd5b600080612ce26040518060400160405280858c60000151038152602001858c60200151018152506127e8565b509150915060405180604001604052808383018152602001848b6020015101815250858581518110612d1057fe5b6020908102919091010152600193909301920101612c6e565b508152949350505050565b6060600082516002026001600160401b0381118015612d5257600080fd5b506040519080825280601f01601f191660200182016040528015612d7d576020820181803683370190505b50905060005b8351811015612e29576004848281518110612d9a57fe5b602001015160f81c60f81b6001600160f81b031916901c828260020281518110612dc057fe5b60200101906001600160f81b031916908160001a9053506010848281518110612de557fe5b016020015160f81c81612df457fe5b0660f81b828260020260010181518110612e0a57fe5b60200101906001600160f81b031916908160001a905350600101612d83565b5092915050565b612e38613942565b60408051600280825260608201909252600091816020015b6060815260200190600190039081612e505790505090506000612e74856001613598565b9050612e826103ef826136ef565b82600081518110612e8f57fe5b6020026020010181905250612ea3846114c4565b82600181518110612eb057fe5b6020026020010181905250611bcf826137bf565b6000602082511015612edb5750602081015161097a565b81806020019051602081101561097557600080fd5b60006060602083600001511015612f1157612f0a836137ee565b9050612f1d565b612f1a83611b49565b90505b61169681612ec4565b6060611528612f3f8360200151600081518110611d9257fe5b612d34565b606082518210612f635750604080516020810190915260008152611528565b61169683838486510361310b565b6000805b808451118015612f855750808351115b8015612fca5750828181518110612f9857fe5b602001015160f81c60f81b6001600160f81b031916848281518110612fb957fe5b01602001516001600160f81b031916145b1561169657600101612f75565b60208101515160009060111415612ff05750600061097a565b6002826020015151141561306c57600061300983612f26565b905060008160008151811061301a57fe5b016020015160f81c90506002811480613036575060ff81166003145b156130465760029250505061097a565b60ff81161580613059575060ff81166001145b156130695760019250505061097a565b50505b6040805162461bcd60e51b8152602060048201526011602482015270496e76616c6964206e6f6465207479706560781b604482015290519081900360640190fd5b60606115286130bb83612f26565b6137f9565b6130c8613942565b60006130d3836114c4565b90506130de81611b24565b6020850151805160001981019081106130f357fe5b602002602001018190525061154c8460200151613842565b60608182601f011015613156576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b82828401101561319e576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b818301845110156131ea576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b60608215801561320957604051915060008252602082016040526127c3565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561324257805183526020928301920161322a565b5050858452601f01601f19166040525050949350505050565b606060208251101561326e57508061097a565b818051906020012060405160200180828152602001915050604051602081830303815290604052905061097a565b6132a4613942565b60408051600280825260608201909252600091816020015b60608152602001906001900390816132bc5790505090506000612e74856000613598565b6132e8613942565b6040805160118082526102408201909252600091816020015b606081526020019060019003908161330157905050905060005b815181101561335d57604051806040016040528060018152602001600160ff1b81525082828151811061334a57fe5b602090810291909101015260010161331b565b50613367816137bf565b91505090565b613375613942565b6000602083511061338e57613389836114c4565b613390565b825b905061339b81611b24565b85602001518560ff16815181106133ae57fe5b6020026020010181905250611bcf8560200151613842565b606060008285016001600160401b03811180156133e257600080fd5b5060405190808252806020026020018201604052801561341c57816020015b613409613942565b8152602001906001900390816134015790505b50905060005b8581101561345d5786818151811061343657fe5b602002602001015182828151811061344a57fe5b6020908102919091010152600101613422565b5060005b8381101561349e5784818151811061347557fe5b6020026020010151828783018151811061348b57fe5b6020908102919091010152600101613461565b5095945050505050565b6134b0613942565b60408051600280825260608201909252600091816020015b60608152602001906001900390816134c857905050905060006134f46134ed866130ad565b6000613598565b90506135026103ef826136ef565b8260008151811061350f57fe5b602002602001018190525060208451101561354257838260018151811061353257fe5b602002602001018190525061354b565b612ea3846114c4565b611bcf826137bf565b8282825b60208110613577578151835260209283019290910190601f1901613558565b905182516020929092036101000a6000190180199091169116179052505050565b60606000826135a85760006135ab565b60025b9050600060028551816135ba57fe5b06905060008160020360ff166001600160401b03811180156135db57600080fd5b506040519080825280601f01601f191660200182016040528015613606576020820181803683370190505b50905081830160f81b8160008151811061361c57fe5b60200101906001600160f81b031916908160001a90535080866040516020018083805190602001908083835b602083106136675780518252601f199092019160209182019101613648565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106136af5780518252601f199092019160209182019101613690565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052935050505092915050565b6060600060028351816136fe57fe5b046001600160401b038111801561371457600080fd5b506040519080825280601f01601f19166020018201604052801561373f576020820181803683370190505b50905060005b8151811015612e295783816002026001018151811061376057fe5b602001015160f81c60f81b600485836002028151811061377c57fe5b602001015160f81c60f81b6001600160f81b031916901b178282815181106137a057fe5b60200101906001600160f81b031916908160001a905350600101613745565b6137c7613942565b60006137d2836119d2565b905060405180604001604052808281526020016117aa83611bd8565b6060611528826138eb565b606060028260008151811061380a57fe5b016020015160f81c8161381957fe5b0660ff166000141561383757613830826002612f44565b905061097a565b613830826001612f44565b61384a613942565b600082516001600160401b038111801561386357600080fd5b5060405190808252806020026020018201604052801561389757816020015b60608152602001906001900390816138825790505b50905060005b83518110156138e1576138c28482815181106138b557fe5b60200260200101516137ee565b8282815181106138ce57fe5b602090810291909101015260010161389d565b50611696816137bf565b6060611528826020015160008460000151612b11565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060008152602001600081525090565b604051806040016040528060608152602001606081525090565b600061396f61396a84614379565b614356565b905082815283838301111561398357600080fd5b828260208301376000602084830101529392505050565b803561097a816143ca565b8051801515811461097a57600080fd5b600082601f8301126139c5578081fd5b6116968383356020850161395c565b80356002811061097a57600080fd5b6000806000606084860312156139f7578283fd5b8335613a02816143ca565b92506020840135613a12816143ca565b915060408401356001600160401b03811115613a2c578182fd5b613a38868287016139b5565b9150509250925092565b600080600060608486031215613a56578283fd5b8335613a61816143ca565b92506020840135915060408401356001600160401b03811115613a2c578182fd5b60008060408385031215613a94578182fd5b8235613a9f816143ca565b915060208301356001600160401b03811115613ab9578182fd5b613ac5858286016139b5565b9150509250929050565b600060208284031215613ae0578081fd5b611696826139a5565b600060208284031215613afa578081fd5b5051919050565b600060208284031215613b12578081fd5b81516001600160401b03811115613b27578182fd5b8201601f81018413613b37578182fd5b8051613b4561396a82614379565b818152856020838501011115613b59578384fd5b611bcf82602083016020860161439a565b600060208284031215613b7b578081fd5b81356001600160401b03811115613b90578182fd5b8201601f81018413613ba0578182fd5b61154c8482356020840161395c565b600060c08284031215613bc0578081fd5b60405160c081018181106001600160401b0382111715613bdc57fe5b8060405250825181526020830151602082015260408301516040820152606083015160608201526080830151613c11816143ca565b6080820152613c2260a084016139a5565b60a08201529392505050565b600060208284031215613c3f578081fd5b81356001600160401b0380821115613c55578283fd5b9083019060e08286031215613c68578283fd5b613c7260e0614356565b8235815260208301356020820152613c8c604084016139d4565b6040820152613c9d6060840161399a565b6060820152613cae6080840161399a565b608082015260a083013560a082015260c083013582811115613cce578485fd5b613cda878286016139b5565b60c08301525095945050505050565b6001600160a01b03169052565b60008151808452613d0e81602086016020860161439a565b601f01601f19169290920160200192915050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b90815260200190565b60008351613d5a81846020880161439a565b835190830190613d6e81836020880161439a565b01949350505050565b600088825287602083015260028710613d8c57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b166055840152508360698301528251613dd381608985016020870161439a565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b600060e08201905060018060a01b038085168352835160208401526020840151604084015260408401516060840152606084015160808401528060808501511660a08401525060a0830151151560c08301529392505050565b901515815260200190565b6020810160038310613ea657fe5b91905290565b60208082526025908201527f53746f7261676520736c6f742068617320616c7265616479206265656e20707260408201526437bb32b71760d91b606082015260800190565b60208082526026908201527f4163636f756e742073746174652068617320616c7265616479206265656e20706040820152653937bb32b71760d11b606082015260800190565b6020808252603e908201527f416c6c206163636f756e7473206d75737420626520636f6d6d6974746564206260408201527f65666f726520636f6d706c6574696e672061207472616e736974696f6e2e0000606082015260800190565b602080825260409082018190527f53746f7261676520736c6f742076616c7565207761736e2774206368616e6765908201527f64206f722068617320616c7265616479206265656e20636f6d6d69747465642e606082015260800190565b6020808252605b908201527f4f564d5f53746174655472616e736974696f6e65723a2050726f76696465642060408201527f4c3120636f6e747261637420636f6465206861736820646f6573206e6f74206d60608201527f61746368204c3220636f6e747261637420636f646520686173682e0000000000608082015260a00190565b6020808252603f908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d6d697474696e67206163636f756e74207374617465732e00606082015260800190565b60208082526038908201527f4e6f7420656e6f7567682067617320746f2065786563757465207472616e736160408201527f6374696f6e2064657465726d696e6973746963616c6c792e0000000000000000606082015260800190565b6020808252603b908201527f4163636f756e74207374617465207761736e2774206368616e676564206f722060408201527f68617320616c7265616479206265656e20636f6d6d69747465642e0000000000606082015260800190565b6020808252603d908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d706c6574696e672061207472616e736974696f6e2e000000606082015260800190565b60208082526031908201527f46756e6374696f6e206d7573742062652063616c6c656420647572696e67207460408201527034329031b7b93932b1ba10383430b9b29760791b606082015260800190565b6020808252601d908201527f496e76616c6964207472616e73616374696f6e2070726f76696465642e000000604082015260600190565b60208082526038908201527f436f6e7472616374206d757374206265207665726966696564206265666f726560408201527f2070726f76696e6720612073746f7261676520736c6f742e0000000000000000606082015260800190565b60006040825283516040830152602084015160608301526040840151600281106142f457fe5b60808381019190915260608501516001600160a01b031660a084015284015161432060c0840182613ce9565b5060a084015160e083015260c084015160e0610100840152614346610120840182613cf6565b9150506116966020830184613ce9565b6040518181016001600160401b038111828210171561437157fe5b604052919050565b60006001600160401b0382111561438c57fe5b50601f01601f191660200190565b60005b838110156143b557818101518382015260200161439d565b838111156143c4576000848401525b50505050565b6001600160a01b03811681146143df57600080fd5b5056fe50726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e52656365697665642061206e6f6465207769746820616e20756e6b6e6f776e20707265666978a264697066735822122098623b5d8a4c0fcdf15bfb72801372ca7a0d19e2a81bde8c6eed2b833d19284964736f6c634300070600334372656174652063616e206f6e6c7920626520646f6e6520627920746865204f564d5f467261756456657269666965722ea2646970667358221220dd4b9e8035653bfb395d28bfa466d3d87570bcf75ea8d58973b1d53f4783560f64736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c806322d1470214610046578063299ca4781461009a578063461a4478146100a2575b600080fd5b61007e6004803603608081101561005c57600080fd5b506001600160a01b038135169060208101359060408101359060600135610148565b604080516001600160a01b039092168252519081900360200190f35b61007e610229565b61007e600480360360208110156100b857600080fd5b8101906020810181356401000000008111156100d357600080fd5b8201836020820111156100e557600080fd5b8035906020019184600183028401116401000000008311171561010757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610238945050505050565b600061017c6040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b815250610238565b6001600160a01b0316336001600160a01b0316146101cb5760405162461bcd60e51b8152600401808060200182810382526031815260200180614a606031913960400191505060405180910390fd5b848484846040516101db90610314565b80856001600160a01b03168152602001848152602001838152602001828152602001945050505050604051809103906000f08015801561021f573d6000803e3d6000fd5b5095945050505050565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610298578181015183820152602001610280565b50505050905090810190601f1680156102c55780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102e257600080fd5b505afa1580156102f6573d6000803e3d6000fd5b505050506040513d602081101561030c57600080fd5b505192915050565b61473e806103228339019056fe60806040523480156200001157600080fd5b506040516200473e3803806200473e833981016040819052620000349162000232565b600080546001600160a01b0319166001600160a01b038616179055600583905560028290556003829055600681905560408051808201909152601781527f4f564d5f53746174654d616e61676572466163746f72790000000000000000006020820152620000a29062000150565b6001600160a01b0316639ed93318306040518263ffffffff1660e01b8152600401620000cf919062000299565b602060405180830381600087803b158015620000ea57600080fd5b505af1158015620000ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000125919062000273565b600180546001600160a01b0319166001600160a01b039290921691909117905550620002c692505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015620001b257818101518382015260200162000198565b50505050905090810190601f168015620001e05780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b158015620001fe57600080fd5b505afa15801562000213573d6000803e3d6000fd5b505050506040513d60208110156200022a57600080fd5b505192915050565b6000806000806080858703121562000248578384fd5b84516200025581620002ad565b60208601516040870151606090970151919890975090945092505050565b60006020828403121562000285578081fd5b81516200029281620002ad565b9392505050565b6001600160a01b0391909116815260200190565b6001600160a01b0381168114620002c357600080fd5b50565b61446880620002d66000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063845fe7a31161008c578063b2fa1c9e11610066578063b2fa1c9e14610185578063b52805711461019a578063b9194310146101a2578063c1c618b8146101b5576100cf565b8063845fe7a314610155578063a244316a14610168578063b1c9fe6e14610170576100cf565b8063299ca478146100d45780632e1ac36c146100f25780632eb1375814610107578063461a44781461011a578063732f960b1461012d578063805e9d3014610140575b600080fd5b6100dc6101bd565b6040516100e99190613de6565b60405180910390f35b610105610100366004613a42565b6101cc565b005b610105610115366004613a82565b610565565b6100dc610128366004613b6a565b6108a1565b61010561013b366004613c2e565b61097f565b610148610c6f565b6040516100e99190613d3f565b610105610163366004613a42565b610c75565b610105610fa1565b610178611128565b6040516100e99190613e98565b61018d611131565b6040516100e99190613e8d565b6100dc61114c565b6101056101b03660046139e3565b61115b565b610148611475565b6000546001600160a01b031681565b60018060045460ff1660028111156101e057fe5b146102065760405162461bcd60e51b81526004016101fd906141e9565b60405180910390fd5b60025460065460005a6001546040516363b285f960e11b81529192506001600160a01b03169063c7650bf290610242908a908a90600401613dfa565b602060405180830381600087803b15801561025c57600080fd5b505af1158015610270573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102949190613acf565b15156001146102b55760405162461bcd60e51b81526004016101fd90613f94565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f1906102e6908b90600401613de6565b60c06040518083038186803b1580156102fe57600080fd5b505afa158015610312573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103369190613baf565b600154604051631aaf392f60e01b81529192506000916001600160a01b0390911690631aaf392f9061036e908c908c90600401613dfa565b60206040518083038186803b15801561038657600080fd5b505afa15801561039a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103be9190613ae9565b90506103ff886040516020016103d49190613d3f565b6040516020818303038152906040526103f46103ef8461147b565b6114c4565b89856040015161152e565b6040808401919091526001549051638f3b964760e01b81526001600160a01b0390911690638f3b964790610439908c908690600401613e34565b600060405180830381600087803b15801561045357600080fd5b505af1158015610467573d6000803e3d6000fd5b505050507f3e3ed1a676a2754a041b49bf752e0f167c8753495e36c320fe01d1ef7476253c898960405161049c929190613dfa565b60405180910390a1505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561054357600080fd5b505af1158015610557573d6000803e3d6000fd5b505050505050505050505050565b60018060045460ff16600281111561057957fe5b146105965760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a9050600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156105ef57600080fd5b505afa158015610603573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106279190613ae9565b156106445760405162461bcd60e51b81526004016101fd90614075565b600154604051630b38106960e11b81526001600160a01b039091169063167020d290610674908990600401613de6565b602060405180830381600087803b15801561068e57600080fd5b505af11580156106a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c69190613acf565b15156001146106e75760405162461bcd60e51b81526004016101fd9061412f565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f190610718908a90600401613de6565b60c06040518083038186803b15801561073057600080fd5b505afa158015610744573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107689190613baf565b90506107a78760405160200161077e9190613d22565b60405160208183030381529060405261079e61079984611554565b611594565b8860035461152e565b6003556040517fcec9ef675d775706a02b43afe48af52c5019bc50f99582e3208c6ff55d59c008906107da908990613de6565b60405180910390a15060005a8203905061081a6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561088057600080fd5b505af1158015610894573d6000803e3d6000fd5b5050505050505050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156109015781810151838201526020016108e9565b50505050905090810190601f16801561092e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561094b57600080fd5b505afa15801561095f573d6000803e3d6000fd5b505050506040513d602081101561097557600080fd5b505190505b919050565b60008060045460ff16600281111561099357fe5b146109b05760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a90506006546109c78661169d565b146109e45760405162461bcd60e51b81526004016101fd9061423a565b6103e88560a0015161040802816109f757fe5b04620186a0015a1015610a1c5760405162461bcd60e51b81526004016101fd906140d2565b6000610a536040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b8152506108a1565b600154604051631381ba4d60e01b81529192506001600160a01b031690631381ba4d90610a84908490600401613de6565b600060405180830381600087803b158015610a9e57600080fd5b505af1158015610ab2573d6000803e3d6000fd5b5050600154604051639be3ad6760e01b81526001600160a01b038086169450639be3ad679350610ae9928b929116906004016142ce565b600060405180830381600087803b158015610b0357600080fd5b505af1158015610b17573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b3f9190810190613b01565b50600154604051631381ba4d60e01b81526001600160a01b0390911690631381ba4d90610b7190600090600401613de6565b600060405180830381600087803b158015610b8b57600080fd5b505af1158015610b9f573d6000803e3d6000fd5b50506004805460ff191660011790555060009150505a82039050610be96040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b158015610c4f57600080fd5b505af1158015610c63573d6000803e3d6000fd5b50505050505050505050565b60025490565b60008060045460ff166002811115610c8957fe5b14610ca65760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a600154604051630ad2267960e01b81529192506001600160a01b031690630ad2267990610ce2908a908a90600401613dfa565b60206040518083038186803b158015610cfa57600080fd5b505afa158015610d0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d329190613acf565b15610d4f5760405162461bcd60e51b81526004016101fd90613eac565b60015460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf90610d7f908a90600401613de6565b60206040518083038186803b158015610d9757600080fd5b505afa158015610dab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcf9190613acf565b1515600114610df05760405162461bcd60e51b81526004016101fd90614271565b60015460405163136e2d8960e11b81526000916001600160a01b0316906326dc5b1290610e21908b90600401613de6565b60206040518083038186803b158015610e3957600080fd5b505afa158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e719190613ae9565b905060007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421821415610ea557506000610f02565b600080610ed28a604051602001610ebc9190613d3f565b6040516020818303038152906040528a866116b6565b909250905060018215151415610efa57610ef3610eee826116df565b6116f2565b9250610eff565b600092505b50505b600154604051635c17d62960e01b81526001600160a01b0390911690635c17d62990610f36908c908c908690600401613e13565b600060405180830381600087803b158015610f5057600080fd5b505af1158015610f64573d6000803e3d6000fd5b50505050505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b60018060045460ff166002811115610fb557fe5b14610fd25760405162461bcd60e51b81526004016101fd906141e9565b600160009054906101000a90046001600160a01b03166001600160a01b031663d7bd4a2a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561102057600080fd5b505afa158015611034573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110589190613ae9565b156110755760405162461bcd60e51b81526004016101fd90613f37565b600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156110c357600080fd5b505afa1580156110d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110fb9190613ae9565b156111185760405162461bcd60e51b81526004016101fd9061418c565b506004805460ff19166002179055565b60045460ff1681565b6000600260045460ff16600281111561114657fe5b14905090565b6001546001600160a01b031681565b60008060045460ff16600281111561116f57fe5b1461118c5760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a60015460405163c8e40fbf60e01b81529192506001600160a01b03169063c8e40fbf906111c6908a90600401613de6565b60206040518083038186803b1580156111de57600080fd5b505afa1580156111f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112169190613acf565b1580156112a057506001546040516307a1294560e01b81526001600160a01b03909116906307a129459061124e908a90600401613de6565b60206040518083038186803b15801561126657600080fd5b505afa15801561127a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129e9190613acf565b155b6112bc5760405162461bcd60e51b81526004016101fd90613ef1565b6000806112eb896040516020016112d39190613d22565b604051602081830303815290604052886002546116b6565b90925090506001821515141561140c57600061130682611721565b606081015190915089907fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470141561133f5750600061136a565b816060015161134d826117b3565b1461136a5760405162461bcd60e51b81526004016101fd90613ff2565b6001546040805160c08101825284518152602080860151908201528482015181830152606080860151908201526001600160a01b038481166080830152600060a08301529151638f3b964760e01b81529190921691638f3b9647916113d3918f91600401613e34565b600060405180830381600087803b1580156113ed57600080fd5b505af1158015611401573d6000803e3d6000fd5b50505050505061143c565b600154604051630d631c9d60e31b81526001600160a01b0390911690636b18e4e890610f36908c90600401613de6565b505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b60035490565b6060806000805b6020811085821a15161561149c5760019182019101611482565b5060405191506040820160405283600882021b60208301528060200382525080915050919050565b606080825160011480156114ec57506080836000815181106114e257fe5b016020015160f81c105b156114f8575081611528565b611504835160806117b7565b83604051602001611516929190613d48565b60405160208183030381529060405290505b92915050565b60008061153a86611906565b905061154881868686611936565b9150505b949350505050565b61155c613901565b604051806080016040528083600001518152602001836020015181526020018360400151815260200183606001518152509050919050565b60408051600480825260a0820190925260609160009190816020015b60608152602001906001900390816115b057505083519091506115d6906103ef9061147b565b816000815181106115e357fe5b60200260200101819052506116016103ef846020015160001b61147b565b8160018151811061160e57fe5b602002602001018190525061164583604001516040516020016116319190613d3f565b6040516020818303038152906040526114c4565b8160028151811061165257fe5b602002602001018190525061167583606001516040516020016116319190613d3f565b8160038151811061168257fe5b6020026020010181905250611696816119d2565b9392505050565b60006116a882611a16565b805190602001209050919050565b6000606060006116c586611906565b90506116d2818686611a51565b9250925050935093915050565b60606115286116ed83611b24565b611b49565b600080600060208451111561170857602061170b565b83515b6020858101519190036008021c92505050919050565b611729613901565b600061173483611bd8565b9050604051806080016040528061175e8360008151811061175157fe5b6020026020010151611beb565b81526020016117738360018151811061175157fe5b81526020016117958360028151811061178857fe5b6020026020010151611bf2565b81526020016117aa8360038151811061178857fe5b90529392505050565b3f90565b6060806038841015611811576040805160018082528183019092529060208201818036833701905050905082840160f81b816000815181106117f557fe5b60200101906001600160f81b031916908160001a905350611696565b600060015b80868161181f57fe5b04156118345760019091019061010002611816565b816001016001600160401b038111801561184d57600080fd5b506040519080825280601f01601f191660200182016040528015611878576020820181803683370190505b50925084820160370160f81b8360008151811061189157fe5b60200101906001600160f81b031916908160001a905350600190505b8181116118fd576101008183036101000a87816118c657fe5b04816118ce57fe5b0660f81b8382815181106118de57fe5b60200101906001600160f81b031916908160001a9053506001016118ad565b50509392505050565b606081805190602001206040516020016119209190613d3f565b6040516020818303038152906040529050919050565b6040805180820190915260018152600160ff1b60209091015260007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42182141561198a576119838585611cec565b905061154c565b600061199584611d10565b90506000806119a5838987611de6565b509150915060006119b984848b858c61218c565b90506119c5818a61256a565b9998505050505050505050565b606060006119df836126c3565b90506119ed815160c06117b7565b816040516020016119ff929190613d48565b604051602081830303815290604052915050919050565b6060816000015182602001518360400151846060015185608001518660a001518760c001516040516020016119209796959493929190613d77565b600060606000611a6085611d10565b90506000806000611a72848a89611de6565b81519295509093509150158080611a865750815b611ad7576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b600081611af35760405180602001604052806000815250611b12565b611b12866001870381518110611b0557fe5b60200260200101516127cc565b919b919a509098505050505050505050565b611b2c613928565b506040805180820190915281518152602082810190820152919050565b60606000806000611b59856127e8565b919450925090506000816001811115611b6e57fe5b14611bc0576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b611bcf85602001518484612b11565b95945050505050565b6060611528611be683611b24565b612bbe565b6000611528825b6000602182600001511115611c4e576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6000806000611c5c856127e8565b919450925090506000816001811115611c7157fe5b14611cc3576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b602080860151840180519091841015611ce25760208490036101000a90045b9695505050505050565b6000611d00611cfa84612d34565b83612e30565b5180516020909101209392505050565b60606000611d1d83611bd8565b9050600081516001600160401b0381118015611d3857600080fd5b50604051908082528060200260200182016040528015611d7257816020015b611d5f613942565b815260200190600190039081611d575790505b50905060005b8251811015611dde576000611d9f848381518110611d9257fe5b6020026020010151611b49565b90506040518060400160405280828152602001611dbb83611bd8565b815250838381518110611dca57fe5b602090810291909101015250600101611d78565b509392505050565b60006060818080611df687612d34565b905085600080611e04613942565b60005b8c51811015612164578c8181518110611e1c57fe5b6020026020010151915082840193506001870196508360001415611e9057815180516020909101208514611e8b576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b611f57565b815151602011611ef757815180516020909101208514611e8b576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b84611f058360000151612ec4565b14611f57576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b60208201515160111415611fc6578551841415611f7357612164565b6000868581518110611f8157fe5b602001015160f81c60f81b60f81c9050600083602001518260ff1681518110611fa657fe5b60200260200101519050611fb981612ef0565b965060019450505061215c565b6002826020015151141561210f576000611fdf83612f26565b9050600081600081518110611ff057fe5b016020015160f81c90506001811660020360006120108460ff8416612f44565b9050600061201e8b8a612f44565b9050600061202c8383612f71565b905060ff851660021480612043575060ff85166003145b15612075578083511480156120585750808251145b1561206257988901985b50600160ff1b9950612164945050505050565b60ff85161580612088575060ff85166001145b156120d857825181146120a85750600160ff1b9950612164945050505050565b6120c988602001516001815181106120bc57fe5b6020026020010151612ef0565b9a50975061215c945050505050565b60405162461bcd60e51b815260040180806020018281038252602681526020018061440d6026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b600101611e07565b50600160ff1b8414866121778786612f44565b909e909d50909b509950505050505050505050565b6060600083905060008760018803815181106121a457fe5b6020026020010151905060006121b982612fd7565b6040805160038082526080820190925291925060009190816020015b6121dd613942565b8152602001906001900390816121d5579050509050600080600284600281111561220357fe5b14156122cd578b51600090156122885760005b60018e51038110156122865760006122408f838151811061223357fe5b6020026020010151612fd7565b600281111561224b57fe5b141561225c5760019091019061227e565b6122788e828151811061226b57fe5b60200260200101516130ad565b51820191505b600101612216565b505b612291866130ad565b516122b561229e886130ad565b6122b06122aa8f612d34565b85612f44565b612f71565b1480156122c157508651155b156122cb57600191505b505b8015612307576122e56122df866130ad565b89612e30565b8383815181106122f157fe5b602002602001018190525060018201915061254b565b600084600281111561231557fe5b141561237e57855161234d5761232b85896130c0565b83838151811061233757fe5b6020026020010181905250600182019150612379565b8483838151811061235a57fe5b60200260200101819052506001820191506122e56122df876001612f44565b61254b565b6000612389866130ad565b905060006123978289612f71565b905080156123f85760006123ad8360008461310b565b90506123c1816123bc8d61325b565b61329c565b8686815181106123cd57fe5b60200260200101819052506001850194506123e88383612f44565b92506123f48983612f44565b9850505b60006124026132e0565b9050825160001415612427576124208161241b8a6127cc565b6130c0565b90506124bf565b60008360008151811061243657fe5b016020015160f81c905061244b846001612f44565b9350600288600281111561245b57fe5b1415612496576000612475856124708c6127cc565b612e30565b905061248e8383612489846000015161325b565b61336d565b9250506124bd565b8351156124ac576000612475856123bc8c6127cc565b6124ba82826124898c6127cc565b91505b505b88516124f4576124cf818c6130c0565b9050808686815181106124de57fe5b6020026020010181905250600185019450612547565b6124ff896001612f44565b98508086868151811061250e57fe5b6020026020010181905250600185019450612529898c612e30565b86868151811061253557fe5b60200260200101819052506001850194505b5050505b61255a8c60018d0385856133c6565b9c9b505050505050505050505050565b60008061257683612d34565b9050612580613942565b84516000906060905b80156126ae5787600182038151811061259e57fe5b602002602001015193506125b184612fd7565b925060028360028111156125c157fe5b14156125ec5760006125d2856130ad565b90506125e4866000835189510361310b565b955050612698565b60018360028111156125fa57fe5b141561263a57600061260b856130ad565b905061261d866000835189510361310b565b8351909650156126345761263185846134a8565b94505b50612698565b600083600281111561264857fe5b1415612698578151156126985760008560018751038151811061266757fe5b602001015160f81c60f81b60f81c9050612687866000600189510361310b565b955061269485828561336d565b9450505b83516126a39061325b565b915060001901612589565b50509051805160209091012095945050505050565b60608151600014156126e4575060408051600081526020810190915261097a565b6000805b8351811015612717578381815181106126fd57fe5b6020026020010151518201915080806001019150506126e8565b6000826001600160401b038111801561272f57600080fd5b506040519080825280601f01601f19166020018201604052801561275a576020820181803683370190505b50600092509050602081015b85518310156127c357600086848151811061277d57fe5b60200260200101519050600060208201905061279b83828451613554565b8785815181106127a757fe5b6020026020010151518301925050508280600101935050612766565b50949350505050565b60208101518051606091611528916000198101908110611d9257fe5b600080600080846000015111612845576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f811161286a576000600160009450945094505050612b0a565b60b781116128df578551607f1982019081106128cd576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b60019550935060009250612b0a915050565b60bf81116129c357855160b6198201908110612942576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a60018501510490508082018860000151116129ae576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b60019091019550935060009250612b0a915050565b60f78111612a3757855160bf198201908110612a26576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b600195509350849250612b0a915050565b855160f6198201908110612a92576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111612af7576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b6001918201965094509250612b0a915050565b9193909250565b60606000826001600160401b0381118015612b2b57600080fd5b506040519080825280601f01601f191660200182016040528015612b56576020820181803683370190505b509050805160001415612b6a579050611696565b8484016020820160005b60208604811015612b95578251825260209283019290910190600101612b74565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b6060600080612bcc846127e8565b91935090915060019050816001811115612be257fe5b14612c34576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b612c55613928565b815260200190600190039081612c4d5790505090506000835b8651811015612d295760208210612cb65760405162461bcd60e51b815260040180806020018281038252602a8152602001806143e3602a913960400191505060405180910390fd5b600080612ce26040518060400160405280858c60000151038152602001858c60200151018152506127e8565b509150915060405180604001604052808383018152602001848b6020015101815250858581518110612d1057fe5b6020908102919091010152600193909301920101612c6e565b508152949350505050565b6060600082516002026001600160401b0381118015612d5257600080fd5b506040519080825280601f01601f191660200182016040528015612d7d576020820181803683370190505b50905060005b8351811015612e29576004848281518110612d9a57fe5b602001015160f81c60f81b6001600160f81b031916901c828260020281518110612dc057fe5b60200101906001600160f81b031916908160001a9053506010848281518110612de557fe5b016020015160f81c81612df457fe5b0660f81b828260020260010181518110612e0a57fe5b60200101906001600160f81b031916908160001a905350600101612d83565b5092915050565b612e38613942565b60408051600280825260608201909252600091816020015b6060815260200190600190039081612e505790505090506000612e74856001613598565b9050612e826103ef826136ef565b82600081518110612e8f57fe5b6020026020010181905250612ea3846114c4565b82600181518110612eb057fe5b6020026020010181905250611bcf826137bf565b6000602082511015612edb5750602081015161097a565b81806020019051602081101561097557600080fd5b60006060602083600001511015612f1157612f0a836137ee565b9050612f1d565b612f1a83611b49565b90505b61169681612ec4565b6060611528612f3f8360200151600081518110611d9257fe5b612d34565b606082518210612f635750604080516020810190915260008152611528565b61169683838486510361310b565b6000805b808451118015612f855750808351115b8015612fca5750828181518110612f9857fe5b602001015160f81c60f81b6001600160f81b031916848281518110612fb957fe5b01602001516001600160f81b031916145b1561169657600101612f75565b60208101515160009060111415612ff05750600061097a565b6002826020015151141561306c57600061300983612f26565b905060008160008151811061301a57fe5b016020015160f81c90506002811480613036575060ff81166003145b156130465760029250505061097a565b60ff81161580613059575060ff81166001145b156130695760019250505061097a565b50505b6040805162461bcd60e51b8152602060048201526011602482015270496e76616c6964206e6f6465207479706560781b604482015290519081900360640190fd5b60606115286130bb83612f26565b6137f9565b6130c8613942565b60006130d3836114c4565b90506130de81611b24565b6020850151805160001981019081106130f357fe5b602002602001018190525061154c8460200151613842565b60608182601f011015613156576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b82828401101561319e576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b818301845110156131ea576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b60608215801561320957604051915060008252602082016040526127c3565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561324257805183526020928301920161322a565b5050858452601f01601f19166040525050949350505050565b606060208251101561326e57508061097a565b818051906020012060405160200180828152602001915050604051602081830303815290604052905061097a565b6132a4613942565b60408051600280825260608201909252600091816020015b60608152602001906001900390816132bc5790505090506000612e74856000613598565b6132e8613942565b6040805160118082526102408201909252600091816020015b606081526020019060019003908161330157905050905060005b815181101561335d57604051806040016040528060018152602001600160ff1b81525082828151811061334a57fe5b602090810291909101015260010161331b565b50613367816137bf565b91505090565b613375613942565b6000602083511061338e57613389836114c4565b613390565b825b905061339b81611b24565b85602001518560ff16815181106133ae57fe5b6020026020010181905250611bcf8560200151613842565b606060008285016001600160401b03811180156133e257600080fd5b5060405190808252806020026020018201604052801561341c57816020015b613409613942565b8152602001906001900390816134015790505b50905060005b8581101561345d5786818151811061343657fe5b602002602001015182828151811061344a57fe5b6020908102919091010152600101613422565b5060005b8381101561349e5784818151811061347557fe5b6020026020010151828783018151811061348b57fe5b6020908102919091010152600101613461565b5095945050505050565b6134b0613942565b60408051600280825260608201909252600091816020015b60608152602001906001900390816134c857905050905060006134f46134ed866130ad565b6000613598565b90506135026103ef826136ef565b8260008151811061350f57fe5b602002602001018190525060208451101561354257838260018151811061353257fe5b602002602001018190525061354b565b612ea3846114c4565b611bcf826137bf565b8282825b60208110613577578151835260209283019290910190601f1901613558565b905182516020929092036101000a6000190180199091169116179052505050565b60606000826135a85760006135ab565b60025b9050600060028551816135ba57fe5b06905060008160020360ff166001600160401b03811180156135db57600080fd5b506040519080825280601f01601f191660200182016040528015613606576020820181803683370190505b50905081830160f81b8160008151811061361c57fe5b60200101906001600160f81b031916908160001a90535080866040516020018083805190602001908083835b602083106136675780518252601f199092019160209182019101613648565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106136af5780518252601f199092019160209182019101613690565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052935050505092915050565b6060600060028351816136fe57fe5b046001600160401b038111801561371457600080fd5b506040519080825280601f01601f19166020018201604052801561373f576020820181803683370190505b50905060005b8151811015612e295783816002026001018151811061376057fe5b602001015160f81c60f81b600485836002028151811061377c57fe5b602001015160f81c60f81b6001600160f81b031916901b178282815181106137a057fe5b60200101906001600160f81b031916908160001a905350600101613745565b6137c7613942565b60006137d2836119d2565b905060405180604001604052808281526020016117aa83611bd8565b6060611528826138eb565b606060028260008151811061380a57fe5b016020015160f81c8161381957fe5b0660ff166000141561383757613830826002612f44565b905061097a565b613830826001612f44565b61384a613942565b600082516001600160401b038111801561386357600080fd5b5060405190808252806020026020018201604052801561389757816020015b60608152602001906001900390816138825790505b50905060005b83518110156138e1576138c28482815181106138b557fe5b60200260200101516137ee565b8282815181106138ce57fe5b602090810291909101015260010161389d565b50611696816137bf565b6060611528826020015160008460000151612b11565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060008152602001600081525090565b604051806040016040528060608152602001606081525090565b600061396f61396a84614379565b614356565b905082815283838301111561398357600080fd5b828260208301376000602084830101529392505050565b803561097a816143ca565b8051801515811461097a57600080fd5b600082601f8301126139c5578081fd5b6116968383356020850161395c565b80356002811061097a57600080fd5b6000806000606084860312156139f7578283fd5b8335613a02816143ca565b92506020840135613a12816143ca565b915060408401356001600160401b03811115613a2c578182fd5b613a38868287016139b5565b9150509250925092565b600080600060608486031215613a56578283fd5b8335613a61816143ca565b92506020840135915060408401356001600160401b03811115613a2c578182fd5b60008060408385031215613a94578182fd5b8235613a9f816143ca565b915060208301356001600160401b03811115613ab9578182fd5b613ac5858286016139b5565b9150509250929050565b600060208284031215613ae0578081fd5b611696826139a5565b600060208284031215613afa578081fd5b5051919050565b600060208284031215613b12578081fd5b81516001600160401b03811115613b27578182fd5b8201601f81018413613b37578182fd5b8051613b4561396a82614379565b818152856020838501011115613b59578384fd5b611bcf82602083016020860161439a565b600060208284031215613b7b578081fd5b81356001600160401b03811115613b90578182fd5b8201601f81018413613ba0578182fd5b61154c8482356020840161395c565b600060c08284031215613bc0578081fd5b60405160c081018181106001600160401b0382111715613bdc57fe5b8060405250825181526020830151602082015260408301516040820152606083015160608201526080830151613c11816143ca565b6080820152613c2260a084016139a5565b60a08201529392505050565b600060208284031215613c3f578081fd5b81356001600160401b0380821115613c55578283fd5b9083019060e08286031215613c68578283fd5b613c7260e0614356565b8235815260208301356020820152613c8c604084016139d4565b6040820152613c9d6060840161399a565b6060820152613cae6080840161399a565b608082015260a083013560a082015260c083013582811115613cce578485fd5b613cda878286016139b5565b60c08301525095945050505050565b6001600160a01b03169052565b60008151808452613d0e81602086016020860161439a565b601f01601f19169290920160200192915050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b90815260200190565b60008351613d5a81846020880161439a565b835190830190613d6e81836020880161439a565b01949350505050565b600088825287602083015260028710613d8c57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b166055840152508360698301528251613dd381608985016020870161439a565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b600060e08201905060018060a01b038085168352835160208401526020840151604084015260408401516060840152606084015160808401528060808501511660a08401525060a0830151151560c08301529392505050565b901515815260200190565b6020810160038310613ea657fe5b91905290565b60208082526025908201527f53746f7261676520736c6f742068617320616c7265616479206265656e20707260408201526437bb32b71760d91b606082015260800190565b60208082526026908201527f4163636f756e742073746174652068617320616c7265616479206265656e20706040820152653937bb32b71760d11b606082015260800190565b6020808252603e908201527f416c6c206163636f756e7473206d75737420626520636f6d6d6974746564206260408201527f65666f726520636f6d706c6574696e672061207472616e736974696f6e2e0000606082015260800190565b602080825260409082018190527f53746f7261676520736c6f742076616c7565207761736e2774206368616e6765908201527f64206f722068617320616c7265616479206265656e20636f6d6d69747465642e606082015260800190565b6020808252605b908201527f4f564d5f53746174655472616e736974696f6e65723a2050726f76696465642060408201527f4c3120636f6e747261637420636f6465206861736820646f6573206e6f74206d60608201527f61746368204c3220636f6e747261637420636f646520686173682e0000000000608082015260a00190565b6020808252603f908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d6d697474696e67206163636f756e74207374617465732e00606082015260800190565b60208082526038908201527f4e6f7420656e6f7567682067617320746f2065786563757465207472616e736160408201527f6374696f6e2064657465726d696e6973746963616c6c792e0000000000000000606082015260800190565b6020808252603b908201527f4163636f756e74207374617465207761736e2774206368616e676564206f722060408201527f68617320616c7265616479206265656e20636f6d6d69747465642e0000000000606082015260800190565b6020808252603d908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d706c6574696e672061207472616e736974696f6e2e000000606082015260800190565b60208082526031908201527f46756e6374696f6e206d7573742062652063616c6c656420647572696e67207460408201527034329031b7b93932b1ba10383430b9b29760791b606082015260800190565b6020808252601d908201527f496e76616c6964207472616e73616374696f6e2070726f76696465642e000000604082015260600190565b60208082526038908201527f436f6e7472616374206d757374206265207665726966696564206265666f726560408201527f2070726f76696e6720612073746f7261676520736c6f742e0000000000000000606082015260800190565b60006040825283516040830152602084015160608301526040840151600281106142f457fe5b60808381019190915260608501516001600160a01b031660a084015284015161432060c0840182613ce9565b5060a084015160e083015260c084015160e0610100840152614346610120840182613cf6565b9150506116966020830184613ce9565b6040518181016001600160401b038111828210171561437157fe5b604052919050565b60006001600160401b0382111561438c57fe5b50601f01601f191660200190565b60005b838110156143b557818101518382015260200161439d565b838111156143c4576000848401525b50505050565b6001600160a01b03811681146143df57600080fd5b5056fe50726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e52656365697665642061206e6f6465207769746820616e20756e6b6e6f776e20707265666978a264697066735822122098623b5d8a4c0fcdf15bfb72801372ca7a0d19e2a81bde8c6eed2b833d19284964736f6c634300070600334372656174652063616e206f6e6c7920626520646f6e6520627920746865204f564d5f467261756456657269666965722ea2646970667358221220dd4b9e8035653bfb395d28bfa466d3d87570bcf75ea8d58973b1d53f4783560f64736f6c63430007060033", "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", @@ -144,16 +144,16 @@ "storageLayout": { "storage": [ { - "astId": 12800, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_StateTransitionerFactory.sol:OVM_StateTransitionerFactory", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12793" + "type": "t_contract(Lib_AddressManager)15296" } ], "types": { - "t_contract(Lib_AddressManager)12793": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" diff --git a/packages/contracts/deployments/kovan/Proxy__OVM_L1CrossDomainMessenger.json b/packages/contracts/deployments/kovan/Proxy__OVM_L1CrossDomainMessenger.json index c42f5d0bf155..0107815ff48d 100644 --- a/packages/contracts/deployments/kovan/Proxy__OVM_L1CrossDomainMessenger.json +++ b/packages/contracts/deployments/kovan/Proxy__OVM_L1CrossDomainMessenger.json @@ -1,5 +1,5 @@ { - "address": "0x78b88FD62FBdBf67b9C5C6528CF84E9d30BB28e0", + "address": "0x4361d0F75A0186C05f971c566dC6bEa5957483fD", "abi": [ { "inputs": [ @@ -22,30 +22,30 @@ "type": "fallback" } ], - "transactionHash": "0xd175bdbcd00f66a7b3a247bf2d0c3719912b845f4898cfe6e09062cc7c33849f", + "transactionHash": "0x7b862bcd408395eaf5df4ace8b3f76ce4618a0c9e82ce87034d40866843ca1bd", "receipt": { "to": null, "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", - "contractAddress": "0x78b88FD62FBdBf67b9C5C6528CF84E9d30BB28e0", - "transactionIndex": 1, - "gasUsed": "222424", + "contractAddress": "0x4361d0F75A0186C05f971c566dC6bEa5957483fD", + "transactionIndex": 4, + "gasUsed": "225024", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x1e1bc36b9553544c99025041f703c41760904c63ad443300a44e9ef0e2be7f56", - "transactionHash": "0xd175bdbcd00f66a7b3a247bf2d0c3719912b845f4898cfe6e09062cc7c33849f", + "blockHash": "0xf9e914ec5932c999ce1b6d840694e4c21d12fb897d31b7f8d210c5ddf2502de2", + "transactionHash": "0x7b862bcd408395eaf5df4ace8b3f76ce4618a0c9e82ce87034d40866843ca1bd", "logs": [], - "blockNumber": 24572837, - "cumulativeGasUsed": "252381", + "blockNumber": 25502615, + "cumulativeGasUsed": "821238", "status": 1, "byzantium": true }, "args": [ - "0xd56F695e73286ac252A37593DD4E7c14270eC1Df", + "0x100Dd3b414Df5BbA2B542864fF94aF8024aFdf3a", "OVM_L1CrossDomainMessenger" ], - "solcInputHash": "5ee8e508e2c54cb5ac6783b4855b1558", - "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\":\"payable\",\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x2ce671a0e004df88b136bea5a3c59d0732cea8887c8496da1d509e0200b03d7d\",\"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 // 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 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 payable\\n {\\n address target = addressManager[address(this)].getAddress(\\n (implementationName[address(this)])\\n );\\n\\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\":\"0xfaecb051b37f1d87d588cafb17a575723cbdf7c3c2079772110f33e747e05027\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506040516104083803806104088339818101604052604081101561003357600080fd5b81516020830180516040519294929383019291908464010000000082111561005a57600080fd5b90830190602082018581111561006f57600080fd5b825164010000000081118282018810171561008957600080fd5b82525081516020918201929091019080838360005b838110156100b657818101518382015260200161009e565b50505050905090810190601f1680156100e35780820380516001836020036101000a031916815260200191505b5060409081523060009081526001602090815282822080546001600160a01b0319166001600160a01b038a16179055818152919020855161012c95509093509085019150610134565b5050506101d5565b828054600181600116156101000203166002900490600052602060002090601f01602090048101928261016a57600085556101b0565b82601f1061018357805160ff19168380011785556101b0565b828001600101855582156101b0579182015b828111156101b0578251825591602001919060010190610195565b506101bc9291506101c0565b5090565b5b808211156101bc57600081556001016101c1565b610224806101e46000396000f3fe60806040818152306000908152600160208181528383205483825293832063bf40fac160e01b909552608490815284546002610100938216159390930260001901169190910460a481905291936001600160a01b039093169263bf40fac192909190819060c490849080156100b55780601f1061008a576101008083540402835291602001916100b5565b820191906000526020600020905b81548152906001019060200180831161009857829003601f168201915b50509250505060206040518083038186803b1580156100d357600080fd5b505afa1580156100e7573d6000803e3d6000fd5b505050506040513d60208110156100fd57600080fd5b505190506001600160a01b0381166101465760405162461bcd60e51b81526004018080602001828103825260238152602001806101cc6023913960400191505060405180910390fd5b600080826001600160a01b03166000366040518083838082843760405192019450600093509091505080830381855af49150503d80600081146101a5576040519150601f19603f3d011682016040523d82523d6000602084013e6101aa565b606091505b509092509050600182151514156101c357805160208201f35b805160208201fdfe5461726765742061646472657373206d75737420626520696e697469616c697a65642ea264697066735822122026d4992ed7562b49b7d3e306977cab94c29f8fb64a137b48d18960cc5ef1341d64736f6c63430007060033", - "deployedBytecode": "0x60806040818152306000908152600160208181528383205483825293832063bf40fac160e01b909552608490815284546002610100938216159390930260001901169190910460a481905291936001600160a01b039093169263bf40fac192909190819060c490849080156100b55780601f1061008a576101008083540402835291602001916100b5565b820191906000526020600020905b81548152906001019060200180831161009857829003601f168201915b50509250505060206040518083038186803b1580156100d357600080fd5b505afa1580156100e7573d6000803e3d6000fd5b505050506040513d60208110156100fd57600080fd5b505190506001600160a01b0381166101465760405162461bcd60e51b81526004018080602001828103825260238152602001806101cc6023913960400191505060405180910390fd5b600080826001600160a01b03166000366040518083838082843760405192019450600093509091505080830381855af49150503d80600081146101a5576040519150601f19603f3d011682016040523d82523d6000602084013e6101aa565b606091505b509092509050600182151514156101c357805160208201f35b805160208201fdfe5461726765742061646472657373206d75737420626520696e697469616c697a65642ea264697066735822122026d4992ed7562b49b7d3e306977cab94c29f8fb64a137b48d18960cc5ef1341d64736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"payable\",\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 // 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 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 payable\\n {\\n address target = addressManager[address(this)].getAddress(\\n (implementationName[address(this)])\\n );\\n\\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\":\"0xfaecb051b37f1d87d588cafb17a575723cbdf7c3c2079772110f33e747e05027\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516104083803806104088339818101604052604081101561003357600080fd5b81516020830180516040519294929383019291908464010000000082111561005a57600080fd5b90830190602082018581111561006f57600080fd5b825164010000000081118282018810171561008957600080fd5b82525081516020918201929091019080838360005b838110156100b657818101518382015260200161009e565b50505050905090810190601f1680156100e35780820380516001836020036101000a031916815260200191505b5060409081523060009081526001602090815282822080546001600160a01b0319166001600160a01b038a16179055818152919020855161012c95509093509085019150610134565b5050506101d5565b828054600181600116156101000203166002900490600052602060002090601f01602090048101928261016a57600085556101b0565b82601f1061018357805160ff19168380011785556101b0565b828001600101855582156101b0579182015b828111156101b0578251825591602001919060010190610195565b506101bc9291506101c0565b5090565b5b808211156101bc57600081556001016101c1565b610224806101e46000396000f3fe60806040818152306000908152600160208181528383205483825293832063bf40fac160e01b909552608490815284546002610100938216159390930260001901169190910460a481905291936001600160a01b039093169263bf40fac192909190819060c490849080156100b55780601f1061008a576101008083540402835291602001916100b5565b820191906000526020600020905b81548152906001019060200180831161009857829003601f168201915b50509250505060206040518083038186803b1580156100d357600080fd5b505afa1580156100e7573d6000803e3d6000fd5b505050506040513d60208110156100fd57600080fd5b505190506001600160a01b0381166101465760405162461bcd60e51b81526004018080602001828103825260238152602001806101cc6023913960400191505060405180910390fd5b600080826001600160a01b03166000366040518083838082843760405192019450600093509091505080830381855af49150503d80600081146101a5576040519150601f19603f3d011682016040523d82523d6000602084013e6101aa565b606091505b509092509050600182151514156101c357805160208201f35b805160208201fdfe5461726765742061646472657373206d75737420626520696e697469616c697a65642ea2646970667358221220d96dd78b72a44c11bfa8efb98d29ee53776a02c67052599da176325fcbf95b6464736f6c63430007060033", + "deployedBytecode": "0x60806040818152306000908152600160208181528383205483825293832063bf40fac160e01b909552608490815284546002610100938216159390930260001901169190910460a481905291936001600160a01b039093169263bf40fac192909190819060c490849080156100b55780601f1061008a576101008083540402835291602001916100b5565b820191906000526020600020905b81548152906001019060200180831161009857829003601f168201915b50509250505060206040518083038186803b1580156100d357600080fd5b505afa1580156100e7573d6000803e3d6000fd5b505050506040513d60208110156100fd57600080fd5b505190506001600160a01b0381166101465760405162461bcd60e51b81526004018080602001828103825260238152602001806101cc6023913960400191505060405180910390fd5b600080826001600160a01b03166000366040518083838082843760405192019450600093509091505080830381855af49150503d80600081146101a5576040519150601f19603f3d011682016040523d82523d6000602084013e6101aa565b606091505b509092509050600182151514156101c357805160208201f35b805160208201fdfe5461726765742061646472657373206d75737420626520696e697469616c697a65642ea2646970667358221220d96dd78b72a44c11bfa8efb98d29ee53776a02c67052599da176325fcbf95b6464736f6c63430007060033", "devdoc": { "kind": "dev", "methods": { @@ -67,7 +67,7 @@ "storageLayout": { "storage": [ { - "astId": 12837, + "astId": 15340, "contract": "contracts/optimistic-ethereum/libraries/resolver/Lib_ResolvedDelegateProxy.sol:Lib_ResolvedDelegateProxy", "label": "implementationName", "offset": 0, @@ -75,12 +75,12 @@ "type": "t_mapping(t_address,t_string_storage)" }, { - "astId": 12841, + "astId": 15344, "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)12793)" + "type": "t_mapping(t_address,t_contract(Lib_AddressManager)15296)" } ], "types": { @@ -89,17 +89,17 @@ "label": "address", "numberOfBytes": "20" }, - "t_contract(Lib_AddressManager)12793": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" }, - "t_mapping(t_address,t_contract(Lib_AddressManager)12793)": { + "t_mapping(t_address,t_contract(Lib_AddressManager)15296)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => contract Lib_AddressManager)", "numberOfBytes": "32", - "value": "t_contract(Lib_AddressManager)12793" + "value": "t_contract(Lib_AddressManager)15296" }, "t_mapping(t_address,t_string_storage)": { "encoding": "mapping", diff --git a/packages/contracts/deployments/kovan/Proxy__OVM_L1StandardBridge.json b/packages/contracts/deployments/kovan/Proxy__OVM_L1StandardBridge.json new file mode 100644 index 000000000000..9528a2fe7ec3 --- /dev/null +++ b/packages/contracts/deployments/kovan/Proxy__OVM_L1StandardBridge.json @@ -0,0 +1,177 @@ +{ + "address": "0x22F24361D548e5FaAfb36d1437839f080363982B", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "getImplementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_code", + "type": "bytes" + } + ], + "name": "setCode", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_key", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_value", + "type": "bytes32" + } + ], + "name": "setStorage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xbc755a0fb1b6966919cd926d8f497002a6538daaaac16ab117f41cdd5ef315d4", + "receipt": { + "to": null, + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0x22F24361D548e5FaAfb36d1437839f080363982B", + "transactionIndex": 1, + "gasUsed": "471232", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xc9f08a4bde2710feb5ab785f464ca5cfc946580768d4a2aa0181223302b2f8bd", + "transactionHash": "0xbc755a0fb1b6966919cd926d8f497002a6538daaaac16ab117f41cdd5ef315d4", + "logs": [], + "blockNumber": 25502648, + "cumulativeGasUsed": "588262", + "status": 1, + "byzantium": true + }, + "args": [ + "0x18394B52d3Cb931dfA76F63251919D051953413d" + ], + "solcInputHash": "7531d7762a77038a37e7490a7b4b176f", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"getImplementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_code\",\"type\":\"bytes\"}],\"name\":\"setCode\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_key\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_value\",\"type\":\"bytes32\"}],\"name\":\"setStorage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Basic ChugSplash proxy contract for L1. Very close to being a normal proxy but has added functions `setCode` and `setStorage` for changing the code or storage of the contract. Nifty! Note for future developers: do NOT make anything in this contract 'public' unless you know what you're doing. Anything public can potentially have a function signature that conflicts with a signature attached to the implementation contract. Public functions SHOULD always have the 'proxyCallIfNotOwner' modifier unless there's some *really* good reason not to have that modifier. And there almost certainly is not a good reason to not have that modifier. Beware!\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_owner\":\"Address of the initial contract owner.\"}},\"getImplementation()\":{\"returns\":{\"_0\":\"Implementation address.\"}},\"getOwner()\":{\"returns\":{\"_0\":\"Owner address.\"}},\"setCode(bytes)\":{\"params\":{\"_code\":\"New contract code to run inside this contract.\"}},\"setOwner(address)\":{\"params\":{\"_owner\":\"New owner of the proxy contract.\"}},\"setStorage(bytes32,bytes32)\":{\"params\":{\"_key\":\"Storage key to modify.\",\"_value\":\"New value for the storage key.\"}}},\"title\":\"L1ChugSplashProxy\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getImplementation()\":{\"notice\":\"Queries the implementation address. Can only be called by the owner OR by making an eth_call and setting the \\\"from\\\" address to address(0).\"},\"getOwner()\":{\"notice\":\"Queries the owner of the proxy contract. Can only be called by the owner OR by making an eth_call and setting the \\\"from\\\" address to address(0).\"},\"setCode(bytes)\":{\"notice\":\"Sets the code that should be running behind this proxy. Note that this scheme is a bit different from the standard proxy scheme where one would typically deploy the code separately and then set the implementation address. We're doing it this way because it gives us a lot more freedom on the client side. Can only be triggered by the contract owner.\"},\"setOwner(address)\":{\"notice\":\"Changes the owner of the proxy contract. Only callable by the owner.\"},\"setStorage(bytes32,bytes32)\":{\"notice\":\"Modifies some storage slot within the proxy contract. Gives us a lot of power to perform upgrades in a more transparent way. Only callable by the owner.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/chugsplash/L1ChugSplashProxy.sol\":\"L1ChugSplashProxy\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/chugsplash/L1ChugSplashProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\nimport { iL1ChugSplashDeployer } from \\\"./interfaces/iL1ChugSplashDeployer.sol\\\";\\n\\n/**\\n * @title L1ChugSplashProxy\\n * @dev Basic ChugSplash proxy contract for L1. Very close to being a normal proxy but has added\\n * functions `setCode` and `setStorage` for changing the code or storage of the contract. Nifty!\\n *\\n * Note for future developers: do NOT make anything in this contract 'public' unless you know what\\n * you're doing. Anything public can potentially have a function signature that conflicts with a\\n * signature attached to the implementation contract. Public functions SHOULD always have the\\n * 'proxyCallIfNotOwner' modifier unless there's some *really* good reason not to have that\\n * modifier. And there almost certainly is not a good reason to not have that modifier. Beware!\\n */\\ncontract L1ChugSplashProxy {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n // \\\"Magic\\\" prefix. When prepended to some arbitrary bytecode and used to create a contract, the\\n // appended bytecode will be deployed as given.\\n bytes13 constant internal DEPLOY_CODE_PREFIX = 0x600D380380600D6000396000f3;\\n\\n // bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n bytes32 constant internal IMPLEMENTATION_KEY = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n // bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1)\\n bytes32 constant internal OWNER_KEY = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n \\n /**\\n * @param _owner Address of the initial contract owner.\\n */\\n constructor(\\n address _owner\\n ) {\\n _setOwner(_owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Blocks a function from being called when the parent signals that the system should be paused\\n * via an isUpgrading function.\\n */\\n modifier onlyWhenNotPaused() {\\n address owner = _getOwner();\\n\\n // We do a low-level call because there's no guarantee that the owner actually *is* an\\n // L1ChugSplashDeployer contract and Solidity will throw errors if we do a normal call and\\n // it turns out that it isn't the right type of contract.\\n (bool success, bytes memory returndata) = owner.staticcall(\\n abi.encodeWithSelector(\\n iL1ChugSplashDeployer.isUpgrading.selector\\n )\\n );\\n\\n // If the call was unsuccessful then we assume that there's no \\\"isUpgrading\\\" method and we\\n // can just continue as normal. We also expect that the return value is exactly 32 bytes\\n // long. If this isn't the case then we can safely ignore the result.\\n if (success && returndata.length == 32) {\\n // Although the expected value is a *boolean*, it's safer to decode as a uint256 in the\\n // case that the isUpgrading function returned something other than 0 or 1. But we only\\n // really care about the case where this value is 0 (= false).\\n uint256 ret = abi.decode(returndata, (uint256));\\n require(\\n ret == 0,\\n \\\"L1ChugSplashProxy: system is currently being upgraded\\\"\\n );\\n }\\n\\n _;\\n }\\n\\n /**\\n * Makes a proxy call instead of triggering the given function when the caller is either the\\n * owner or the zero address. Caller can only ever be the zero address if this function is\\n * being called off-chain via eth_call, which is totally fine and can be convenient for\\n * client-side tooling. Avoids situations where the proxy and implementation share a sighash\\n * and the proxy function ends up being called instead of the implementation one.\\n *\\n * Note: msg.sender == address(0) can ONLY be triggered off-chain via eth_call. If there's a\\n * way for someone to send a transaction with msg.sender == address(0) in any real context then\\n * we have much bigger problems. Primary reason to include this additional allowed sender is\\n * because the owner address can be changed dynamically and we do not want clients to have to\\n * keep track of the current owner in order to make an eth_call that doesn't trigger the\\n * proxied contract.\\n */\\n modifier proxyCallIfNotOwner() {\\n if (msg.sender == _getOwner() || msg.sender == address(0)) {\\n _;\\n } else {\\n // This WILL halt the call frame on completion.\\n _doProxyCall();\\n }\\n }\\n\\n\\n /*********************\\n * Fallback Function *\\n *********************/\\n\\n fallback()\\n external\\n payable\\n {\\n // Proxy call by default.\\n _doProxyCall();\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sets the code that should be running behind this proxy. Note that this scheme is a bit\\n * different from the standard proxy scheme where one would typically deploy the code\\n * separately and then set the implementation address. We're doing it this way because it gives\\n * us a lot more freedom on the client side. Can only be triggered by the contract owner.\\n * @param _code New contract code to run inside this contract.\\n */\\n function setCode(\\n bytes memory _code\\n )\\n proxyCallIfNotOwner\\n public\\n {\\n // Get the code hash of the current implementation.\\n address implementation = _getImplementation();\\n\\n // If the code hash matches the new implementation then we return early.\\n if (keccak256(_code) == _getAccountCodeHash(implementation)) {\\n return;\\n }\\n\\n // Create the deploycode by appending the magic prefix.\\n bytes memory deploycode = abi.encodePacked(\\n DEPLOY_CODE_PREFIX,\\n _code\\n );\\n\\n // Deploy the code and set the new implementation address.\\n address newImplementation;\\n assembly {\\n newImplementation := create(0x0, add(deploycode, 0x20), mload(deploycode))\\n }\\n\\n // Check that the code was actually deployed correctly. I'm not sure if you can ever\\n // actually fail this check. Should only happen if the contract creation from above runs\\n // out of gas but this parent execution thread does NOT run out of gas. Seems like we\\n // should be doing this check anyway though.\\n require(\\n _getAccountCodeHash(newImplementation) == keccak256(_code),\\n \\\"L1ChugSplashProxy: code was not correctly deployed.\\\"\\n );\\n\\n _setImplementation(newImplementation);\\n }\\n\\n /**\\n * Modifies some storage slot within the proxy contract. Gives us a lot of power to perform\\n * upgrades in a more transparent way. Only callable by the owner.\\n * @param _key Storage key to modify.\\n * @param _value New value for the storage key.\\n */\\n function setStorage(\\n bytes32 _key,\\n bytes32 _value\\n )\\n proxyCallIfNotOwner\\n public\\n {\\n assembly {\\n sstore(_key, _value)\\n }\\n }\\n\\n /**\\n * Changes the owner of the proxy contract. Only callable by the owner.\\n * @param _owner New owner of the proxy contract.\\n */\\n function setOwner(\\n address _owner\\n )\\n proxyCallIfNotOwner\\n public\\n {\\n _setOwner(_owner);\\n }\\n\\n /**\\n * Queries the owner of the proxy contract. Can only be called by the owner OR by making an\\n * eth_call and setting the \\\"from\\\" address to address(0).\\n * @return Owner address.\\n */\\n function getOwner()\\n proxyCallIfNotOwner\\n public\\n returns (\\n address\\n )\\n {\\n return _getOwner();\\n }\\n\\n /**\\n * Queries the implementation address. Can only be called by the owner OR by making an\\n * eth_call and setting the \\\"from\\\" address to address(0).\\n * @return Implementation address.\\n */\\n function getImplementation()\\n proxyCallIfNotOwner\\n public\\n returns (\\n address\\n )\\n {\\n return _getImplementation();\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Sets the implementation address.\\n * @param _implementation New implementation address.\\n */\\n function _setImplementation(\\n address _implementation\\n )\\n internal\\n {\\n assembly {\\n sstore(IMPLEMENTATION_KEY, _implementation)\\n }\\n }\\n\\n /**\\n * Queries the implementation address.\\n * @return Implementation address.\\n */\\n function _getImplementation()\\n internal\\n view\\n returns (\\n address\\n )\\n {\\n address implementation;\\n assembly {\\n implementation := sload(IMPLEMENTATION_KEY)\\n }\\n return implementation;\\n }\\n\\n /**\\n * Changes the owner of the proxy contract.\\n * @param _owner New owner of the proxy contract.\\n */\\n function _setOwner(\\n address _owner\\n )\\n internal\\n {\\n assembly {\\n sstore(OWNER_KEY, _owner)\\n }\\n }\\n\\n /**\\n * Queries the owner of the proxy contract.\\n * @return Owner address.\\n */\\n function _getOwner()\\n internal\\n view \\n returns (\\n address\\n )\\n {\\n address owner;\\n assembly {\\n owner := sload(OWNER_KEY)\\n }\\n return owner;\\n }\\n\\n /**\\n * Gets the code hash for a given account.\\n * @param _account Address of the account to get a code hash for.\\n * @return Code hash for the account.\\n */\\n function _getAccountCodeHash(\\n address _account\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n bytes32 codeHash;\\n assembly {\\n codeHash := extcodehash(_account)\\n }\\n return codeHash;\\n }\\n\\n /**\\n * Performs the proxy call via a delegatecall.\\n */\\n function _doProxyCall()\\n onlyWhenNotPaused\\n internal\\n {\\n address implementation = _getImplementation();\\n\\n require(\\n implementation != address(0),\\n \\\"L1ChugSplashProxy: implementation is not set yet\\\"\\n );\\n\\n assembly {\\n // Copy calldata into memory at 0x0....calldatasize.\\n calldatacopy(0x0, 0x0, calldatasize())\\n\\n // Perform the delegatecall, make sure to pass all available gas.\\n let success := delegatecall(gas(), implementation, 0x0, calldatasize(), 0x0, 0x0)\\n\\n // Copy returndata into memory at 0x0....returndatasize. Note that this *will*\\n // overwrite the calldata that we just copied into memory but that doesn't really\\n // matter because we'll be returning in a second anyway.\\n returndatacopy(0x0, 0x0, returndatasize())\\n \\n // Success == 0 means a revert. We'll revert too and pass the data up.\\n if iszero(success) {\\n revert(0x0, returndatasize())\\n }\\n\\n // Otherwise we'll just return and pass the data up.\\n return(0x0, returndatasize())\\n }\\n }\\n}\\n\",\"keccak256\":\"0x654af4f1d1aab76467c49fcce992eaf3522040ed806d656d98735c50ac235eeb\",\"license\":\"MIT\"},\"contracts/chugsplash/interfaces/iL1ChugSplashDeployer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title iL1ChugSplashDeployer\\n */\\ninterface iL1ChugSplashDeployer {\\n function isUpgrading()\\n external\\n view\\n returns (\\n bool\\n );\\n}\\n\",\"keccak256\":\"0xdab3ecb1ce03376523cd2f2ce5f991389c388829c56907987da01d99d3fc44c7\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516107983803806107988339818101604052602081101561003357600080fd5b505161003e81610044565b50610068565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610721806100776000396000f3fe60806040526004361061004a5760003560e01c806313af4035146100545780636c5d4ad014610087578063893d20e81461013a5780639b0b0fda1461016b578063aaf10f421461019b575b6100526101b0565b005b34801561006057600080fd5b506100526004803603602081101561007757600080fd5b50356001600160a01b031661036c565b34801561009357600080fd5b50610052600480360360208110156100aa57600080fd5b8101906020810181356401000000008111156100c557600080fd5b8201836020820111156100d757600080fd5b803590602001918460018302840111640100000000831117156100f957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506103af945050505050565b34801561014657600080fd5b5061014f610505565b604080516001600160a01b039092168252519081900360200190f35b34801561017757600080fd5b506100526004803603604081101561018e57600080fd5b508035906020013561054b565b3480156101a757600080fd5b5061014f610589565b60006101ba6105bd565b60408051600481526024810182526020810180516001600160e01b0316635bca393160e11b1781529151815193945060009384936001600160a01b0387169392918291908083835b602083106102215780518252601f199092019160209182019101610202565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114610281576040519150601f19603f3d011682016040523d82523d6000602084013e610286565b606091505b5091509150818015610299575080516020145b156102f85760008180602001905160208110156102b557600080fd5b5051905080156102f65760405162461bcd60e51b81526004018080602001828103825260358152602001806106b76035913960400191505060405180910390fd5b505b60006103026105e2565b90506001600160a01b0381166103495760405162461bcd60e51b81526004018080602001828103825260308152602001806106546030913960400191505060405180910390fd5b3660008037600080366000845af43d6000803e80610366573d6000fd5b503d6000f35b6103746105bd565b6001600160a01b0316336001600160a01b03161480610391575033155b156103a45761039f81610607565b6103ac565b6103ac6101b0565b50565b6103b76105bd565b6001600160a01b0316336001600160a01b031614806103d4575033155b156103a45760006103e36105e2565b90506103ee8161062b565b825160208401201415610401575061039f565b60006c600d380380600d6000396000f360981b83604051602001808372ffffffffffffffffffffffffffffffffffffff19168152600d0182805190602001908083835b602083106104635780518252601f199092019160209182019101610444565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052905060008151602083016000f0905083805190602001206104b88261062b565b146104f45760405162461bcd60e51b81526004018080602001828103825260338152602001806106846033913960400191505060405180910390fd5b6104fd8161062f565b5050506103ac565b600061050f6105bd565b6001600160a01b0316336001600160a01b0316148061052c575033155b15610540576105396105bd565b9050610548565b6105486101b0565b90565b6105536105bd565b6001600160a01b0316336001600160a01b03161480610570575033155b1561057d57808255610585565b6105856101b0565b5050565b60006105936105bd565b6001600160a01b0316336001600160a01b031614806105b0575033155b15610540576105396105e2565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b3f90565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe4c314368756753706c61736850726f78793a20696d706c656d656e746174696f6e206973206e6f7420736574207965744c314368756753706c61736850726f78793a20636f646520776173206e6f7420636f72726563746c79206465706c6f7965642e4c314368756753706c61736850726f78793a2073797374656d2069732063757272656e746c79206265696e67207570677261646564a26469706673582212202e20c1d0062b5a698d49624edce72a713b117e88f4cd70877869b53519c1d1f964736f6c63430007060033", + "deployedBytecode": "0x60806040526004361061004a5760003560e01c806313af4035146100545780636c5d4ad014610087578063893d20e81461013a5780639b0b0fda1461016b578063aaf10f421461019b575b6100526101b0565b005b34801561006057600080fd5b506100526004803603602081101561007757600080fd5b50356001600160a01b031661036c565b34801561009357600080fd5b50610052600480360360208110156100aa57600080fd5b8101906020810181356401000000008111156100c557600080fd5b8201836020820111156100d757600080fd5b803590602001918460018302840111640100000000831117156100f957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506103af945050505050565b34801561014657600080fd5b5061014f610505565b604080516001600160a01b039092168252519081900360200190f35b34801561017757600080fd5b506100526004803603604081101561018e57600080fd5b508035906020013561054b565b3480156101a757600080fd5b5061014f610589565b60006101ba6105bd565b60408051600481526024810182526020810180516001600160e01b0316635bca393160e11b1781529151815193945060009384936001600160a01b0387169392918291908083835b602083106102215780518252601f199092019160209182019101610202565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114610281576040519150601f19603f3d011682016040523d82523d6000602084013e610286565b606091505b5091509150818015610299575080516020145b156102f85760008180602001905160208110156102b557600080fd5b5051905080156102f65760405162461bcd60e51b81526004018080602001828103825260358152602001806106b76035913960400191505060405180910390fd5b505b60006103026105e2565b90506001600160a01b0381166103495760405162461bcd60e51b81526004018080602001828103825260308152602001806106546030913960400191505060405180910390fd5b3660008037600080366000845af43d6000803e80610366573d6000fd5b503d6000f35b6103746105bd565b6001600160a01b0316336001600160a01b03161480610391575033155b156103a45761039f81610607565b6103ac565b6103ac6101b0565b50565b6103b76105bd565b6001600160a01b0316336001600160a01b031614806103d4575033155b156103a45760006103e36105e2565b90506103ee8161062b565b825160208401201415610401575061039f565b60006c600d380380600d6000396000f360981b83604051602001808372ffffffffffffffffffffffffffffffffffffff19168152600d0182805190602001908083835b602083106104635780518252601f199092019160209182019101610444565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052905060008151602083016000f0905083805190602001206104b88261062b565b146104f45760405162461bcd60e51b81526004018080602001828103825260338152602001806106846033913960400191505060405180910390fd5b6104fd8161062f565b5050506103ac565b600061050f6105bd565b6001600160a01b0316336001600160a01b0316148061052c575033155b15610540576105396105bd565b9050610548565b6105486101b0565b90565b6105536105bd565b6001600160a01b0316336001600160a01b03161480610570575033155b1561057d57808255610585565b6105856101b0565b5050565b60006105936105bd565b6001600160a01b0316336001600160a01b031614806105b0575033155b15610540576105396105e2565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b3f90565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe4c314368756753706c61736850726f78793a20696d706c656d656e746174696f6e206973206e6f7420736574207965744c314368756753706c61736850726f78793a20636f646520776173206e6f7420636f72726563746c79206465706c6f7965642e4c314368756753706c61736850726f78793a2073797374656d2069732063757272656e746c79206265696e67207570677261646564a26469706673582212202e20c1d0062b5a698d49624edce72a713b117e88f4cd70877869b53519c1d1f964736f6c63430007060033", + "devdoc": { + "details": "Basic ChugSplash proxy contract for L1. Very close to being a normal proxy but has added functions `setCode` and `setStorage` for changing the code or storage of the contract. Nifty! Note for future developers: do NOT make anything in this contract 'public' unless you know what you're doing. Anything public can potentially have a function signature that conflicts with a signature attached to the implementation contract. Public functions SHOULD always have the 'proxyCallIfNotOwner' modifier unless there's some *really* good reason not to have that modifier. And there almost certainly is not a good reason to not have that modifier. Beware!", + "kind": "dev", + "methods": { + "constructor": { + "params": { + "_owner": "Address of the initial contract owner." + } + }, + "getImplementation()": { + "returns": { + "_0": "Implementation address." + } + }, + "getOwner()": { + "returns": { + "_0": "Owner address." + } + }, + "setCode(bytes)": { + "params": { + "_code": "New contract code to run inside this contract." + } + }, + "setOwner(address)": { + "params": { + "_owner": "New owner of the proxy contract." + } + }, + "setStorage(bytes32,bytes32)": { + "params": { + "_key": "Storage key to modify.", + "_value": "New value for the storage key." + } + } + }, + "title": "L1ChugSplashProxy", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "getImplementation()": { + "notice": "Queries the implementation address. Can only be called by the owner OR by making an eth_call and setting the \"from\" address to address(0)." + }, + "getOwner()": { + "notice": "Queries the owner of the proxy contract. Can only be called by the owner OR by making an eth_call and setting the \"from\" address to address(0)." + }, + "setCode(bytes)": { + "notice": "Sets the code that should be running behind this proxy. Note that this scheme is a bit different from the standard proxy scheme where one would typically deploy the code separately and then set the implementation address. We're doing it this way because it gives us a lot more freedom on the client side. Can only be triggered by the contract owner." + }, + "setOwner(address)": { + "notice": "Changes the owner of the proxy contract. Only callable by the owner." + }, + "setStorage(bytes32,bytes32)": { + "notice": "Modifies some storage slot within the proxy contract. Gives us a lot of power to perform upgrades in a more transparent way. Only callable by the owner." + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/kovan/mockOVM_BondManager.json b/packages/contracts/deployments/kovan/mockOVM_BondManager.json index 4ef5baaa33b7..65faad0e40bb 100644 --- a/packages/contracts/deployments/kovan/mockOVM_BondManager.json +++ b/packages/contracts/deployments/kovan/mockOVM_BondManager.json @@ -1,5 +1,5 @@ { - "address": "0x8ECe272C9f83041bcb1Cd57AC49Ca6494776bE01", + "address": "0xD6143943447DFf503d948Fba3D8af3d4Df28f45c", "abi": [ { "inputs": [ @@ -173,29 +173,29 @@ "type": "function" } ], - "transactionHash": "0x51934b4913fc6cb446cb9b81b11c91393e8a00eb70ba44ac7fa1361fb8119deb", + "transactionHash": "0x2a2e990a58395c97f00e36241b54b37d78574a2bd053a8e507bfea7d6c8c3cc9", "receipt": { "to": null, "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", - "contractAddress": "0x8ECe272C9f83041bcb1Cd57AC49Ca6494776bE01", - "transactionIndex": 1, - "gasUsed": "297198", + "contractAddress": "0xD6143943447DFf503d948Fba3D8af3d4Df28f45c", + "transactionIndex": 0, + "gasUsed": "298498", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xd12c9c8a22bc6d6e515104cc5c8473933eb037f559f8ab725149f9dee9d5f25f", - "transactionHash": "0x51934b4913fc6cb446cb9b81b11c91393e8a00eb70ba44ac7fa1361fb8119deb", + "blockHash": "0xbe6c95e62392b9037260b0a7278cd8aeb2269033f6c09b7579174c473b9c717b", + "transactionHash": "0x2a2e990a58395c97f00e36241b54b37d78574a2bd053a8e507bfea7d6c8c3cc9", "logs": [], - "blockNumber": 24572822, - "cumulativeGasUsed": "595662", + "blockNumber": 25502601, + "cumulativeGasUsed": "298498", "status": 1, "byzantium": true }, "args": [ - "0xd56F695e73286ac252A37593DD4E7c14270eC1Df" + "0x100Dd3b414Df5BbA2B542864fF94aF8024aFdf3a" ], - "solcInputHash": "5ee8e508e2c54cb5ac6783b4855b1558", - "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\":\"_who\",\"type\":\"address\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"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\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"getGasSpent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_who\",\"type\":\"address\"}],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"startWithdrawal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}}},\"title\":\"mockOVM_BondManager\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/mockOVM/verification/mockOVM_BondManager.sol\":\"mockOVM_BondManager\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x2ce671a0e004df88b136bea5a3c59d0732cea8887c8496da1d509e0200b03d7d\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"license\":\"MIT\"},\"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 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_Proposer\\\");\\n }\\n\\n function getGasSpent(\\n bytes32, // _preStateRoot,\\n address // _who\\n )\\n override\\n public\\n pure\\n returns (\\n uint256\\n )\\n {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0xe649b49573ba5babca407f116e97dc13f24bf677cbcd03824a2eb98a7750c4e8\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506040516104673803806104678339818101604052602081101561003357600080fd5b5051600080546001600160a01b039092166001600160a01b0319909216919091179055610402806100656000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063abfbbe1311610066578063abfbbe1314610207578063bc2f8dd814610239578063c5b6aa2f14610239578063d0e30db014610239578063dc6453dc146102415761009e565b806302ad4d2a146100a35780631e16e92f146100dd5780631e83409a14610117578063299ca4781461013d578063461a447814610161575b600080fd5b6100c9600480360360208110156100b957600080fd5b50356001600160a01b031661027f565b604080519115158252519081900360200190f35b610115600480360360808110156100f357600080fd5b508035906020810135906001600160a01b0360408201351690606001356102c9565b005b6101156004803603602081101561012d57600080fd5b50356001600160a01b03166102cf565b6101456102d2565b604080516001600160a01b039092168252519081900360200190f35b6101456004803603602081101561017757600080fd5b81019060208101813564010000000081111561019257600080fd5b8201836020820111156101a457600080fd5b803590602001918460018302840111640100000000831117156101c657600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506102e1945050505050565b6101156004803603606081101561021d57600080fd5b508035906001600160a01b0360208201351690604001356103bd565b6101156103c2565b61026d6004803603604081101561025757600080fd5b50803590602001356001600160a01b03166103c4565b60408051918252519081900360200190f35b60006102ae6040518060400160405280600c81526020016b27ab26afa83937b837b9b2b960a11b8152506102e1565b6001600160a01b0316826001600160a01b0316149050919050565b50505050565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610341578181015183820152602001610329565b50505050905090810190601f16801561036e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561038b57600080fd5b505afa15801561039f573d6000803e3d6000fd5b505050506040513d60208110156103b557600080fd5b505192915050565b505050565b565b60009291505056fea264697066735822122023ce16ce6de3f7672940d40a33de4b777fbb7eaa3ec117bcace31640220db75d64736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061009e5760003560e01c8063abfbbe1311610066578063abfbbe1314610207578063bc2f8dd814610239578063c5b6aa2f14610239578063d0e30db014610239578063dc6453dc146102415761009e565b806302ad4d2a146100a35780631e16e92f146100dd5780631e83409a14610117578063299ca4781461013d578063461a447814610161575b600080fd5b6100c9600480360360208110156100b957600080fd5b50356001600160a01b031661027f565b604080519115158252519081900360200190f35b610115600480360360808110156100f357600080fd5b508035906020810135906001600160a01b0360408201351690606001356102c9565b005b6101156004803603602081101561012d57600080fd5b50356001600160a01b03166102cf565b6101456102d2565b604080516001600160a01b039092168252519081900360200190f35b6101456004803603602081101561017757600080fd5b81019060208101813564010000000081111561019257600080fd5b8201836020820111156101a457600080fd5b803590602001918460018302840111640100000000831117156101c657600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506102e1945050505050565b6101156004803603606081101561021d57600080fd5b508035906001600160a01b0360208201351690604001356103bd565b6101156103c2565b61026d6004803603604081101561025757600080fd5b50803590602001356001600160a01b03166103c4565b60408051918252519081900360200190f35b60006102ae6040518060400160405280600c81526020016b27ab26afa83937b837b9b2b960a11b8152506102e1565b6001600160a01b0316826001600160a01b0316149050919050565b50505050565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610341578181015183820152602001610329565b50505050905090810190601f16801561036e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561038b57600080fd5b505afa15801561039f573d6000803e3d6000fd5b505050506040513d60208110156103b557600080fd5b505192915050565b505050565b565b60009291505056fea264697066735822122023ce16ce6de3f7672940d40a33de4b777fbb7eaa3ec117bcace31640220db75d64736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"_who\",\"type\":\"address\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"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\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"getGasSpent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_who\",\"type\":\"address\"}],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"startWithdrawal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}}},\"title\":\"mockOVM_BondManager\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/mockOVM/verification/mockOVM_BondManager.sol\":\"mockOVM_BondManager\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"license\":\"MIT\"},\"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 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_Proposer\\\");\\n }\\n\\n function getGasSpent(\\n bytes32, // _preStateRoot,\\n address // _who\\n )\\n override\\n public\\n pure\\n returns (\\n uint256\\n )\\n {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0xe649b49573ba5babca407f116e97dc13f24bf677cbcd03824a2eb98a7750c4e8\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516104673803806104678339818101604052602081101561003357600080fd5b5051600080546001600160a01b039092166001600160a01b0319909216919091179055610402806100656000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063abfbbe1311610066578063abfbbe1314610207578063bc2f8dd814610239578063c5b6aa2f14610239578063d0e30db014610239578063dc6453dc146102415761009e565b806302ad4d2a146100a35780631e16e92f146100dd5780631e83409a14610117578063299ca4781461013d578063461a447814610161575b600080fd5b6100c9600480360360208110156100b957600080fd5b50356001600160a01b031661027f565b604080519115158252519081900360200190f35b610115600480360360808110156100f357600080fd5b508035906020810135906001600160a01b0360408201351690606001356102c9565b005b6101156004803603602081101561012d57600080fd5b50356001600160a01b03166102cf565b6101456102d2565b604080516001600160a01b039092168252519081900360200190f35b6101456004803603602081101561017757600080fd5b81019060208101813564010000000081111561019257600080fd5b8201836020820111156101a457600080fd5b803590602001918460018302840111640100000000831117156101c657600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506102e1945050505050565b6101156004803603606081101561021d57600080fd5b508035906001600160a01b0360208201351690604001356103bd565b6101156103c2565b61026d6004803603604081101561025757600080fd5b50803590602001356001600160a01b03166103c4565b60408051918252519081900360200190f35b60006102ae6040518060400160405280600c81526020016b27ab26afa83937b837b9b2b960a11b8152506102e1565b6001600160a01b0316826001600160a01b0316149050919050565b50505050565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610341578181015183820152602001610329565b50505050905090810190601f16801561036e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561038b57600080fd5b505afa15801561039f573d6000803e3d6000fd5b505050506040513d60208110156103b557600080fd5b505192915050565b505050565b565b60009291505056fea2646970667358221220c19aac7427cb83d5b9d44589a9b54252aad926befab3c327ae2aebfd25184a9464736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061009e5760003560e01c8063abfbbe1311610066578063abfbbe1314610207578063bc2f8dd814610239578063c5b6aa2f14610239578063d0e30db014610239578063dc6453dc146102415761009e565b806302ad4d2a146100a35780631e16e92f146100dd5780631e83409a14610117578063299ca4781461013d578063461a447814610161575b600080fd5b6100c9600480360360208110156100b957600080fd5b50356001600160a01b031661027f565b604080519115158252519081900360200190f35b610115600480360360808110156100f357600080fd5b508035906020810135906001600160a01b0360408201351690606001356102c9565b005b6101156004803603602081101561012d57600080fd5b50356001600160a01b03166102cf565b6101456102d2565b604080516001600160a01b039092168252519081900360200190f35b6101456004803603602081101561017757600080fd5b81019060208101813564010000000081111561019257600080fd5b8201836020820111156101a457600080fd5b803590602001918460018302840111640100000000831117156101c657600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506102e1945050505050565b6101156004803603606081101561021d57600080fd5b508035906001600160a01b0360208201351690604001356103bd565b6101156103c2565b61026d6004803603604081101561025757600080fd5b50803590602001356001600160a01b03166103c4565b60408051918252519081900360200190f35b60006102ae6040518060400160405280600c81526020016b27ab26afa83937b837b9b2b960a11b8152506102e1565b6001600160a01b0316826001600160a01b0316149050919050565b50505050565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610341578181015183820152602001610329565b50505050905090810190601f16801561036e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561038b57600080fd5b505afa15801561039f573d6000803e3d6000fd5b505050506040513d60208110156103b557600080fd5b505192915050565b505050565b565b60009291505056fea2646970667358221220c19aac7427cb83d5b9d44589a9b54252aad926befab3c327ae2aebfd25184a9464736f6c63430007060033", "devdoc": { "kind": "dev", "methods": { @@ -223,16 +223,16 @@ "storageLayout": { "storage": [ { - "astId": 12800, + "astId": 15303, "contract": "contracts/optimistic-ethereum/mockOVM/verification/mockOVM_BondManager.sol:mockOVM_BondManager", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12793" + "type": "t_contract(Lib_AddressManager)15296" } ], "types": { - "t_contract(Lib_AddressManager)12793": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" diff --git a/packages/contracts/deployments/kovan/solcInputs/7531d7762a77038a37e7490a7b4b176f.json b/packages/contracts/deployments/kovan/solcInputs/7531d7762a77038a37e7490a7b4b176f.json new file mode 100644 index 000000000000..e0264142f533 --- /dev/null +++ b/packages/contracts/deployments/kovan/solcInputs/7531d7762a77038a37e7490a7b4b176f.json @@ -0,0 +1,38 @@ +{ + "language": "Solidity", + "sources": { + "contracts/chugsplash/interfaces/iL1ChugSplashDeployer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title iL1ChugSplashDeployer\n */\ninterface iL1ChugSplashDeployer {\n function isUpgrading()\n external\n view\n returns (\n bool\n );\n}\n" + }, + "contracts/chugsplash/L1ChugSplashProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\nimport { iL1ChugSplashDeployer } from \"./interfaces/iL1ChugSplashDeployer.sol\";\n\n/**\n * @title L1ChugSplashProxy\n * @dev Basic ChugSplash proxy contract for L1. Very close to being a normal proxy but has added\n * functions `setCode` and `setStorage` for changing the code or storage of the contract. Nifty!\n *\n * Note for future developers: do NOT make anything in this contract 'public' unless you know what\n * you're doing. Anything public can potentially have a function signature that conflicts with a\n * signature attached to the implementation contract. Public functions SHOULD always have the\n * 'proxyCallIfNotOwner' modifier unless there's some *really* good reason not to have that\n * modifier. And there almost certainly is not a good reason to not have that modifier. Beware!\n */\ncontract L1ChugSplashProxy {\n\n /*************\n * Constants *\n *************/\n\n // \"Magic\" prefix. When prepended to some arbitrary bytecode and used to create a contract, the\n // appended bytecode will be deployed as given.\n bytes13 constant internal DEPLOY_CODE_PREFIX = 0x600D380380600D6000396000f3;\n\n // bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\n bytes32 constant internal IMPLEMENTATION_KEY = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n // bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1)\n bytes32 constant internal OWNER_KEY = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n\n /***************\n * Constructor *\n ***************/\n \n /**\n * @param _owner Address of the initial contract owner.\n */\n constructor(\n address _owner\n ) {\n _setOwner(_owner);\n }\n\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * Blocks a function from being called when the parent signals that the system should be paused\n * via an isUpgrading function.\n */\n modifier onlyWhenNotPaused() {\n address owner = _getOwner();\n\n // We do a low-level call because there's no guarantee that the owner actually *is* an\n // L1ChugSplashDeployer contract and Solidity will throw errors if we do a normal call and\n // it turns out that it isn't the right type of contract.\n (bool success, bytes memory returndata) = owner.staticcall(\n abi.encodeWithSelector(\n iL1ChugSplashDeployer.isUpgrading.selector\n )\n );\n\n // If the call was unsuccessful then we assume that there's no \"isUpgrading\" method and we\n // can just continue as normal. We also expect that the return value is exactly 32 bytes\n // long. If this isn't the case then we can safely ignore the result.\n if (success && returndata.length == 32) {\n // Although the expected value is a *boolean*, it's safer to decode as a uint256 in the\n // case that the isUpgrading function returned something other than 0 or 1. But we only\n // really care about the case where this value is 0 (= false).\n uint256 ret = abi.decode(returndata, (uint256));\n require(\n ret == 0,\n \"L1ChugSplashProxy: system is currently being upgraded\"\n );\n }\n\n _;\n }\n\n /**\n * Makes a proxy call instead of triggering the given function when the caller is either the\n * owner or the zero address. Caller can only ever be the zero address if this function is\n * being called off-chain via eth_call, which is totally fine and can be convenient for\n * client-side tooling. Avoids situations where the proxy and implementation share a sighash\n * and the proxy function ends up being called instead of the implementation one.\n *\n * Note: msg.sender == address(0) can ONLY be triggered off-chain via eth_call. If there's a\n * way for someone to send a transaction with msg.sender == address(0) in any real context then\n * we have much bigger problems. Primary reason to include this additional allowed sender is\n * because the owner address can be changed dynamically and we do not want clients to have to\n * keep track of the current owner in order to make an eth_call that doesn't trigger the\n * proxied contract.\n */\n modifier proxyCallIfNotOwner() {\n if (msg.sender == _getOwner() || msg.sender == address(0)) {\n _;\n } else {\n // This WILL halt the call frame on completion.\n _doProxyCall();\n }\n }\n\n\n /*********************\n * Fallback Function *\n *********************/\n\n fallback()\n external\n payable\n {\n // Proxy call by default.\n _doProxyCall();\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Sets the code that should be running behind this proxy. Note that this scheme is a bit\n * different from the standard proxy scheme where one would typically deploy the code\n * separately and then set the implementation address. We're doing it this way because it gives\n * us a lot more freedom on the client side. Can only be triggered by the contract owner.\n * @param _code New contract code to run inside this contract.\n */\n function setCode(\n bytes memory _code\n )\n proxyCallIfNotOwner\n public\n {\n // Get the code hash of the current implementation.\n address implementation = _getImplementation();\n\n // If the code hash matches the new implementation then we return early.\n if (keccak256(_code) == _getAccountCodeHash(implementation)) {\n return;\n }\n\n // Create the deploycode by appending the magic prefix.\n bytes memory deploycode = abi.encodePacked(\n DEPLOY_CODE_PREFIX,\n _code\n );\n\n // Deploy the code and set the new implementation address.\n address newImplementation;\n assembly {\n newImplementation := create(0x0, add(deploycode, 0x20), mload(deploycode))\n }\n\n // Check that the code was actually deployed correctly. I'm not sure if you can ever\n // actually fail this check. Should only happen if the contract creation from above runs\n // out of gas but this parent execution thread does NOT run out of gas. Seems like we\n // should be doing this check anyway though.\n require(\n _getAccountCodeHash(newImplementation) == keccak256(_code),\n \"L1ChugSplashProxy: code was not correctly deployed.\"\n );\n\n _setImplementation(newImplementation);\n }\n\n /**\n * Modifies some storage slot within the proxy contract. Gives us a lot of power to perform\n * upgrades in a more transparent way. Only callable by the owner.\n * @param _key Storage key to modify.\n * @param _value New value for the storage key.\n */\n function setStorage(\n bytes32 _key,\n bytes32 _value\n )\n proxyCallIfNotOwner\n public\n {\n assembly {\n sstore(_key, _value)\n }\n }\n\n /**\n * Changes the owner of the proxy contract. Only callable by the owner.\n * @param _owner New owner of the proxy contract.\n */\n function setOwner(\n address _owner\n )\n proxyCallIfNotOwner\n public\n {\n _setOwner(_owner);\n }\n\n /**\n * Queries the owner of the proxy contract. Can only be called by the owner OR by making an\n * eth_call and setting the \"from\" address to address(0).\n * @return Owner address.\n */\n function getOwner()\n proxyCallIfNotOwner\n public\n returns (\n address\n )\n {\n return _getOwner();\n }\n\n /**\n * Queries the implementation address. Can only be called by the owner OR by making an\n * eth_call and setting the \"from\" address to address(0).\n * @return Implementation address.\n */\n function getImplementation()\n proxyCallIfNotOwner\n public\n returns (\n address\n )\n {\n return _getImplementation();\n }\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Sets the implementation address.\n * @param _implementation New implementation address.\n */\n function _setImplementation(\n address _implementation\n )\n internal\n {\n assembly {\n sstore(IMPLEMENTATION_KEY, _implementation)\n }\n }\n\n /**\n * Queries the implementation address.\n * @return Implementation address.\n */\n function _getImplementation()\n internal\n view\n returns (\n address\n )\n {\n address implementation;\n assembly {\n implementation := sload(IMPLEMENTATION_KEY)\n }\n return implementation;\n }\n\n /**\n * Changes the owner of the proxy contract.\n * @param _owner New owner of the proxy contract.\n */\n function _setOwner(\n address _owner\n )\n internal\n {\n assembly {\n sstore(OWNER_KEY, _owner)\n }\n }\n\n /**\n * Queries the owner of the proxy contract.\n * @return Owner address.\n */\n function _getOwner()\n internal\n view \n returns (\n address\n )\n {\n address owner;\n assembly {\n owner := sload(OWNER_KEY)\n }\n return owner;\n }\n\n /**\n * Gets the code hash for a given account.\n * @param _account Address of the account to get a code hash for.\n * @return Code hash for the account.\n */\n function _getAccountCodeHash(\n address _account\n )\n internal\n view\n returns (\n bytes32\n )\n {\n bytes32 codeHash;\n assembly {\n codeHash := extcodehash(_account)\n }\n return codeHash;\n }\n\n /**\n * Performs the proxy call via a delegatecall.\n */\n function _doProxyCall()\n onlyWhenNotPaused\n internal\n {\n address implementation = _getImplementation();\n\n require(\n implementation != address(0),\n \"L1ChugSplashProxy: implementation is not set yet\"\n );\n\n assembly {\n // Copy calldata into memory at 0x0....calldatasize.\n calldatacopy(0x0, 0x0, calldatasize())\n\n // Perform the delegatecall, make sure to pass all available gas.\n let success := delegatecall(gas(), implementation, 0x0, calldatasize(), 0x0, 0x0)\n\n // Copy returndata into memory at 0x0....returndatasize. Note that this *will*\n // overwrite the calldata that we just copied into memory but that doesn't really\n // matter because we'll be returning in a second anyway.\n returndatacopy(0x0, 0x0, returndatasize())\n \n // Success == 0 means a revert. We'll revert too and pass the data up.\n if iszero(success) {\n revert(0x0, returndatasize())\n }\n\n // Otherwise we'll just return and pass the data up.\n return(0x0, returndatasize())\n }\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "storageLayout", + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/kovan/solcInputs/ef3f334bac4d7e77d91b457a0d89ab0a.json b/packages/contracts/deployments/kovan/solcInputs/ef3f334bac4d7e77d91b457a0d89ab0a.json new file mode 100644 index 000000000000..dfd91954d94a --- /dev/null +++ b/packages/contracts/deployments/kovan/solcInputs/ef3f334bac4d7e77d91b457a0d89ab0a.json @@ -0,0 +1,338 @@ +{ + "language": "Solidity", + "sources": { + "contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_CrossDomainMessenger.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/**\n * @title iOVM_CrossDomainMessenger\n */\ninterface iOVM_CrossDomainMessenger {\n\n /**********\n * Events *\n **********/\n\n event SentMessage(bytes message);\n event RelayedMessage(bytes32 msgHash);\n event FailedRelayedMessage(bytes32 msgHash);\n\n\n /*************\n * Variables *\n *************/\n\n function xDomainMessageSender() external view returns (address);\n\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/libraries/bridge/OVM_CrossDomainEnabled.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Interface Imports */\nimport { iOVM_CrossDomainMessenger } from \"../../iOVM/bridge/messaging/iOVM_CrossDomainMessenger.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\n /*************\n * Variables *\n *************/\n\n // Messenger contract used to send and recieve messages from the other domain.\n address public messenger;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _messenger Address of the CrossDomainMessenger on the current layer.\n */\n constructor(\n address _messenger\n ) {\n messenger = _messenger;\n }\n\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * 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\n * 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 /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Gets the messenger, usually from storage. This function is exposed in case a child contract\n * 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 iOVM_CrossDomainMessenger\n )\n {\n return iOVM_CrossDomainMessenger(messenger);\n }\n\n /**\n * Sends a message to an account on another domain\n * @param _crossDomainTarget The intended recipient on the destination domain\n * @param _message The data to send to the target (usually calldata to a function with\n * `onlyFromCrossDomainAccount()`)\n * @param _gasLimit The gasLimit for the receipt of the message on the target domain.\n */\n function sendCrossDomainMessage(\n address _crossDomainTarget,\n uint32 _gasLimit,\n bytes memory _message\n )\n internal\n {\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit);\n }\n}\n" + }, + "contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L2StandardBridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Interface Imports */\nimport { iOVM_L1StandardBridge } from \"../../../iOVM/bridge/tokens/iOVM_L1StandardBridge.sol\";\nimport { iOVM_L1ERC20Bridge } from \"../../../iOVM/bridge/tokens/iOVM_L1ERC20Bridge.sol\";\nimport { iOVM_L2ERC20Bridge } from \"../../../iOVM/bridge/tokens/iOVM_L2ERC20Bridge.sol\";\n\n/* Library Imports */\nimport { ERC165Checker } from \"@openzeppelin/contracts/introspection/ERC165Checker.sol\";\nimport { OVM_CrossDomainEnabled } from \"../../../libraries/bridge/OVM_CrossDomainEnabled.sol\";\nimport { Lib_PredeployAddresses } from \"../../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Contract Imports */\nimport { IL2StandardERC20 } from \"../../../libraries/standards/IL2StandardERC20.sol\";\n\n/**\n * @title OVM_L2StandardBridge\n * @dev The L2 Standard bridge is a contract which works together with the L1 Standard bridge to enable\n * ETH and ERC20 transitions between L1 and L2.\n * This contract acts as a minter for new tokens when it hears about deposits into the L1 Standard bridge.\n * This contract also acts as a burner of the tokens intended for withdrawal, informing the L1 bridge to release L1 funds.\n *\n * Compiler used: optimistic-solc\n * Runtime target: OVM\n */\ncontract OVM_L2StandardBridge is iOVM_L2ERC20Bridge, OVM_CrossDomainEnabled {\n\n /********************************\n * External Contract References *\n ********************************/\n\n address public l1TokenBridge;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _l2CrossDomainMessenger Cross-domain messenger used by this contract.\n * @param _l1TokenBridge Address of the L1 bridge deployed to the main chain.\n */\n constructor(\n address _l2CrossDomainMessenger,\n address _l1TokenBridge\n )\n OVM_CrossDomainEnabled(_l2CrossDomainMessenger)\n {\n l1TokenBridge = _l1TokenBridge;\n }\n\n /***************\n * Withdrawing *\n ***************/\n\n /**\n * @inheritdoc iOVM_L2ERC20Bridge\n */\n function withdraw(\n address _l2Token,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n )\n external\n override\n virtual\n {\n _initiateWithdrawal(\n _l2Token,\n msg.sender,\n msg.sender,\n _amount,\n _l1Gas,\n _data\n );\n }\n\n /**\n * @inheritdoc iOVM_L2ERC20Bridge\n */\n function withdrawTo(\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n )\n external\n override\n virtual\n {\n _initiateWithdrawal(\n _l2Token,\n msg.sender,\n _to,\n _amount,\n _l1Gas,\n _data\n );\n }\n\n /**\n * @dev Performs the logic for deposits by storing the token and informing the L2 token Gateway of the deposit.\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _from Account to pull the deposit from on L2.\n * @param _to Account to give the withdrawal to on L1.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function _initiateWithdrawal(\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n )\n internal\n {\n // When a withdrawal is initiated, we burn the withdrawer's funds to prevent subsequent L2 usage\n IL2StandardERC20(_l2Token).burn(msg.sender, _amount);\n\n // Construct calldata for l1TokenBridge.finalizeERC20Withdrawal(_to, _amount)\n address l1Token = IL2StandardERC20(_l2Token).l1Token();\n bytes memory message;\n\n if (_l2Token == Lib_PredeployAddresses.OVM_ETH) {\n message = abi.encodeWithSelector(\n iOVM_L1StandardBridge.finalizeETHWithdrawal.selector,\n _from,\n _to,\n _amount,\n _data\n );\n } else {\n message = abi.encodeWithSelector(\n iOVM_L1ERC20Bridge.finalizeERC20Withdrawal.selector,\n l1Token,\n _l2Token,\n _from,\n _to,\n _amount,\n _data\n );\n }\n\n // Send message up to L1 bridge\n sendCrossDomainMessage(\n l1TokenBridge,\n _l1Gas,\n message\n );\n\n emit WithdrawalInitiated(l1Token, _l2Token, msg.sender, _to, _amount, _data);\n }\n\n /************************************\n * Cross-chain Function: Depositing *\n ************************************/\n\n /**\n * @inheritdoc iOVM_L2ERC20Bridge\n */\n function finalizeDeposit(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n )\n external\n override\n virtual\n onlyFromCrossDomainAccount(l1TokenBridge)\n {\n // Check the target token is compliant and\n // verify the deposited token on L1 matches the L2 deposited token representation here\n if (\n ERC165Checker.supportsInterface(_l2Token, 0x1d1d8b63) &&\n _l1Token == IL2StandardERC20(_l2Token).l1Token()\n ) {\n // When a deposit is finalized, we credit the account on L2 with the same amount of tokens.\n IL2StandardERC20(_l2Token).mint(_to, _amount);\n emit DepositFinalized(_l1Token, _l2Token, _from, _to, _amount, _data);\n } else {\n // Either the L2 token which is being deposited-into disagrees about the correct address\n // of its L1 token, or does not support the correct interface.\n // This should only happen if there is a malicious L2 token, or if a user somehow\n // specified the wrong L2 token address to deposit into.\n // In either case, we stop the process here and construct a withdrawal\n // message so that users can get their funds out in some cases.\n // There is no way to prevent malicious token contracts altogether, but this does limit\n // user error and mitigate some forms of malicious contract behavior.\n bytes memory message = abi.encodeWithSelector(\n iOVM_L1ERC20Bridge.finalizeERC20Withdrawal.selector,\n _l1Token,\n _l2Token,\n _to, // switched the _to and _from here to bounce back the deposit to the sender\n _from,\n _amount,\n _data\n );\n\n // Send message up to L1 bridge\n sendCrossDomainMessage(\n l1TokenBridge,\n 0,\n message\n );\n emit DepositFailed(_l1Token, _l2Token, _from, _to, _amount, _data);\n }\n }\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1StandardBridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0;\npragma experimental ABIEncoderV2;\n\nimport './iOVM_L1ERC20Bridge.sol';\n\n/**\n * @title iOVM_L1StandardBridge\n */\ninterface iOVM_L1StandardBridge is iOVM_L1ERC20Bridge {\n\n /**********\n * Events *\n **********/\n event ETHDepositInitiated (\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n event ETHWithdrawalFinalized (\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n \n /**\n * @dev Deposit an amount of the ETH to the caller's balance on L2.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETH (\n uint32 _l2Gas,\n bytes calldata _data\n )\n external\n payable;\n\n /**\n * @dev Deposit an amount of ETH to a recipient's balance on L2.\n * @param _to L2 address to credit the withdrawal to.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETHTo (\n address _to,\n uint32 _l2Gas,\n bytes calldata _data\n )\n external\n payable;\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 ETH token.\n * Since only the xDomainMessenger can call this function, it will never be called before the withdrawal is finalized.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeETHWithdrawal (\n address _from,\n address _to,\n uint _amount,\n bytes calldata _data\n )\n external;\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1ERC20Bridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0;\npragma experimental ABIEncoderV2;\n\n/**\n * @title iOVM_L1ERC20Bridge\n */\ninterface iOVM_L1ERC20Bridge {\n\n /**********\n * Events *\n **********/\n\n event ERC20DepositInitiated (\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event ERC20WithdrawalFinalized (\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev deposit an amount of the ERC20 to the caller's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _amount Amount of the ERC20 to deposit\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20 (\n address _l1Token,\n address _l2Token,\n uint _amount,\n uint32 _l2Gas,\n bytes calldata _data\n )\n external;\n\n /**\n * @dev deposit an amount of ERC20 to a recipient's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _to L2 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20To (\n address _l1Token,\n address _l2Token,\n address _to,\n uint _amount,\n uint32 _l2Gas,\n bytes calldata _data\n )\n external;\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 _l1Token Address of L1 token to finalizeWithdrawal for.\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Data provided by the sender on L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeERC20Withdrawal (\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint _amount,\n bytes calldata _data\n )\n external;\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L2ERC20Bridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0;\npragma experimental ABIEncoderV2;\n\n/**\n * @title iOVM_L2ERC20Bridge\n */\ninterface iOVM_L2ERC20Bridge {\n\n /**********\n * Events *\n **********/\n\n event WithdrawalInitiated (\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFinalized (\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFailed (\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev initiate a withdraw of some tokens to the caller's account on L1\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdraw (\n address _l2Token,\n uint _amount,\n uint32 _l1Gas,\n bytes calldata _data\n )\n external;\n\n /**\n * @dev initiate a withdraw of some token to a recipient's account on L1.\n * @param _l2Token Address of L2 token where withdrawal is initiated.\n * @param _to L1 adress to credit the withdrawal to.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdrawTo (\n address _l2Token,\n address _to,\n uint _amount,\n uint32 _l1Gas,\n bytes calldata _data\n )\n external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a deposit from L1 to L2, and credits funds to the recipient's balance of this\n * L2 token.\n * This call will fail if it did not originate from a corresponding deposit in OVM_l1TokenGateway.\n * @param _l1Token Address for the l1 token this is called with\n * @param _l2Token Address for the l2 token this is called with\n * @param _from Account to pull the deposit from on L2.\n * @param _to Address to receive the withdrawal at\n * @param _amount Amount of the token to withdraw\n * @param _data Data provider by the sender on L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeDeposit (\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint _amount,\n bytes calldata _data\n )\n external;\n\n}\n" + }, + "@openzeppelin/contracts/introspection/ERC165Checker.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.2 <0.8.0;\n\n/**\n * @dev Library used to query support of an interface declared via {IERC165}.\n *\n * Note that these functions return the actual result of the query: they do not\n * `revert` if an interface is not supported. It is up to the caller to decide\n * what to do in these cases.\n */\nlibrary ERC165Checker {\n // As per the EIP-165 spec, no interface should ever match 0xffffffff\n bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;\n\n /*\n * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7\n */\n bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;\n\n /**\n * @dev Returns true if `account` supports the {IERC165} interface,\n */\n function supportsERC165(address account) internal view returns (bool) {\n // Any contract that implements ERC165 must explicitly indicate support of\n // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid\n return _supportsERC165Interface(account, _INTERFACE_ID_ERC165) &&\n !_supportsERC165Interface(account, _INTERFACE_ID_INVALID);\n }\n\n /**\n * @dev Returns true if `account` supports the interface defined by\n * `interfaceId`. Support for {IERC165} itself is queried automatically.\n *\n * See {IERC165-supportsInterface}.\n */\n function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {\n // query support of both ERC165 as per the spec and support of _interfaceId\n return supportsERC165(account) &&\n _supportsERC165Interface(account, interfaceId);\n }\n\n /**\n * @dev Returns a boolean array where each value corresponds to the\n * interfaces passed in and whether they're supported or not. This allows\n * you to batch check interfaces for a contract where your expectation\n * is that some interfaces may not be supported.\n *\n * See {IERC165-supportsInterface}.\n *\n * _Available since v3.4._\n */\n function getSupportedInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool[] memory) {\n // an array of booleans corresponding to interfaceIds and whether they're supported or not\n bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);\n\n // query support of ERC165 itself\n if (supportsERC165(account)) {\n // query support of each interface in interfaceIds\n for (uint256 i = 0; i < interfaceIds.length; i++) {\n interfaceIdsSupported[i] = _supportsERC165Interface(account, interfaceIds[i]);\n }\n }\n\n return interfaceIdsSupported;\n }\n\n /**\n * @dev Returns true if `account` supports all the interfaces defined in\n * `interfaceIds`. Support for {IERC165} itself is queried automatically.\n *\n * Batch-querying can lead to gas savings by skipping repeated checks for\n * {IERC165} support.\n *\n * See {IERC165-supportsInterface}.\n */\n function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {\n // query support of ERC165 itself\n if (!supportsERC165(account)) {\n return false;\n }\n\n // query support of each interface in _interfaceIds\n for (uint256 i = 0; i < interfaceIds.length; i++) {\n if (!_supportsERC165Interface(account, interfaceIds[i])) {\n return false;\n }\n }\n\n // all interfaces supported\n return true;\n }\n\n /**\n * @notice Query if a contract implements an interface, does not check ERC165 support\n * @param account The address of the contract to query for support of an interface\n * @param interfaceId The interface identifier, as specified in ERC-165\n * @return true if the contract at account indicates support of the interface with\n * identifier interfaceId, false otherwise\n * @dev Assumes that account contains a contract that supports ERC165, otherwise\n * the behavior of this method is undefined. This precondition can be checked\n * with {supportsERC165}.\n * Interface identification is specified in ERC-165.\n */\n function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) {\n // success determines whether the staticcall succeeded and result determines\n // whether the contract at account indicates support of _interfaceId\n (bool success, bool result) = _callERC165SupportsInterface(account, interfaceId);\n\n return (success && result);\n }\n\n /**\n * @notice Calls the function with selector 0x01ffc9a7 (ERC165) and suppresses throw\n * @param account The address of the contract to query for support of an interface\n * @param interfaceId The interface identifier, as specified in ERC-165\n * @return success true if the STATICCALL succeeded, false otherwise\n * @return result true if the STATICCALL succeeded and the contract at account\n * indicates support of the interface with identifier interfaceId, false otherwise\n */\n function _callERC165SupportsInterface(address account, bytes4 interfaceId)\n private\n view\n returns (bool, bool)\n {\n bytes memory encodedParams = abi.encodeWithSelector(_INTERFACE_ID_ERC165, interfaceId);\n (bool success, bytes memory result) = account.staticcall{ gas: 30000 }(encodedParams);\n if (result.length < 32) return (false, false);\n return (success, abi.decode(result, (bool)));\n }\n}\n" + }, + "contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title Lib_PredeployAddresses\n */\nlibrary Lib_PredeployAddresses {\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\n address internal constant ECDSA_CONTRACT_ACCOUNT = 0x4200000000000000000000000000000000000003;\n address internal constant SEQUENCER_ENTRYPOINT = 0x4200000000000000000000000000000000000005;\n address payable internal constant OVM_ETH = 0x4200000000000000000000000000000000000006;\n address internal constant L2_CROSS_DOMAIN_MESSENGER = 0x4200000000000000000000000000000000000007;\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\n address internal constant EXECUTION_MANAGER_WRAPPER = 0x420000000000000000000000000000000000000B;\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\n address internal constant ERC1820_REGISTRY = 0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24;\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\n}\n" + }, + "contracts/optimistic-ethereum/libraries/standards/IL2StandardERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.16 <0.8.0;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IERC165 } from \"@openzeppelin/contracts/introspection/IERC165.sol\";\n\ninterface IL2StandardERC20 is IERC20, IERC165 {\n function l1Token() external returns (address);\n\n function mint(address _to, uint256 _amount) external;\n\n function burn(address _from, uint256 _amount) external;\n\n event Mint(address indexed _account, uint256 _amount);\n event Burn(address indexed _account, uint256 _amount);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" + }, + "@openzeppelin/contracts/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerFeeVault.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Contract Imports */\nimport { OVM_ETH } from \"../predeploys/OVM_ETH.sol\";\nimport { OVM_L2StandardBridge } from \"../bridge/tokens/OVM_L2StandardBridge.sol\";\n\n/**\n * @title OVM_SequencerFeeVault\n * @dev Simple holding contract for fees paid to the Sequencer. Likely to be replaced in the future\n * but \"good enough for now\".\n *\n * Compiler used: optimistic-solc\n * Runtime target: OVM\n */\ncontract OVM_SequencerFeeVault {\n\n /*************\n * Constants *\n *************/\n\n // Minimum ETH balance that can be withdrawn in a single withdrawal.\n uint256 public constant MIN_WITHDRAWAL_AMOUNT = 15 ether;\n\n\n /*************\n * Variables *\n *************/\n\n // Address on L1 that will hold the fees once withdrawn. Dynamically initialized within l2geth.\n address public l1FeeWallet;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _l1FeeWallet Initial address for the L1 wallet that will hold fees once withdrawn.\n * Currently HAS NO EFFECT in production because l2geth will mutate this storage slot during\n * the genesis block. This is ONLY for testing purposes.\n */\n constructor(\n address _l1FeeWallet\n ) {\n l1FeeWallet = _l1FeeWallet;\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n function withdraw()\n public\n {\n uint256 balance = OVM_ETH(Lib_PredeployAddresses.OVM_ETH).balanceOf(address(this));\n\n require(\n balance >= MIN_WITHDRAWAL_AMOUNT,\n \"OVM_SequencerFeeVault: withdrawal amount must be greater than minimum withdrawal amount\"\n );\n\n OVM_L2StandardBridge(Lib_PredeployAddresses.L2_STANDARD_BRIDGE).withdrawTo(\n Lib_PredeployAddresses.OVM_ETH,\n l1FeeWallet,\n balance,\n 0,\n bytes(\"\")\n );\n }\n}\n" + }, + "contracts/optimistic-ethereum/OVM/predeploys/OVM_ETH.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Contract Imports */\nimport { L2StandardERC20 } from \"../../libraries/standards/L2StandardERC20.sol\";\nimport { IWETH9 } from \"../../libraries/standards/IWETH9.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 L2StandardERC20, IWETH9 {\n\n /***************\n * Constructor *\n ***************/\n\n constructor()\n L2StandardERC20(\n Lib_PredeployAddresses.L2_STANDARD_BRIDGE,\n address(0),\n \"Ether\",\n \"ETH\"\n )\n {}\n\n\n /******************************\n * Custom WETH9 Functionality *\n ******************************/\n fallback() external payable {\n deposit();\n }\n\n /**\n * Implements the WETH9 deposit() function as a no-op.\n * WARNING: this function does NOT have to do with cross-chain asset bridging. The\n * relevant deposit and withdraw functions for that use case can be found at L2StandardBridge.sol.\n * This function allows developers to treat OVM_ETH as WETH without any modifications to their code.\n */\n function deposit()\n public\n payable\n override\n {\n // Calling deposit() with nonzero value will send the ETH to this contract address. Once recieved here,\n // We transfer it back by sending to the msg.sender.\n _transfer(address(this), msg.sender, msg.value);\n\n emit Deposit(msg.sender, msg.value);\n }\n\n /**\n * Implements the WETH9 withdraw() function as a no-op.\n * WARNING: this function does NOT have to do with cross-chain asset bridging. The\n * relevant deposit and withdraw functions for that use case can be found at L2StandardBridge.sol.\n * This function allows developers to treat OVM_ETH as WETH without any modifications to their code.\n * @param _wad Amount being withdrawn\n */\n function withdraw(\n uint256 _wad\n )\n external\n override\n {\n // Calling withdraw() with value exceeding the withdrawer's ovmBALANCE should revert, as in WETH9.\n require(balanceOf(msg.sender) >= _wad);\n\n // Other than emitting an event, OVM_ETH already is native ETH, so we don't need to do anything else.\n emit Withdrawal(msg.sender, _wad);\n }\n}\n" + }, + "contracts/optimistic-ethereum/libraries/standards/L2StandardERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.16 <0.8.0;\n\nimport { ERC20 } from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\nimport './IL2StandardERC20.sol';\n\ncontract L2StandardERC20 is IL2StandardERC20, ERC20 {\n address public override l1Token;\n address public l2Bridge;\n\n /**\n * @param _l1Token Address of the corresponding L1 token.\n * @param _name ERC20 name.\n * @param _symbol ERC20 symbol.\n */\n constructor(\n address _l2Bridge,\n address _l1Token,\n string memory _name,\n string memory _symbol\n )\n ERC20(_name, _symbol) {\n l1Token = _l1Token;\n l2Bridge = _l2Bridge;\n }\n\n modifier onlyL2Bridge {\n require(msg.sender == l2Bridge, \"Only L2 Bridge can mint and burn\");\n _;\n }\n\n function supportsInterface(bytes4 _interfaceId) public override pure returns (bool) {\n bytes4 firstSupportedInterface = bytes4(keccak256(\"supportsInterface(bytes4)\")); // ERC165\n bytes4 secondSupportedInterface = IL2StandardERC20.l1Token.selector\n ^ IL2StandardERC20.mint.selector\n ^ IL2StandardERC20.burn.selector;\n return _interfaceId == firstSupportedInterface || _interfaceId == secondSupportedInterface;\n }\n\n function mint(address _to, uint256 _amount) public override onlyL2Bridge {\n _mint(_to, _amount);\n\n emit Mint(_to, _amount);\n }\n\n function burn(address _from, uint256 _amount) public override onlyL2Bridge {\n _burn(_from, _amount);\n\n emit Burn(_from, _amount);\n }\n}\n" + }, + "contracts/optimistic-ethereum/libraries/standards/IWETH9.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity =0.7.6;\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\n/// @title Interface for WETH9. Also contains the non-ERC20 events normally present in the WETH9 implementation.\ninterface IWETH9 is IERC20 {\n event Deposit(address indexed dst, uint256 wad);\n event Withdrawal(address indexed src, uint256 wad);\n\n /// @notice Deposit ether to get wrapped ether\n function deposit() external payable;\n\n /// @notice Withdraw wrapped ether to get ether\n function withdraw(uint256) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\nimport \"../../utils/Context.sol\";\nimport \"./IERC20.sol\";\nimport \"../../math/SafeMath.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin guidelines: functions revert instead\n * of returning `false` on failure. This behavior is nonetheless conventional\n * and does not conflict with the expectations of ERC20 applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20 {\n using SafeMath for uint256;\n\n mapping (address => uint256) private _balances;\n\n mapping (address => mapping (address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n uint8 private _decimals;\n\n /**\n * @dev Sets the values for {name} and {symbol}, initializes {decimals} with\n * a default value of 18.\n *\n * To select a different value for {decimals}, use {_setupDecimals}.\n *\n * All three of these values are immutable: they can only be set once during\n * construction.\n */\n constructor (string memory name_, string memory symbol_) public {\n _name = name_;\n _symbol = symbol_;\n _decimals = 18;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5,05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is\n * called.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual returns (uint8) {\n return _decimals;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, \"ERC20: transfer amount exceeds allowance\"));\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, \"ERC20: decreased allowance below zero\"));\n return true;\n }\n\n /**\n * @dev Moves tokens `amount` from `sender` to `recipient`.\n *\n * This is internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(address sender, address recipient, uint256 amount) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n _balances[sender] = _balances[sender].sub(amount, \"ERC20: transfer amount exceeds balance\");\n _balances[recipient] = _balances[recipient].add(amount);\n emit Transfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply = _totalSupply.add(amount);\n _balances[account] = _balances[account].add(amount);\n emit Transfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n _balances[account] = _balances[account].sub(amount, \"ERC20: burn amount exceeds balance\");\n _totalSupply = _totalSupply.sub(amount);\n emit Transfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Sets {decimals} to a value other than the default one of 18.\n *\n * WARNING: This function should only be called from the constructor. Most\n * applications that interact with token contracts will not expect\n * {decimals} to ever change, and may work incorrectly if it does.\n */\n function _setupDecimals(uint8 decimals_) internal virtual {\n _decimals = decimals_;\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be to transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/*\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with GSN meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address payable) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes memory) {\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n return msg.data;\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" + }, + "@openzeppelin/contracts/token/ERC20/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"../../math/SafeMath.sol\";\nimport \"../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using SafeMath for uint256;\n using Address for address;\n\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n // solhint-disable-next-line max-line-length\n require((value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 newAllowance = token.allowance(address(this), spender).add(value);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 newAllowance = token.allowance(address(this), spender).sub(value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) { // Return data is optional\n // solhint-disable-next-line max-line-length\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.2 <0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n // solhint-disable-next-line no-inline-assembly\n assembly { size := extcodesize(account) }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\n (bool success, ) = recipient.call{ value: amount }(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain`call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.call{ value: value }(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.staticcall(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1StandardBridge.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_L1StandardBridge } from \"../../../iOVM/bridge/tokens/iOVM_L1StandardBridge.sol\";\nimport { iOVM_L1ERC20Bridge } from \"../../../iOVM/bridge/tokens/iOVM_L1ERC20Bridge.sol\";\nimport { iOVM_L2ERC20Bridge } from \"../../../iOVM/bridge/tokens/iOVM_L2ERC20Bridge.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/* Library Imports */\nimport { OVM_CrossDomainEnabled } from \"../../../libraries/bridge/OVM_CrossDomainEnabled.sol\";\nimport { Lib_PredeployAddresses } from \"../../../libraries/constants/Lib_PredeployAddresses.sol\";\nimport { SafeMath } from \"@openzeppelin/contracts/math/SafeMath.sol\";\nimport { Address } from \"@openzeppelin/contracts/utils/Address.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/SafeERC20.sol\";\n\n/**\n * @title OVM_L1StandardBridge\n * @dev The L1 ETH and ERC20 Bridge is a contract which stores deposited L1 funds and standard tokens that are in use on L2.\n * It synchronizes a corresponding L2 Bridge, informing it of deposits, and listening to it for newly finalized withdrawals.\n *\n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_L1StandardBridge is iOVM_L1StandardBridge, OVM_CrossDomainEnabled {\n using SafeMath for uint;\n using SafeERC20 for IERC20;\n\n /********************************\n * External Contract References *\n ********************************/\n\n address public l2TokenBridge;\n\n // Maps L1 token to L2 token to balance of the L1 token deposited\n mapping(address => mapping (address => uint256)) public deposits;\n\n /***************\n * Constructor *\n ***************/\n\n // This contract lives behind a proxy, so the constructor parameters will go unused.\n constructor()\n OVM_CrossDomainEnabled(address(0))\n {}\n\n /******************\n * Initialization *\n ******************/\n\n /**\n * @param _l1messenger L1 Messenger address being used for cross-chain communications.\n * @param _l2TokenBridge L2 standard bridge address.\n */\n function initialize(\n address _l1messenger,\n address _l2TokenBridge\n )\n public\n {\n require(messenger == address(0), \"Contract has already been initialized.\");\n messenger = _l1messenger;\n l2TokenBridge = _l2TokenBridge;\n }\n\n /**************\n * Depositing *\n **************/\n\n /// @dev Modifier requiring sender to be EOA. This check could be bypassed by a malicious contract via initcode, but it takes care of the user error we want to avoid.\n modifier onlyEOA() {\n // Used to stop deposits from contracts (avoid accidentally lost tokens)\n require(!Address.isContract(msg.sender), \"Account not EOA\");\n _;\n }\n\n /**\n * @dev This function can be called with no data\n * to deposit an amount of ETH to the caller's balance on L2.\n * Since the receive function doesn't take data, a conservative\n * default amount is forwarded to L2.\n */\n receive()\n external\n payable\n onlyEOA()\n {\n _initiateETHDeposit(\n msg.sender,\n msg.sender,\n 1_300_000,\n bytes(\"\")\n );\n }\n\n /**\n * @inheritdoc iOVM_L1StandardBridge\n */\n function depositETH(\n uint32 _l2Gas,\n bytes calldata _data\n )\n external\n override\n payable\n onlyEOA()\n {\n _initiateETHDeposit(\n msg.sender,\n msg.sender,\n _l2Gas,\n _data\n );\n }\n\n /**\n * @inheritdoc iOVM_L1StandardBridge\n */\n function depositETHTo(\n address _to,\n uint32 _l2Gas,\n bytes calldata _data\n )\n external\n override\n payable\n {\n _initiateETHDeposit(\n msg.sender,\n _to,\n _l2Gas,\n _data\n );\n }\n\n /**\n * @dev Performs the logic for deposits by storing the ETH and informing the L2 ETH Gateway of the deposit.\n * @param _from Account to pull the deposit from on L1.\n * @param _to Account to give the deposit to on L2.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function _initiateETHDeposit(\n address _from,\n address _to,\n uint32 _l2Gas,\n bytes memory _data\n )\n internal\n {\n // Construct calldata for finalizeDeposit call\n bytes memory message =\n abi.encodeWithSelector(\n iOVM_L2ERC20Bridge.finalizeDeposit.selector,\n address(0),\n Lib_PredeployAddresses.OVM_ETH,\n _from,\n _to,\n msg.value,\n _data\n );\n\n // Send calldata into L2\n sendCrossDomainMessage(\n l2TokenBridge,\n _l2Gas,\n message\n );\n\n emit ETHDepositInitiated(_from, _to, msg.value, _data);\n }\n\n /**\n * @inheritdoc iOVM_L1ERC20Bridge\n */\n function depositERC20(\n address _l1Token,\n address _l2Token,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n )\n external\n override\n virtual\n onlyEOA()\n {\n _initiateERC20Deposit(_l1Token, _l2Token, msg.sender, msg.sender, _amount, _l2Gas, _data);\n }\n\n /**\n * @inheritdoc iOVM_L1ERC20Bridge\n */\n function depositERC20To(\n address _l1Token,\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n )\n external\n override\n virtual\n {\n _initiateERC20Deposit(_l1Token, _l2Token, msg.sender, _to, _amount, _l2Gas, _data);\n }\n\n /**\n * @dev Performs the logic for deposits by informing the L2 Deposited Token\n * contract of the deposit and calling a handler to lock the L1 funds. (e.g. transferFrom)\n *\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\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 * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function _initiateERC20Deposit(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n )\n internal\n {\n // When a deposit is initiated on L1, the L1 Bridge transfers the funds to itself for future withdrawals.\n // safeTransferFrom also checks if the contract has code, so this will fail if _from is an EOA or address(0).\n IERC20(_l1Token).safeTransferFrom(\n _from,\n address(this),\n _amount\n );\n\n // Construct calldata for _l2Token.finalizeDeposit(_to, _amount)\n bytes memory message = abi.encodeWithSelector(\n iOVM_L2ERC20Bridge.finalizeDeposit.selector,\n _l1Token,\n _l2Token,\n _from,\n _to,\n _amount,\n _data\n );\n\n // Send calldata into L2\n sendCrossDomainMessage(\n l2TokenBridge,\n _l2Gas,\n message\n );\n\n deposits[_l1Token][_l2Token] = deposits[_l1Token][_l2Token].add(_amount);\n\n emit ERC20DepositInitiated(_l1Token, _l2Token, _from, _to, _amount, _data);\n }\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @inheritdoc iOVM_L1StandardBridge\n */\n function finalizeETHWithdrawal(\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n )\n external\n override\n onlyFromCrossDomainAccount(l2TokenBridge)\n {\n (bool success, ) = _to.call{value: _amount}(new bytes(0));\n require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');\n\n emit ETHWithdrawalFinalized(_from, _to, _amount, _data);\n }\n\n /**\n * @inheritdoc iOVM_L1ERC20Bridge\n */\n function finalizeERC20Withdrawal(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n )\n external\n override\n onlyFromCrossDomainAccount(l2TokenBridge)\n {\n deposits[_l1Token][_l2Token] = deposits[_l1Token][_l2Token].sub(_amount);\n\n // When a withdrawal is finalized on L1, the L1 Bridge transfers the funds to the withdrawer.\n IERC20(_l1Token).safeTransfer(_to, _amount);\n\n emit ERC20WithdrawalFinalized(_l1Token, _l2Token, _from, _to, _amount, _data);\n }\n\n /*****************************\n * Temporary - Migrating ETH *\n *****************************/\n\n /**\n * @dev Adds ETH balance to the account. This is meant to allow for ETH\n * to be migrated from an old gateway to a new gateway.\n * NOTE: This is left for one upgrade only so we are able to receive the migrated ETH from the old contract\n */\n function donateETH() external payable {}\n}\n" + }, + "contracts/optimistic-ethereum/OVM/predeploys/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/predeploys/iOVM_ECDSAContractAccount.sol\";\n\n/* Library Imports */\nimport { Lib_EIP155Tx } from \"../../libraries/codec/Lib_EIP155Tx.sol\";\nimport { Lib_ExecutionManagerWrapper } from \"../../libraries/wrappers/Lib_ExecutionManagerWrapper.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Contract Imports */\nimport { OVM_ETH } from \"../predeploys/OVM_ETH.sol\";\n\n/* External Imports */\nimport { SafeMath } from \"@openzeppelin/contracts/math/SafeMath.sol\";\nimport { ECDSA } from \"@openzeppelin/contracts/cryptography/ECDSA.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 EIP155 formatted transaction encodings.\n *\n * Compiler used: optimistic-solc\n * Runtime target: OVM\n */\ncontract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount {\n\n /*************\n * Libraries *\n *************/\n\n using Lib_EIP155Tx for Lib_EIP155Tx.EIP155Tx;\n\n\n /*************\n * Constants *\n *************/\n\n // TODO: should be the amount sufficient to cover the gas costs of all of the transactions up\n // to and including the CALL/CREATE which forms the entrypoint of the transaction.\n uint256 constant EXECUTION_VALIDATION_GAS_OVERHEAD = 25000;\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * No-op fallback mirrors behavior of calling an EOA on L1.\n */\n fallback()\n external\n payable\n {\n return;\n }\n\n /**\n * @dev Should return whether the signature provided is valid for the provided data\n * @param hash Hash of the data to be signed\n * @param signature Signature byte array associated with _data\n */\n function isValidSignature(\n bytes32 hash,\n bytes memory signature\n )\n public\n view\n returns (\n bytes4 magicValue\n )\n {\n return ECDSA.recover(hash, signature) == address(this) ?\n this.isValidSignature.selector :\n bytes4(0);\n }\n\n /**\n * Executes a signed transaction.\n * @param _transaction Signed EIP155 transaction.\n * @return Whether or not the call returned (rather than reverted).\n * @return Data returned by the call.\n */\n function execute(\n Lib_EIP155Tx.EIP155Tx memory _transaction\n )\n override\n public\n returns (\n bool,\n bytes memory\n )\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 require(\n _transaction.sender() == Lib_ExecutionManagerWrapper.ovmADDRESS(),\n \"Signature provided for EOA transaction execution is invalid.\"\n );\n\n require(\n _transaction.chainId == Lib_ExecutionManagerWrapper.ovmCHAINID(),\n \"Transaction signed with wrong chain ID\"\n );\n\n // Need to make sure that the transaction nonce is right.\n require(\n _transaction.nonce == Lib_ExecutionManagerWrapper.ovmGETNONCE(),\n \"Transaction nonce does not match the expected nonce.\"\n );\n\n // TEMPORARY: Disable gas checks for mainnet.\n // // Need to make sure that the gas is sufficient to execute the transaction.\n // require(\n // gasleft() >= SafeMath.add(transaction.gasLimit, EXECUTION_VALIDATION_GAS_OVERHEAD),\n // \"Gas is not sufficient to execute the transaction.\"\n // );\n\n // Transfer fee to relayer.\n require(\n OVM_ETH(Lib_PredeployAddresses.OVM_ETH).transfer(\n Lib_PredeployAddresses.SEQUENCER_FEE_WALLET,\n SafeMath.mul(_transaction.gasLimit, _transaction.gasPrice)\n ),\n \"Fee was not transferred to relayer.\"\n );\n\n if (_transaction.isCreate) {\n // TEMPORARY: Disable value transfer for contract creations.\n require(\n _transaction.value == 0,\n \"Value transfer in contract creation not supported.\"\n );\n\n (address created, bytes memory revertdata) = Lib_ExecutionManagerWrapper.ovmCREATE(\n _transaction.data\n );\n\n // Return true if the contract creation succeeded, false w/ revertdata otherwise.\n if (created != address(0)) {\n return (true, abi.encode(created));\n } else {\n return (false, revertdata);\n }\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_ExecutionManagerWrapper.ovmINCREMENTNONCE();\n\n // NOTE: Upgrades are temporarily disabled because users can, in theory, modify their EOA\n // so that they don't have to pay any fees to the sequencer. Function will remain disabled\n // until a robust solution is in place.\n require(\n _transaction.to != Lib_ExecutionManagerWrapper.ovmADDRESS(),\n \"Calls to self are disabled until upgradability is re-enabled.\"\n );\n\n return _transaction.to.call{value: _transaction.value}(_transaction.data);\n }\n }\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/predeploys/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_EIP155Tx } from \"../../libraries/codec/Lib_EIP155Tx.sol\";\n\n/**\n * @title iOVM_ECDSAContractAccount\n */\ninterface iOVM_ECDSAContractAccount {\n\n /********************\n * Public Functions *\n ********************/\n\n function execute(\n Lib_EIP155Tx.EIP155Tx memory _transaction\n )\n external\n returns (\n bool,\n bytes memory\n );\n}\n" + }, + "contracts/optimistic-ethereum/libraries/codec/Lib_EIP155Tx.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\";\n\n/**\n * @title Lib_EIP155Tx\n * @dev A simple library for dealing with the transaction type defined by EIP155:\n * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md\n */\nlibrary Lib_EIP155Tx {\n\n /***********\n * Structs *\n ***********/\n\n // Struct representing an EIP155 transaction. See EIP link above for more information.\n struct EIP155Tx {\n // These fields correspond to the actual RLP-encoded fields specified by EIP155.\n uint256 nonce;\n uint256 gasPrice;\n uint256 gasLimit;\n address to;\n uint256 value;\n bytes data;\n uint8 v;\n bytes32 r;\n bytes32 s;\n\n // Chain ID to associate this transaction with. Used all over the place, seemed easier to\n // set this once when we create the transaction rather than providing it as an input to\n // each function. I don't see a strong need to have a transaction with a mutable chain ID.\n uint256 chainId;\n\n // The ECDSA \"recovery parameter,\" should always be 0 or 1. EIP155 specifies that:\n // `v = {0,1} + CHAIN_ID * 2 + 35`\n // Where `{0,1}` is a stand in for our `recovery_parameter`. Now computing our formula for\n // the recovery parameter:\n // 1. `v = {0,1} + CHAIN_ID * 2 + 35`\n // 2. `v = recovery_parameter + CHAIN_ID * 2 + 35`\n // 3. `v - CHAIN_ID * 2 - 35 = recovery_parameter`\n // So we're left with the final formula:\n // `recovery_parameter = v - CHAIN_ID * 2 - 35`\n // NOTE: This variable is a uint8 because `v` is inherently limited to a uint8. If we\n // didn't use a uint8, then recovery_parameter would always be a negative number for chain\n // IDs greater than 110 (`255 - 110 * 2 - 35 = 0`). So we need to wrap around to support\n // anything larger.\n uint8 recoveryParam;\n\n // Whether or not the transaction is a creation. Necessary because we can't make an address\n // \"nil\". Using the zero address creates a potential conflict if the user did actually\n // intend to send a transaction to the zero address.\n bool isCreate;\n }\n\n // Lets us use nicer syntax.\n using Lib_EIP155Tx for EIP155Tx;\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Decodes an EIP155 transaction and attaches a given Chain ID.\n * Transaction *must* be RLP-encoded.\n * @param _encoded RLP-encoded EIP155 transaction.\n * @param _chainId Chain ID to assocaite with this transaction.\n * @return Parsed transaction.\n */\n function decode(\n bytes memory _encoded,\n uint256 _chainId\n )\n internal\n pure\n returns (\n EIP155Tx memory\n )\n {\n Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_encoded);\n\n // Note formula above about how recoveryParam is computed.\n uint8 v = uint8(Lib_RLPReader.readUint256(decoded[6]));\n uint8 recoveryParam = uint8(v - 2 * _chainId - 35);\n\n // Recovery param being anything other than 0 or 1 indicates that we have the wrong chain\n // ID.\n require(\n recoveryParam < 2,\n \"Lib_EIP155Tx: Transaction signed with wrong chain ID\"\n );\n\n // Creations can be detected by looking at the byte length here.\n bool isCreate = Lib_RLPReader.readBytes(decoded[3]).length == 0;\n\n return EIP155Tx({\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 v: v,\n r: Lib_RLPReader.readBytes32(decoded[7]),\n s: Lib_RLPReader.readBytes32(decoded[8]),\n chainId: _chainId,\n recoveryParam: recoveryParam,\n isCreate: isCreate\n });\n }\n\n /**\n * Encodes an EIP155 transaction into RLP.\n * @param _transaction EIP155 transaction to encode.\n * @param _includeSignature Whether or not to encode the signature.\n * @return RLP-encoded transaction.\n */\n function encode(\n EIP155Tx memory _transaction,\n bool _includeSignature\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\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\n // We write the encoding of empty bytes when the transaction is a creation, *not* the zero\n // address as one might assume.\n if (_transaction.isCreate) {\n raw[3] = Lib_RLPWriter.writeBytes('');\n } else {\n raw[3] = Lib_RLPWriter.writeAddress(_transaction.to);\n }\n\n raw[4] = Lib_RLPWriter.writeUint(_transaction.value);\n raw[5] = Lib_RLPWriter.writeBytes(_transaction.data);\n\n if (_includeSignature) {\n raw[6] = Lib_RLPWriter.writeUint(_transaction.v);\n raw[7] = Lib_RLPWriter.writeBytes32(_transaction.r);\n raw[8] = Lib_RLPWriter.writeBytes32(_transaction.s);\n } else {\n // Chain ID *is* included in the unsigned transaction.\n raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId);\n raw[7] = Lib_RLPWriter.writeBytes('');\n raw[8] = Lib_RLPWriter.writeBytes('');\n }\n\n return Lib_RLPWriter.writeList(raw);\n }\n\n /**\n * Computes the hash of an EIP155 transaction. Assumes that you don't want to include the\n * signature in this hash because that's a very uncommon usecase. If you really want to include\n * the signature, just encode with the signature and take the hash yourself.\n */\n function hash(\n EIP155Tx memory _transaction\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n return keccak256(\n _transaction.encode(false)\n );\n }\n\n /**\n * Computes the sender of an EIP155 transaction.\n * @param _transaction EIP155 transaction to get a sender for.\n * @return Address corresponding to the private key that signed this transaction.\n */\n function sender(\n EIP155Tx memory _transaction\n )\n internal\n pure\n returns (\n address\n )\n {\n return ecrecover(\n _transaction.hash(),\n _transaction.recoveryParam + 27,\n _transaction.r,\n _transaction.s\n );\n }\n}\n" + }, + "contracts/optimistic-ethereum/libraries/wrappers/Lib_ExecutionManagerWrapper.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_ErrorUtils } from \"../utils/Lib_ErrorUtils.sol\";\nimport { Lib_PredeployAddresses } from \"../constants/Lib_PredeployAddresses.sol\";\n\n/**\n * @title Lib_ExecutionManagerWrapper\n * @dev This library acts as a utility for easily calling the OVM_ExecutionManagerWrapper, the\n * predeployed contract which exposes the `kall` builtin. Effectively, this contract allows the\n * user to trigger OVM opcodes by directly calling the OVM_ExecutionManger.\n *\n * Compiler used: solc\n * Runtime target: OVM\n */\nlibrary Lib_ExecutionManagerWrapper {\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Performs a safe ovmCREATE call.\n * @param _bytecode Code for the new contract.\n * @return Address of the created contract.\n */\n function ovmCREATE(\n bytes memory _bytecode\n )\n internal\n returns (\n address,\n bytes memory\n )\n {\n bytes memory returndata = _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmCREATE(bytes)\",\n _bytecode\n )\n );\n\n return abi.decode(returndata, (address, bytes));\n }\n\n /**\n * Performs a safe ovmGETNONCE call.\n * @return Result of calling ovmGETNONCE.\n */\n function ovmGETNONCE()\n internal\n returns (\n uint256\n )\n {\n bytes memory returndata = _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmGETNONCE()\"\n )\n );\n\n return abi.decode(returndata, (uint256));\n }\n\n /**\n * Performs a safe ovmINCREMENTNONCE call.\n */\n function ovmINCREMENTNONCE()\n internal\n {\n _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmINCREMENTNONCE()\"\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 ovmCREATEEOA(\n bytes32 _messageHash,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n )\n internal\n {\n _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\",\n _messageHash,\n _v,\n _r,\n _s\n )\n );\n }\n\n /**\n * Calls the ovmL1TXORIGIN opcode.\n * @return Address that sent this message from L1.\n */\n function ovmL1TXORIGIN()\n internal\n returns (\n address\n )\n {\n bytes memory returndata = _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmL1TXORIGIN()\"\n )\n );\n\n return abi.decode(returndata, (address));\n }\n\n /**\n * Calls the ovmCHAINID opcode.\n * @return Chain ID of the current network.\n */\n function ovmCHAINID()\n internal\n returns (\n uint256\n )\n {\n bytes memory returndata = _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmCHAINID()\"\n )\n );\n\n return abi.decode(returndata, (uint256));\n }\n\n /**\n * Performs a safe ovmADDRESS call.\n * @return Result of calling ovmADDRESS.\n */\n function ovmADDRESS()\n internal\n returns (\n address\n )\n {\n bytes memory returndata = _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmADDRESS()\"\n )\n );\n\n return abi.decode(returndata, (address));\n }\n\n /**\n * Calls the value-enabled ovmCALL opcode.\n * @param _gasLimit Amount of gas to be passed into this call.\n * @param _address Address of the contract to call.\n * @param _value ETH value to pass with the 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 uint256 _value,\n bytes memory _calldata\n )\n internal\n returns (\n bool,\n bytes memory\n )\n {\n bytes memory returndata = _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmCALL(uint256,address,uint256,bytes)\",\n _gasLimit,\n _address,\n _value,\n _calldata\n )\n );\n\n return abi.decode(returndata, (bool, bytes));\n }\n\n /**\n * Calls the ovmBALANCE opcode.\n * @param _address OVM account to query the balance of.\n * @return Balance of the account.\n */\n function ovmBALANCE(\n address _address\n )\n internal\n returns (\n uint256\n )\n {\n bytes memory returndata = _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmBALANCE(address)\",\n _address\n )\n );\n\n return abi.decode(returndata, (uint256));\n }\n\n /**\n * Calls the ovmCALLVALUE opcode.\n * @return Value of the current call frame.\n */\n function ovmCALLVALUE()\n internal\n returns (\n uint256\n )\n {\n bytes memory returndata = _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmCALLVALUE()\"\n )\n );\n\n return abi.decode(returndata, (uint256));\n }\n\n\n /*********************\n * Private Functions *\n *********************/\n\n /**\n * Performs an ovm interaction and the necessary safety checks.\n * @param _calldata Data to send to the OVM_ExecutionManager (encoded with sighash).\n * @return Data sent back by the OVM_ExecutionManager.\n */\n function _callWrapperContract(\n bytes memory _calldata\n )\n private\n returns (\n bytes memory\n )\n {\n (bool success, bytes memory returndata) = Lib_PredeployAddresses.EXECUTION_MANAGER_WRAPPER.delegatecall(_calldata);\n\n if (success == true) {\n return returndata;\n } else {\n assembly {\n revert(add(returndata, 0x20), mload(returndata))\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n // Check the signature length\n if (signature.length != 65) {\n revert(\"ECDSA: invalid signature length\");\n }\n\n // Divide the signature in r, s and v variables\n bytes32 r;\n bytes32 s;\n uint8 v;\n\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n\n return recover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover-bytes32-bytes-} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n require(uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, \"ECDSA: invalid signature 's' value\");\n require(v == 27 || v == 28, \"ECDSA: invalid signature 'v' value\");\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n require(signer != address(0), \"ECDSA: invalid signature\");\n\n return signer;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * replicates the behavior of the\n * https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign[`eth_sign`]\n * JSON-RPC method.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\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 require(\n out == 0 || out == 1,\n \"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\"\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/**\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 The RLP encoded string in bytes.\n */\n function writeBytes(\n bytes memory _in\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n bytes memory encoded;\n\n if (_in.length == 1 && uint8(_in[0]) < 128) {\n encoded = _in;\n } else {\n encoded = abi.encodePacked(_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 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\n )\n {\n bytes memory list = _flatten(_in);\n return abi.encodePacked(_writeLength(list.length, 192), list);\n }\n\n /**\n * RLP encodes a string.\n * @param _in The string to encode.\n * @return The RLP encoded string in bytes.\n */\n function writeString(\n string memory _in\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n return writeBytes(bytes(_in));\n }\n\n /**\n * RLP encodes an address.\n * @param _in The address to encode.\n * @return The RLP encoded address in bytes.\n */\n function writeAddress(\n address _in\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n return writeBytes(abi.encodePacked(_in));\n }\n\n /**\n * RLP encodes a bytes32 value.\n * @param _in The bytes32 to encode.\n * @return _out The RLP encoded bytes32 in bytes.\n */\n function writeBytes32(\n bytes32 _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 The RLP encoded uint256 in bytes.\n */\n function writeUint(\n uint256 _in\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n return writeBytes(_toBinary(_in));\n }\n\n /**\n * RLP encodes a bool.\n * @param _in The bool to encode.\n * @return The RLP encoded bool in bytes.\n */\n function writeBool(\n bool _in\n )\n internal\n pure\n returns (\n bytes memory\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 RLP encoded bytes.\n */\n function _writeLength(\n uint256 _len,\n uint256 _offset\n )\n private\n pure\n returns (\n bytes memory\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 RLP encoded bytes.\n */\n function _toBinary(\n uint256 _x\n )\n private\n pure\n returns (\n bytes memory\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 The flattened byte string.\n */\n function _flatten(\n bytes[] memory _list\n )\n private\n pure\n returns (\n bytes memory\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}\n" + }, + "contracts/optimistic-ethereum/libraries/utils/Lib_ErrorUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/**\n * @title Lib_ErrorUtils\n */\nlibrary Lib_ErrorUtils {\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Encodes an error string into raw solidity-style revert data.\n * (i.e. ascii bytes, prefixed with bytes4(keccak(\"Error(string))\"))\n * Ref: https://docs.soliditylang.org/en/v0.8.2/control-structures.html?highlight=Error(string)#panic-via-assert-and-error-via-require\n * @param _reason Reason for the reversion.\n * @return Standard solidity revert data for the given reason.\n */\n function encodeRevertString(\n string memory _reason\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n return abi.encodeWithSignature(\n \"Error(string)\",\n _reason\n );\n }\n}\n" + }, + "contracts/optimistic-ethereum/OVM/predeploys/OVM_ProxyEOA.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\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\nimport { Lib_ExecutionManagerWrapper } from \"../../libraries/wrappers/Lib_ExecutionManagerWrapper.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: optimistic-solc\n * Runtime target: OVM\n */\ncontract OVM_ProxyEOA {\n\n /**********\n * Events *\n **********/\n\n event Upgraded(\n address indexed implementation\n );\n\n\n /*************\n * Constants *\n *************/\n\n bytes32 constant IMPLEMENTATION_KEY = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; //bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1);\n\n\n /*********************\n * Fallback Function *\n *********************/\n\n fallback()\n external\n payable\n {\n (bool success, bytes memory returndata) = getImplementation().delegatecall(msg.data);\n\n if (success) {\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 // WARNING: We use the deployed bytecode of this contract as a template to create ProxyEOA\n // contracts. As a result, we must *not* perform any constructor logic. Use initialization\n // functions if necessary.\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Changes the implementation address.\n * @param _implementation New implementation address.\n */\n function upgrade(\n address _implementation\n )\n external\n {\n require(\n msg.sender == Lib_ExecutionManagerWrapper.ovmADDRESS(),\n \"EOAs can only upgrade their own EOA implementation.\"\n );\n\n _setImplementation(_implementation);\n emit Upgraded(_implementation);\n }\n\n /**\n * Gets the address of the current implementation.\n * @return Current implementation address.\n */\n function getImplementation()\n public\n view\n returns (\n address\n )\n {\n bytes32 addr32;\n assembly {\n addr32 := sload(IMPLEMENTATION_KEY)\n }\n\n address implementation = Lib_Bytes32Utils.toAddress(addr32);\n if (implementation == address(0)) {\n return Lib_PredeployAddresses.ECDSA_CONTRACT_ACCOUNT;\n } else {\n return implementation;\n }\n }\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n function _setImplementation(\n address _implementation\n )\n internal\n {\n bytes32 addr32 = Lib_Bytes32Utils.fromAddress(_implementation);\n assembly {\n sstore(IMPLEMENTATION_KEY, addr32)\n }\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 /**\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \"true.\"\n * @param _in Input bytes32 value.\n * @return Bytes32 as a boolean.\n */\n function toBool(\n bytes32 _in\n )\n internal\n pure\n returns (\n bool\n )\n {\n return _in != 0;\n }\n\n /**\n * Converts a boolean to a bytes32 value.\n * @param _in Input boolean value.\n * @return Boolean as a bytes32.\n */\n function fromBool(\n bool _in\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n return bytes32(uint256(_in ? 1 : 0));\n }\n\n /**\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\n * @param _in Input bytes32 value.\n * @return Bytes32 as an address.\n */\n function toAddress(\n bytes32 _in\n )\n internal\n pure\n returns (\n address\n )\n {\n return address(uint160(uint256(_in)));\n }\n\n /**\n * Converts an address to a bytes32.\n * @param _in Input address value.\n * @return Address as a bytes32.\n */\n function fromAddress(\n address _in\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n return bytes32(uint256(_in));\n }\n\n /**\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\n * @param _in Input bytes32 value.\n * @return Bytes32 without any leading zeros.\n */\n function removeLeadingZeros(\n bytes32 _in\n )\n internal\n pure\n returns (\n bytes memory\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/OVM/predeploys/OVM_SequencerEntrypoint.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_EIP155Tx } from \"../../libraries/codec/Lib_EIP155Tx.sol\";\nimport { Lib_ExecutionManagerWrapper } from \"../../libraries/wrappers/Lib_ExecutionManagerWrapper.sol\";\nimport { iOVM_ECDSAContractAccount } from \"../../iOVM/predeploys/iOVM_ECDSAContractAccount.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 * Compiler used: optimistic-solc\n * Runtime target: OVM\n */\ncontract OVM_SequencerEntrypoint {\n\n /*************\n * Libraries *\n *************/\n\n using Lib_EIP155Tx for Lib_EIP155Tx.EIP155Tx;\n\n\n /*********************\n * Fallback Function *\n *********************/\n\n /**\n * Expects an RLP-encoded EIP155 transaction as input. See the EIP for a more detailed\n * description of this transaction format:\n * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md\n */\n fallback()\n external\n {\n // We use this twice, so it's more gas efficient to store a copy of it (barely).\n bytes memory encodedTx = msg.data;\n\n // Decode the tx with the correct chain ID.\n Lib_EIP155Tx.EIP155Tx memory transaction = Lib_EIP155Tx.decode(\n encodedTx,\n Lib_ExecutionManagerWrapper.ovmCHAINID()\n );\n\n // Value is computed on the fly. Keep it in the stack to save some gas.\n address target = transaction.sender();\n\n bool isEmptyContract;\n assembly {\n isEmptyContract := iszero(extcodesize(target))\n }\n\n // If the account is empty, deploy the default EOA to that address.\n if (isEmptyContract) {\n Lib_ExecutionManagerWrapper.ovmCREATEEOA(\n transaction.hash(),\n transaction.recoveryParam,\n transaction.r,\n transaction.s\n );\n }\n\n // Forward the transaction over to the EOA.\n (bool success, bytes memory returndata) = target.call(\n abi.encodeWithSelector(iOVM_ECDSAContractAccount.execute.selector, transaction)\n );\n\n if (success) {\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/codec/TestLib_EIP155Tx.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_EIP155Tx } from \"../../optimistic-ethereum/libraries/codec/Lib_EIP155Tx.sol\";\n\n/**\n * @title TestLib_EIP155Tx\n */\ncontract TestLib_EIP155Tx {\n function decode(\n bytes memory _encoded,\n uint256 _chainId\n )\n public\n pure\n returns (\n Lib_EIP155Tx.EIP155Tx memory\n )\n {\n return Lib_EIP155Tx.decode(\n _encoded,\n _chainId\n );\n }\n\n function encode(\n Lib_EIP155Tx.EIP155Tx memory _transaction,\n bool _includeSignature\n )\n public\n pure\n returns (\n bytes memory\n )\n {\n return Lib_EIP155Tx.encode(\n _transaction,\n _includeSignature\n );\n }\n\n function hash(\n Lib_EIP155Tx.EIP155Tx memory _transaction\n )\n public\n pure\n returns (\n bytes32\n )\n {\n return Lib_EIP155Tx.hash(\n _transaction\n );\n }\n\n function sender(\n Lib_EIP155Tx.EIP155Tx memory _transaction\n )\n public\n pure\n returns (\n address\n )\n {\n return Lib_EIP155Tx.sender(\n _transaction\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() {}\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 abi.encodePacked(\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/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 slice(\n bytes memory _bytes,\n uint256 _start,\n uint256 _length\n )\n internal\n pure\n returns (\n bytes memory\n )\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 (\n bytes memory\n )\n {\n if (_start >= _bytes.length) {\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 (\n bytes32\n )\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 (\n bytes32\n )\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 (\n uint256\n )\n {\n return uint256(toBytes32(_bytes));\n }\n\n function toUint24(\n bytes memory _bytes,\n uint256 _start\n )\n internal\n pure\n returns (\n uint24\n )\n {\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(\n bytes memory _bytes,\n uint256 _start\n )\n internal\n pure\n returns (\n uint8\n )\n {\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(\n bytes memory _bytes,\n uint256 _start\n )\n internal\n pure\n returns (\n address\n )\n {\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 (\n bytes memory\n )\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 (\n bytes memory\n )\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 (\n bool\n )\n {\n return keccak256(_bytes) == keccak256(_other);\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 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 external\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 external\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 external\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 external\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 external\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 external\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 // Prevent the Execution Manager from calling this SM again.\n ovmStateManager.setExecutionManager(address(0));\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 external\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 external\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 external\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/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\";\n\n/**\n * @title Lib_OVMCodec\n */\nlibrary Lib_OVMCodec {\n\n /*********\n * Enums *\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 transactionHash;\n uint40 timestamp;\n uint40 blockNumber;\n }\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Encodes a standard OVM transaction.\n * @param _transaction OVM transaction to encode.\n * @return Encoded transaction bytes.\n */\n function encodeTransaction(\n Transaction memory _transaction\n )\n internal\n pure\n returns (\n bytes memory\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 Hashed transaction\n */\n function hashTransaction(\n Transaction memory _transaction\n )\n internal\n pure\n returns (\n bytes32\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 Converted EVM account.\n */\n function toEVMAccount(\n Account memory _in\n )\n internal\n pure\n returns (\n EVMAccount memory\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 RLP-encoded account state.\n */\n function encodeEVMAccount(\n EVMAccount memory _account\n )\n internal\n pure\n returns (\n bytes memory\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 state struct.\n */\n function decodeEVMAccount(\n bytes memory _encoded\n )\n internal\n pure\n returns (\n EVMAccount memory\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 of the header.\n */\n function hashBatchHeader(\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\n )\n internal\n pure\n returns (\n bytes32\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/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 */\nabstract contract Lib_AddressResolver {\n\n /*************\n * Variables *\n *************/\n\n Lib_AddressManager public libAddressManager;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address of the Lib_AddressManager.\n */\n constructor(\n address _libAddressManager\n ) {\n libAddressManager = Lib_AddressManager(_libAddressManager);\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Resolves the address associated with a given name.\n * @param _name Name to resolve an address for.\n * @return Address associated with the given name.\n */\n function resolve(\n string memory _name\n )\n public\n view\n returns (\n address\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 *\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 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\n )\n {\n bytes memory code;\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 Full code of the contract.\n */\n function getCode(\n address _address\n )\n internal\n view\n returns (\n bytes memory\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 Size of the contract's code in bytes.\n */\n function getCodeSize(\n address _address\n )\n internal\n view\n returns (\n uint256\n )\n {\n uint256 codeSize;\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 Hash of the contract's code.\n */\n function getCodeHash(\n address _address\n )\n internal\n view\n returns (\n bytes32\n )\n {\n bytes32 codeHash;\n assembly {\n codeHash := extcodehash(_address)\n }\n\n return codeHash;\n }\n\n /**\n * Creates a contract with some given initialization code.\n * @param _code Contract initialization code.\n * @return Address of the created contract.\n */\n function createContract(\n bytes memory _code\n )\n internal\n returns (\n address\n )\n {\n address created;\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 to be generated by CREATE.\n */\n function getAddressForCREATE(\n address _creator,\n uint256 _nonce\n )\n internal\n pure\n returns (\n 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 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 (\n address\n )\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/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 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_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 OUT_OF_GAS,\n INTENTIONAL_REVERT,\n EXCEEDS_NUISANCE_GAS,\n INVALID_STATE_ACCESS,\n UNSAFE_BYTECODE,\n CREATE_COLLISION,\n STATIC_VIOLATION,\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 enum MessageType {\n ovmCALL,\n ovmSTATICCALL,\n ovmDELEGATECALL,\n ovmCREATE,\n ovmCREATE2\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 uint256 ovmCALLVALUE;\n bool isStatic;\n }\n\n struct MessageRecord {\n uint256 nuisanceGasLeft;\n }\n\n\n /************************************\n * Transaction Execution Entrypoint *\n ************************************/\n\n function run(\n Lib_OVMCodec.Transaction calldata _transaction,\n address _txStateManager\n ) external returns (bytes memory);\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 ovmCALLVALUE() external view returns (uint _callValue);\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, bytes memory _revertdata);\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract, bytes memory _revertdata);\n\n\n /*******************************\n * Account Abstraction Opcodes *\n ******************************/\n\n function ovmGETNONCE() external returns (uint256 _nonce);\n function ovmINCREMENTNONCE() external;\n function ovmCREATEEOA(bytes32 _messageHash, uint8 _v, bytes32 _r, bytes32 _s) external;\n\n\n /****************************\n * Contract Calling Opcodes *\n ****************************/\n\n // Valueless ovmCALL for maintaining backwards compatibility with legacy OVM bytecode.\n function ovmCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\n function ovmCALL(uint256 _gasLimit, address _address, uint256 _value, 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 * ETH Value Opcodes *\n *********************/\n\n function ovmBALANCE(address _contract) external returns (uint256 _balance);\n function ovmSELFBALANCE() external returns (uint256 _balance);\n\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_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/resolver/Lib_AddressManager.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* External Imports */\nimport { Ownable } from \"@openzeppelin/contracts/access/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 indexed _name,\n address _newAddress,\n address _oldAddress\n );\n\n\n /*************\n * Variables *\n *************/\n\n mapping (bytes32 => address) private addresses;\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Changes the address associated with a particular name.\n * @param _name String name to associate an address with.\n * @param _address Address to associate with the name.\n */\n function setAddress(\n string memory _name,\n address _address\n )\n external\n onlyOwner\n {\n bytes32 nameHash = _getNameHash(_name);\n address oldAddress = addresses[nameHash];\n addresses[nameHash] = _address;\n\n emit AddressSet(\n _name,\n _address,\n oldAddress\n );\n }\n\n /**\n * Retrieves the address associated with a given name.\n * @param _name Name to retrieve an address for.\n * @return Address associated with the given name.\n */\n function getAddress(\n string memory _name\n )\n external\n view\n returns (\n address\n )\n {\n return addresses[_getNameHash(_name)];\n }\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Computes the hash of a name.\n * @param _name Name to compute a hash for.\n * @return Hash of the given name.\n */\n function _getNameHash(\n string memory _name\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n return keccak256(abi.encodePacked(_name));\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\nimport \"../utils/Context.sol\";\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor () internal {\n address msgSender = _msgSender();\n _owner = msgSender;\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\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 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, _key, 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 != pathRemainder.length) {\n // Our extension node is not identical to the remainder.\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 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 path may include\n * additional nodes (e.g., it comes directly from a proof) and we can't resize in-memory\n * arrays without costly duplication.\n * @param _key Full original key.\n * @param _keyRemainder Portion of the initial key that must be inserted 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 _key,\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 // Reference: https://github.com/ethereumjs/merkle-patricia-tree/blob/c0a10395aab37d42c175a47114ebfcbd7efcf059/src/baseTrie.ts#L294-L313\n bool matchLeaf = false;\n if (lastNodeType == NodeType.LeafNode) {\n uint256 l = 0;\n if (_path.length > 0) {\n for (uint256 i = 0; i < _path.length - 1; i++) {\n if (_getNodeType(_path[i]) == NodeType.BranchNode) {\n l++;\n } else {\n l += _getNodeKey(_path[i]).length;\n }\n }\n }\n\n if (\n _getSharedNibbleLength(\n _getNodeKey(lastNode),\n Lib_BytesUtils.slice(Lib_BytesUtils.toNibbles(_key), l)\n ) == _getNodeKey(lastNode).length\n && keyRemainder.length == 0\n ) {\n matchLeaf = true;\n }\n }\n\n if (matchLeaf) {\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 = _editExtensionNodeValue(currentNode, 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 * Creates a new extension node with the same key but a different value.\n * @param _node Extension node to copy and modify.\n * @param _value New value for the extension node.\n * @return New node with the same key and different value.\n */\n function _editExtensionNodeValue(\n TrieNode memory _node,\n bytes memory _value\n )\n private\n pure\n returns (\n TrieNode memory\n )\n {\n bytes[] memory raw = new bytes[](2);\n bytes memory key = _addHexPrefix(_getNodeKey(_node), false);\n raw[0] = Lib_RLPWriter.writeBytes(Lib_BytesUtils.fromNibbles(key));\n if (_value.length < 32) {\n raw[1] = _value;\n } else {\n raw[1] = Lib_RLPWriter.writeBytes(_value);\n }\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 abi.encodePacked(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 /***************\n * Constructor *\n ***************/\n\n constructor(\n address _libAddressManager\n )\n Lib_AddressResolver(_libAddressManager)\n {}\n\n\n /********************\n * Public Functions *\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 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\n )\n {\n require(\n msg.sender == resolve(\"OVM_FraudVerifier\"),\n \"Create can only be done by the OVM_FraudVerifier.\"\n );\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 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\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 * 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" + }, + "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 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 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_Proposer\");\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 // For efficiency reasons getMerkleRoot modifies the `_batch` argument in place\n // while calculating the root hash therefore any arguments passed to it must not\n // be used again afterwards\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 * Note that the _elements argument is modified, therefore it must not be used again afterwards\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 pure\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 == 1) {\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 (uint256 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" + }, + "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_Buffer } from \"../../libraries/utils/Lib_Buffer.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 distinct 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_Buffer for Lib_Buffer.Buffer;\n\n\n /*************\n * Variables *\n *************/\n\n string public owner;\n Lib_Buffer.Buffer 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 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 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" + }, + "contracts/optimistic-ethereum/libraries/utils/Lib_Buffer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title Lib_Buffer\n * @dev This library implements a bytes32 storage array with some additional gas-optimized\n * functionality. In particular, it encodes its length as a uint40, and tightly packs this with an\n * overwritable \"extra data\" field so we can store more information with a single SSTORE.\n */\nlibrary Lib_Buffer {\n\n /*************\n * Libraries *\n *************/\n\n using Lib_Buffer for Buffer;\n\n\n /***********\n * Structs *\n ***********/\n\n struct Buffer {\n bytes32 context;\n mapping (uint256 => bytes32) buf;\n }\n\n struct BufferContext {\n // Stores the length of the array. Uint40 is way more elements than we'll ever reasonably\n // need in an array and we get an extra 27 bytes of extra data to play with.\n uint40 length;\n\n // Arbitrary extra data that can be modified whenever the length is updated. Useful for\n // squeezing out some gas optimizations.\n bytes27 extraData;\n }\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 Global extra data.\n */\n function push(\n Buffer storage _self,\n bytes32 _value,\n bytes27 _extraData\n )\n internal\n {\n BufferContext memory ctx = _self.getContext();\n\n _self.buf[ctx.length] = _value;\n\n // Bump the global index and insert our extra data, then save the context.\n ctx.length++;\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 Buffer storage _self,\n bytes32 _value\n )\n internal\n {\n BufferContext memory ctx = _self.getContext();\n\n _self.push(\n _value,\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 Buffer storage _self,\n uint256 _index\n )\n internal\n view\n returns (\n bytes32\n )\n {\n BufferContext memory ctx = _self.getContext();\n\n require(\n _index < ctx.length,\n \"Index out of bounds.\"\n );\n\n return _self.buf[_index];\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 Buffer storage _self,\n uint40 _index,\n bytes27 _extraData\n )\n internal\n {\n BufferContext memory ctx = _self.getContext();\n\n require(\n _index < ctx.length,\n \"Index out of bounds.\"\n );\n\n // Set our length and extra data, save the context.\n ctx.length = _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 Buffer storage _self,\n uint40 _index\n )\n internal\n {\n BufferContext 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 Buffer storage _self\n )\n internal\n view\n returns (\n uint40\n )\n {\n BufferContext memory ctx = _self.getContext();\n return ctx.length;\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 Buffer storage _self,\n bytes27 _extraData\n )\n internal\n {\n BufferContext 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 Buffer storage _self\n )\n internal\n view\n returns (\n bytes27\n )\n {\n BufferContext memory ctx = _self.getContext();\n return ctx.extraData;\n }\n\n /**\n * Sets the current buffer context.\n * @param _self Buffer to access.\n * @param _ctx Current buffer context.\n */\n function setContext(\n Buffer storage _self,\n BufferContext memory _ctx\n )\n internal\n {\n bytes32 context;\n uint40 length = _ctx.length;\n bytes27 extraData = _ctx.extraData;\n assembly {\n context := length\n context := or(context, extraData)\n }\n\n if (_self.context != context) {\n _self.context = context;\n }\n }\n\n /**\n * Retrieves the current buffer context.\n * @param _self Buffer to access.\n * @return Current buffer context.\n */\n function getContext(\n Buffer storage _self\n )\n internal\n view\n returns (\n BufferContext memory\n )\n {\n bytes32 context = _self.context;\n uint40 length;\n bytes27 extraData;\n assembly {\n length := and(context, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\n extraData := and(context, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000)\n }\n\n return BufferContext({\n length: length,\n extraData: extraData\n });\n }\n}\n" + }, + "contracts/test-libraries/utils/TestLib_Buffer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_Buffer } from \"../../optimistic-ethereum/libraries/utils/Lib_Buffer.sol\";\n\n/**\n * @title TestLib_Buffer\n */\ncontract TestLib_Buffer {\n using Lib_Buffer for Lib_Buffer.Buffer;\n\n Lib_Buffer.Buffer 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 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 )\n public\n {\n return buf.deleteElementsAfterInclusive(\n _index\n );\n }\n\n function deleteElementsAfterInclusive(\n uint40 _index,\n bytes27 _extraData\n )\n public\n {\n return buf.deleteElementsAfterInclusive(\n _index,\n _extraData\n );\n }\n\n function getLength()\n public\n view\n returns (\n uint40\n )\n {\n return buf.getLength();\n }\n\n function setExtraData(\n bytes27 _extraData\n )\n public\n {\n return buf.setExtraData(\n _extraData\n );\n }\n\n function getExtraData()\n public\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\";\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/* External Imports */\nimport { Math } from \"@openzeppelin/contracts/math/Math.sol\";\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 = 50000;\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 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 return _getQueueElement(\n _index,\n queue()\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 return _getQueueLength(\n queue()\n );\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 queueRef = queue();\n\n queueRef.push(transactionHash);\n queueRef.push(timestampAndBlockNumber);\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 and subtract 1.\n uint256 queueIndex = queueRef.length() / 2 - 1;\n emit TransactionEnqueued(\n msg.sender,\n _target,\n _gasLimit,\n _data,\n queueIndex,\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 pure\n {\n // TEMPORARY: Disable `appendQueueBatch` for minnet\n revert(\"appendQueueBatch is currently disabled.\");\n\n // _numQueuedTransactions = 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\n require(\n msg.data.length >= nextTransactionPtr,\n \"Not enough BatchContexts provided.\"\n );\n\n // Take a reference to the queue and its length so we don't have to keep resolving it.\n // Length isn't going to change during the course of execution, so it's fine to simply\n // resolve this once at the start. Saves gas.\n iOVM_ChainStorageContainer queueRef = queue();\n uint40 queueLength = _getQueueLength(queueRef);\n\n // Reserve some memory to save gas on hashing later on. This is a relatively safe estimate\n // for the average transaction size that will prevent having to resize this chunk of memory\n // later on. Saves gas.\n bytes memory hashMemory = new bytes((msg.data.length / totalElementsToAppend) * 2);\n\n // Initialize the array of canonical chain leaves that we will append.\n bytes32[] memory leaves = new bytes32[](totalElementsToAppend);\n\n // Each leaf index corresponds to a tx, either sequenced or enqueued.\n uint32 leafIndex = 0;\n\n // Counter for number of sequencer transactions appended so far.\n uint32 numSequencerTransactions = 0;\n\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 for (uint32 i = 0; i < numContexts; i++) {\n BatchContext memory nextContext = _getBatchContext(i);\n\n if (i == 0) {\n // Execute a special check for the first batch.\n _validateFirstBatchContext(nextContext);\n }\n\n // Execute this check on every single batch, including the first one.\n _validateNextBatchContext(\n curContext,\n nextContext,\n nextQueueIndex,\n queueRef\n );\n\n // Now we can update our current context.\n curContext = nextContext;\n\n // Process sequencer transactions first.\n for (uint32 j = 0; j < curContext.numSequencedTransactions; j++) {\n uint256 txDataLength;\n assembly {\n txDataLength := shr(232, calldataload(nextTransactionPtr))\n }\n require(\n txDataLength <= MAX_ROLLUP_TX_SIZE,\n \"Transaction data size exceeds maximum for rollup transaction.\"\n );\n\n leaves[leafIndex] = _getSequencerLeafHash(\n curContext,\n nextTransactionPtr,\n txDataLength,\n hashMemory\n );\n\n nextTransactionPtr += uint40(TX_DATA_HEADER_SIZE + txDataLength);\n numSequencerTransactions++;\n leafIndex++;\n }\n\n // Now process any subsequent queue transactions.\n for (uint32 j = 0; j < curContext.numSubsequentQueueTransactions; j++) {\n require(\n nextQueueIndex < queueLength,\n \"Not enough queued transactions to append.\"\n );\n\n leaves[leafIndex] = _getQueueLeafHash(nextQueueIndex);\n nextQueueIndex++;\n leafIndex++;\n }\n }\n\n _validateFinalBatchContext(\n curContext,\n nextQueueIndex,\n queueLength,\n queueRef\n );\n\n require(\n msg.data.length == 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 blockTimestamp;\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 blockTimestamp = 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 // curContext.numSubsequentQueueTransactions > 0 which means that we've processed at least one queue element.\n // We increment nextQueueIndex after processing each queue element,\n // so the index of the last element we processed is nextQueueIndex - 1.\n Lib_OVMCodec.QueueElement memory lastElement = _getQueueElement(\n nextQueueIndex - 1,\n queueRef\n );\n\n blockTimestamp = lastElement.timestamp;\n blockNumber = lastElement.blockNumber;\n }\n\n // For efficiency reasons getMerkleRoot modifies the `leaves` argument in place\n // while calculating the root hash therefore any arguments passed to it must not\n // be used again afterwards\n _appendBatch(\n Lib_MerkleTree.getMerkleRoot(leaves),\n totalElementsToAppend,\n numQueuedTransactions,\n blockTimestamp,\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 pure\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 * 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 iOVM_ChainStorageContainer _queueRef\n )\n internal\n view\n returns (\n Lib_OVMCodec.QueueElement memory _element\n )\n {\n // The underlying queue data structure stores 2 elements\n // per insertion, so to get the actual desired queue index\n // we need to multiply by 2.\n uint40 trueIndex = uint40(_index * 2);\n bytes32 transactionHash = _queueRef.get(trueIndex);\n bytes32 timestampAndBlockNumber = _queueRef.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 transactionHash: transactionHash,\n timestamp: elementTimestamp,\n blockNumber: elementBlockNumber\n });\n }\n\n /**\n * Retrieves the length of the queue.\n * @return Length of the queue.\n */\n function _getQueueLength(\n iOVM_ChainStorageContainer _queueRef\n )\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.\n return uint40(_queueRef.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 bytes memory _hashMemory\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n // Only allocate more memory if we didn't reserve enough to begin with.\n if (BYTES_TILL_TX_DATA + _txDataLength > _hashMemory.length) {\n _hashMemory = new bytes(BYTES_TILL_TX_DATA + _txDataLength);\n }\n\n uint256 ctxTimestamp = _context.timestamp;\n uint256 ctxBlockNumber = _context.blockNumber;\n\n bytes32 leafHash;\n assembly {\n let chainElementStart := add(_hashMemory, 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 iOVM_ChainStorageContainer batchesRef = batches();\n (uint40 totalElements, uint40 nextQueueIndex,,) = _getBatchExtraData();\n\n Lib_OVMCodec.ChainBatchHeader memory header = Lib_OVMCodec.ChainBatchHeader({\n batchIndex: batchesRef.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 batchesRef.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 have the same context\n // or a later timestamp and block number.\n if (getTotalElements() > 0) {\n (,, uint40 lastTimestamp, uint40 lastBlockNumber) = _getBatchExtraData();\n\n require(\n _firstContext.blockNumber >= lastBlockNumber,\n \"Context block number is lower than last submitted.\"\n );\n\n require(\n _firstContext.timestamp >= lastTimestamp,\n \"Context timestamp is lower than last submitted.\"\n );\n }\n\n // Sequencer cannot submit contexts which are more than the force inclusion period old.\n require(\n _firstContext.timestamp + forceInclusionPeriodSeconds >= block.timestamp,\n \"Context timestamp too far in the past.\"\n );\n\n require(\n _firstContext.blockNumber + forceInclusionPeriodBlocks >= block.number,\n \"Context block number too far in the past.\"\n );\n }\n\n /**\n * Checks that a given batch context has a time context which is below a given que element\n * @param _context The batch context to validate has values lower.\n * @param _queueIndex Index of the queue element we are validating came later than the context.\n * @param _queueRef The storage container for the queue.\n */\n function _validateContextBeforeEnqueue(\n BatchContext memory _context,\n uint40 _queueIndex,\n iOVM_ChainStorageContainer _queueRef\n )\n internal\n view\n {\n Lib_OVMCodec.QueueElement memory nextQueueElement = _getQueueElement(\n _queueIndex,\n _queueRef\n );\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 _context.timestamp <= nextQueueElement.timestamp,\n \"Sequencer transaction timestamp exceeds that of next queue element.\"\n );\n\n require(\n _context.blockNumber <= nextQueueElement.blockNumber,\n \"Sequencer transaction blockNumber exceeds that of next queue element.\"\n );\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 * @param _queueRef The storage container for the queue.\n */\n function _validateNextBatchContext(\n BatchContext memory _prevContext,\n BatchContext memory _nextContext,\n uint40 _nextQueueIndex,\n iOVM_ChainStorageContainer _queueRef\n )\n internal\n view\n {\n // All sequencer transactions' times must be greater than or equal to 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 is going to be a queue element pulled in from this context:\n if (_nextContext.numSubsequentQueueTransactions > 0) {\n _validateContextBeforeEnqueue(\n _nextContext,\n _nextQueueIndex,\n _queueRef\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 * @param _queueLength The length of the queue at the start of the batchAppend call.\n * @param _nextQueueIndex The next element in the queue that will be pulled into the CTC.\n * @param _queueRef The storage container for the queue.\n */\n function _validateFinalBatchContext(\n BatchContext memory _finalContext,\n uint40 _nextQueueIndex,\n uint40 _queueLength,\n iOVM_ChainStorageContainer _queueRef\n )\n internal\n view\n {\n // If the queue is not now empty, check the mononoticity of whatever the next batch that will come in is.\n if (_queueLength - _nextQueueIndex > 0 && _finalContext.numSubsequentQueueTransactions == 0) {\n _validateContextBeforeEnqueue(\n _finalContext,\n _nextQueueIndex,\n _queueRef\n );\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.transactionHash == 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/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_Bytes32Utils } from \"../../libraries/utils/Lib_Bytes32Utils.sol\";\nimport { Lib_EthUtils } from \"../../libraries/utils/Lib_EthUtils.sol\";\nimport { Lib_ErrorUtils } from \"../../libraries/utils/Lib_ErrorUtils.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.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_DeployerWhitelist } from \"../predeploys/OVM_DeployerWhitelist.sol\";\n\n/* External Imports */\nimport { Math } from \"@openzeppelin/contracts/math/Math.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 * Native Value Constants *\n **************************/\n\n // Public so we can access and make assertions in integration tests.\n uint256 public constant CALL_WITH_VALUE_INTRINSIC_GAS = 90000;\n\n\n /**************************\n * Default Context Values *\n **************************/\n\n uint256 constant DEFAULT_UINT256 = 0xdefa017defa017defa017defa017defa017defa017defa017defa017defa017d;\n address constant DEFAULT_ADDRESS = 0xdEfa017defA017DeFA017DEfa017DeFA017DeFa0;\n\n\n /*************************************\n * Container Contract Address Prefix *\n *************************************/\n\n /**\n * @dev The Execution Manager and State Manager each have this 30 byte prefix, and are uncallable.\n */\n address constant CONTAINER_CONTRACT_PREFIX = 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000;\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 Lib_AddressResolver(_libAddressManager)\n {\n ovmSafetyChecker = iOVM_SafetyChecker(resolve(\"OVM_SafetyChecker\"));\n gasMeterConfig = _gasMeterConfig;\n globalContext = _globalContext;\n _resetContext();\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 external\n returns (\n bytes memory\n )\n {\n // Make sure that run() is not re-enterable. This condition should always be satisfied\n // Once run has been called once, due to the behavior of _isValidInput().\n if (transactionContext.ovmNUMBER != DEFAULT_UINT256) {\n return bytes(\"\");\n }\n\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 (_isValidInput(_transaction) == false) {\n _resetContext();\n return bytes(\"\");\n }\n\n // TEMPORARY: Gas metering is disabled for minnet.\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 (, bytes memory returndata) = ovmCALL(\n _transaction.gasLimit - gasMeterConfig.minTransactionGasLimit,\n _transaction.entrypoint,\n 0,\n _transaction.data\n );\n\n // TEMPORARY: Gas metering is disabled for minnet.\n // // Update the cumulative gas based on the amount of gas used.\n // uint256 gasUsed = gasProvided - gasleft();\n // _updateCumulativeGas(gasUsed, _transaction.l1QueueOrigin);\n\n // Wipe the execution context.\n _resetContext();\n\n return returndata;\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 external\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 CALLVALUE.\n * @return _CALLVALUE Value sent along with the call according to the current message context.\n */\n function ovmCALLVALUE()\n override\n public\n view\n returns (\n uint256 _CALLVALUE\n )\n {\n return messageContext.ovmCALLVALUE;\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 external\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 external\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 external\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 external\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 source (Sequencer or Queue) this transaction originated from.\n * @return _queueOrigin Enum indicating the ovmL1QUEUEORIGIN within the current message context.\n */\n function ovmL1QUEUEORIGIN()\n override\n external\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 external\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 Address of the created contract.\n * @return Revert data, if and only if the creation threw an exception.\n */\n function ovmCREATE(\n bytes memory _bytecode\n )\n override\n public\n notStatic\n fixedGasDiscount(40000)\n returns (\n address,\n bytes memory\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 MessageType.ovmCREATE\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 Address of the created contract.\n * @return Revert data, if and only if the creation threw an exception.\n */\n function ovmCREATE2(\n bytes memory _bytecode,\n bytes32 _salt\n )\n override\n external\n notStatic\n fixedGasDiscount(40000)\n returns (\n address,\n bytes memory\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 MessageType.ovmCREATE2\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 external\n returns (\n uint256 _nonce\n )\n {\n return _getAccountNonce(ovmADDRESS());\n }\n\n /**\n * Bumps the nonce of the current ovmADDRESS by one.\n */\n function ovmINCREMENTNONCE()\n override\n external\n notStatic\n {\n address account = ovmADDRESS();\n uint256 nonce = _getAccountNonce(account);\n\n // Prevent overflow.\n if (nonce + 1 > nonce) {\n _setAccountNonce(account, nonce + 1);\n }\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 // Creates a duplicate of the OVM_ProxyEOA located at 0x42....09. Uses the following\n // \"magic\" prefix to deploy an exact copy of the code:\n // PUSH1 0x0D # size of this prefix in bytes\n // CODESIZE\n // SUB # subtract prefix size from codesize\n // DUP1\n // PUSH1 0x0D\n // PUSH1 0x00\n // CODECOPY # copy everything after prefix into memory at pos 0\n // PUSH1 0x00\n // RETURN # return the copied code\n address proxyEOA = Lib_EthUtils.createContract(abi.encodePacked(\n hex\"600D380380600D6000396000f3\",\n ovmEXTCODECOPY(\n Lib_PredeployAddresses.PROXY_EOA,\n 0,\n ovmEXTCODESIZE(Lib_PredeployAddresses.PROXY_EOA)\n )\n ));\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 _value ETH value to pass with the 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 uint256 _value,\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 nextMessageContext.ovmCALLVALUE = _value;\n\n return _callContract(\n nextMessageContext,\n _gasLimit,\n _address,\n _calldata,\n MessageType.ovmCALL\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, valueless context.\n MessageContext memory nextMessageContext = messageContext;\n nextMessageContext.ovmCALLER = nextMessageContext.ovmADDRESS;\n nextMessageContext.ovmADDRESS = _address;\n nextMessageContext.isStatic = true;\n nextMessageContext.ovmCALLVALUE = 0;\n\n return _callContract(\n nextMessageContext,\n _gasLimit,\n _address,\n _calldata,\n MessageType.ovmSTATICCALL\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\n return _callContract(\n nextMessageContext,\n _gasLimit,\n _address,\n _calldata,\n MessageType.ovmDELEGATECALL\n );\n }\n\n /**\n * @notice Legacy ovmCALL function which did not support ETH value; this maintains backwards compatibility.\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 returns(\n bool _success,\n bytes memory _returndata\n )\n {\n // Legacy ovmCALL assumed always-0 value.\n return ovmCALL(\n _gasLimit,\n _address,\n 0,\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 external\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 external\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 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 external\n returns (\n bytes32 _EXTCODEHASH\n )\n {\n return Lib_EthUtils.getCodeHash(\n _getAccountEthAddress(_contract)\n );\n }\n\n\n /***************************************\n * Public Functions: ETH Value Opcodes *\n ***************************************/\n\n /**\n * @notice Overrides BALANCE.\n * NOTE: In the future, this could be optimized to directly invoke EM._getContractStorage(...).\n * @param _contract Address of the contract to query the OVM_ETH balance of.\n * @return _BALANCE OVM_ETH balance of the requested contract.\n */\n function ovmBALANCE(\n address _contract\n )\n override\n public\n returns (\n uint256 _BALANCE\n )\n {\n // Easiest way to get the balance is query OVM_ETH as normal.\n bytes memory balanceOfCalldata = abi.encodeWithSignature(\n \"balanceOf(address)\",\n _contract\n );\n\n // Static call because this should be a read-only query.\n (bool success, bytes memory returndata) = ovmSTATICCALL(\n gasleft(),\n Lib_PredeployAddresses.OVM_ETH,\n balanceOfCalldata\n );\n\n // All balanceOf queries should successfully return a uint, otherwise this must be an OOG.\n if (!success || returndata.length != 32) {\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\n }\n\n // Return the decoded balance.\n return abi.decode(returndata, (uint256));\n }\n\n /**\n * @notice Overrides SELFBALANCE.\n * @return _BALANCE OVM_ETH balance of the requesting contract.\n */\n function ovmSELFBALANCE()\n override\n external\n returns (\n uint256 _BALANCE\n )\n {\n return ovmBALANCE(ovmADDRESS());\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 Whitelisting *\n ********************************************/\n\n /**\n * Checks whether the given address is on the whitelist 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 semantics perspective, this will appear 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) = ovmSTATICCALL(\n gasleft(),\n Lib_PredeployAddresses.DEPLOYER_WHITELIST,\n abi.encodeWithSelector(\n OVM_DeployerWhitelist.isDeployerAllowed.selector,\n _deployerAddress\n )\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 Final OVM contract address.\n * @return Revertdata, if and only if the creation threw an exception.\n */\n function _createContract(\n address _contractAddress,\n bytes memory _bytecode,\n MessageType _messageType\n )\n internal\n returns (\n address,\n bytes memory\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 the common logic which occurs between call-type and create-type messages,\n // passing in the creation bytecode and `true` to trigger create-specific logic.\n (bool success, bytes memory data) = _handleExternalMessage(\n nextMessageContext,\n gasleft(),\n _contractAddress,\n _bytecode,\n _messageType\n );\n\n // Yellow paper requires that address returned is zero if the contract deployment fails.\n return (\n success ? _contractAddress : address(0),\n data\n );\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 MessageType _messageType\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(CONTAINER_CONTRACT_PREFIX)\n ) {\n // EVM does not return data in the success case, see: https://github.com/ethereum/go-ethereum/blob/aae7660410f0ef90279e14afaaf2f429fdc2a186/core/vm/instructions.go#L600-L604\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 _handleExternalMessage(\n _nextMessageContext,\n _gasLimit,\n codeContractAddress,\n _calldata,\n _messageType\n );\n }\n\n /**\n * Handles all interactions which involve the execution manager calling out to untrusted code (both calls and creates).\n * Ensures that OVM-related measures are enforced, including L2 gas refunds, nuisance gas, and flagged reversions.\n *\n * @param _nextMessageContext Message context to be used for the external message.\n * @param _gasLimit Amount of gas to be passed into this message. NOTE: this argument is overwritten in some cases to avoid stack-too-deep.\n * @param _contract OVM address being called or deployed to\n * @param _data Data for the message (either calldata or creation code)\n * @param _messageType What type of ovmOPCODE this message corresponds to.\n * @return Whether or not the message (either a call or deployment) succeeded.\n * @return Data returned by the message.\n */\n function _handleExternalMessage(\n MessageContext memory _nextMessageContext,\n // NOTE: this argument is overwritten in some cases to avoid stack-too-deep.\n uint256 _gasLimit,\n address _contract,\n bytes memory _data,\n MessageType _messageType\n )\n internal\n returns (\n bool,\n bytes memory\n )\n {\n uint256 messageValue = _nextMessageContext.ovmCALLVALUE;\n // If there is value in this message, we need to transfer the ETH over before switching contexts.\n if (\n messageValue > 0\n && _isValueType(_messageType)\n ) {\n // Handle out-of-intrinsic gas consistent with EVM behavior -- the subcall \"appears to revert\" if we don't have enough gas to transfer the ETH.\n // Similar to dynamic gas cost of value exceeding gas here:\n // https://github.com/ethereum/go-ethereum/blob/c503f98f6d5e80e079c1d8a3601d188af2a899da/core/vm/interpreter.go#L268-L273\n if (gasleft() < CALL_WITH_VALUE_INTRINSIC_GAS) {\n return (false, hex\"\");\n }\n\n // If there *is* enough gas to transfer ETH, then we need to make sure this amount of gas is reserved (i.e. not\n // given to the _contract.call below) to guarantee that _handleExternalMessage can't run out of gas.\n // In particular, in the event that the call fails, we will need to transfer the ETH back to the sender.\n // Taking the lesser of _gasLimit and gasleft() - CALL_WITH_VALUE_INTRINSIC_GAS guarantees that the second\n // _attemptForcedEthTransfer below, if needed, always has enough gas to succeed.\n _gasLimit = Math.min(\n _gasLimit,\n gasleft() - CALL_WITH_VALUE_INTRINSIC_GAS // Cannot overflow due to the above check.\n );\n\n // Now transfer the value of the call.\n // The target is interpreted to be the next message's ovmADDRESS account.\n bool transferredOvmEth = _attemptForcedEthTransfer(\n _nextMessageContext.ovmADDRESS,\n messageValue\n );\n\n // If the ETH transfer fails (should only be possible in the case of insufficient balance), then treat this as a revert.\n // This mirrors EVM behavior, see https://github.com/ethereum/go-ethereum/blob/2dee31930c9977af2a9fcb518fb9838aa609a7cf/core/vm/evm.go#L298\n if (!transferredOvmEth) {\n return (false, hex\"\");\n }\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. `_contract` 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\n bool success;\n bytes memory returndata;\n if (_isCreateType(_messageType)) {\n // safeCREATE() is a function which replicates a CREATE message, but uses return values\n // Which match that of CALL (i.e. bool, bytes). This allows many security checks to be\n // to be shared between untrusted call and create call frames.\n (success, returndata) = address(this).call{gas: _gasLimit}(\n abi.encodeWithSelector(\n this.safeCREATE.selector,\n _data,\n _contract\n )\n );\n } else {\n (success, returndata) = _contract.call{gas: _gasLimit}(_data);\n }\n\n // If the message threw an exception, its value should be returned back to the sender.\n // So, we force it back, BEFORE returning the messageContext to the previous addresses.\n // This operation is part of the reason we \"reserved the intrinsic gas\" above.\n if (\n messageValue > 0\n && _isValueType(_messageType)\n && !success\n ) {\n bool transferredOvmEth = _attemptForcedEthTransfer(\n prevMessageContext.ovmADDRESS,\n messageValue\n );\n\n // Since we transferred it in above and the call reverted, the transfer back should always pass.\n // This code path should NEVER be triggered since we sent `messageValue` worth of OVM_ETH into the target\n // and reserved sufficient gas to execute the transfer, but in case there is some edge case which has\n // been missed, we revert the entire frame (and its parent) to make sure the ETH gets sent back.\n if (!transferredOvmEth) {\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\n }\n }\n\n // Switch back to the original message context now that we're out of the call and all OVM_ETH is in the right place.\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. Additionally, we surface custom error messages\n // to developers in the case of unsafe creations for improved devex.\n // All other revert types return no data.\n if (\n flag == RevertFlag.INTENTIONAL_REVERT\n || flag == RevertFlag.UNSAFE_BYTECODE\n ) {\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 * Handles the creation-specific safety measures required for OVM contract deployment.\n * This function sanitizes the return types for creation messages to match calls (bool, bytes),\n * by being an external function which the EM can call, that mimics the success/fail case of the CREATE.\n * This allows for consistent handling of both types of messages in _handleExternalMessage().\n * Having this step occur as a separate call frame also allows us to easily revert the\n * contract deployment in the event that the code is unsafe.\n *\n * @param _creationCode Code to pass into CREATE for deployment.\n * @param _address OVM address being deployed to.\n */\n function safeCREATE(\n bytes memory _creationCode,\n address _address\n )\n external\n {\n // The only way this should callable is from within _createContract(),\n // and it should DEFINITELY not be callable by a non-EM code contract.\n if (msg.sender != address(this)) {\n return;\n }\n // Check that there is not already code at this address.\n if (_hasEmptyAccount(_address) == false) {\n // Note: in the EVM, this case burns all allotted gas. For improved\n // developer experience, we do return the remaining gas.\n _revertWithFlag(\n RevertFlag.CREATE_COLLISION\n );\n }\n\n // Check the creation bytecode against the OVM_SafetyChecker.\n if (ovmSafetyChecker.isBytecodeSafe(_creationCode) == false) {\n // Note: in the EVM, this case burns all allotted gas. For improved\n // developer experience, we do return the remaining gas.\n _revertWithFlag(\n RevertFlag.UNSAFE_BYTECODE,\n Lib_ErrorUtils.encodeRevertString(\"Contract creation code contains unsafe opcodes. Did you use the right compiler or pass an unsafe constructor argument?\")\n );\n }\n\n // We always need to initialize the contract with the default account values.\n _initPendingAccount(_address);\n\n // Actually execute the EVM create message.\n // NOTE: The inline assembly below means we can NOT make any evm calls between here and then.\n address ethAddress = Lib_EthUtils.createContract(_creationCode);\n\n if (ethAddress == address(0)) {\n // If the creation fails, the EVM lets us grab its revert data. This may contain a revert flag\n // to be used above in _handleExternalMessage, so we pass the revert data back up unmodified.\n assembly {\n returndatacopy(0,0,returndatasize())\n revert(0, returndatasize())\n }\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(\n RevertFlag.UNSAFE_BYTECODE,\n Lib_ErrorUtils.encodeRevertString(\"Constructor attempted to deploy unsafe bytecode.\")\n );\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 * Internal Functions: Value Manipulation *\n ******************************************/\n\n /**\n * Invokes an ovmCALL to OVM_ETH.transfer on behalf of the current ovmADDRESS, allowing us to force movement of OVM_ETH in correspondence with ETH's native value functionality.\n * WARNING: this will send on behalf of whatever the messageContext.ovmADDRESS is in storage at the time of the call.\n * NOTE: In the future, this could be optimized to directly invoke EM._setContractStorage(...).\n * @param _to Amount of OVM_ETH to be sent.\n * @param _value Amount of OVM_ETH to send.\n * @return _success Whether or not the transfer worked.\n */\n function _attemptForcedEthTransfer(\n address _to,\n uint256 _value\n )\n internal\n returns(\n bool _success\n )\n {\n bytes memory transferCalldata = abi.encodeWithSignature(\n \"transfer(address,uint256)\",\n _to,\n _value\n );\n\n // OVM_ETH inherits from the UniswapV2ERC20 standard. In this implementation, its return type\n // is a boolean. However, the implementation always returns true if it does not revert.\n // Thus, success of the call frame is sufficient to infer success of the transfer itself.\n (bool success, ) = ovmCALL(\n gasleft(),\n Lib_PredeployAddresses.OVM_ETH,\n 0,\n transferCalldata\n );\n\n return success;\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 ) {\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 view\n {\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 input values of a transaction.\n * @return _valid Whether or not the transaction data is valid.\n */\n function _isValidInput(\n Lib_OVMCodec.Transaction memory _transaction\n )\n view\n internal\n returns (\n bool\n )\n {\n // Prevent reentrancy to run():\n // This check prevents calling run with the default ovmNumber.\n // Combined with the first check in run():\n // if (transactionContext.ovmNUMBER != DEFAULT_UINT256) { return; }\n // It should be impossible to re-enter since run() returns before any other call frames are created.\n // Since this value is already being written to storage, we save much gas compared to\n // using the standard nonReentrant pattern.\n if (_transaction.blockNumber == DEFAULT_UINT256) {\n return false;\n }\n\n if (_isValidGasLimit(_transaction.gasLimit, _transaction.l1QueueOrigin) == false) {\n return false;\n }\n\n return true;\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 view\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 // These conditionals allow us to avoid unneccessary SSTOREs. However, they do mean that the current storage\n // value for the messageContext MUST equal the _prevMessageContext argument, or an SSTORE might be erroneously skipped.\n if (_prevMessageContext.ovmCALLER != _nextMessageContext.ovmCALLER) {\n messageContext.ovmCALLER = _nextMessageContext.ovmCALLER;\n }\n\n if (_prevMessageContext.ovmADDRESS != _nextMessageContext.ovmADDRESS) {\n messageContext.ovmADDRESS = _nextMessageContext.ovmADDRESS;\n }\n\n if (_prevMessageContext.isStatic != _nextMessageContext.isStatic) {\n messageContext.isStatic = _nextMessageContext.isStatic;\n }\n\n if (_prevMessageContext.ovmCALLVALUE != _nextMessageContext.ovmCALLVALUE) {\n messageContext.ovmCALLVALUE = _nextMessageContext.ovmCALLVALUE;\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 = DEFAULT_ADDRESS;\n transactionContext.ovmTIMESTAMP = DEFAULT_UINT256;\n transactionContext.ovmNUMBER = DEFAULT_UINT256;\n transactionContext.ovmGASLIMIT = DEFAULT_UINT256;\n transactionContext.ovmTXGASLIMIT = DEFAULT_UINT256;\n transactionContext.ovmL1QUEUEORIGIN = Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE;\n\n transactionRecord.ovmGasRefund = DEFAULT_UINT256;\n\n messageContext.ovmCALLER = DEFAULT_ADDRESS;\n messageContext.ovmADDRESS = DEFAULT_ADDRESS;\n messageContext.isStatic = false;\n\n messageRecord.nuisanceGasLeft = DEFAULT_UINT256;\n\n // Reset the ovmStateManager.\n ovmStateManager = iOVM_StateManager(address(0));\n }\n\n\n /******************************************\n * Internal Functions: Message Typechecks *\n ******************************************/\n\n /**\n * Returns whether or not the given message type is a CREATE-type.\n * @param _messageType the message type in question.\n */\n function _isCreateType(\n MessageType _messageType\n )\n internal\n pure\n returns(\n bool\n )\n {\n return (\n _messageType == MessageType.ovmCREATE\n || _messageType == MessageType.ovmCREATE2\n );\n }\n\n /**\n * Returns whether or not the given message type (potentially) requires the transfer of ETH value along with the message.\n * @param _messageType the message type in question.\n */\n function _isValueType(\n MessageType _messageType\n )\n internal\n pure\n returns(\n bool\n )\n {\n // ovmSTATICCALL and ovmDELEGATECALL types do not accept or transfer value.\n return (\n _messageType == MessageType.ovmCALL\n || _messageType == MessageType.ovmCREATE\n || _messageType == MessageType.ovmCREATE2\n );\n }\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 * @param _value the amount of ETH value to send.\n * @param _ovmStateManager the address of the OVM_StateManager precompile in the L2 state.\n */\n function simulateMessage(\n Lib_OVMCodec.Transaction memory _transaction,\n address _from,\n uint256 _value,\n iOVM_StateManager _ovmStateManager\n )\n external\n returns (\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 // Initialize the EM's internal state, ignoring nuisance gas.\n ovmStateManager = _ovmStateManager;\n _initContext(_transaction);\n messageRecord.nuisanceGasLeft = uint(-1);\n\n // Set the ovmADDRESS to the _from so that the subsequent call frame \"comes from\" them.\n messageContext.ovmADDRESS = _from;\n\n // Execute the desired message.\n bool isCreate = _transaction.entrypoint == address(0);\n if (isCreate) {\n (address created, bytes memory revertData) = ovmCREATE(_transaction.data);\n if (created == address(0)) {\n return abi.encode(false, revertData);\n } else {\n // The eth_call RPC endpoint for to = undefined will return the deployed bytecode\n // in the success case, differing from standard create messages.\n return abi.encode(true, Lib_EthUtils.getCode(created));\n }\n } else {\n (bool success, bytes memory returndata) = ovmCALL(\n _transaction.gasLimit,\n _transaction.entrypoint,\n _value,\n _transaction.data\n );\n return abi.encode(success, returndata);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow, so we distribute\n return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);\n }\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/predeploys/OVM_DeployerWhitelist.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Interface Imports */\nimport { iOVM_DeployerWhitelist } from \"../../iOVM/predeploys/iOVM_DeployerWhitelist.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: optimistic-solc\n * Runtime target: OVM\n */\ncontract OVM_DeployerWhitelist is iOVM_DeployerWhitelist {\n\n /**********************\n * Contract Constants *\n **********************/\n\n bool public initialized;\n bool public allowArbitraryDeployment;\n address override public owner;\n mapping (address => bool) public whitelist;\n\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * Blocks functions to anyone except the contract owner.\n */\n modifier onlyOwner() {\n require(\n msg.sender == 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 external\n {\n if (initialized == true) {\n return;\n }\n\n initialized = true;\n allowArbitraryDeployment = _allowArbitraryDeployment;\n owner = _owner;\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 external\n onlyOwner\n {\n whitelist[_deployer] = _isWhitelisted;\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 owner = _owner;\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 allowArbitraryDeployment = _allowArbitraryDeployment;\n }\n\n /**\n * Permanently enables arbitrary contract deployment and deletes the owner.\n */\n function enableArbitraryContractDeployment()\n override\n external\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 external\n returns (\n bool\n )\n {\n return (\n initialized == false\n || allowArbitraryDeployment == true\n || whitelist[_deployer]\n );\n }\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/predeploys/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 owner() 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/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 /**\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 (\n bool\n )\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" + }, + "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 *\n ********************/\n\n /**\n * Creates a new OVM_StateManager\n * @param _owner Owner of the created contract.\n * @return New OVM_StateManager instance.\n */\n function create(\n address _owner\n )\n override\n public\n returns (\n iOVM_StateManager\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 * 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 * Variables *\n *************/\n\n address override public owner;\n address override public ovmExecutionManager;\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 {\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 *\n ********************/\n\n /**\n * Checks whether a given address is allowed to modify this contract.\n * @param _address Address to check.\n * @return Whether or not the address can modify this contract.\n */\n function isAuthenticated(\n address _address\n )\n override\n public\n view\n returns (\n bool\n )\n {\n return (_address == owner || _address == ovmExecutionManager);\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 * 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 for the given address.\n */\n function getAccount(\n address _address\n )\n override\n public\n view\n returns (\n Lib_OVMCodec.Account memory\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 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\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 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\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 of the account.\n */\n function getAccountNonce(\n address _address\n )\n override\n public\n view\n returns (\n uint256\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 Corresponding Ethereum address.\n */\n function getAccountEthAddress(\n address _address\n )\n override\n public\n view\n returns (\n address\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 Corresponding storage root.\n */\n function getAccountStorageRoot(\n address _address\n )\n override\n public\n view\n returns (\n bytes32\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 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\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 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\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 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\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 uncommitted accounts.\n */\n function getTotalUncommittedAccounts()\n override\n public\n view\n returns (\n uint256\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 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\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 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\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 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\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 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\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 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\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 uncommitted storage slots.\n */\n function getTotalUncommittedContractStorage()\n override\n public\n view\n returns (\n uint256\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 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\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/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 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" + }, + "contracts/optimistic-ethereum/OVM/bridge/messaging/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_AddressResolver } from \"../../../libraries/resolver/Lib_AddressResolver.sol\";\nimport { Lib_OVMCodec } from \"../../../libraries/codec/Lib_OVMCodec.sol\";\nimport { Lib_AddressManager } from \"../../../libraries/resolver/Lib_AddressManager.sol\";\nimport { Lib_SecureMerkleTrie } from \"../../../libraries/trie/Lib_SecureMerkleTrie.sol\";\nimport { Lib_PredeployAddresses } from \"../../../libraries/constants/Lib_PredeployAddresses.sol\";\nimport { Lib_CrossDomainUtils } from \"../../../libraries/bridge/Lib_CrossDomainUtils.sol\";\n\n/* Interface Imports */\nimport { iOVM_L1CrossDomainMessenger } from \"../../../iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol\";\nimport { iOVM_CanonicalTransactionChain } from \"../../../iOVM/chain/iOVM_CanonicalTransactionChain.sol\";\nimport { iOVM_StateCommitmentChain } from \"../../../iOVM/chain/iOVM_StateCommitmentChain.sol\";\n\n/* External Imports */\nimport { OwnableUpgradeable } from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport { PausableUpgradeable } from \"@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol\";\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol\";\n\n/**\n * @title OVM_L1CrossDomainMessenger\n * @dev The L1 Cross Domain Messenger contract sends messages from L1 to L2, and relays messages\n * from L2 onto L1. In the event that a message sent from L1 to L2 is rejected for exceeding the L2\n * epoch gas limit, it can be resubmitted via this contract's replay function.\n *\n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_L1CrossDomainMessenger is\n iOVM_L1CrossDomainMessenger,\n Lib_AddressResolver,\n OwnableUpgradeable,\n PausableUpgradeable,\n ReentrancyGuardUpgradeable\n{\n\n /**********\n * Events *\n **********/\n\n event MessageBlocked(\n bytes32 indexed _xDomainCalldataHash\n );\n\n event MessageAllowed(\n bytes32 indexed _xDomainCalldataHash\n );\n\n /*************\n * Constants *\n *************/\n\n // The default x-domain message sender being set to a non-zero value makes\n // deployment a bit more expensive, but in exchange the refund on every call to\n // `relayMessage` by the L1 and L2 messengers will be higher.\n address internal constant DEFAULT_XDOMAIN_SENDER = 0x000000000000000000000000000000000000dEaD;\n\n /**********************\n * Contract Variables *\n **********************/\n\n mapping (bytes32 => bool) public blockedMessages;\n mapping (bytes32 => bool) public relayedMessages;\n mapping (bytes32 => bool) public successfulMessages;\n\n address internal xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * This contract is intended to be behind a delegate proxy.\n * We pass the zero address to the address resolver just to satisfy the constructor.\n * We still need to set this value in initialize().\n */\n constructor()\n Lib_AddressResolver(address(0))\n {}\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * Modifier to enforce that, if configured, only the OVM_L2MessageRelayer contract may\n * 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 * @param _libAddressManager Address of the Address Manager.\n */\n function initialize(\n address _libAddressManager\n )\n public\n initializer\n {\n require(\n address(libAddressManager) == address(0),\n \"L1CrossDomainMessenger already intialized.\"\n );\n libAddressManager = Lib_AddressManager(_libAddressManager);\n xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\n\n // Initialize upgradable OZ contracts\n __Context_init_unchained(); // Context is a dependency for both Ownable and Pausable\n __Ownable_init_unchained();\n __Pausable_init_unchained();\n __ReentrancyGuard_init_unchained();\n }\n\n /**\n * Pause relaying.\n */\n function pause()\n external\n onlyOwner\n {\n _pause();\n }\n\n /**\n * Block a message.\n * @param _xDomainCalldataHash Hash of the message to block.\n */\n function blockMessage(\n bytes32 _xDomainCalldataHash\n )\n external\n onlyOwner\n {\n blockedMessages[_xDomainCalldataHash] = true;\n emit MessageBlocked(_xDomainCalldataHash);\n }\n\n /**\n * Allow a message.\n * @param _xDomainCalldataHash Hash of the message to block.\n */\n function allowMessage(\n bytes32 _xDomainCalldataHash\n )\n external\n onlyOwner\n {\n blockedMessages[_xDomainCalldataHash] = false;\n emit MessageAllowed(_xDomainCalldataHash);\n }\n\n function xDomainMessageSender()\n public\n override\n view\n returns (\n address\n )\n {\n require(xDomainMsgSender != DEFAULT_XDOMAIN_SENDER, \"xDomainMessageSender is not set\");\n return xDomainMsgSender;\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 memory _message,\n uint32 _gasLimit\n )\n override\n public\n {\n address ovmCanonicalTransactionChain = resolve(\"OVM_CanonicalTransactionChain\");\n // Use the CTC queue length as nonce\n uint40 nonce = iOVM_CanonicalTransactionChain(ovmCanonicalTransactionChain).getQueueLength();\n\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n msg.sender,\n _message,\n nonce\n );\n\n address l2CrossDomainMessenger = resolve(\"OVM_L2CrossDomainMessenger\");\n _sendXDomainMessage(ovmCanonicalTransactionChain, l2CrossDomainMessenger, xDomainCalldata, _gasLimit);\n emit SentMessage(xDomainCalldata);\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 whenNotPaused\n {\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\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 require(\n blockedMessages[xDomainCalldataHash] == false,\n \"Provided message has been blocked.\"\n );\n\n xDomainMsgSender = _sender;\n (bool success, ) = _target.call(_message);\n xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\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 } else {\n emit FailedRelayedMessage(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 _queueIndex,\n uint32 _gasLimit\n )\n override\n public\n {\n // Verify that the message is in the queue:\n address canonicalTransactionChain = resolve(\"OVM_CanonicalTransactionChain\");\n Lib_OVMCodec.QueueElement memory element = iOVM_CanonicalTransactionChain(canonicalTransactionChain).getQueueElement(_queueIndex);\n\n address l2CrossDomainMessenger = resolve(\"OVM_L2CrossDomainMessenger\");\n // Compute the transactionHash\n bytes32 transactionHash = keccak256(\n abi.encode(\n address(this),\n l2CrossDomainMessenger,\n _gasLimit,\n _message\n )\n );\n\n require(\n transactionHash == element.transactionHash,\n \"Provided message has not been enqueued.\"\n );\n\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n _sender,\n _message,\n _queueIndex\n );\n\n _sendXDomainMessage(canonicalTransactionChain, l2CrossDomainMessenger, 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(\n resolve(\"OVM_StateCommitmentChain\")\n );\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(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER),\n _proof.stateTrieWitness,\n _proof.stateRoot\n );\n\n require(\n exists == true,\n \"Message passing predeploy 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 _canonicalTransactionChain Address of the OVM_CanonicalTransactionChain instance.\n * @param _l2CrossDomainMessenger Address of the OVM_L2CrossDomainMessenger instance.\n * @param _message Message to send.\n * @param _gasLimit OVM gas limit for the message.\n */\n function _sendXDomainMessage(\n address _canonicalTransactionChain,\n address _l2CrossDomainMessenger,\n bytes memory _message,\n uint256 _gasLimit\n )\n internal\n {\n iOVM_CanonicalTransactionChain(_canonicalTransactionChain).enqueue(\n _l2CrossDomainMessenger,\n _gasLimit,\n _message\n );\n }\n}\n" + }, + "contracts/optimistic-ethereum/libraries/bridge/Lib_CrossDomainUtils.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\";\n\n/**\n * @title Lib_CrossDomainUtils\n */\nlibrary Lib_CrossDomainUtils {\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 encodeXDomainCalldata(\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" + }, + "contracts/optimistic-ethereum/iOVM/bridge/messaging/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 { iOVM_CrossDomainMessenger } from \"./iOVM_CrossDomainMessenger.sol\";\n\n/**\n * @title iOVM_L1CrossDomainMessenger\n */\ninterface iOVM_L1CrossDomainMessenger is iOVM_CrossDomainMessenger {\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 _queueIndex CTC Queue index for the message to replay.\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 _queueIndex,\n uint32 _gasLimit\n ) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/Initializable.sol\";\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal initializer {\n __Context_init_unchained();\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal initializer {\n address msgSender = _msgSender();\n _owner = msgSender;\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\n }\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\nimport \"./ContextUpgradeable.sol\";\nimport \"../proxy/Initializable.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n function __Pausable_init() internal initializer {\n __Context_init_unchained();\n __Pausable_init_unchained();\n }\n\n function __Pausable_init_unchained() internal initializer {\n _paused = false;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n require(!paused(), \"Pausable: paused\");\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n require(paused(), \"Pausable: not paused\");\n _;\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\n }\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\nimport \"../proxy/Initializable.sol\";\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 ReentrancyGuardUpgradeable is Initializable {\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 function __ReentrancyGuard_init() internal initializer {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal initializer {\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 uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\nimport \"../proxy/Initializable.sol\";\n\n/*\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with GSN meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal initializer {\n __Context_init_unchained();\n }\n\n function __Context_init_unchained() internal initializer {\n }\n function _msgSender() internal view virtual returns (address payable) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes memory) {\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n return msg.data;\n }\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\n// solhint-disable-next-line compiler-version\npragma solidity >=0.4.24 <0.8.0;\n\nimport \"../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n */\nabstract contract Initializable {\n\n /**\n * @dev Indicates that the contract has been initialized.\n */\n bool private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Modifier to protect an initializer function from being invoked twice.\n */\n modifier initializer() {\n require(_initializing || _isConstructor() || !_initialized, \"Initializable: contract is already initialized\");\n\n bool isTopLevelCall = !_initializing;\n if (isTopLevelCall) {\n _initializing = true;\n _initialized = true;\n }\n\n _;\n\n if (isTopLevelCall) {\n _initializing = false;\n }\n }\n\n /// @dev Returns true if and only if the function is running in the constructor\n function _isConstructor() private view returns (bool) {\n return !AddressUpgradeable.isContract(address(this));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.2 <0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n // solhint-disable-next-line no-inline-assembly\n assembly { size := extcodesize(account) }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\n (bool success, ) = recipient.call{ value: amount }(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain`call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.call{ value: value }(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.staticcall(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1MultiMessageRelayer.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_L1CrossDomainMessenger } from \"../../../iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol\";\nimport { iOVM_L1MultiMessageRelayer } from \"../../../iOVM/bridge/messaging/iOVM_L1MultiMessageRelayer.sol\";\n\n/* Library Imports */\nimport { Lib_AddressResolver } from \"../../../libraries/resolver/Lib_AddressResolver.sol\";\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\n /**\n * @param _libAddressManager Address of the Address Manager.\n */\n constructor(\n address _libAddressManager\n )\n Lib_AddressResolver(_libAddressManager)\n {}\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 /********************\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(\n L2ToL1Message[] calldata _messages\n ) \n override\n external\n onlyBatchRelayer\n {\n iOVM_L1CrossDomainMessenger messenger = iOVM_L1CrossDomainMessenger(\n resolve(\"Proxy__OVM_L1CrossDomainMessenger\")\n );\n\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/messaging/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/messaging/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/optimistic-ethereum/OVM/bridge/messaging/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_CrossDomainUtils } from \"../../../libraries/bridge/Lib_CrossDomainUtils.sol\";\n\n/* Interface Imports */\nimport { iOVM_L2CrossDomainMessenger } from \"../../../iOVM/bridge/messaging/iOVM_L2CrossDomainMessenger.sol\";\nimport { iOVM_L1MessageSender } from \"../../../iOVM/predeploys/iOVM_L1MessageSender.sol\";\nimport { iOVM_L2ToL1MessagePasser } from \"../../../iOVM/predeploys/iOVM_L2ToL1MessagePasser.sol\";\n\n/* External Imports */\nimport { ReentrancyGuard } from \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\";\n\n/* External Imports */\nimport { ReentrancyGuard } from \"@openzeppelin/contracts/utils/ReentrancyGuard.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\n iOVM_L2CrossDomainMessenger,\n Lib_AddressResolver,\n ReentrancyGuard\n{\n\n /*************\n * Constants *\n *************/\n\n // The default x-domain message sender being set to a non-zero value makes\n // deployment a bit more expensive, but in exchange the refund on every call to\n // `relayMessage` by the L1 and L2 messengers will be higher.\n address internal constant DEFAULT_XDOMAIN_SENDER = 0x000000000000000000000000000000000000dEaD;\n\n /*************\n * 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 internal xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address of the Address Manager.\n */\n constructor(address _libAddressManager) Lib_AddressResolver(_libAddressManager) ReentrancyGuard() {}\n\n\n /********************\n * Public Functions *\n ********************/\n\n function xDomainMessageSender()\n public\n override\n view\n returns (\n address\n )\n {\n require(xDomainMsgSender != DEFAULT_XDOMAIN_SENDER, \"xDomainMessageSender is not set\");\n return xDomainMsgSender;\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 memory _message,\n uint32 _gasLimit\n )\n override\n public\n {\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\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 * 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 = Lib_CrossDomainUtils.encodeXDomainCalldata(\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 // Prevent calls to OVM_L2ToL1MessagePasser, which would enable\n // an attacker to maliciously craft the _message to spoof\n // a call from any L2 account.\n if(_target == resolve(\"OVM_L2ToL1MessagePasser\")){\n // Write to the successfulMessages mapping and return immediately.\n successfulMessages[xDomainCalldataHash] = true;\n return;\n }\n\n xDomainMsgSender = _sender;\n (bool success, ) = _target.call(_message);\n xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\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 } else {\n emit FailedRelayedMessage(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\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 view\n internal\n returns (\n bool _valid\n )\n {\n return (\n iOVM_L1MessageSender(\n resolve(\"OVM_L1MessageSender\")\n ).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 internal\n {\n iOVM_L2ToL1MessagePasser(resolve(\"OVM_L2ToL1MessagePasser\")).passMessageToL1(_message);\n }\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_L2CrossDomainMessenger.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Interface Imports */\nimport { iOVM_CrossDomainMessenger } from \"./iOVM_CrossDomainMessenger.sol\";\n\n/**\n * @title iOVM_L2CrossDomainMessenger\n */\ninterface iOVM_L2CrossDomainMessenger is iOVM_CrossDomainMessenger {\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/predeploys/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/predeploys/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" + }, + "@openzeppelin/contracts/utils/ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.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 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/OVM/predeploys/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/predeploys/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 * 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/predeploys/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/predeploys/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/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/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 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/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 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/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 // 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 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 payable\n {\n address target = addressManager[address(this)].getAddress(\n (implementationName[address(this)])\n );\n\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/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* External Imports */\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\n\n/**\n * @title OVM_GasPriceOracle\n * @dev This contract exposes the current l2 gas price, a measure of how congested the network\n * currently is. This measure is used by the Sequencer to determine what fee to charge for\n * transactions. When the system is more congested, the l2 gas price will increase and fees\n * will also increase as a result.\n *\n * Compiler used: optimistic-solc\n * Runtime target: OVM\n */\ncontract OVM_GasPriceOracle is Ownable {\n\n /*************\n * Variables *\n *************/\n\n // Current l2 gas price\n uint256 public gasPrice;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _owner Address that will initially own this contract.\n */\n constructor(\n address _owner,\n uint256 _initialGasPrice\n )\n Ownable()\n {\n setGasPrice(_initialGasPrice);\n transferOwnership(_owner);\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Allows the owner to modify the l2 gas price.\n * @param _gasPrice New l2 gas price.\n */\n function setGasPrice(\n uint256 _gasPrice\n )\n public\n onlyOwner\n {\n gasPrice = _gasPrice;\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/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_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 pure\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 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_Proposer\");\n }\n\n function getGasSpent(\n bytes32, // _preStateRoot,\n address // _who\n )\n override\n public\n pure\n returns (\n uint256\n )\n {\n return 0;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "storageLayout", + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file From b74b0520461cc42dce530146f5715c61d647cc7d Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Wed, 16 Jun 2021 15:49:37 -0400 Subject: [PATCH 095/125] maintenance[monorepo]: first pass update to README (#1106) * maintenance[monorepo]: first pass update to README Doing some relatively minor updates to the README just to clean things up a bit. * replying to review comments --- README.md | 137 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 95 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 8ed492095de5..5efb3575cc68 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,20 @@ -#

Optimism Monorepo

+

+ +

-**Monorepo implementing the Optimistic Ethereum protocol** +#

The Optimism Monorepo

[![Github Actions](https://github.com/ethereum-optimism/optimism/workflows/typescript%20/%20contracts/badge.svg)](https://github.com/ethereum-optimism/optimism/actions/workflows/ts-packages.yml?query=branch%3Amaster) [![Github Actions](https://github.com/ethereum-optimism/optimism/workflows/integration/badge.svg)](https://github.com/ethereum-optimism/optimism/actions/workflows/integration.yml?query=branch%3Amaster) [![Github Actions](https://github.com/ethereum-optimism/optimism/workflows/geth%20unit%20tests/badge.svg)](https://github.com/ethereum-optimism/optimism/actions/workflows/geth.yml?query=branch%3Amaster) +## TL;DR + +This is the primary place where [Optimism](https://optimism.io) works on stuff related to [Optimistic Ethereum](https://research.paradigm.xyz/optimism). + ## Documentation -Extensive documentation is available [here](http://community.optimism.io/docs/) +Extensive documentation is available [here](http://community.optimism.io/docs/). ## Directory Structure @@ -26,65 +32,54 @@ Extensive documentation is available [here](http://community.optimism.io/docs/) * [`ops`](./ops): Contains Dockerfiles for containerizing each service involved in the protocol, as well as a docker-compose file for bringing up local testnets easily -## Quickstart +## Development Quick Start -### Installation +### Setup -Dependency management is done using `yarn`. +Clone the repository, open it, and install dependencies: ```bash git clone git@github.com:ethereum-optimism/optimism.git cd optimism -yarn +yarn install ``` -After installing the dependencies, you must also build them so that the typescript -is compiled down to javascript: +### Building the TypeScript packages -```bash -yarn build -``` - -When changing branches, be sure to clean the repo before building. +To build all of the [TypeScript packages](./packages), run: ```bash yarn clean +yarn build ``` -### Unit tests - -All tests are run in parallel using `lerna`: - -```bash -yarn test -``` - -When you want to run tests only for packages that have changed since `master` (or any other branch) -you can run `yarn lerna run test --parallel --since master` - -### Integration Tests +Packages compiled when on one branch may not be compatible with packages on a different branch. +**You should recompile all packages whenever you move from one branch to another.** +Use the above commands to recompile the packages. -#### Running the integration tests +### Building the rest of the system -The integration tests first require bringing up the Optimism stack. This is done via -a Docker Compose network. For better performance, we also recommend enabling Docker -BuildKit +If you want to run an Optimistic Ethereum node OR **if you want to run the integration tests**, you'll need to build the rest of the system. -```bash +``` cd ops -export COMPOSE_DOCKER_CLI_BUILD=1 +export COMPOSE_DOCKER_CLI_BUILD=1 # these environment variables significantly speed up build time export DOCKER_BUILDKIT=1 docker-compose build -cd ../integration-tests -yarn build:integration -yarn test:integration ``` -#### Locally testing and re-building specific services - -If you want to make changes to any of the containers, you'll have to bring one down, -rebuild it, and then bring it back up. - +This will build the following containers: +* [`builder`](https://hub.docker.com/r/ethereumoptimism/builder): used to build the TypeScript packages +* [`l1_chain`](https://hub.docker.com/r/ethereumoptimism/hardhat): simulated L1 chain using hardhat-evm as a backend +* [`deployer`](https://hub.docker.com/r/ethereumoptimism/deployer): process that deploys L1 smart contracts to the L1 chain +* [`dtl`](https://hub.docker.com/r/ethereumoptimism/data-transport-layer): service that indexes transaction data from the L1 chain +* [`l2geth`](https://hub.docker.com/r/ethereumoptimism/l2geth): L2 geth node running in Sequencer mode +* [`verifier`](https://hub.docker.com/r/ethereumoptimism/go-ethereum): L2 geth node running in Verifier mode +* [`relayer`](https://hub.docker.com/r/ethereumoptimism/message-relayer): helper process that relays messages between L1 and L2 +* [`batch_submitter`](https://hub.docker.com/r/ethereumoptimism/batch-submitter): service that submits batches of Sequencer transactions to the L1 chain +* [`integration_tests`](https://hub.docker.com/r/ethereumoptimism/integration-tests): integration tests in a box + +If you want to make a change to a container, you'll need to take it down and rebuild it. For example, if you make a change in l2geth: ```bash @@ -104,17 +99,75 @@ docker-compose build -- builder batch_submitter docker-compose start batch_submitter ``` +Source code changes can have an impact on more than one container. +**If you're unsure about which containers to rebuild, just rebuild them all**: + +``` +cd ops +docker-compose down +docker-compose build +docker-compose up +``` + +Finally, **if you're running into weird problems and nothing seems to be working**, run: + +``` +cd optimism +yarn clean +yarn build +cd ops +docker-compose down -v +docker-compose build +docker-compose up +``` + +#### Viewing docker container logs By default, the `docker-compose up` command will show logs from all services, and that can be hard to filter through. In order to view the logs from a specific service, you can run: ``` docker-compose logs --follow ``` -### Static analysis -To run `slither` locally in `./packages/contracts` do +### Running tests + +Before running tests: **follow the above instructions to get everything built.** + +#### Running unit tests + +Run unit tests for all packages in parallel via: + +```bash +yarn test +``` + +To run unit tests for a specific package: + +```bash +cd packages/package-to-test +yarn test +``` + +#### Running integration tests + +Follow above instructions for building the whole stack. +Build and run the integration tests: +```bash +cd integration-tests +yarn build:integration +yarn test:integration ``` + +## Additional Reference Material +### Running contract static analysis + +We perform static analysis with [`slither`](https://github.com/crytic/slither). +You must have Python 3.x installed to run `slither`. +To run `slither` locally, do: + +```bash +cd packages/contracts pip3 install slither-analyzer yarn test:slither ``` From 5c89c45fe0cabfc2dd61a462482f8601fe926e8b Mon Sep 17 00:00:00 2001 From: Ben Wilson <82120899+optimisticben@users.noreply.github.com> Date: Thu, 17 Jun 2021 11:38:32 -0400 Subject: [PATCH 096/125] Move the metric prefix string to a label (#1047) Added changeset and fixes Changeset to patch --- .changeset/sour-adults-worry.md | 7 +++++++ packages/batch-submitter/src/exec/run-batch-submitter.ts | 4 ++-- packages/common-ts/src/common/metrics.ts | 2 +- .../data-transport-layer/src/services/server/service.ts | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 .changeset/sour-adults-worry.md diff --git a/.changeset/sour-adults-worry.md b/.changeset/sour-adults-worry.md new file mode 100644 index 000000000000..bd3031690f86 --- /dev/null +++ b/.changeset/sour-adults-worry.md @@ -0,0 +1,7 @@ +--- +'@eth-optimism/batch-submitter': patch +'@eth-optimism/common-ts': patch +'@eth-optimism/data-transport-layer': patch +--- + +Move the metric prefix string to a label #1047 diff --git a/packages/batch-submitter/src/exec/run-batch-submitter.ts b/packages/batch-submitter/src/exec/run-batch-submitter.ts index 627b63e9647c..3eda27d655dc 100644 --- a/packages/batch-submitter/src/exec/run-batch-submitter.ts +++ b/packages/batch-submitter/src/exec/run-batch-submitter.ts @@ -84,6 +84,7 @@ export const run = async () => { const env = process.env const environment = config.str('node-env', env.NODE_ENV) const network = config.str('eth-network-name', env.ETH_NETWORK_NAME) + const service = `batch-submitter` const release = `batch-submitter@${env.npm_package_version}` const sentryDsn = config.str('sentry-dsn', env.SENTRY_DSN) const sentryTraceRate = config.ufloat( @@ -181,8 +182,7 @@ export const run = async () => { /* Metrics */ const metrics = new Metrics({ - prefix: name, - labels: { environment, release, network }, + labels: { environment, release, network, service }, }) const FRAUD_SUBMISSION_ADDRESS = config.str( diff --git a/packages/common-ts/src/common/metrics.ts b/packages/common-ts/src/common/metrics.ts index d8ac45bfd0df..99082dd7c5b8 100644 --- a/packages/common-ts/src/common/metrics.ts +++ b/packages/common-ts/src/common/metrics.ts @@ -9,7 +9,7 @@ import { Server } from 'net' import { Logger } from './logger' export interface MetricsOptions { - prefix: string + prefix?: string labels?: Object } diff --git a/packages/data-transport-layer/src/services/server/service.ts b/packages/data-transport-layer/src/services/server/service.ts index 202c3e2454d9..8abdc6ce156e 100644 --- a/packages/data-transport-layer/src/services/server/service.ts +++ b/packages/data-transport-layer/src/services/server/service.ts @@ -153,11 +153,11 @@ export class L1TransportServer extends BaseService { */ private _initMetrics() { this.metrics = new Metrics({ - prefix: this.name, labels: { environment: this.options.nodeEnv, network: this.options.ethNetworkName, release: this.options.release, + service: this.name, }, }) const metricsMiddleware = promBundle({ From 71349a4eaaa66f8090f4ee1105c84a139a9be221 Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Thu, 17 Jun 2021 18:05:07 -0400 Subject: [PATCH 097/125] fix[smock]: add support for hardhat 2.4.0 (#1112) * fix[smock]: add support for hardhat 2.4.0 * chore: add changeset * lint: fix --- .changeset/nice-terms-walk.md | 5 ++ packages/smock/package.json | 4 +- packages/smock/src/smockit/binding.ts | 18 +++- yarn.lock | 114 +++++++++++++++++++++++++- 4 files changed, 135 insertions(+), 6 deletions(-) create mode 100644 .changeset/nice-terms-walk.md diff --git a/.changeset/nice-terms-walk.md b/.changeset/nice-terms-walk.md new file mode 100644 index 000000000000..98581e283868 --- /dev/null +++ b/.changeset/nice-terms-walk.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/smock': patch +--- + +Minor smock patch to add support for hardhat 2.4.0 and up diff --git a/packages/smock/package.json b/packages/smock/package.json index 3564296c9fd3..be16bcf0c645 100644 --- a/packages/smock/package.json +++ b/packages/smock/package.json @@ -23,7 +23,7 @@ "@nomiclabs/ethereumjs-vm": "^4", "@nomiclabs/hardhat-ethers": "^2", "ethers": "^5", - "hardhat": "^2.2.1" + "hardhat": "^2" }, "dependencies": { "@eth-optimism/core-utils": "^0.4.5", @@ -54,7 +54,7 @@ "eslint-plugin-unicorn": "^32.0.1", "ethereum-waffle": "^3.3.0", "ethers": "^5.0.31", - "hardhat": "^2.2.1", + "hardhat": "^2.4.0", "lodash": "^4.17.20", "prettier": "^2.2.1" } diff --git a/packages/smock/src/smockit/binding.ts b/packages/smock/src/smockit/binding.ts index 349b471aa6b0..1779d85bc985 100644 --- a/packages/smock/src/smockit/binding.ts +++ b/packages/smock/src/smockit/binding.ts @@ -1,20 +1,32 @@ /* Imports: External */ import { HardhatNetworkProvider } from 'hardhat/internal/hardhat-network/provider/provider' -import { decodeRevertReason } from 'hardhat/internal/hardhat-network/stack-traces/revert-reasons' import { VmError } from '@nomiclabs/ethereumjs-vm/dist/exceptions' import BN from 'bn.js' +/* eslint-disable @typescript-eslint/no-var-requires */ +// Handle hardhat ^2.4.0 +let decodeRevertReason: (value: Buffer) => string +try { + decodeRevertReason = require('hardhat/internal/hardhat-network/stack-traces/revert-reasons') + .decodeRevertReason +} catch (err) { + const { + ReturnData, + } = require('hardhat/internal/hardhat-network/provider/return-data') + decodeRevertReason = (value: Buffer) => { + return new ReturnData(value).decodeError() + } +} // Handle hardhat ^2.2.0 let TransactionExecutionError: any try { - // eslint-disable-next-line @typescript-eslint/no-var-requires TransactionExecutionError = require('hardhat/internal/hardhat-network/provider/errors') .TransactionExecutionError } catch (err) { - // eslint-disable-next-line @typescript-eslint/no-var-requires TransactionExecutionError = require('hardhat/internal/core/providers/errors') .TransactionExecutionError } +/* eslint-enable @typescript-eslint/no-var-requires */ /* Imports: Internal */ import { MockContract, SmockedVM } from './types' diff --git a/yarn.lock b/yarn.lock index 5ade0edd675a..ce3911ca9cc8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -565,6 +565,16 @@ ethereumjs-util "^7.0.10" merkle-patricia-tree "^4.1.0" +"@ethereumjs/block@^3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@ethereumjs/block/-/block-3.3.0.tgz#a1b3baec831c71c0d9e7f6145f25e919cff4939c" + integrity sha512-WoefY9Rs4W8vZTxG9qwntAlV61xsSv0NPoXmHO7x3SH16dwJQtU15YvahPCz4HEEXbu7GgGgNgu0pv8JY7VauA== + dependencies: + "@ethereumjs/common" "^2.3.0" + "@ethereumjs/tx" "^3.2.0" + ethereumjs-util "^7.0.10" + merkle-patricia-tree "^4.2.0" + "@ethereumjs/blockchain@^5.2.1": version "5.2.1" resolved "https://registry.yarnpkg.com/@ethereumjs/blockchain/-/blockchain-5.2.1.tgz#83ed83647667265f1666f111caf065ef9d1e82b5" @@ -580,6 +590,21 @@ rlp "^2.2.4" semaphore-async-await "^1.5.1" +"@ethereumjs/blockchain@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@ethereumjs/blockchain/-/blockchain-5.3.0.tgz#206936e30a4320d87a26e58d157eadef21ef6ff1" + integrity sha512-B0Y5QDZcRDQISPilv3m8nzk97QmC98DnSE9WxzGpCxfef22Mw7xhwGipci5Iy0dVC2Np2Cr5d3F6bHAR7+yVmQ== + dependencies: + "@ethereumjs/block" "^3.3.0" + "@ethereumjs/common" "^2.3.0" + "@ethereumjs/ethash" "^1.0.0" + debug "^2.2.0" + ethereumjs-util "^7.0.10" + level-mem "^5.0.1" + lru-cache "^5.1.1" + rlp "^2.2.4" + semaphore-async-await "^1.5.1" + "@ethereumjs/common@^2.2.0": version "2.2.0" resolved "https://registry.yarnpkg.com/@ethereumjs/common/-/common-2.2.0.tgz#850a3e3e594ee707ad8d44a11e8152fb62450535" @@ -588,6 +613,14 @@ crc-32 "^1.2.0" ethereumjs-util "^7.0.9" +"@ethereumjs/common@^2.3.0", "@ethereumjs/common@^2.3.1": + version "2.3.1" + resolved "https://registry.yarnpkg.com/@ethereumjs/common/-/common-2.3.1.tgz#d692e3aff5adb35dd587dd1e6caab69e0ed2fa0b" + integrity sha512-V8hrULExoq0H4HFs3cCmdRGbgmipmlNzak6Xg34nHYfQyqkSdrCuflvYjyWmsNpI8GtrcZhzifAbgX/1C1Cjwg== + dependencies: + crc-32 "^1.2.0" + ethereumjs-util "^7.0.10" + "@ethereumjs/ethash@^1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@ethereumjs/ethash/-/ethash-1.0.0.tgz#4e77f85b37be1ade5393e8719bdabac3e796ddaa" @@ -606,6 +639,14 @@ "@ethereumjs/common" "^2.2.0" ethereumjs-util "^7.0.10" +"@ethereumjs/tx@^3.2.0", "@ethereumjs/tx@^3.2.1": + version "3.2.1" + resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-3.2.1.tgz#65f5f1c11541764f08377a94ba4b0dcbbd67739e" + integrity sha512-i9V39OtKvwWos1uVNZxdVhd7zFOyzFLjgt69CoiOY0EmXugS0HjO3uxpLBSglDKFMRriuGqw6ddKEv+RP1UNEw== + dependencies: + "@ethereumjs/common" "^2.3.1" + ethereumjs-util "^7.0.10" + "@ethereumjs/vm@^5.3.2": version "5.3.2" resolved "https://registry.yarnpkg.com/@ethereumjs/vm/-/vm-5.3.2.tgz#b4d83a3d50a7ad22d6d412cc21bbde221b3e2871" @@ -7532,7 +7573,7 @@ github-from-package@0.0.0: resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce" integrity sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4= -glob-parent@^5.1.0, glob-parent@^5.1.1, glob-parent@~5.1.0: +glob-parent@^5.0.0, glob-parent@^5.1.0, glob-parent@^5.1.1, glob-parent@~5.1.0: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== @@ -7866,6 +7907,59 @@ hardhat@^2.3.0: uuid "^3.3.2" ws "^7.2.1" +hardhat@^2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.4.0.tgz#b0db7a6e07fa72414665634ced149bbb10252499" + integrity sha512-IMh7Ws/7fIO5RRkm4nhqS2JWEct0690K35BcFVuIOoIRMcDLKc/7+JSxhey3RkXc5M4qUvdxfQI0LRQx4aqBZw== + dependencies: + "@ethereumjs/block" "^3.3.0" + "@ethereumjs/blockchain" "^5.3.0" + "@ethereumjs/common" "^2.3.1" + "@ethereumjs/tx" "^3.2.1" + "@ethereumjs/vm" "^5.3.2" + "@ethersproject/abi" "^5.1.2" + "@sentry/node" "^5.18.1" + "@solidity-parser/parser" "^0.11.0" + "@types/bn.js" "^5.1.0" + "@types/lru-cache" "^5.1.0" + abort-controller "^3.0.0" + adm-zip "^0.4.16" + ansi-escapes "^4.3.0" + chalk "^2.4.2" + chokidar "^3.4.0" + ci-info "^2.0.0" + debug "^4.1.1" + enquirer "^2.3.0" + env-paths "^2.2.0" + eth-sig-util "^2.5.2" + ethereum-cryptography "^0.1.2" + ethereumjs-abi "^0.6.8" + ethereumjs-util "^7.0.10" + find-up "^2.1.0" + fp-ts "1.19.3" + fs-extra "^7.0.1" + glob "^7.1.3" + https-proxy-agent "^5.0.0" + immutable "^4.0.0-rc.12" + io-ts "1.10.4" + lodash "^4.17.11" + merkle-patricia-tree "^4.2.0" + mnemonist "^0.38.0" + mocha "^7.1.2" + node-fetch "^2.6.0" + qs "^6.7.0" + raw-body "^2.4.1" + resolve "1.17.0" + semver "^6.3.0" + slash "^3.0.0" + solc "0.7.3" + source-map-support "^0.5.13" + stacktrace-parser "^0.1.10" + "true-case-path" "^2.2.1" + tsort "0.0.1" + uuid "^3.3.2" + ws "^7.4.6" + has-ansi@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" @@ -9841,6 +9935,19 @@ merkle-patricia-tree@^4.0.0, merkle-patricia-tree@^4.1.0: rlp "^2.2.3" semaphore-async-await "^1.5.1" +merkle-patricia-tree@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/merkle-patricia-tree/-/merkle-patricia-tree-4.2.0.tgz#a204b9041be5c25e8d14f0ff47021de090e811a1" + integrity sha512-0sBVXs7z1Q1/kxzWZ3nPnxSPiaHKF/f497UQzt9O7isRcS10tel9jM/4TivF6Jv7V1yFq4bWyoATxbDUOen5vQ== + dependencies: + "@types/levelup" "^4.3.0" + ethereumjs-util "^7.0.10" + level-mem "^5.0.1" + level-ws "^2.0.0" + readable-stream "^3.6.0" + rlp "^2.2.4" + semaphore-async-await "^1.5.1" + merkletreejs@^0.2.12, merkletreejs@^0.2.18: version "0.2.18" resolved "https://registry.yarnpkg.com/merkletreejs/-/merkletreejs-0.2.18.tgz#205cc4f79e134c9bc887bdbd440b9e78787c4823" @@ -15084,6 +15191,11 @@ ws@^7.2.1: resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.4.tgz#383bc9742cb202292c9077ceab6f6047b17f2d59" integrity sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw== +ws@^7.4.6: + version "7.5.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.0.tgz#0033bafea031fb9df041b2026fc72a571ca44691" + integrity sha512-6ezXvzOZupqKj4jUqbQ9tXuJNo+BR2gU8fFRk3XCP3e0G6WT414u5ELe6Y0vtp7kmSJ3F7YWObSNr1ESsgi4vw== + xhr-request-promise@^0.1.2: version "0.1.3" resolved "https://registry.yarnpkg.com/xhr-request-promise/-/xhr-request-promise-0.1.3.tgz#2d5f4b16d8c6c893be97f1a62b0ed4cf3ca5f96c" From 3c6c99b853fb7443c67419ea1980d1d0e66abf48 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 18 Jun 2021 13:26:32 -0400 Subject: [PATCH 098/125] build(deps): bump hosted-git-info from 2.8.8 to 2.8.9 (#1064) Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.8 to 2.8.9. - [Release notes](https://github.com/npm/hosted-git-info/releases) - [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md) - [Commits](https://github.com/npm/hosted-git-info/compare/v2.8.8...v2.8.9) --- updated-dependencies: - dependency-name: hosted-git-info dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: smartcontracts --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index ce3911ca9cc8..bcb6ed5a7aa0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8110,9 +8110,9 @@ hoopy@^0.1.4: integrity sha512-HRcs+2mr52W0K+x8RzcLzuPPmVIKMSv97RGHy0Ea9y/mpcaK+xTrjICA04KAHi4GRzxliNqNJEFYWHghy3rSfQ== hosted-git-info@^2.1.4, hosted-git-info@^2.6.0: - version "2.8.8" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.8.tgz#7539bd4bc1e0e0a895815a2e0262420b12858488" - integrity sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg== + version "2.8.9" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9" + integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw== hosted-git-info@^4.0.1: version "4.0.2" From 3b60ea63f8cfffac9b9f84f997f43837f84ee92f Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Fri, 18 Jun 2021 14:33:12 -0400 Subject: [PATCH 099/125] Misc. small improvements to README (#1115) * Update README.md * Update README.md --- README.md | 47 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 5efb3575cc68..0f4d185446df 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,13 @@ +
+ Optimism +
+

The Optimism Monorepo

+

- -

- -#

The Optimism Monorepo

- -[![Github Actions](https://github.com/ethereum-optimism/optimism/workflows/typescript%20/%20contracts/badge.svg)](https://github.com/ethereum-optimism/optimism/actions/workflows/ts-packages.yml?query=branch%3Amaster) -[![Github Actions](https://github.com/ethereum-optimism/optimism/workflows/integration/badge.svg)](https://github.com/ethereum-optimism/optimism/actions/workflows/integration.yml?query=branch%3Amaster) -[![Github Actions](https://github.com/ethereum-optimism/optimism/workflows/geth%20unit%20tests/badge.svg)](https://github.com/ethereum-optimism/optimism/actions/workflows/geth.yml?query=branch%3Amaster) + + + +

## TL;DR @@ -16,6 +17,10 @@ This is the primary place where [Optimism](https://optimism.io) works on stuff r Extensive documentation is available [here](http://community.optimism.io/docs/). +## Community + +* [Come hang on discord](https://discord.optimism.io) + ## Directory Structure * [`packages`](./packages): Contains all the typescript packages and contracts @@ -34,9 +39,19 @@ as well as a docker-compose file for bringing up local testnets easily ## Development Quick Start +### Dependencies + +You'll need the following: + +* [Git](https://git-scm.com/downloads) +* [NodeJS](https://nodejs.org/en/download/) +* [Yarn](https://classic.yarnpkg.com/en/docs/install) +* [Docker](https://docs.docker.com/get-docker/) +* [Docker Compose](https://docs.docker.com/compose/install/) + ### Setup -Clone the repository, open it, and install dependencies: +Clone the repository, open it, and install nodejs packages with `yarn`: ```bash git clone git@github.com:ethereum-optimism/optimism.git @@ -61,7 +76,7 @@ Use the above commands to recompile the packages. If you want to run an Optimistic Ethereum node OR **if you want to run the integration tests**, you'll need to build the rest of the system. -``` +```bash cd ops export COMPOSE_DOCKER_CLI_BUILD=1 # these environment variables significantly speed up build time export DOCKER_BUILDKIT=1 @@ -102,7 +117,7 @@ docker-compose start batch_submitter Source code changes can have an impact on more than one container. **If you're unsure about which containers to rebuild, just rebuild them all**: -``` +```bash cd ops docker-compose down docker-compose build @@ -111,7 +126,7 @@ docker-compose up Finally, **if you're running into weird problems and nothing seems to be working**, run: -``` +```bash cd optimism yarn clean yarn build @@ -125,7 +140,7 @@ docker-compose up By default, the `docker-compose up` command will show logs from all services, and that can be hard to filter through. In order to view the logs from a specific service, you can run: -``` +```bash docker-compose logs --follow ``` @@ -171,3 +186,9 @@ cd packages/contracts pip3 install slither-analyzer yarn test:slither ``` + +## License + +Code forked from [`go-ethereum`](https://github.com/ethereum/go-ethereum) under the name [`l2geth`](https://github.com/ethereum-optimism/optimism/tree/master/l2geth) is licensed under the [GNU GPLv3](https://gist.github.com/kn9ts/cbe95340d29fc1aaeaa5dd5c059d2e60) in accordance with the [original license](https://github.com/ethereum/go-ethereum/blob/master/COPYING). + +All other files within this repository are licensed under the [MIT License](https://github.com/ethereum-optimism/optimism/blob/master/LICENSE) unless stated otherwise. From a415d01762ef2a7401b344af11b2dd0084530a91 Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Fri, 18 Jun 2021 16:14:44 -0400 Subject: [PATCH 100/125] fix[dtl]: use the same L2 chain ID everywhere (#1122) * fix[dtl]: use the same L2 chain ID everywhere * chore: add changeset --- .changeset/modern-pets-tie.md | 5 +++++ .../src/services/l1-ingestion/service.ts | 10 ++++------ 2 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 .changeset/modern-pets-tie.md diff --git a/.changeset/modern-pets-tie.md b/.changeset/modern-pets-tie.md new file mode 100644 index 000000000000..0bee3baa798c --- /dev/null +++ b/.changeset/modern-pets-tie.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/data-transport-layer': patch +--- + +Updates the DTL to use the same L2 chain ID everywhere diff --git a/packages/data-transport-layer/src/services/l1-ingestion/service.ts b/packages/data-transport-layer/src/services/l1-ingestion/service.ts index d614372f0750..8a98a57d1135 100644 --- a/packages/data-transport-layer/src/services/l1-ingestion/service.ts +++ b/packages/data-transport-layer/src/services/l1-ingestion/service.ts @@ -53,6 +53,9 @@ const optionSettings = { return validators.isUrl(val) || validators.isJsonRpcProvider(val) }, }, + l2ChainId: { + validate: validators.isInteger, + }, } export class L1IngestionService extends BaseService { @@ -65,7 +68,6 @@ export class L1IngestionService extends BaseService { contracts: OptimismContracts l1RpcProvider: JsonRpcProvider startingL1BlockNumber: number - l2ChainId: number } = {} as any protected async _init(): Promise { @@ -115,10 +117,6 @@ export class L1IngestionService extends BaseService { this.options.addressManager ) - this.state.l2ChainId = ethers.BigNumber.from( - await this.state.contracts.OVM_ExecutionManager.ovmCHAINID() - ).toNumber() - const startingL1BlockNumber = await this.state.db.getStartingL1Block() if (startingL1BlockNumber) { this.state.startingL1BlockNumber = startingL1BlockNumber @@ -301,7 +299,7 @@ export class L1IngestionService extends BaseService { const parsedEvent = await handlers.parseEvent( event, extraData, - this.state.l2ChainId + this.options.l2ChainId ) await handlers.storeEvent(parsedEvent, this.state.db) } From f9bacd71fede35832962d39a523d528142230357 Mon Sep 17 00:00:00 2001 From: Annie Ke Date: Mon, 21 Jun 2021 11:43:30 -0700 Subject: [PATCH 101/125] fix: make sync tests only on workflow dispatch (#1123) --- .github/workflows/sync-tests.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/sync-tests.yml b/.github/workflows/sync-tests.yml index bd031837cde8..a6b2a38cc51a 100644 --- a/.github/workflows/sync-tests.yml +++ b/.github/workflows/sync-tests.yml @@ -1,13 +1,6 @@ name: sync-tests -on: - push: - branches: - - 'master' - - 'develop' - - 'regenesis/*' - pull_request: - workflow_dispatch: +on: workflow_dispatch jobs: integration-sync-test: From ca7d65dbf13b94076b4b9f7903678caf42e4f827 Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Mon, 21 Jun 2021 15:20:48 -0400 Subject: [PATCH 102/125] fix[dtl]: remove old stringification function (#1134) * fix[dtl]: remove old stringification function * chore: add changeset --- .changeset/gold-grapes-beg.md | 5 ++++ .../src/db/transport-db.ts | 23 +------------------ 2 files changed, 6 insertions(+), 22 deletions(-) create mode 100644 .changeset/gold-grapes-beg.md diff --git a/.changeset/gold-grapes-beg.md b/.changeset/gold-grapes-beg.md new file mode 100644 index 000000000000..647c59db76fb --- /dev/null +++ b/.changeset/gold-grapes-beg.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/data-transport-layer': patch +--- + +Removes a function that was previously used for backwards compatibility but is no longer necessary diff --git a/packages/data-transport-layer/src/db/transport-db.ts b/packages/data-transport-layer/src/db/transport-db.ts index 80deead5c576..c1c50c4eac53 100644 --- a/packages/data-transport-layer/src/db/transport-db.ts +++ b/packages/data-transport-layer/src/db/transport-db.ts @@ -387,27 +387,6 @@ export class TransportDB { startIndex: number, endIndex: number ): Promise { - const entries = await this.db.range( - `${key}:index`, - startIndex, - endIndex - ) - const results = [] - for (const entry of entries) { - results.push(stringify(entry)) - } - return results - } -} - -const stringify = (entry) => { - if (entry === null || entry === undefined) { - return entry - } - if (entry.gasLimit) { - entry.gasLimit = BigNumber.from(entry.gasLimit).toString() - } - if (entry.decoded) { - entry.decoded.gasLimit = BigNumber.from(entry.decoded.gasLimit).toString() + return this.db.range(`${key}:index`, startIndex, endIndex) } } From 16f6815923a0c7d562ad9373c8cf2002b56f2648 Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Mon, 21 Jun 2021 15:21:18 -0400 Subject: [PATCH 103/125] fix[dtl]: log server errors as ERROR instead of INFO (#1133) * fix[dtl]: log server errors as ERROR instead of INFO * chore: add changeset --- .changeset/lazy-foxes-jump.md | 5 +++++ packages/data-transport-layer/src/services/server/service.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/lazy-foxes-jump.md diff --git a/.changeset/lazy-foxes-jump.md b/.changeset/lazy-foxes-jump.md new file mode 100644 index 000000000000..b099e06143c2 --- /dev/null +++ b/.changeset/lazy-foxes-jump.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/data-transport-layer': patch +--- + +Have DTL log failed HTTP requests as ERROR instead of INFO diff --git a/packages/data-transport-layer/src/services/server/service.ts b/packages/data-transport-layer/src/services/server/service.ts index 8abdc6ce156e..f8461a036086 100644 --- a/packages/data-transport-layer/src/services/server/service.ts +++ b/packages/data-transport-layer/src/services/server/service.ts @@ -201,7 +201,7 @@ export class L1TransportServer extends BaseService { return res.json(json) } catch (e) { const elapsed = Date.now() - start - this.logger.info('Failed HTTP Request', { + this.logger.error('Failed HTTP Request', { method: req.method, url: req.url, elapsed, From 57ca21a2e3a10232c3d7881d966a55a829ea1c7c Mon Sep 17 00:00:00 2001 From: Matt Masurka Date: Mon, 21 Jun 2021 12:48:19 -0700 Subject: [PATCH 104/125] Contracts: connectL1Contracts & connectL2Contracts (#713) * Contracts: connect-contracts * Trying to resolve build problems * connect-contracts build working * Adds artifacts-ovm back to gitignore * Removes incorrect changes * Adds copy-artifacts script * Adds test file (not working yet) * fix: incorrect contract instantiation * Improves tests and removes old deployment versions * Single source of truth for predeploy addresses * Reverts deployments/README.md * Makes connect-contracts more DRY * Adds missing @ethersproject/abstract-signer dependency * Adds argument evaluation * Adds L1Contracts and L2Contracts types * Attempts removing artifacts-ovm again * Adds webpack config (not working yet) * build: add artifacts to dist (#776) * Updates lint rule * Adds l2 imports * Fixes dependency tree bug * Removes webpack stuff * Fixing package.json issues and adds .DS_Store to gitignore * Removes test-contracts script * Reverting script change * Adds comments * Adds comment * Renames deployments folders * Fixes linting errors * Generates markdown * build: add deployments directory to Dockerfiles * Removes unneeded contracts, improves error handling and tests * Adds changeset * yarn.lock * Removes console.log * Changes from minor to patch version * Fixes lint errors Co-authored-by: Kelvin Fichter Co-authored-by: Liam Horne Co-authored-by: Georgios Konstantopoulos --- .changeset/fair-icons-argue.md | 5 + ops/docker/Dockerfile.batch-submitter | 1 + ops/docker/Dockerfile.data-transport-layer | 1 + ops/docker/Dockerfile.message-relayer | 1 + packages/contracts/src/connect-contracts.ts | 125 ++++++++++++ packages/contracts/src/contract-data.ts | 180 ++++++++++++++++++ packages/contracts/src/index.ts | 1 + .../contracts/test/connect-contracts.spec.ts | 61 ++++++ packages/contracts/tsconfig.json | 2 +- 9 files changed, 376 insertions(+), 1 deletion(-) create mode 100644 .changeset/fair-icons-argue.md create mode 100644 packages/contracts/src/connect-contracts.ts create mode 100644 packages/contracts/src/contract-data.ts create mode 100644 packages/contracts/test/connect-contracts.spec.ts diff --git a/.changeset/fair-icons-argue.md b/.changeset/fair-icons-argue.md new file mode 100644 index 000000000000..b1e90110a7ce --- /dev/null +++ b/.changeset/fair-icons-argue.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/contracts': patch +--- + +"Adds connectL1Contracts and connectL2Contracts utility functions" diff --git a/ops/docker/Dockerfile.batch-submitter b/ops/docker/Dockerfile.batch-submitter index 1d5c92e758a6..07b14a9b3c09 100644 --- a/ops/docker/Dockerfile.batch-submitter +++ b/ops/docker/Dockerfile.batch-submitter @@ -17,6 +17,7 @@ COPY --from=builder /optimism/packages/common-ts/package.json ./packages/common- COPY --from=builder /optimism/packages/common-ts/dist ./packages/common-ts/dist COPY --from=builder /optimism/packages/contracts/package.json ./packages/contracts/package.json +COPY --from=builder /optimism/packages/contracts/deployments ./packages/contracts/deployments COPY --from=builder /optimism/packages/contracts/dist ./packages/contracts/dist COPY --from=builder /optimism/packages/contracts/artifacts ./packages/contracts/artifacts COPY --from=builder /optimism/packages/contracts/artifacts-ovm ./packages/contracts/artifacts-ovm diff --git a/ops/docker/Dockerfile.data-transport-layer b/ops/docker/Dockerfile.data-transport-layer index e6bcdfee2b89..dfc1c8278b78 100644 --- a/ops/docker/Dockerfile.data-transport-layer +++ b/ops/docker/Dockerfile.data-transport-layer @@ -18,6 +18,7 @@ COPY --from=builder /optimism/packages/common-ts/package.json ./packages/common- COPY --from=builder /optimism/packages/common-ts/dist ./packages/common-ts/dist COPY --from=builder /optimism/packages/contracts/package.json ./packages/contracts/package.json +COPY --from=builder /optimism/packages/contracts/deployments ./packages/contracts/deployments COPY --from=builder /optimism/packages/contracts/dist ./packages/contracts/dist COPY --from=builder /optimism/packages/contracts/artifacts ./packages/contracts/artifacts COPY --from=builder /optimism/packages/contracts/artifacts-ovm ./packages/contracts/artifacts-ovm diff --git a/ops/docker/Dockerfile.message-relayer b/ops/docker/Dockerfile.message-relayer index 92614be95492..5c976daee892 100644 --- a/ops/docker/Dockerfile.message-relayer +++ b/ops/docker/Dockerfile.message-relayer @@ -18,6 +18,7 @@ COPY --from=builder /optimism/packages/common-ts/package.json ./packages/common- COPY --from=builder /optimism/packages/common-ts/dist ./packages/common-ts/dist COPY --from=builder /optimism/packages/contracts/package.json ./packages/contracts/package.json +COPY --from=builder /optimism/packages/contracts/deployments ./packages/contracts/deployments COPY --from=builder /optimism/packages/contracts/dist ./packages/contracts/dist COPY --from=builder /optimism/packages/contracts/artifacts ./packages/contracts/artifacts COPY --from=builder /optimism/packages/contracts/artifacts-ovm ./packages/contracts/artifacts-ovm diff --git a/packages/contracts/src/connect-contracts.ts b/packages/contracts/src/connect-contracts.ts new file mode 100644 index 000000000000..d68ae07b7bb1 --- /dev/null +++ b/packages/contracts/src/connect-contracts.ts @@ -0,0 +1,125 @@ +import { Signer, Contract, providers, ethers } from 'ethers' +import { Provider } from '@ethersproject/abstract-provider' +import { getL1ContractData, getL2ContractData } from './contract-data' + +export type Network = 'goerli' | 'kovan' | 'mainnet' +interface L1Contracts { + addressManager: Contract + canonicalTransactionChain: Contract + executionManager: Contract + fraudVerifier: Contract + ethGateway: Contract + multiMessageRelayer: Contract + stateCommitmentChain: Contract + xDomainMessengerProxy: Contract + l1EthGatewayProxy: Contract + bondManager: Contract +} + +interface L2Contracts { + eth: Contract + xDomainMessenger: Contract + messagePasser: Contract + messageSender: Contract + deployerWhiteList: Contract + ecdsaContractAccount: Contract + sequencerEntrypoint: Contract + erc1820Registry: Contract + addressManager: Contract +} + +/** + * Validates user provided a singer or provider & throws error if not + * + * @param signerOrProvider + */ +const checkSignerType = (signerOrProvider: Signer | Provider) => { + if (!signerOrProvider) { + throw Error('signerOrProvider argument is undefined') + } + if ( + !Provider.isProvider(signerOrProvider) && + !Signer.isSigner(signerOrProvider) + ) { + throw Error('signerOrProvider argument is the wrong type') + } +} + +/** + * Connects a signer/provider to layer 1 contracts on a given network + * + * @param signerOrProvider ethers signer or provider + * @param network string denoting network + * @returns l1 contracts connected to signer/provider + */ +export const connectL1Contracts = async ( + signerOrProvider: Signer | Provider, + network: Network +): Promise => { + checkSignerType(signerOrProvider) + + if (!['mainnet', 'kovan', 'goerli'].includes(network)) { + throw Error('Must specify network: mainnet, kovan, or goerli.') + } + + const l1ContractData = getL1ContractData(network) + + const toEthersContract = (data) => + new Contract(data.address, data.abi, signerOrProvider) + + return { + addressManager: toEthersContract(l1ContractData.Lib_AddressManager), + canonicalTransactionChain: toEthersContract( + l1ContractData.OVM_CanonicalTransactionChain + ), + executionManager: toEthersContract(l1ContractData.OVM_ExecutionManager), + fraudVerifier: toEthersContract(l1ContractData.OVM_FraudVerifier), + ethGateway: toEthersContract(l1ContractData.OVM_L1ETHGateway), + multiMessageRelayer: toEthersContract( + l1ContractData.OVM_L1MultiMessageRelayer + ), + stateCommitmentChain: toEthersContract( + l1ContractData.OVM_StateCommitmentChain + ), + xDomainMessengerProxy: toEthersContract( + l1ContractData.Proxy__OVM_L1CrossDomainMessenger + ), + l1EthGatewayProxy: toEthersContract(l1ContractData.Proxy__OVM_L1ETHGateway), + // TODO: update this with actual bond manager when its ready + bondManager: toEthersContract(l1ContractData.mockOVM_BondManager), + } +} + +/** + * Connects a signer/provider to layer 2 contracts (network agnostic) + * + * @param signerOrProvider ethers signer or provider + * @returns l2 contracts connected to signer/provider + */ +export const connectL2Contracts = async ( + signerOrProvider +): Promise => { + const l2ContractData = await getL2ContractData() + checkSignerType(signerOrProvider) + + const toEthersContract = (data) => + new Contract(data.address, data.abi, signerOrProvider) + + return { + eth: toEthersContract(l2ContractData.OVM_ETH), + xDomainMessenger: toEthersContract( + l2ContractData.OVM_L2CrossDomainMessenger + ), + messagePasser: toEthersContract(l2ContractData.OVM_L2ToL1MessagePasser), + messageSender: toEthersContract(l2ContractData.OVM_L1MessageSender), + deployerWhiteList: toEthersContract(l2ContractData.OVM_DeployerWhitelist), + ecdsaContractAccount: toEthersContract( + l2ContractData.OVM_ECDSAContractAccount + ), + sequencerEntrypoint: toEthersContract( + l2ContractData.OVM_SequencerEntrypoint + ), + erc1820Registry: toEthersContract(l2ContractData.ERC1820Registry), + addressManager: toEthersContract(l2ContractData.Lib_AddressManager), + } +} diff --git a/packages/contracts/src/contract-data.ts b/packages/contracts/src/contract-data.ts new file mode 100644 index 000000000000..f492c798f109 --- /dev/null +++ b/packages/contracts/src/contract-data.ts @@ -0,0 +1,180 @@ +/* eslint-disable @typescript-eslint/no-var-requires */ +import { predeploys as l2Addresses } from './predeploys' +import { Network } from './connect-contracts' + +/** + * This file is necessarily not DRY because it needs to be usable + * in a browser context and can't take advantage of dynamic imports + * (ie: the json needs to all be imported when transpiled) + */ + +const Mainnet__Lib_AddressManager = require('../deployments/mainnet/Lib_AddressManager.json') +const Mainnet__OVM_CanonicalTransactionChain = require('../deployments/mainnet/OVM_CanonicalTransactionChain.json') +const Mainnet__OVM_ExecutionManager = require('../deployments/mainnet/OVM_ExecutionManager.json') +const Mainnet__OVM_FraudVerifier = require('../deployments/mainnet/OVM_FraudVerifier.json') +const Mainnet__OVM_L1CrossDomainMessenger = require('../deployments/mainnet/OVM_L1CrossDomainMessenger.json') +const Mainnet__OVM_L1ETHGateway = require('../deployments/mainnet/OVM_L1ETHGateway.json') +const Mainnet__OVM_L1MultiMessageRelayer = require('../deployments/mainnet/OVM_L1MultiMessageRelayer.json') +const Mainnet__OVM_SafetyChecker = require('../deployments/mainnet/OVM_SafetyChecker.json') +const Mainnet__OVM_StateCommitmentChain = require('../deployments/mainnet/OVM_StateCommitmentChain.json') +const Mainnet__OVM_StateManagerFactory = require('../deployments/mainnet/OVM_StateManagerFactory.json') +const Mainnet__OVM_StateTransitionerFactory = require('../deployments/mainnet/OVM_StateTransitionerFactory.json') +const Mainnet__Proxy__OVM_L1CrossDomainMessenger = require('../deployments/mainnet/Proxy__OVM_L1CrossDomainMessenger.json') +const Mainnet__Proxy__OVM_L1ETHGateway = require('../deployments/mainnet/Proxy__OVM_L1ETHGateway.json') +const Mainnet__mockOVM_BondManager = require('../deployments/mainnet/mockOVM_BondManager.json') + +const Kovan__Lib_AddressManager = require('../deployments/kovan/Lib_AddressManager.json') +const Kovan__OVM_CanonicalTransactionChain = require('../deployments/kovan/OVM_CanonicalTransactionChain.json') +const Kovan__OVM_ExecutionManager = require('../deployments/kovan/OVM_ExecutionManager.json') +const Kovan__OVM_FraudVerifier = require('../deployments/kovan/OVM_FraudVerifier.json') +const Kovan__OVM_L1CrossDomainMessenger = require('../deployments/kovan/OVM_L1CrossDomainMessenger.json') +const Kovan__OVM_L1ETHGateway = require('../deployments/kovan/OVM_L1ETHGateway.json') +const Kovan__OVM_L1MultiMessageRelayer = require('../deployments/kovan/OVM_L1MultiMessageRelayer.json') +const Kovan__OVM_SafetyChecker = require('../deployments/kovan/OVM_SafetyChecker.json') +const Kovan__OVM_StateCommitmentChain = require('../deployments/kovan/OVM_StateCommitmentChain.json') +const Kovan__OVM_StateManagerFactory = require('../deployments/kovan/OVM_StateManagerFactory.json') +const Kovan__OVM_StateTransitionerFactory = require('../deployments/kovan/OVM_StateTransitionerFactory.json') +const Kovan__Proxy__OVM_L1CrossDomainMessenger = require('../deployments/kovan/Proxy__OVM_L1CrossDomainMessenger.json') +const Kovan__Proxy__OVM_L1ETHGateway = require('../deployments/kovan/Proxy__OVM_L1ETHGateway.json') +const Kovan__mockOVM_BondManager = require('../deployments/kovan/mockOVM_BondManager.json') + +const Goerli__Lib_AddressManager = require('../deployments/goerli/Lib_AddressManager.json') +const Goerli__OVM_CanonicalTransactionChain = require('../deployments/goerli/OVM_CanonicalTransactionChain.json') +const Goerli__OVM_ExecutionManager = require('../deployments/goerli/OVM_ExecutionManager.json') +const Goerli__OVM_FraudVerifier = require('../deployments/goerli/OVM_FraudVerifier.json') +const Goerli__OVM_L1CrossDomainMessenger = require('../deployments/goerli/OVM_L1CrossDomainMessenger.json') +const Goerli__OVM_L1ETHGateway = require('../deployments/goerli/OVM_L1ETHGateway.json') +const Goerli__OVM_L1MultiMessageRelayer = require('../deployments/goerli/OVM_L1MultiMessageRelayer.json') +const Goerli__OVM_SafetyChecker = require('../deployments/goerli/OVM_SafetyChecker.json') +const Goerli__OVM_StateCommitmentChain = require('../deployments/goerli/OVM_StateCommitmentChain.json') +const Goerli__OVM_StateManagerFactory = require('../deployments/goerli/OVM_StateManagerFactory.json') +const Goerli__OVM_StateTransitionerFactory = require('../deployments/goerli/OVM_StateTransitionerFactory.json') +const Goerli__Proxy__OVM_L1CrossDomainMessenger = require('../deployments/goerli/Proxy__OVM_L1CrossDomainMessenger.json') +const Goerli__Proxy__OVM_L1ETHGateway = require('../deployments/goerli/Proxy__OVM_L1ETHGateway.json') +const Goerli__mockOVM_BondManager = require('../deployments/goerli/mockOVM_BondManager.json') + +export const getL1ContractData = (network: Network) => { + return { + Lib_AddressManager: { + mainnet: Mainnet__Lib_AddressManager, + kovan: Kovan__Lib_AddressManager, + goerli: Goerli__Lib_AddressManager, + }[network], + OVM_CanonicalTransactionChain: { + mainnet: Mainnet__OVM_CanonicalTransactionChain, + kovan: Kovan__OVM_CanonicalTransactionChain, + goerli: Goerli__OVM_CanonicalTransactionChain, + }[network], + OVM_ExecutionManager: { + mainnet: Mainnet__OVM_ExecutionManager, + kovan: Kovan__OVM_ExecutionManager, + goerli: Goerli__OVM_ExecutionManager, + }[network], + OVM_FraudVerifier: { + mainnet: Mainnet__OVM_FraudVerifier, + kovan: Kovan__OVM_FraudVerifier, + goerli: Goerli__OVM_FraudVerifier, + }[network], + OVM_L1CrossDomainMessenger: { + mainnet: Mainnet__OVM_L1CrossDomainMessenger, + kovan: Kovan__OVM_L1CrossDomainMessenger, + goerli: Goerli__OVM_L1CrossDomainMessenger, + }[network], + OVM_L1ETHGateway: { + mainnet: Mainnet__OVM_L1ETHGateway, + kovan: Kovan__OVM_L1ETHGateway, + goerli: Goerli__OVM_L1ETHGateway, + }[network], + OVM_L1MultiMessageRelayer: { + mainnet: Mainnet__OVM_L1MultiMessageRelayer, + kovan: Kovan__OVM_L1MultiMessageRelayer, + goerli: Goerli__OVM_L1MultiMessageRelayer, + }[network], + OVM_SafetyChecker: { + mainnet: Mainnet__OVM_SafetyChecker, + kovan: Kovan__OVM_SafetyChecker, + goerli: Goerli__OVM_SafetyChecker, + }[network], + OVM_StateCommitmentChain: { + mainnet: Mainnet__OVM_StateCommitmentChain, + kovan: Kovan__OVM_StateCommitmentChain, + goerli: Goerli__OVM_StateCommitmentChain, + }[network], + OVM_StateManagerFactory: { + mainnet: Mainnet__OVM_StateManagerFactory, + kovan: Kovan__OVM_StateManagerFactory, + goerli: Goerli__OVM_StateManagerFactory, + }[network], + OVM_StateTransitionerFactory: { + mainnet: Mainnet__OVM_StateTransitionerFactory, + kovan: Kovan__OVM_StateTransitionerFactory, + goerli: Goerli__OVM_StateTransitionerFactory, + }[network], + Proxy__OVM_L1CrossDomainMessenger: { + mainnet: Mainnet__Proxy__OVM_L1CrossDomainMessenger, + kovan: Kovan__Proxy__OVM_L1CrossDomainMessenger, + goerli: Goerli__Proxy__OVM_L1CrossDomainMessenger, + }[network], + Proxy__OVM_L1ETHGateway: { + mainnet: Mainnet__Proxy__OVM_L1ETHGateway, + kovan: Kovan__Proxy__OVM_L1ETHGateway, + goerli: Goerli__Proxy__OVM_L1ETHGateway, + }[network], + mockOVM_BondManager: { + mainnet: Mainnet__mockOVM_BondManager, + kovan: Kovan__mockOVM_BondManager, + goerli: Goerli__mockOVM_BondManager, + }[network], + } +} + +const OVM_ETH = require('../artifacts-ovm/contracts/optimistic-ethereum/OVM/predeploys/OVM_ETH.sol/OVM_ETH.json') +const OVM_L2CrossDomainMessenger = require('../artifacts-ovm/contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L2CrossDomainMessenger.sol/OVM_L2CrossDomainMessenger.json') +const OVM_L2ToL1MessagePasser = require('../artifacts-ovm/contracts/optimistic-ethereum/OVM/predeploys/OVM_L2ToL1MessagePasser.sol/OVM_L2ToL1MessagePasser.json') +const OVM_L1MessageSender = require('../artifacts-ovm/contracts/optimistic-ethereum/OVM/predeploys/OVM_L1MessageSender.sol/OVM_L1MessageSender.json') +const OVM_DeployerWhitelist = require('../artifacts-ovm/contracts/optimistic-ethereum/OVM/predeploys/OVM_DeployerWhitelist.sol/OVM_DeployerWhitelist.json') +const OVM_ECDSAContractAccount = require('../artifacts-ovm/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol/OVM_ECDSAContractAccount.json') +const OVM_SequencerEntrypoint = require('../artifacts-ovm/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerEntrypoint.sol/OVM_SequencerEntrypoint.json') +const ERC1820Registry = require('../artifacts-ovm/contracts/optimistic-ethereum/OVM/predeploys/ERC1820Registry.sol/ERC1820Registry.json') +const Lib_AddressManager = require('../artifacts-ovm/contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol/Lib_AddressManager.json') + +export const getL2ContractData = () => { + return { + OVM_ETH: { + abi: OVM_ETH.abi, + address: l2Addresses.OVM_ETH, + }, + OVM_L2CrossDomainMessenger: { + abi: OVM_L2CrossDomainMessenger.abi, + address: l2Addresses.OVM_L2CrossDomainMessenger, + }, + OVM_L2ToL1MessagePasser: { + abi: OVM_L2ToL1MessagePasser.abi, + address: l2Addresses.OVM_L2ToL1MessagePasser, + }, + OVM_L1MessageSender: { + abi: OVM_L1MessageSender.abi, + address: l2Addresses.OVM_L1MessageSender, + }, + OVM_DeployerWhitelist: { + abi: OVM_DeployerWhitelist.abi, + address: l2Addresses.OVM_DeployerWhitelist, + }, + OVM_ECDSAContractAccount: { + abi: OVM_ECDSAContractAccount.abi, + address: l2Addresses.OVM_ECDSAContractAccount, + }, + OVM_SequencerEntrypoint: { + abi: OVM_SequencerEntrypoint.abi, + address: l2Addresses.OVM_SequencerEntrypoint, + }, + ERC1820Registry: { + abi: ERC1820Registry.abi, + address: l2Addresses.ERC1820Registry, + }, + Lib_AddressManager: { + abi: Lib_AddressManager.abi, + address: l2Addresses.Lib_AddressManager, + }, + } +} diff --git a/packages/contracts/src/index.ts b/packages/contracts/src/index.ts index 85ec437261a7..b38a30ad8e55 100644 --- a/packages/contracts/src/index.ts +++ b/packages/contracts/src/index.ts @@ -2,3 +2,4 @@ export * from './contract-defs' export * from './state-dump/get-dump' export * from './contract-deployment' export * from './predeploys' +export * from './connect-contracts' diff --git a/packages/contracts/test/connect-contracts.spec.ts b/packages/contracts/test/connect-contracts.spec.ts new file mode 100644 index 000000000000..fdf5684507d6 --- /dev/null +++ b/packages/contracts/test/connect-contracts.spec.ts @@ -0,0 +1,61 @@ +import { ethers } from 'hardhat' +import { Signer, Contract } from 'ethers' +import { + connectL1Contracts, + connectL2Contracts, +} from '../dist/connect-contracts' +import { expect } from './setup' + +describe('connectL1Contracts', () => { + let user: Signer + const l1ContractNames = [ + 'addressManager', + 'canonicalTransactionChain', + 'executionManager', + 'fraudVerifier', + 'ethGateway', + 'multiMessageRelayer', + 'stateCommitmentChain', + 'xDomainMessengerProxy', + 'l1EthGatewayProxy', + 'bondManager', + ] + + const l2ContractNames = [ + 'eth', + 'xDomainMessenger', + 'messagePasser', + 'messageSender', + 'deployerWhiteList', + 'ecdsaContractAccount', + 'sequencerEntrypoint', + 'erc1820Registry', + 'addressManager', + ] + + before(async () => { + ;[user] = await ethers.getSigners() + }) + + it(`connectL1Contracts should throw error if signer or provider isn't provided.`, async () => { + try { + await connectL1Contracts(undefined, 'mainnet') + } catch (err) { + expect(err.message).to.be.equal('signerOrProvider argument is undefined') + } + }) + + for (const name of l1ContractNames) { + it(`connectL1Contracts should return a contract assigned to a field named "${name}"`, async () => { + const l1Contracts = await connectL1Contracts(user, 'mainnet') + expect(l1Contracts[name]).to.be.an.instanceOf(Contract) + }) + } + + for (const name of l2ContractNames) { + it(`connectL2Contracts should return a contract assigned to a field named "${name}"`, async () => { + const l2Contracts = await connectL2Contracts(user) + expect(l2Contracts[name]).to.be.an.instanceOf(Contract) + }) + } +}) diff --git a/packages/contracts/tsconfig.json b/packages/contracts/tsconfig.json index aa33388023ee..b4e5ff40ae0e 100644 --- a/packages/contracts/tsconfig.json +++ b/packages/contracts/tsconfig.json @@ -1,6 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "resolveJsonModule": true + "resolveJsonModule": true, } } From 257deb7044439e9c5c11f7511d080df93909a4b2 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Mon, 21 Jun 2021 13:04:46 -0700 Subject: [PATCH 105/125] fix: prevent overflow in abi encoding (#1135) * l2geth: prevent overflow in abi encoding to ovm codec tx * chore: add changeset --- .changeset/happy-dancers-raise.md | 5 +++++ l2geth/core/state_transition_ovm.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/happy-dancers-raise.md diff --git a/.changeset/happy-dancers-raise.md b/.changeset/happy-dancers-raise.md new file mode 100644 index 000000000000..a0e37bb17399 --- /dev/null +++ b/.changeset/happy-dancers-raise.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/l2geth': patch +--- + +Prevent overflows in abi encoding of ovm codec transaction from geth types.Transaction diff --git a/l2geth/core/state_transition_ovm.go b/l2geth/core/state_transition_ovm.go index fbdf124d3cbc..5d84acbc4828 100644 --- a/l2geth/core/state_transition_ovm.go +++ b/l2geth/core/state_transition_ovm.go @@ -111,7 +111,7 @@ func EncodeSimulatedMessage(msg Message, timestamp, blockNumber *big.Int, execut uint8(msg.QueueOrigin()), *msg.L1MessageSender(), *to, - big.NewInt(int64(msg.Gas())), + new(big.Int).SetUint64(msg.Gas()), msg.Data(), } From b8e2d685a1066a21ea1fc33a1eae8f6e1df5c12e Mon Sep 17 00:00:00 2001 From: Annie Ke Date: Mon, 21 Jun 2021 15:44:28 -0700 Subject: [PATCH 106/125] tests: replica syncing (#981) * [wip] add l2_dtl and replica images * passing basic dummy tx test * add erc20 test * add sync test to ci Co-authored-by: Mark Tyneway --- .changeset/tidy-rivers-press.md | 6 + .github/workflows/sync-tests.yml | 1 + ...rifier.spec.ts => 1-sync-verifier.spec.ts} | 16 ++- .../sync-tests/2-sync-replica.spec.ts | 119 ++++++++++++++++++ .../test/shared/docker-compose.ts | 1 + integration-tests/test/shared/utils.ts | 22 +++- ops/README.md | 6 +- ops/docker-compose.yml | 32 ++++- .../src/services/l2-ingestion/service.ts | 6 +- 9 files changed, 192 insertions(+), 17 deletions(-) create mode 100644 .changeset/tidy-rivers-press.md rename integration-tests/sync-tests/{sync-verifier.spec.ts => 1-sync-verifier.spec.ts} (90%) create mode 100644 integration-tests/sync-tests/2-sync-replica.spec.ts diff --git a/.changeset/tidy-rivers-press.md b/.changeset/tidy-rivers-press.md new file mode 100644 index 000000000000..16e413fc8e17 --- /dev/null +++ b/.changeset/tidy-rivers-press.md @@ -0,0 +1,6 @@ +--- +'@eth-optimism/integration-tests': patch +'@eth-optimism/data-transport-layer': patch +--- + +Add replica sync test to integration tests; handle 0 L2 blocks in DTL diff --git a/.github/workflows/sync-tests.yml b/.github/workflows/sync-tests.yml index a6b2a38cc51a..2e3c94d37f3c 100644 --- a/.github/workflows/sync-tests.yml +++ b/.github/workflows/sync-tests.yml @@ -34,6 +34,7 @@ jobs: working-directory: ./integration-tests run: | yarn + yarn build:integration yarn test:sync - name: Collect docker logs on failure diff --git a/integration-tests/sync-tests/sync-verifier.spec.ts b/integration-tests/sync-tests/1-sync-verifier.spec.ts similarity index 90% rename from integration-tests/sync-tests/sync-verifier.spec.ts rename to integration-tests/sync-tests/1-sync-verifier.spec.ts index 2c931eb87c4f..acc5963b3ec1 100644 --- a/integration-tests/sync-tests/sync-verifier.spec.ts +++ b/integration-tests/sync-tests/1-sync-verifier.spec.ts @@ -2,7 +2,12 @@ import chai, { expect } from 'chai' import { Wallet, BigNumber, providers } from 'ethers' import { injectL2Context } from '@eth-optimism/core-utils' -import { sleep, l2Provider, verifierProvider } from '../test/shared/utils' +import { + sleep, + l2Provider, + verifierProvider, + waitForL2Geth, +} from '../test/shared/utils' import { OptimismEnv } from '../test/shared/env' import { DockerComposeNetwork } from '../test/shared/docker-compose' @@ -33,14 +38,7 @@ describe('Syncing a verifier', () => { verifier = new DockerComposeNetwork(['verifier']) await verifier.up({ commandOptions: ['--scale', 'verifier=1'] }) - // Wait for verifier to be looping - let logs = await verifier.logs() - while (!logs.out.includes('Starting Sequencer Loop')) { - await sleep(500) - logs = await verifier.logs() - } - - provider = injectL2Context(verifierProvider) + provider = await waitForL2Geth(verifierProvider) } const syncVerifier = async (sequencerBlockNumber: number) => { diff --git a/integration-tests/sync-tests/2-sync-replica.spec.ts b/integration-tests/sync-tests/2-sync-replica.spec.ts new file mode 100644 index 000000000000..ae8a108fbd03 --- /dev/null +++ b/integration-tests/sync-tests/2-sync-replica.spec.ts @@ -0,0 +1,119 @@ +import chai, { expect } from 'chai' +import { Wallet, Contract, ContractFactory, providers } from 'ethers' +import { ethers } from 'hardhat' +import { injectL2Context } from '@eth-optimism/core-utils' + +import { + sleep, + l2Provider, + replicaProvider, + waitForL2Geth, +} from '../test/shared/utils' +import { OptimismEnv } from '../test/shared/env' +import { DockerComposeNetwork } from '../test/shared/docker-compose' + +describe('Syncing a replica', () => { + let env: OptimismEnv + let wallet: Wallet + let replica: DockerComposeNetwork + let provider: providers.JsonRpcProvider + + const sequencerProvider = injectL2Context(l2Provider) + + /* Helper functions */ + + const startReplica = async () => { + // Bring up new replica + replica = new DockerComposeNetwork(['replica']) + await replica.up({ + commandOptions: ['--scale', 'replica=1'], + }) + + provider = await waitForL2Geth(replicaProvider) + } + + const syncReplica = async (sequencerBlockNumber: number) => { + // Wait until replica has caught up to the sequencer + let latestReplicaBlock = (await provider.getBlock('latest')) as any + while (latestReplicaBlock.number < sequencerBlockNumber) { + await sleep(500) + latestReplicaBlock = (await provider.getBlock('latest')) as any + } + + return provider.getBlock(sequencerBlockNumber) + } + + before(async () => { + env = await OptimismEnv.new() + wallet = env.l2Wallet + }) + + after(async () => { + await replica.stop('replica') + await replica.rm() + }) + + describe('Basic transactions and ERC20s', () => { + const initialAmount = 1000 + const tokenName = 'OVM Test' + const tokenDecimals = 8 + const TokenSymbol = 'OVM' + + let other: Wallet + let Factory__ERC20: ContractFactory + let ERC20: Contract + + before(async () => { + other = Wallet.createRandom().connect(ethers.provider) + Factory__ERC20 = await ethers.getContractFactory('ERC20', wallet) + }) + + it('should sync dummy transaction', async () => { + const tx = { + to: '0x' + '1234'.repeat(10), + gasLimit: 4000000, + gasPrice: 0, + data: '0x', + value: 0, + } + const result = await wallet.sendTransaction(tx) + await result.wait() + + const latestSequencerBlock = (await sequencerProvider.getBlock( + 'latest' + )) as any + + await startReplica() + + const matchingReplicaBlock = (await syncReplica( + latestSequencerBlock.number + )) as any + + expect(matchingReplicaBlock.stateRoot).to.eq( + latestSequencerBlock.stateRoot + ) + }) + + it('should sync ERC20 deployment and transfer', async () => { + ERC20 = await Factory__ERC20.deploy( + initialAmount, + tokenName, + tokenDecimals, + TokenSymbol + ) + + const transfer = await ERC20.transfer(other.address, 100) + await transfer.wait() + + const latestSequencerBlock = (await provider.getBlock('latest')) as any + + const matchingReplicaBlock = (await syncReplica( + latestSequencerBlock.number + )) as any + + expect(matchingReplicaBlock.stateRoot).to.eq( + latestSequencerBlock.stateRoot + ) + }) + }) +}) diff --git a/integration-tests/test/shared/docker-compose.ts b/integration-tests/test/shared/docker-compose.ts index d283fd0eae65..8ecf6beae112 100644 --- a/integration-tests/test/shared/docker-compose.ts +++ b/integration-tests/test/shared/docker-compose.ts @@ -8,6 +8,7 @@ type ServiceNames = | 'l2geth' | 'relayer' | 'verifier' + | 'replica' const OPS_DIRECTORY = path.join(process.cwd(), '../ops') const DEFAULT_SERVICES: ServiceNames[] = [ diff --git a/integration-tests/test/shared/utils.ts b/integration-tests/test/shared/utils.ts index 5e9214afaae0..5b91a7b68e8c 100644 --- a/integration-tests/test/shared/utils.ts +++ b/integration-tests/test/shared/utils.ts @@ -4,7 +4,7 @@ import { getContractFactory, getContractInterface, } from '@eth-optimism/contracts' -import { remove0x, Watcher } from '@eth-optimism/core-utils' +import { injectL2Context, remove0x, Watcher } from '@eth-optimism/core-utils' import { Contract, Wallet, @@ -22,9 +22,11 @@ const env = cleanEnv(process.env, { L1_URL: str({ default: 'http://localhost:9545' }), L2_URL: str({ default: 'http://localhost:8545' }), VERIFIER_URL: str({ default: 'http://localhost:8547' }), + REPLICA_URL: str({ default: 'http://localhost:8549' }), L1_POLLING_INTERVAL: num({ default: 10 }), L2_POLLING_INTERVAL: num({ default: 10 }), VERIFIER_POLLING_INTERVAL: num({ default: 10 }), + REPLICA_POLLING_INTERVAL: num({ default: 10 }), PRIVATE_KEY: str({ default: '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80', @@ -44,6 +46,9 @@ l2Provider.pollingInterval = env.L2_POLLING_INTERVAL export const verifierProvider = new providers.JsonRpcProvider(env.VERIFIER_URL) verifierProvider.pollingInterval = env.VERIFIER_POLLING_INTERVAL +export const replicaProvider = new providers.JsonRpcProvider(env.REPLICA_URL) +replicaProvider.pollingInterval = env.REPLICA_POLLING_INTERVAL + // The sequencer private key which is funded on L1 export const l1Wallet = new Wallet(env.PRIVATE_KEY, l1Provider) @@ -111,3 +116,18 @@ const abiCoder = new utils.AbiCoder() export const encodeSolidityRevertMessage = (_reason: string): string => { return '0x08c379a0' + remove0x(abiCoder.encode(['string'], [_reason])) } + +export const waitForL2Geth = async ( + provider: providers.JsonRpcProvider +): Promise => { + let ready: boolean = false + while (!ready) { + try { + await provider.getNetwork() + ready = true + } catch (error) { + await sleep(1000) + } + } + return injectL2Context(provider) +} diff --git a/ops/README.md b/ops/README.md index 1dc7858efb0e..6838b666ec53 100644 --- a/ops/README.md +++ b/ops/README.md @@ -30,12 +30,14 @@ docker-compose \ up --build --detach ``` -Optionally, run a verifier along the rest of the stack. +Optionally, run a verifier along the rest of the stack. Run a replica with the same command by switching the service name! ``` -docker-compose up --scale verifier=1 \ +docker-compose up --scale \ + verifier=1 \ --build --detach ``` + A Makefile has been provided for convience. The following targets are available. - make up - make down diff --git a/ops/docker-compose.yml b/ops/docker-compose.yml index 496f3738705f..9791365d6404 100644 --- a/ops/docker-compose.yml +++ b/ops/docker-compose.yml @@ -62,6 +62,7 @@ services: # connect to the 2 layers DATA_TRANSPORT_LAYER__L1_RPC_ENDPOINT: http://l1_chain:8545 DATA_TRANSPORT_LAYER__L2_RPC_ENDPOINT: http://l2geth:8545 + DATA_TRANSPORT_LAYER__SYNC_FROM_L2: 'true' DATA_TRANSPORT_LAYER__L2_CHAIN_ID: 420 ports: - ${DTL_PORT:-7878}:7878 @@ -141,23 +142,46 @@ services: build: context: .. dockerfile: ./ops/docker/Dockerfile.geth - # override with the geth script and the env vars required for it entrypoint: sh ./geth.sh env_file: - ./envs/geth.env environment: ETH1_HTTP: http://l1_chain:8545 ROLLUP_STATE_DUMP_PATH: http://deployer:8081/state-dump.latest.json - # used for getting the addresses URL: http://deployer:8081/addresses.json - # connecting to the DTL ROLLUP_CLIENT_HTTP: http://dtl:7878 + ROLLUP_BACKEND: 'l1' ETH1_CTC_DEPLOYMENT_HEIGHT: 8 RETRIES: 60 - IS_VERIFIER: "true" + ROLLUP_VERIFIER_ENABLE: 'true' ports: - ${VERIFIER_HTTP_PORT:-8547}:8545 - ${VERIFIER_WS_PORT:-8548}:8546 + + replica: + depends_on: + - dtl + image: ethereumoptimism/l2geth + deploy: + replicas: 0 + build: + context: .. + dockerfile: ./ops/docker/Dockerfile.geth + entrypoint: sh ./geth.sh + env_file: + - ./envs/geth.env + environment: + ETH1_HTTP: http://l1_chain:8545 + ROLLUP_STATE_DUMP_PATH: http://deployer:8081/state-dump.latest.json + URL: http://deployer:8081/addresses.json + ROLLUP_CLIENT_HTTP: http://dtl:7878 + ROLLUP_BACKEND: 'l2' + ROLLUP_VERIFIER_ENABLE: 'true' + ETH1_CTC_DEPLOYMENT_HEIGHT: 8 + RETRIES: 60 + ports: + - ${L2GETH_HTTP_PORT:-8549}:8545 + - ${L2GETH_WS_PORT:-8550}:8546 integration_tests: image: ethereumoptimism/integration-tests diff --git a/packages/data-transport-layer/src/services/l2-ingestion/service.ts b/packages/data-transport-layer/src/services/l2-ingestion/service.ts index 9b3eead27be5..dae374f7c756 100644 --- a/packages/data-transport-layer/src/services/l2-ingestion/service.ts +++ b/packages/data-transport-layer/src/services/l2-ingestion/service.ts @@ -88,7 +88,11 @@ export class L2IngestionService extends BaseService { ) // We're already at the head, so no point in attempting to sync. - if (highestSyncedL2BlockNumber === targetL2Block) { + // Also wait on edge case of no L2 transactions + if ( + highestSyncedL2BlockNumber === targetL2Block || + currentL2Block === 0 + ) { await sleep(this.options.pollingInterval) continue } From 735cd78f5222ca46c4c2f41fecf9bc1c3ae52e3c Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Mon, 21 Jun 2021 18:45:38 -0400 Subject: [PATCH 107/125] fix[relayer]: update exported files list in package.json (#1138) * fix[relayer]: update exported files * chore: add changeset --- .changeset/lazy-ghosts-shop.md | 5 +++++ packages/message-relayer/package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/lazy-ghosts-shop.md diff --git a/.changeset/lazy-ghosts-shop.md b/.changeset/lazy-ghosts-shop.md new file mode 100644 index 000000000000..9fb797f017e9 --- /dev/null +++ b/.changeset/lazy-ghosts-shop.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/message-relayer': patch +--- + +Update relayer package JSON to correctly export all files in dist diff --git a/packages/message-relayer/package.json b/packages/message-relayer/package.json index 9d6f1ffd4c32..ad171597ebe7 100644 --- a/packages/message-relayer/package.json +++ b/packages/message-relayer/package.json @@ -5,7 +5,7 @@ "main": "dist/index", "types": "dist/index", "files": [ - "dist/index" + "dist/*" ], "scripts": { "start": "node ./exec/run-message-relayer.js", From dd8edc7b278b5f6abaa35c61c27bbc19ab0deaa3 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Mon, 21 Jun 2021 16:30:31 -0700 Subject: [PATCH 108/125] fix: import path (#1141) * fix: correct import path for altered contract path * chore: add changeset --- .changeset/bright-turtles-juggle.md | 5 +++++ packages/contracts/src/contract-data.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/bright-turtles-juggle.md diff --git a/.changeset/bright-turtles-juggle.md b/.changeset/bright-turtles-juggle.md new file mode 100644 index 000000000000..f796acb74ccb --- /dev/null +++ b/.changeset/bright-turtles-juggle.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/contracts': patch +--- + +Update the ECDSAContractAccount import path in the `contract-data.ts` file for connecting ethers contracts to the L2 contracts diff --git a/packages/contracts/src/contract-data.ts b/packages/contracts/src/contract-data.ts index f492c798f109..c81e80f2430c 100644 --- a/packages/contracts/src/contract-data.ts +++ b/packages/contracts/src/contract-data.ts @@ -133,7 +133,7 @@ const OVM_L2CrossDomainMessenger = require('../artifacts-ovm/contracts/optimisti const OVM_L2ToL1MessagePasser = require('../artifacts-ovm/contracts/optimistic-ethereum/OVM/predeploys/OVM_L2ToL1MessagePasser.sol/OVM_L2ToL1MessagePasser.json') const OVM_L1MessageSender = require('../artifacts-ovm/contracts/optimistic-ethereum/OVM/predeploys/OVM_L1MessageSender.sol/OVM_L1MessageSender.json') const OVM_DeployerWhitelist = require('../artifacts-ovm/contracts/optimistic-ethereum/OVM/predeploys/OVM_DeployerWhitelist.sol/OVM_DeployerWhitelist.json') -const OVM_ECDSAContractAccount = require('../artifacts-ovm/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol/OVM_ECDSAContractAccount.json') +const OVM_ECDSAContractAccount = require('../artifacts-ovm/contracts/optimistic-ethereum/OVM/predeploys/OVM_ECDSAContractAccount.sol/OVM_ECDSAContractAccount.json') const OVM_SequencerEntrypoint = require('../artifacts-ovm/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerEntrypoint.sol/OVM_SequencerEntrypoint.json') const ERC1820Registry = require('../artifacts-ovm/contracts/optimistic-ethereum/OVM/predeploys/ERC1820Registry.sol/ERC1820Registry.json') const Lib_AddressManager = require('../artifacts-ovm/contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol/Lib_AddressManager.json') From 31f517a2a2fb5e36bb9521d3837556d5cafeaff5 Mon Sep 17 00:00:00 2001 From: Liam Horne Date: Mon, 21 Jun 2021 19:56:00 -0400 Subject: [PATCH 109/125] refactor: improve logging for batch submission timeout scenarios (#1120) --- .changeset/short-badgers-itch.md | 5 +++++ .../src/batch-submitter/batch-submitter.ts | 11 +++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 .changeset/short-badgers-itch.md diff --git a/.changeset/short-badgers-itch.md b/.changeset/short-badgers-itch.md new file mode 100644 index 000000000000..4667285782c7 --- /dev/null +++ b/.changeset/short-badgers-itch.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/batch-submitter': patch +--- + +Improved logging of batch submission timeout logs diff --git a/packages/batch-submitter/src/batch-submitter/batch-submitter.ts b/packages/batch-submitter/src/batch-submitter/batch-submitter.ts index c487d86dfac9..9c82d8212b40 100644 --- a/packages/batch-submitter/src/batch-submitter/batch-submitter.ts +++ b/packages/batch-submitter/src/batch-submitter/batch-submitter.ts @@ -143,15 +143,16 @@ export abstract class BatchSubmitter { protected _shouldSubmitBatch(batchSizeInBytes: number): boolean { const currentTimestamp = Date.now() - const isTimeoutReached = - this.lastBatchSubmissionTimestamp + this.maxBatchSubmissionTime <= - currentTimestamp if (batchSizeInBytes < this.minTxSize) { - if (!isTimeoutReached) { + const timeSinceLastSubmission = + currentTimestamp - this.lastBatchSubmissionTimestamp + if (timeSinceLastSubmission < this.maxBatchSubmissionTime) { this.logger.info( 'Skipping batch submission. Batch too small & max submission timeout not reached.', { batchSizeInBytes, + timeSinceLastSubmission, + maxBatchSubmissionTime: this.maxBatchSubmissionTime, minTxSize: this.minTxSize, lastBatchSubmissionTimestamp: this.lastBatchSubmissionTimestamp, currentTimestamp, @@ -161,6 +162,8 @@ export abstract class BatchSubmitter { } this.logger.info('Timeout reached, proceeding with batch submission.', { batchSizeInBytes, + timeSinceLastSubmission, + maxBatchSubmissionTime: this.maxBatchSubmissionTime, lastBatchSubmissionTimestamp: this.lastBatchSubmissionTimestamp, currentTimestamp, }) From 29431d6a9d003f8e6ca974f14229d9c38c336795 Mon Sep 17 00:00:00 2001 From: Liam Horne Date: Tue, 22 Jun 2021 09:48:24 -0400 Subject: [PATCH 110/125] Add highest L1 and L2 block number Gauge metrics to DTL (#1125) * build: add prom-client to data-transport-layer * refactor: thread metrics more carefully through data-transport-layer; add two new metrics * style: fix some style issues * refactor: make metrics mandatory * refactor: move metrics register code to top of file * style: apply linting * refactor: move promethesus initialization after express * refactor: move promBundle call up, provide registry * build: add changeset --- .changeset/rude-eels-count.md | 5 +++ packages/data-transport-layer/package.json | 1 + .../src/services/l1-ingestion/service.ts | 29 +++++++++++++- .../src/services/l2-ingestion/service.ts | 24 +++++++++++- .../src/services/main/service.ts | 15 ++++++- .../data-transport-layer/src/services/run.ts | 1 - .../src/services/server/service.ts | 39 ++++++++----------- 7 files changed, 87 insertions(+), 27 deletions(-) create mode 100644 .changeset/rude-eels-count.md diff --git a/.changeset/rude-eels-count.md b/.changeset/rude-eels-count.md new file mode 100644 index 000000000000..9b10bfd2a3bf --- /dev/null +++ b/.changeset/rude-eels-count.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/data-transport-layer': patch +--- + +Add highest L1 and L2 block number Gauge metrics to DTL diff --git a/packages/data-transport-layer/package.json b/packages/data-transport-layer/package.json index 7982c69b08f1..5e85d1ee437b 100644 --- a/packages/data-transport-layer/package.json +++ b/packages/data-transport-layer/package.json @@ -68,6 +68,7 @@ "mocha": "^8.3.2", "pino-pretty": "^4.7.1", "prettier": "^2.2.1", + "prom-client": "^13.1.0", "rimraf": "^3.0.2", "ts-node": "^9.1.1", "typescript": "^4.2.3" diff --git a/packages/data-transport-layer/src/services/l1-ingestion/service.ts b/packages/data-transport-layer/src/services/l1-ingestion/service.ts index b8b8cb4c39b2..62ca2bd38fef 100644 --- a/packages/data-transport-layer/src/services/l1-ingestion/service.ts +++ b/packages/data-transport-layer/src/services/l1-ingestion/service.ts @@ -1,9 +1,10 @@ /* Imports: External */ import { fromHexString, EventArgsAddressSet } from '@eth-optimism/core-utils' -import { BaseService } from '@eth-optimism/common-ts' +import { BaseService, Metrics } from '@eth-optimism/common-ts' import { JsonRpcProvider } from '@ethersproject/providers' import { LevelUp } from 'levelup' import { ethers, constants } from 'ethers' +import { Gauge } from 'prom-client' /* Imports: Internal */ import { TransportDB } from '../../db/transport-db' @@ -21,9 +22,25 @@ import { handleEventsStateBatchAppended } from './handlers/state-batch-appended' import { L1DataTransportServiceOptions } from '../main/service' import { MissingElementError, EventName } from './handlers/errors' +interface L1IngestionMetrics { + highestSyncedL1Block: Gauge +} + +const registerMetrics = ({ + client, + registry, +}: Metrics): L1IngestionMetrics => ({ + highestSyncedL1Block: new client.Gauge({ + name: 'data_transport_layer_highest_synced_l1_block', + help: 'Highest Synced L1 Block Number', + registers: [registry], + }), +}) + export interface L1IngestionServiceOptions extends L1DataTransportServiceOptions { db: LevelUp + metrics: Metrics } const optionSettings = { @@ -61,6 +78,8 @@ export class L1IngestionService extends BaseService { super('L1_Ingestion_Service', options, optionSettings) } + private l1IngestionMetrics: L1IngestionMetrics + private state: { db: TransportDB contracts: OptimismContracts @@ -72,6 +91,8 @@ export class L1IngestionService extends BaseService { protected async _init(): Promise { this.state.db = new TransportDB(this.options.db) + this.l1IngestionMetrics = registerMetrics(this.metrics) + this.state.l1RpcProvider = typeof this.options.l1RpcProvider === 'string' ? new JsonRpcProvider(this.options.l1RpcProvider) @@ -199,6 +220,8 @@ export class L1IngestionService extends BaseService { await this.state.db.setHighestSyncedL1Block(targetL1Block) + this.l1IngestionMetrics.highestSyncedL1Block.set(targetL1Block) + if ( currentL1Block - highestSyncedL1Block < this.options.logsPerPollingInterval @@ -240,6 +263,10 @@ export class L1IngestionService extends BaseService { lastGoodElement.blockNumber ) + this.l1IngestionMetrics.highestSyncedL1Block.set( + lastGoodElement.blockNumber + ) + // Something we should be keeping track of. this.logger.warn('recovering from a missing event', { eventName, diff --git a/packages/data-transport-layer/src/services/l2-ingestion/service.ts b/packages/data-transport-layer/src/services/l2-ingestion/service.ts index dae374f7c756..50ea6e514874 100644 --- a/packages/data-transport-layer/src/services/l2-ingestion/service.ts +++ b/packages/data-transport-layer/src/services/l2-ingestion/service.ts @@ -1,10 +1,11 @@ /* Imports: External */ -import { BaseService } from '@eth-optimism/common-ts' +import { BaseService, Metrics } from '@eth-optimism/common-ts' import { JsonRpcProvider } from '@ethersproject/providers' import { BigNumber } from 'ethers' import { LevelUp } from 'levelup' import axios from 'axios' import bfj from 'bfj' +import { Gauge } from 'prom-client' /* Imports: Internal */ import { TransportDB } from '../../db/transport-db' @@ -12,6 +13,21 @@ import { sleep, toRpcHexString, validators } from '../../utils' import { L1DataTransportServiceOptions } from '../main/service' import { handleSequencerBlock } from './handlers/transaction' +interface L2IngestionMetrics { + highestSyncedL2Block: Gauge +} + +const registerMetrics = ({ + client, + registry, +}: Metrics): L2IngestionMetrics => ({ + highestSyncedL2Block: new client.Gauge({ + name: 'data_transport_layer_highest_synced_l2_block', + help: 'Highest Synced L2 Block Number', + registers: [registry], + }), +}) + export interface L2IngestionServiceOptions extends L1DataTransportServiceOptions { db: LevelUp @@ -52,6 +68,8 @@ export class L2IngestionService extends BaseService { super('L2_Ingestion_Service', options, optionSettings) } + private l2IngestionMetrics: L2IngestionMetrics + private state: { db: TransportDB l2RpcProvider: JsonRpcProvider @@ -64,6 +82,8 @@ export class L2IngestionService extends BaseService { ) } + this.l2IngestionMetrics = registerMetrics(this.metrics) + this.state.db = new TransportDB(this.options.db) this.state.l2RpcProvider = @@ -113,6 +133,8 @@ export class L2IngestionService extends BaseService { await this.state.db.setHighestSyncedUnconfirmedBlock(targetL2Block) + this.l2IngestionMetrics.highestSyncedL2Block.set(targetL2Block) + if ( currentL2Block - highestSyncedL2BlockNumber < this.options.transactionsPerPollingInterval diff --git a/packages/data-transport-layer/src/services/main/service.ts b/packages/data-transport-layer/src/services/main/service.ts index b4d0839a360e..c8567a448d3b 100644 --- a/packages/data-transport-layer/src/services/main/service.ts +++ b/packages/data-transport-layer/src/services/main/service.ts @@ -1,5 +1,5 @@ /* Imports: External */ -import { BaseService, Logger } from '@eth-optimism/common-ts' +import { BaseService, Logger, Metrics } from '@eth-optimism/common-ts' import { LevelUp } from 'levelup' import level from 'level' @@ -31,7 +31,6 @@ export interface L1DataTransportServiceOptions { useSentry?: boolean sentryDsn?: string sentryTraceRate?: number - enableMetrics?: boolean defaultBackend: string } @@ -65,8 +64,18 @@ export class L1DataTransportService extends BaseService { private _initializeApp() { // TODO: Maybe pass this in as a parameter instead of creating it here? this.state.app = express() + if (this.options.useSentry) { this._initSentry() } - if (this.options.enableMetrics) { - this._initMetrics() - } + this.state.app.use(cors()) + + // Add prometheus middleware to express BEFORE route registering + this.state.app.use( + // This also serves metrics on port 3000 at /metrics + promBundle({ + // Provide metrics registry that other metrics uses + promRegistry: this.metrics.registry, + includeMethod: true, + includePath: true, + }) + ) + this._registerAllRoutes() + // Sentry error handling must be after all controllers // and before other error middleware if (this.options.useSentry) { @@ -148,25 +162,6 @@ export class L1TransportServer extends BaseService { this.state.app.use(Sentry.Handlers.tracingHandler()) } - /** - * Initialize Prometheus metrics collection and endpoint - */ - private _initMetrics() { - this.metrics = new Metrics({ - labels: { - environment: this.options.nodeEnv, - network: this.options.ethNetworkName, - release: this.options.release, - service: this.name, - }, - }) - const metricsMiddleware = promBundle({ - includeMethod: true, - includePath: true, - }) - this.state.app.use(metricsMiddleware) - } - /** * Registers a route on the server. * From df5ff890fe6816c0273c9a1a677d11c3fd5fbc57 Mon Sep 17 00:00:00 2001 From: Rajiv Patel-O'Connor Date: Tue, 22 Jun 2021 10:30:44 -0400 Subject: [PATCH 111/125] Improve Watcher ability to find transactions (#1107) * remove listeners and use loop to find tx receipt * add yarn ready * moved filters inside loop * [added] changeset --- .changeset/tall-plums-behave.md | 5 +++ package.json | 1 + packages/core-utils/src/watcher.ts | 63 ++++++++++++------------------ 3 files changed, 31 insertions(+), 38 deletions(-) create mode 100644 .changeset/tall-plums-behave.md diff --git a/.changeset/tall-plums-behave.md b/.changeset/tall-plums-behave.md new file mode 100644 index 000000000000..3459ad6e5e1a --- /dev/null +++ b/.changeset/tall-plums-behave.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/core-utils': patch +--- + +improved watcher ability to find transactions during periods of high load diff --git a/package.json b/package.json index b424d60f1095..163c5ef289ac 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "lint:check": "yarn lerna run lint:check", "lint:fix": "yarn lerna run lint:fix", "postinstall": "patch-package", + "ready": "yarn lint && yarn test", "release": "yarn build && yarn changeset publish" }, "dependencies": { diff --git a/packages/core-utils/src/watcher.ts b/packages/core-utils/src/watcher.ts index 49f69bd57ce3..b22cd2e24f95 100644 --- a/packages/core-utils/src/watcher.ts +++ b/packages/core-utils/src/watcher.ts @@ -73,22 +73,31 @@ export class Watcher { msgHash: string, pollForPending: boolean = true ): Promise { - const blockNumber = await layer.provider.getBlockNumber() - const startingBlock = Math.max(blockNumber - this.NUM_BLOCKS_TO_FETCH, 0) - const successFilter = { - address: layer.messengerAddress, - topics: [ethers.utils.id(`RelayedMessage(bytes32)`)], - fromBlock: startingBlock, - } - const failureFilter = { - address: layer.messengerAddress, - topics: [ethers.utils.id(`FailedRelayedMessage(bytes32)`)], - fromBlock: startingBlock, + let matches: ethers.providers.Log[] = [] + + // scan for transaction with specified message + while (matches.length === 0) { + const blockNumber = await layer.provider.getBlockNumber() + const startingBlock = Math.max(blockNumber - this.NUM_BLOCKS_TO_FETCH, 0) + const successFilter: ethers.providers.Filter = { + address: layer.messengerAddress, + topics: [ethers.utils.id(`RelayedMessage(bytes32)`)], + fromBlock: startingBlock + } + const failureFilter: ethers.providers.Filter = { + address: layer.messengerAddress, + topics: [ethers.utils.id(`FailedRelayedMessage(bytes32)`)], + fromBlock: startingBlock + } + const successLogs = await layer.provider.getLogs(successFilter) + const failureLogs = await layer.provider.getLogs(failureFilter) + const logs = successLogs.concat(failureLogs) + matches = logs.filter((log: ethers.providers.Log) => log.data === msgHash) + // exit loop after first iteration if not polling + if (!pollForPending) { + break + } } - const successLogs = await layer.provider.getLogs(successFilter) - const failureLogs = await layer.provider.getLogs(failureFilter) - const logs = successLogs.concat(failureLogs) - const matches = logs.filter((log: any) => log.data === msgHash) // Message was relayed in the past if (matches.length > 0) { @@ -98,30 +107,8 @@ export class Watcher { ) } return layer.provider.getTransactionReceipt(matches[0].transactionHash) - } - if (!pollForPending) { + } else { return Promise.resolve(undefined) } - - // Message has yet to be relayed, poll until it is found - return new Promise(async (resolve, reject) => { - const handleEvent = async (log: any) => { - if (log.data === msgHash) { - try { - const txReceipt = await layer.provider.getTransactionReceipt( - log.transactionHash - ) - layer.provider.off(successFilter) - layer.provider.off(failureFilter) - resolve(txReceipt) - } catch (e) { - reject(e) - } - } - } - - layer.provider.on(successFilter, handleEvent) - layer.provider.on(failureFilter, handleEvent) - }) } } From 017d32319c67477fa73186678a930b20462fc241 Mon Sep 17 00:00:00 2001 From: Maurelian Date: Tue, 22 Jun 2021 10:33:49 -0400 Subject: [PATCH 112/125] Add minimal vscode settings and extensions (#1109) * chore: add minimal vscode settings and extensions * chore: Add "files.trimTrailingWhitespace" to vscode native config * chore: replace vscode prettier plugin with eslint plugin --- .vscode/extensions.json | 12 ++++++++++++ .vscode/settings.json | 11 +++++++++++ 2 files changed, 23 insertions(+) create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 000000000000..db78da54acff --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,12 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. + // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp + + // List of extensions which should be recommended for users of this workspace. + "recommendations": [ + "dbaeumer.vscode-eslint", + "editorconfig.editorconfig", + "juanblanco.solidity", + "golang.go", + ], +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000000..a7defeb9329f --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,11 @@ +{ + "editor.formatOnSave": true, + "[typescript]": { + "editor.defaultFormatter": "dbaeumer.vscode-eslint", + "editor.formatOnSave": true, + }, + "eslint.nodePath": "./node_modules/eslint/bin/", + "eslint.format.enable": true, + "editorconfig.generateAuto": false, + "files.trimTrailingWhitespace": true, +} From fa29b03e114f93ea644b2d77164bbe0d08f7844e Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Tue, 22 Jun 2021 10:42:51 -0400 Subject: [PATCH 113/125] fix[contracts]: remove part of MultiMessageRelayer deployment (#1144) * fix[contracts]: remove part of MultiMessageRelayer deployment * chore: add changeset --- .changeset/red-hornets-design.md | 5 +++++ .../014-OVM_L1MultiMessageRelayer.deploy.ts | 15 --------------- 2 files changed, 5 insertions(+), 15 deletions(-) create mode 100644 .changeset/red-hornets-design.md diff --git a/.changeset/red-hornets-design.md b/.changeset/red-hornets-design.md new file mode 100644 index 000000000000..4660f3a81dc9 --- /dev/null +++ b/.changeset/red-hornets-design.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/contracts': patch +--- + +Updates the deployment of the L1MultiMessageRelayer to NOT set the OVM_L2MessageRelayer address in the AddressManager diff --git a/packages/contracts/deploy/014-OVM_L1MultiMessageRelayer.deploy.ts b/packages/contracts/deploy/014-OVM_L1MultiMessageRelayer.deploy.ts index e814688b95bf..8b74aefa3fdf 100644 --- a/packages/contracts/deploy/014-OVM_L1MultiMessageRelayer.deploy.ts +++ b/packages/contracts/deploy/014-OVM_L1MultiMessageRelayer.deploy.ts @@ -5,7 +5,6 @@ import { DeployFunction } from 'hardhat-deploy/dist/types' import { deployAndRegister, getDeployedContract, - registerAddress, } from '../src/hardhat-deploy-ethers' const deployFn: DeployFunction = async (hre) => { @@ -19,20 +18,6 @@ const deployFn: DeployFunction = async (hre) => { name: 'OVM_L1MultiMessageRelayer', args: [Lib_AddressManager.address], }) - - // OVM_L2MessageRelayer *must* be set to multi message relayer address on mainnet. - if (hre.network.name.includes('mainnet')) { - const OVM_L1MultiMessageRelayer = await getDeployedContract( - hre, - 'OVM_L1MultiMessageRelayer' - ) - - await registerAddress({ - hre, - name: 'OVM_L2MessageRelayer', - address: OVM_L1MultiMessageRelayer.address, - }) - } } deployFn.dependencies = ['Lib_AddressManager'] From 8582fc16e95a6b88089536789d65f85ee45d775e Mon Sep 17 00:00:00 2001 From: CAPtheorem <79423264+CAPtheorem@users.noreply.github.com> Date: Tue, 22 Jun 2021 10:16:28 -0700 Subject: [PATCH 114/125] Define L1 Starting block via OwnershipTransferred rather than AddressSet (#1129) * Update service.ts * Create thirty-years-look.md Co-authored-by: smartcontracts --- .changeset/thirty-years-look.md | 5 +++++ .../src/services/l1-ingestion/service.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/thirty-years-look.md diff --git a/.changeset/thirty-years-look.md b/.changeset/thirty-years-look.md new file mode 100644 index 000000000000..bf8435446302 --- /dev/null +++ b/.changeset/thirty-years-look.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/data-transport-layer': minor +--- + +Define L1 Starting block via OwnershipTransferred (occurring on block 1) rather than AddressSet (occuring on block 2 onwards) diff --git a/packages/data-transport-layer/src/services/l1-ingestion/service.ts b/packages/data-transport-layer/src/services/l1-ingestion/service.ts index 62ca2bd38fef..ad8894c8db5c 100644 --- a/packages/data-transport-layer/src/services/l1-ingestion/service.ts +++ b/packages/data-transport-layer/src/services/l1-ingestion/service.ts @@ -423,7 +423,7 @@ export class L1IngestionService extends BaseService { for (let i = 0; i < currentL1Block; i += 1000000) { const events = await this.state.contracts.Lib_AddressManager.queryFilter( - this.state.contracts.Lib_AddressManager.filters.AddressSet(), + this.state.contracts.Lib_AddressManager.filters.OwnershipTransferred(), i, Math.min(i + 1000000, currentL1Block) ) From d9644c343bfaf009096c8cadf2eb140dbdf2a1ca Mon Sep 17 00:00:00 2001 From: Alejandro Santander Date: Tue, 22 Jun 2021 15:02:27 -0300 Subject: [PATCH 115/125] Easy fix for broken watchers (#1121) * Easy fix for broken watchers * Ran yarn changeset Co-authored-by: Liam Horne --- .changeset/old-wombats-tie.md | 5 +++++ packages/core-utils/src/watcher.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/old-wombats-tie.md diff --git a/.changeset/old-wombats-tie.md b/.changeset/old-wombats-tie.md new file mode 100644 index 000000000000..8ad19a7dbf7a --- /dev/null +++ b/.changeset/old-wombats-tie.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/core-utils': patch +--- + +Minor fix on watchers to pick up finalization of transactions on L1 diff --git a/packages/core-utils/src/watcher.ts b/packages/core-utils/src/watcher.ts index b22cd2e24f95..a13fe7ee90e4 100644 --- a/packages/core-utils/src/watcher.ts +++ b/packages/core-utils/src/watcher.ts @@ -33,7 +33,7 @@ export class Watcher { l2ToL1MsgHash: string, pollForPending: boolean = true ): Promise { - return this.getTransactionReceipt(this.l2, l2ToL1MsgHash, pollForPending) + return this.getTransactionReceipt(this.l1, l2ToL1MsgHash, pollForPending) } public async getL2TransactionReceipt( From 42decb6ebed73d138017cea1de1dd00541e0d893 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Tue, 22 Jun 2021 11:03:03 -0700 Subject: [PATCH 116/125] feat: go packages (#1111) * go: add utils module * readme: update --- go/utils/README.md | 29 +++++++ go/utils/fees/rollup_fee.go | 113 +++++++++++++++++++++++++ go/utils/fees/rollup_fee_test.go | 104 +++++++++++++++++++++++ go/utils/go.mod | 5 ++ go/utils/go.sum | 140 +++++++++++++++++++++++++++++++ 5 files changed, 391 insertions(+) create mode 100644 go/utils/README.md create mode 100644 go/utils/fees/rollup_fee.go create mode 100644 go/utils/fees/rollup_fee_test.go create mode 100644 go/utils/go.mod create mode 100644 go/utils/go.sum diff --git a/go/utils/README.md b/go/utils/README.md new file mode 100644 index 000000000000..ae7a13688a6f --- /dev/null +++ b/go/utils/README.md @@ -0,0 +1,29 @@ +# utils + +This package is meant to hold utilities used by +[Optimistic Ethereum](https://github.com/ethereum-optimism/optimism) written in +Golang. + +## Packages + +### Fees + +Package fees includes helpers for dealing with fees on Optimistic Ethereum + +#### `EncodeTxGasLimit(data []byte, l1GasPrice, l2GasLimit, l2GasPrice *big.Int) *big.Int` + +Encodes `tx.gasLimit` based on the variables that are used to determine it. + +`data` - Calldata of the transaction being sent. This data should *not* include the full signed RLP transaction. + +`l1GasPrice` - gas price on L1 in wei + +`l2GasLimit` - amount of gas provided for execution in L2. Notably, accounts are charged for execution based on this gasLimit, even if the gasUsed ends up being less. + +`l2GasPrice` - gas price on L2 in wei + +#### `DecodeL2GasLimit(gasLimit *big.Int) *big.Int` + +Accepts the return value of `eth_estimateGas` and decodes the L2 gas limit that +is encoded in the return value. This is the gas limit that is passed to the user +contract within the OVM. diff --git a/go/utils/fees/rollup_fee.go b/go/utils/fees/rollup_fee.go new file mode 100644 index 000000000000..13feafbbdef7 --- /dev/null +++ b/go/utils/fees/rollup_fee.go @@ -0,0 +1,113 @@ +package fees + +import ( + "math/big" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/params" +) + +// overhead represents the fixed cost of batch submission of a single +// transaction in gas. +const overhead uint64 = 4200 + 200*params.TxDataNonZeroGasEIP2028 + +// feeScalar is used to scale the calculations in EncodeL2GasLimit +// to prevent them from being too large +const feeScalar uint64 = 10_000_000 + +// TxGasPrice is a constant that determines the result of `eth_gasPrice` +// It is scaled upwards by 50% +// tx.gasPrice is hard coded to 1500 * wei and all transactions must set that +// gas price. +const TxGasPrice uint64 = feeScalar + (feeScalar / 2) + +// BigTxGasPrice is the L2GasPrice as type big.Int +var BigTxGasPrice = new(big.Int).SetUint64(TxGasPrice) +var bigFeeScalar = new(big.Int).SetUint64(feeScalar) + +const tenThousand = 10000 + +var BigTenThousand = new(big.Int).SetUint64(tenThousand) + +// EncodeTxGasLimit computes the `tx.gasLimit` based on the L1/L2 gas prices and +// the L2 gas limit. The L2 gas limit is encoded inside of the lower order bits +// of the number like so: [ | l2GasLimit ] +// [ tx.gaslimit ] +// The lower order bits must be large enough to fit the L2 gas limit, so 10**8 +// is chosen. If higher order bits collide with any bits from the L2 gas limit, +// the L2 gas limit will not be able to be decoded. +// An explicit design goal of this scheme was to make the L2 gas limit be human +// readable. The entire number is interpreted as the gas limit when computing +// the fee, so increasing the L2 Gas limit will increase the fee paid. +// The calculation is: +// l1GasLimit = zero_count(data) * 4 + non_zero_count(data) * 16 + overhead +// roundedL2GasLimit = ceilmod(l2GasLimit, 10_000) +// l1Fee = l1GasPrice * l1GasLimit +// l2Fee = l2GasPrice * roundedL2GasLimit +// sum = l1Fee + l2Fee +// scaled = sum / scalar +// rounded = ceilmod(scaled, tenThousand) +// roundedScaledL2GasLimit = roundedL2GasLimit / tenThousand +// result = rounded + roundedScaledL2GasLimit +// Note that for simplicity purposes, only the calldata is passed into this +// function when in reality the RLP encoded transaction should be. The +// additional cost is added to the overhead constant to prevent the need to RLP +// encode transactions during calls to `eth_estimateGas` +func EncodeTxGasLimit(data []byte, l1GasPrice, l2GasLimit, l2GasPrice *big.Int) *big.Int { + l1GasLimit := calculateL1GasLimit(data, overhead) + roundedL2GasLimit := Ceilmod(l2GasLimit, BigTenThousand) + l1Fee := new(big.Int).Mul(l1GasPrice, l1GasLimit) + l2Fee := new(big.Int).Mul(l2GasPrice, roundedL2GasLimit) + sum := new(big.Int).Add(l1Fee, l2Fee) + scaled := new(big.Int).Div(sum, bigFeeScalar) + rounded := Ceilmod(scaled, BigTenThousand) + roundedScaledL2GasLimit := new(big.Int).Div(roundedL2GasLimit, BigTenThousand) + result := new(big.Int).Add(rounded, roundedScaledL2GasLimit) + return result +} + +func Ceilmod(a, b *big.Int) *big.Int { + remainder := new(big.Int).Mod(a, b) + if remainder.Cmp(common.Big0) == 0 { + return a + } + sum := new(big.Int).Add(a, b) + rounded := new(big.Int).Sub(sum, remainder) + return rounded +} + +// DecodeL2GasLimit decodes the L2 gas limit from an encoded L2 gas limit +func DecodeL2GasLimit(gasLimit *big.Int) *big.Int { + scaled := new(big.Int).Mod(gasLimit, BigTenThousand) + return new(big.Int).Mul(scaled, BigTenThousand) +} + +func DecodeL2GasLimitU64(gasLimit uint64) uint64 { + scaled := gasLimit % tenThousand + return scaled * tenThousand +} + +// calculateL1GasLimit computes the L1 gasLimit based on the calldata and +// constant sized overhead. The overhead can be decreased as the cost of the +// batch submission goes down via contract optimizations. This will not overflow +// under standard network conditions. +func calculateL1GasLimit(data []byte, overhead uint64) *big.Int { + zeroes, ones := zeroesAndOnes(data) + zeroesCost := zeroes * params.TxDataZeroGas + onesCost := ones * params.TxDataNonZeroGasEIP2028 + gasLimit := zeroesCost + onesCost + overhead + return new(big.Int).SetUint64(gasLimit) +} + +func zeroesAndOnes(data []byte) (uint64, uint64) { + var zeroes uint64 + var ones uint64 + for _, byt := range data { + if byt == 0 { + zeroes++ + } else { + ones++ + } + } + return zeroes, ones +} diff --git a/go/utils/fees/rollup_fee_test.go b/go/utils/fees/rollup_fee_test.go new file mode 100644 index 000000000000..254d418ad8fa --- /dev/null +++ b/go/utils/fees/rollup_fee_test.go @@ -0,0 +1,104 @@ +package fees + +import ( + "math/big" + "testing" + + "github.com/ethereum/go-ethereum/params" +) + +var l1GasLimitTests = map[string]struct { + data []byte + overhead uint64 + expect *big.Int +}{ + "simple": {[]byte{}, 0, big.NewInt(0)}, + "simple-overhead": {[]byte{}, 10, big.NewInt(10)}, + "zeros": {[]byte{0x00, 0x00, 0x00, 0x00}, 10, big.NewInt(26)}, + "ones": {[]byte{0x01, 0x02, 0x03, 0x04}, 200, big.NewInt(16*4 + 200)}, +} + +func TestL1GasLimit(t *testing.T) { + for name, tt := range l1GasLimitTests { + t.Run(name, func(t *testing.T) { + got := calculateL1GasLimit(tt.data, tt.overhead) + if got.Cmp(tt.expect) != 0 { + t.Fatal("Calculated gas limit does not match") + } + }) + } +} + +var feeTests = map[string]struct { + dataLen int + l1GasPrice uint64 + l2GasLimit uint64 + l2GasPrice uint64 +}{ + "simple": { + dataLen: 10, + l1GasPrice: params.GWei, + l2GasLimit: 437118, + l2GasPrice: params.GWei, + }, + "zero-l2-gasprice": { + dataLen: 10, + l1GasPrice: params.GWei, + l2GasLimit: 196205, + l2GasPrice: 0, + }, + "one-l2-gasprice": { + dataLen: 10, + l1GasPrice: params.GWei, + l2GasLimit: 196205, + l2GasPrice: 1, + }, + "zero-l1-gasprice": { + dataLen: 10, + l1GasPrice: 0, + l2GasLimit: 196205, + l2GasPrice: params.GWei, + }, + "one-l1-gasprice": { + dataLen: 10, + l1GasPrice: 1, + l2GasLimit: 23255, + l2GasPrice: params.GWei, + }, + "zero-gasprices": { + dataLen: 10, + l1GasPrice: 0, + l2GasLimit: 23255, + l2GasPrice: 0, + }, + "max-gaslimit": { + dataLen: 10, + l1GasPrice: params.GWei, + l2GasLimit: 99_970_000, + l2GasPrice: params.GWei, + }, + "larger-divisor": { + dataLen: 10, + l1GasPrice: 0, + l2GasLimit: 10, + l2GasPrice: 0, + }, +} + +func TestCalculateRollupFee(t *testing.T) { + for name, tt := range feeTests { + t.Run(name, func(t *testing.T) { + data := make([]byte, tt.dataLen) + l1GasPrice := new(big.Int).SetUint64(tt.l1GasPrice) + l2GasLimit := new(big.Int).SetUint64(tt.l2GasLimit) + l2GasPrice := new(big.Int).SetUint64(tt.l2GasPrice) + + fee := EncodeTxGasLimit(data, l1GasPrice, l2GasLimit, l2GasPrice) + decodedGasLimit := DecodeL2GasLimit(fee) + roundedL2GasLimit := Ceilmod(l2GasLimit, BigTenThousand) + if roundedL2GasLimit.Cmp(decodedGasLimit) != 0 { + t.Errorf("rollup fee check failed: expected %d, got %d", l2GasLimit.Uint64(), decodedGasLimit) + } + }) + } +} diff --git a/go/utils/go.mod b/go/utils/go.mod new file mode 100644 index 000000000000..61d776bf5106 --- /dev/null +++ b/go/utils/go.mod @@ -0,0 +1,5 @@ +module github.com/ethereum-optimism/optimism/go/utils + +go 1.15 + +require github.com/ethereum/go-ethereum v1.9.10 diff --git a/go/utils/go.sum b/go/utils/go.sum new file mode 100644 index 000000000000..82868be88225 --- /dev/null +++ b/go/utils/go.sum @@ -0,0 +1,140 @@ +github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4= +github.com/Azure/azure-pipeline-go v0.2.2/go.mod h1:4rQ/NZncSvGqNkkOsNpOU1tgoNuIlp9AfUH5G1tvCHc= +github.com/Azure/azure-storage-blob-go v0.7.0/go.mod h1:f9YQKtsG1nMisotuTPpO0tjNuEjKRYAcJU8/ydDI++4= +github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= +github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= +github.com/Azure/go-autorest/autorest/adal v0.8.0/go.mod h1:Z6vX6WXXuyieHAXwMj0S6HY6e6wcHn37qQMBQlvY3lc= +github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= +github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g= +github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= +github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= +github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM= +github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= +github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/OneOfOne/xxhash v1.2.5/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q= +github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= +github.com/VictoriaMetrics/fastcache v1.5.3/go.mod h1:+jv9Ckb+za/P1ZRg/sulP5Ni1v49daAVERr0H3CuscE= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= +github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= +github.com/aws/aws-sdk-go v1.25.48/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/btcsuite/btcd v0.0.0-20171128150713-2e60448ffcc6/go.mod h1:Dmm/EzmjnCiweXmzRIAiUWCInVmPgjkzgv5k4tVyXiQ= +github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.0.1-0.20190104013014-3767db7a7e18/go.mod h1:HD5P3vAIAh+Y2GAxg0PrPN1P8WkepXGpjbUPDHJqqKM= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cloudflare/cloudflare-go v0.10.2-0.20190916151808-a80f83b9add9/go.mod h1:1MxXX1Ux4x6mqPmjkUgTP1CdXIBXKX7T+Jk9Gxrmx+U= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/elastic/gosigar v0.8.1-0.20180330100440-37f05ff46ffa/go.mod h1:cdorVVzy1fhmEqmtgqkoE3bYtCfSCkVyjTyCIo22xvs= +github.com/ethereum/go-ethereum v1.9.10 h1:jooX7tWcscpC7ytufk73t9JMCeJQ7aJF2YmZJQEuvFo= +github.com/ethereum/go-ethereum v1.9.10/go.mod h1:lXHkVo/MTvsEXfYsmNzelZ8R1e0DTvdk/wMZJIRpaRw= +github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2-0.20190517061210-b285ee9cfc6c/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/gorilla/websocket v1.4.1-0.20190629185528-ae1634f6a989/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/graph-gophers/graphql-go v0.0.0-20191115155744-f33e81362277/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= +github.com/hashicorp/golang-lru v0.0.0-20160813221303-0a025b7e63ad/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/huin/goupnp v0.0.0-20161224104101-679507af18f3/go.mod h1:MZ2ZmwcBpvOoJ22IJsc7va19ZwoheaBk43rKg12SKag= +github.com/influxdata/influxdb v1.2.3-0.20180221223340-01288bdb0883/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY= +github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= +github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/julienschmidt/httprouter v1.1.1-0.20170430222011-975b5c4c7c21/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= +github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= +github.com/mattn/go-isatty v0.0.5-0.20180830101745-3fb116b82035/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= +github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/olekukonko/tablewriter v0.0.2-0.20190409134802-7e037d187b0c/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34= +github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/tsdb v0.6.2-0.20190402121629-4f204dcbc150/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= +github.com/robertkrimen/otto v0.0.0-20170205013659-6a77b7cbc37d/go.mod h1:xvqspoSXJTIpemEonrMDFq6XzwHYYgToXWj5eRX1OtY= +github.com/rs/cors v0.0.0-20160617231935-a62a804a8a00/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521/go.mod h1:RvLn4FgxWubrpZHtQLnOf6EwhN2hEMusxZOhcW9H3UQ= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spaolacci/murmur3 v1.0.1-0.20190317074736-539464a789e9/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= +github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570/go.mod h1:8OR4w3TdeIHIh1g6EMY5p0gVNOovcWC+1vpc7naMuAw= +github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3/go.mod h1:hpGUWaI9xL8pRQCTXQgocU38Qw1g0Us7n5PxxTwTCYU= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA= +github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= +github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= +gopkg.in/olebedev/go-duktape.v3 v3.0.0-20190213234257-ec84240a7772/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= +gopkg.in/sourcemap.v1 v1.0.5/go.mod h1:2RlvNNSMglmRrcvhfuzp4hQHwOtjxlbjX7UPY/GXb78= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= From 264ee54ccd1faed12725edcd1e08315031b25ba5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 22 Jun 2021 15:54:18 -0400 Subject: [PATCH 117/125] Version Packages (#1094) Co-authored-by: github-actions[bot] --- .changeset/blue-cooks-join.md | 6 --- .changeset/bright-turtles-juggle.md | 5 --- .changeset/brown-boxes-compete.md | 5 --- .changeset/calm-ants-dream.md | 5 --- .changeset/calm-fans-travel.md | 5 --- .changeset/chatty-walls-rescue.md | 5 --- .changeset/clever-dancers-warn.md | 5 --- .changeset/cold-ways-grow.md | 6 --- .changeset/eight-bobcats-turn.md | 6 --- .changeset/fair-donuts-lick.md | 5 --- .changeset/fair-icons-argue.md | 5 --- .changeset/fast-oranges-happen.md | 9 ---- .changeset/flat-bananas-perform.md | 6 --- .changeset/fluffy-jobs-kiss.md | 6 --- .changeset/gold-grapes-beg.md | 5 --- .changeset/happy-cars-fix.md | 5 --- .changeset/happy-dancers-raise.md | 5 --- .changeset/heavy-planets-return.md | 5 --- .changeset/hungry-pears-vanish.md | 5 --- .changeset/itchy-bikes-flash.md | 5 --- .changeset/khaki-ads-kiss.md | 5 --- .changeset/lazy-foxes-jump.md | 5 --- .changeset/lazy-ghosts-shop.md | 5 --- .changeset/lovely-suns-learn.md | 5 --- .changeset/modern-pets-tie.md | 5 --- .changeset/nice-terms-walk.md | 5 --- .changeset/odd-shrimps-laugh.md | 5 --- .changeset/old-wombats-tie.md | 5 --- .changeset/olive-planets-clean.md | 5 --- .changeset/poor-owls-wash.md | 5 --- .changeset/quiet-ladybugs-burn.md | 7 ---- .changeset/real-pumpkins-shop.md | 5 --- .changeset/red-hornets-design.md | 5 --- .changeset/rude-eels-count.md | 5 --- .changeset/sharp-dragons-check.md | 5 --- .changeset/sharp-roses-admire.md | 5 --- .changeset/short-badgers-itch.md | 5 --- .changeset/shy-brooms-divide.md | 7 ---- .changeset/six-seals-eat.md | 5 --- .changeset/sour-adults-worry.md | 7 ---- .changeset/tall-plums-behave.md | 5 --- .changeset/thirty-years-look.md | 5 --- .changeset/tidy-rivers-press.md | 6 --- .changeset/wild-months-matter.md | 5 --- .changeset/witty-chefs-learn.md | 5 --- .changeset/witty-horses-nail.md | 5 --- integration-tests/CHANGELOG.md | 16 +++++++ integration-tests/package.json | 6 +-- l2geth/CHANGELOG.md | 20 +++++++++ l2geth/package.json | 2 +- packages/batch-submitter/CHANGELOG.md | 40 ++++++++++++++++++ packages/batch-submitter/package.json | 10 ++--- packages/common-ts/CHANGELOG.md | 6 +++ packages/common-ts/package.json | 2 +- packages/contracts/CHANGELOG.md | 38 +++++++++++++++++ packages/contracts/package.json | 6 +-- packages/core-utils/CHANGELOG.md | 7 ++++ packages/core-utils/package.json | 2 +- packages/data-transport-layer/CHANGELOG.md | 49 ++++++++++++++++++++++ packages/data-transport-layer/package.json | 8 ++-- packages/message-relayer/CHANGELOG.md | 37 ++++++++++++++++ packages/message-relayer/package.json | 10 ++--- packages/smock/CHANGELOG.md | 9 ++++ packages/smock/package.json | 4 +- 64 files changed, 247 insertions(+), 271 deletions(-) delete mode 100644 .changeset/blue-cooks-join.md delete mode 100644 .changeset/bright-turtles-juggle.md delete mode 100644 .changeset/brown-boxes-compete.md delete mode 100644 .changeset/calm-ants-dream.md delete mode 100644 .changeset/calm-fans-travel.md delete mode 100644 .changeset/chatty-walls-rescue.md delete mode 100644 .changeset/clever-dancers-warn.md delete mode 100644 .changeset/cold-ways-grow.md delete mode 100644 .changeset/eight-bobcats-turn.md delete mode 100644 .changeset/fair-donuts-lick.md delete mode 100644 .changeset/fair-icons-argue.md delete mode 100644 .changeset/fast-oranges-happen.md delete mode 100644 .changeset/flat-bananas-perform.md delete mode 100644 .changeset/fluffy-jobs-kiss.md delete mode 100644 .changeset/gold-grapes-beg.md delete mode 100644 .changeset/happy-cars-fix.md delete mode 100644 .changeset/happy-dancers-raise.md delete mode 100644 .changeset/heavy-planets-return.md delete mode 100644 .changeset/hungry-pears-vanish.md delete mode 100644 .changeset/itchy-bikes-flash.md delete mode 100644 .changeset/khaki-ads-kiss.md delete mode 100644 .changeset/lazy-foxes-jump.md delete mode 100644 .changeset/lazy-ghosts-shop.md delete mode 100644 .changeset/lovely-suns-learn.md delete mode 100644 .changeset/modern-pets-tie.md delete mode 100644 .changeset/nice-terms-walk.md delete mode 100644 .changeset/odd-shrimps-laugh.md delete mode 100644 .changeset/old-wombats-tie.md delete mode 100644 .changeset/olive-planets-clean.md delete mode 100644 .changeset/poor-owls-wash.md delete mode 100644 .changeset/quiet-ladybugs-burn.md delete mode 100644 .changeset/real-pumpkins-shop.md delete mode 100644 .changeset/red-hornets-design.md delete mode 100644 .changeset/rude-eels-count.md delete mode 100644 .changeset/sharp-dragons-check.md delete mode 100644 .changeset/sharp-roses-admire.md delete mode 100644 .changeset/short-badgers-itch.md delete mode 100644 .changeset/shy-brooms-divide.md delete mode 100644 .changeset/six-seals-eat.md delete mode 100644 .changeset/sour-adults-worry.md delete mode 100644 .changeset/tall-plums-behave.md delete mode 100644 .changeset/thirty-years-look.md delete mode 100644 .changeset/tidy-rivers-press.md delete mode 100644 .changeset/wild-months-matter.md delete mode 100644 .changeset/witty-chefs-learn.md delete mode 100644 .changeset/witty-horses-nail.md diff --git a/.changeset/blue-cooks-join.md b/.changeset/blue-cooks-join.md deleted file mode 100644 index acf5dc675b40..000000000000 --- a/.changeset/blue-cooks-join.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@eth-optimism/integration-tests': patch -'@eth-optimism/contracts': patch ---- - -Adds ERC1271 support to default contract account diff --git a/.changeset/bright-turtles-juggle.md b/.changeset/bright-turtles-juggle.md deleted file mode 100644 index f796acb74ccb..000000000000 --- a/.changeset/bright-turtles-juggle.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/contracts': patch ---- - -Update the ECDSAContractAccount import path in the `contract-data.ts` file for connecting ethers contracts to the L2 contracts diff --git a/.changeset/brown-boxes-compete.md b/.changeset/brown-boxes-compete.md deleted file mode 100644 index c5a2c95c8aa9..000000000000 --- a/.changeset/brown-boxes-compete.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/data-transport-layer': patch ---- - -Adds additional code into the DTL to defend against situations where an RPC provider might be missing an event. diff --git a/.changeset/calm-ants-dream.md b/.changeset/calm-ants-dream.md deleted file mode 100644 index 15908ea02cba..000000000000 --- a/.changeset/calm-ants-dream.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/l2geth': patch ---- - -Add new config `ROLLUP_GAS_PRICE_ORACLE_OWNER_ADDRESS` to set the owner of the gas price oracle at runtime diff --git a/.changeset/calm-fans-travel.md b/.changeset/calm-fans-travel.md deleted file mode 100644 index b579a850af27..000000000000 --- a/.changeset/calm-fans-travel.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/contracts': patch ---- - -Migrated from tslint to eslint. The preference for lint exceptions is as follows: line level, block level, file level, package level. diff --git a/.changeset/chatty-walls-rescue.md b/.changeset/chatty-walls-rescue.md deleted file mode 100644 index 6bd374c21536..000000000000 --- a/.changeset/chatty-walls-rescue.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/contracts': minor ---- - -Disables EOA contract upgrades until further notice diff --git a/.changeset/clever-dancers-warn.md b/.changeset/clever-dancers-warn.md deleted file mode 100644 index 5af303ee00d7..000000000000 --- a/.changeset/clever-dancers-warn.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/contracts': patch ---- - -Apply consistent styling to constants diff --git a/.changeset/cold-ways-grow.md b/.changeset/cold-ways-grow.md deleted file mode 100644 index a79702ddfa1e..000000000000 --- a/.changeset/cold-ways-grow.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@eth-optimism/l2geth': patch -'@eth-optimism/data-transport-layer': patch ---- - -Add extra overflow protection for the DTL types diff --git a/.changeset/eight-bobcats-turn.md b/.changeset/eight-bobcats-turn.md deleted file mode 100644 index 7ade829f8fa5..000000000000 --- a/.changeset/eight-bobcats-turn.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@eth-optimism/batch-submitter': patch -'@eth-optimism/contracts': patch ---- - -Use dashes instead of colons in contract names diff --git a/.changeset/fair-donuts-lick.md b/.changeset/fair-donuts-lick.md deleted file mode 100644 index 62a0373f1cd7..000000000000 --- a/.changeset/fair-donuts-lick.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/contracts': patch ---- - -Replaces RingBuffer with a simpler Buffer library diff --git a/.changeset/fair-icons-argue.md b/.changeset/fair-icons-argue.md deleted file mode 100644 index b1e90110a7ce..000000000000 --- a/.changeset/fair-icons-argue.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/contracts': patch ---- - -"Adds connectL1Contracts and connectL2Contracts utility functions" diff --git a/.changeset/fast-oranges-happen.md b/.changeset/fast-oranges-happen.md deleted file mode 100644 index 78b72c2b4834..000000000000 --- a/.changeset/fast-oranges-happen.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -'@eth-optimism/contracts': minor -'@eth-optimism/integration-tests': patch -'@eth-optimism/l2geth': patch ---- - -Add a new Standard Token Bridge, to handle deposits and withdrawals of any ERC20 token. -For projects developing a custom bridge, if you were previously importing `iAbs_BaseCrossDomainMessenger`, you should now -import `iOVM_CrossDomainMessenger`. diff --git a/.changeset/flat-bananas-perform.md b/.changeset/flat-bananas-perform.md deleted file mode 100644 index 620d6955ad06..000000000000 --- a/.changeset/flat-bananas-perform.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@eth-optimism/contracts': minor -'@eth-optimism/data-transport-layer': minor ---- - -Update AddressSet event to speed search up a bit. Breaks AddressSet API. diff --git a/.changeset/fluffy-jobs-kiss.md b/.changeset/fluffy-jobs-kiss.md deleted file mode 100644 index 6e2c814bb810..000000000000 --- a/.changeset/fluffy-jobs-kiss.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@eth-optimism/integration-tests': patch -'@eth-optimism/contracts': patch ---- - -Add WETH9 compatible deposit and withdraw functions to OVM_ETH diff --git a/.changeset/gold-grapes-beg.md b/.changeset/gold-grapes-beg.md deleted file mode 100644 index 647c59db76fb..000000000000 --- a/.changeset/gold-grapes-beg.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/data-transport-layer': patch ---- - -Removes a function that was previously used for backwards compatibility but is no longer necessary diff --git a/.changeset/happy-cars-fix.md b/.changeset/happy-cars-fix.md deleted file mode 100644 index 1c596a1f26b8..000000000000 --- a/.changeset/happy-cars-fix.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/contracts': patch ---- - -Deploy new Goerli contracts at d3e743aa7a406c583f7d76f4fda607f592d03e47 diff --git a/.changeset/happy-dancers-raise.md b/.changeset/happy-dancers-raise.md deleted file mode 100644 index a0e37bb17399..000000000000 --- a/.changeset/happy-dancers-raise.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/l2geth': patch ---- - -Prevent overflows in abi encoding of ovm codec transaction from geth types.Transaction diff --git a/.changeset/heavy-planets-return.md b/.changeset/heavy-planets-return.md deleted file mode 100644 index c69ceaf05bc6..000000000000 --- a/.changeset/heavy-planets-return.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/l2geth': patch ---- - -Update queueOrigin type diff --git a/.changeset/hungry-pears-vanish.md b/.changeset/hungry-pears-vanish.md deleted file mode 100644 index 2ce7119b88cc..000000000000 --- a/.changeset/hungry-pears-vanish.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/contracts': patch ---- - -ECDSA account interface contract moved to predeploys dir diff --git a/.changeset/itchy-bikes-flash.md b/.changeset/itchy-bikes-flash.md deleted file mode 100644 index ed20c3f61b4a..000000000000 --- a/.changeset/itchy-bikes-flash.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/contracts': patch ---- - -Deploy v0.4.0 rc to Kovan diff --git a/.changeset/khaki-ads-kiss.md b/.changeset/khaki-ads-kiss.md deleted file mode 100644 index 8d0e9e41a90f..000000000000 --- a/.changeset/khaki-ads-kiss.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/contracts': patch ---- - -Moved contracts in the "accounts" folder into the "predeploys" folder diff --git a/.changeset/lazy-foxes-jump.md b/.changeset/lazy-foxes-jump.md deleted file mode 100644 index b099e06143c2..000000000000 --- a/.changeset/lazy-foxes-jump.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/data-transport-layer': patch ---- - -Have DTL log failed HTTP requests as ERROR instead of INFO diff --git a/.changeset/lazy-ghosts-shop.md b/.changeset/lazy-ghosts-shop.md deleted file mode 100644 index 9fb797f017e9..000000000000 --- a/.changeset/lazy-ghosts-shop.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/message-relayer': patch ---- - -Update relayer package JSON to correctly export all files in dist diff --git a/.changeset/lovely-suns-learn.md b/.changeset/lovely-suns-learn.md deleted file mode 100644 index c76d61cdf684..000000000000 --- a/.changeset/lovely-suns-learn.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/contracts': patch ---- - -Use predeploy constants lib for EM wrapper diff --git a/.changeset/modern-pets-tie.md b/.changeset/modern-pets-tie.md deleted file mode 100644 index 0bee3baa798c..000000000000 --- a/.changeset/modern-pets-tie.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/data-transport-layer': patch ---- - -Updates the DTL to use the same L2 chain ID everywhere diff --git a/.changeset/nice-terms-walk.md b/.changeset/nice-terms-walk.md deleted file mode 100644 index 98581e283868..000000000000 --- a/.changeset/nice-terms-walk.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/smock': patch ---- - -Minor smock patch to add support for hardhat 2.4.0 and up diff --git a/.changeset/odd-shrimps-laugh.md b/.changeset/odd-shrimps-laugh.md deleted file mode 100644 index cf599708e9af..000000000000 --- a/.changeset/odd-shrimps-laugh.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/l2geth': patch ---- - -Removes config options that are no longer required. `ROLLUP_DATAPRICE`, `ROLLUP_EXECUTION_PRICE`, `ROLLUP_GAS_PRICE_ORACLE_ADDRESS` and `ROLLUP_ENABLE_L2_GAS_POLLING`. The oracle was moved to a predeploy 0x42.. address and polling is always enabled as it no longer needs to be backwards compatible diff --git a/.changeset/old-wombats-tie.md b/.changeset/old-wombats-tie.md deleted file mode 100644 index 8ad19a7dbf7a..000000000000 --- a/.changeset/old-wombats-tie.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/core-utils': patch ---- - -Minor fix on watchers to pick up finalization of transactions on L1 diff --git a/.changeset/olive-planets-clean.md b/.changeset/olive-planets-clean.md deleted file mode 100644 index 27ddbce53227..000000000000 --- a/.changeset/olive-planets-clean.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/batch-submitter': patch ---- - -Add failure metrics to batch submitter diff --git a/.changeset/poor-owls-wash.md b/.changeset/poor-owls-wash.md deleted file mode 100644 index a966e8b709e0..000000000000 --- a/.changeset/poor-owls-wash.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/contracts': patch ---- - -Adds a temporary way to fund hardhat accounts when testing locally diff --git a/.changeset/quiet-ladybugs-burn.md b/.changeset/quiet-ladybugs-burn.md deleted file mode 100644 index e1feefe6f800..000000000000 --- a/.changeset/quiet-ladybugs-burn.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@eth-optimism/integration-tests': minor -'@eth-optimism/l2geth': minor -'@eth-optimism/contracts': minor ---- - -Add support for ovmCALL with nonzero ETH value diff --git a/.changeset/real-pumpkins-shop.md b/.changeset/real-pumpkins-shop.md deleted file mode 100644 index 07e9a21f96a0..000000000000 --- a/.changeset/real-pumpkins-shop.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/contracts': patch ---- - -Removes one-off GasPriceOracle deployment file diff --git a/.changeset/red-hornets-design.md b/.changeset/red-hornets-design.md deleted file mode 100644 index 4660f3a81dc9..000000000000 --- a/.changeset/red-hornets-design.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/contracts': patch ---- - -Updates the deployment of the L1MultiMessageRelayer to NOT set the OVM_L2MessageRelayer address in the AddressManager diff --git a/.changeset/rude-eels-count.md b/.changeset/rude-eels-count.md deleted file mode 100644 index 9b10bfd2a3bf..000000000000 --- a/.changeset/rude-eels-count.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/data-transport-layer': patch ---- - -Add highest L1 and L2 block number Gauge metrics to DTL diff --git a/.changeset/sharp-dragons-check.md b/.changeset/sharp-dragons-check.md deleted file mode 100644 index 6e23143b208e..000000000000 --- a/.changeset/sharp-dragons-check.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/l2geth': patch ---- - -Removes the gas refund for unused gas in geth since it is instead managed in the smart contracts diff --git a/.changeset/sharp-roses-admire.md b/.changeset/sharp-roses-admire.md deleted file mode 100644 index 4d3244390799..000000000000 --- a/.changeset/sharp-roses-admire.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/contracts': patch ---- - -Disable upgradability from the ECDSA account instead of the EOA proxy. diff --git a/.changeset/short-badgers-itch.md b/.changeset/short-badgers-itch.md deleted file mode 100644 index 4667285782c7..000000000000 --- a/.changeset/short-badgers-itch.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/batch-submitter': patch ---- - -Improved logging of batch submission timeout logs diff --git a/.changeset/shy-brooms-divide.md b/.changeset/shy-brooms-divide.md deleted file mode 100644 index 75837f9b5a4b..000000000000 --- a/.changeset/shy-brooms-divide.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@eth-optimism/integration-tests': patch -'@eth-optimism/l2geth': patch -'@eth-optimism/contracts': patch ---- - -Adds new SequencerFeeVault contract to store generated fees diff --git a/.changeset/six-seals-eat.md b/.changeset/six-seals-eat.md deleted file mode 100644 index 89854eed54dc..000000000000 --- a/.changeset/six-seals-eat.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/l2geth': patch ---- - -Removes the SignatureHashType from l2geth as it is deprecated and no longer required. diff --git a/.changeset/sour-adults-worry.md b/.changeset/sour-adults-worry.md deleted file mode 100644 index bd3031690f86..000000000000 --- a/.changeset/sour-adults-worry.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@eth-optimism/batch-submitter': patch -'@eth-optimism/common-ts': patch -'@eth-optimism/data-transport-layer': patch ---- - -Move the metric prefix string to a label #1047 diff --git a/.changeset/tall-plums-behave.md b/.changeset/tall-plums-behave.md deleted file mode 100644 index 3459ad6e5e1a..000000000000 --- a/.changeset/tall-plums-behave.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/core-utils': patch ---- - -improved watcher ability to find transactions during periods of high load diff --git a/.changeset/thirty-years-look.md b/.changeset/thirty-years-look.md deleted file mode 100644 index bf8435446302..000000000000 --- a/.changeset/thirty-years-look.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/data-transport-layer': minor ---- - -Define L1 Starting block via OwnershipTransferred (occurring on block 1) rather than AddressSet (occuring on block 2 onwards) diff --git a/.changeset/tidy-rivers-press.md b/.changeset/tidy-rivers-press.md deleted file mode 100644 index 16e413fc8e17..000000000000 --- a/.changeset/tidy-rivers-press.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@eth-optimism/integration-tests': patch -'@eth-optimism/data-transport-layer': patch ---- - -Add replica sync test to integration tests; handle 0 L2 blocks in DTL diff --git a/.changeset/wild-months-matter.md b/.changeset/wild-months-matter.md deleted file mode 100644 index aa4c01a6e5c8..000000000000 --- a/.changeset/wild-months-matter.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/contracts': patch ---- - -Token gateways pass additional information: sender and arbitrary data. diff --git a/.changeset/witty-chefs-learn.md b/.changeset/witty-chefs-learn.md deleted file mode 100644 index e2b245c416b4..000000000000 --- a/.changeset/witty-chefs-learn.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/contracts': patch ---- - -Do not RLP decode the transaction in the OVM_ECDSAContractAccount diff --git a/.changeset/witty-horses-nail.md b/.changeset/witty-horses-nail.md deleted file mode 100644 index daed003f40a6..000000000000 --- a/.changeset/witty-horses-nail.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/contracts': patch ---- - -Introduce the L1ChugSplashProxy contract diff --git a/integration-tests/CHANGELOG.md b/integration-tests/CHANGELOG.md index ea2181a934dd..80029d217be2 100644 --- a/integration-tests/CHANGELOG.md +++ b/integration-tests/CHANGELOG.md @@ -1,5 +1,21 @@ # @eth-optimism/integration-tests +## 0.1.0 + +### Minor Changes + +- e04de624: Add support for ovmCALL with nonzero ETH value + +### Patch Changes + +- 25f09abd: Adds ERC1271 support to default contract account +- 5fc728da: Add a new Standard Token Bridge, to handle deposits and withdrawals of any ERC20 token. + For projects developing a custom bridge, if you were previously importing `iAbs_BaseCrossDomainMessenger`, you should now + import `iOVM_CrossDomainMessenger`. +- c43b33ec: Add WETH9 compatible deposit and withdraw functions to OVM_ETH +- e045f582: Adds new SequencerFeeVault contract to store generated fees +- b8e2d685: Add replica sync test to integration tests; handle 0 L2 blocks in DTL + ## 0.0.7 ### Patch Changes diff --git a/integration-tests/package.json b/integration-tests/package.json index 12061c3b9d4a..c59b9ae426db 100644 --- a/integration-tests/package.json +++ b/integration-tests/package.json @@ -1,6 +1,6 @@ { "name": "@eth-optimism/integration-tests", - "version": "0.0.7", + "version": "0.1.0", "description": "[Optimism] Integration Tests", "private": true, "author": "Optimism PBC", @@ -17,8 +17,8 @@ "clean": "rimraf cache artifacts artifacts-ovm cache-ovm" }, "devDependencies": { - "@eth-optimism/contracts": "^0.3.5", - "@eth-optimism/core-utils": "^0.4.5", + "@eth-optimism/contracts": "^0.4.0", + "@eth-optimism/core-utils": "^0.4.6", "@eth-optimism/hardhat-ovm": "^0.2.2", "@ethersproject/providers": "^5.0.24", "@nomiclabs/hardhat-ethers": "^2.0.2", diff --git a/l2geth/CHANGELOG.md b/l2geth/CHANGELOG.md index 95f2630fce25..a73773b63dbc 100644 --- a/l2geth/CHANGELOG.md +++ b/l2geth/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +## 0.4.0 + +### Minor Changes + +- e04de624: Add support for ovmCALL with nonzero ETH value + +### Patch Changes + +- 01646a0a: Add new config `ROLLUP_GAS_PRICE_ORACLE_OWNER_ADDRESS` to set the owner of the gas price oracle at runtime +- 8fee7bed: Add extra overflow protection for the DTL types +- 5fc728da: Add a new Standard Token Bridge, to handle deposits and withdrawals of any ERC20 token. + For projects developing a custom bridge, if you were previously importing `iAbs_BaseCrossDomainMessenger`, you should now + import `iOVM_CrossDomainMessenger`. +- 257deb70: Prevent overflows in abi encoding of ovm codec transaction from geth types.Transaction +- 08873674: Update queueOrigin type +- 01646a0a: Removes config options that are no longer required. `ROLLUP_DATAPRICE`, `ROLLUP_EXECUTION_PRICE`, `ROLLUP_GAS_PRICE_ORACLE_ADDRESS` and `ROLLUP_ENABLE_L2_GAS_POLLING`. The oracle was moved to a predeploy 0x42.. address and polling is always enabled as it no longer needs to be backwards compatible +- 0a7f5a46: Removes the gas refund for unused gas in geth since it is instead managed in the smart contracts +- e045f582: Adds new SequencerFeeVault contract to store generated fees +- 25a5dbdd: Removes the SignatureHashType from l2geth as it is deprecated and no longer required. + ## 0.3.9 ### Patch Changes diff --git a/l2geth/package.json b/l2geth/package.json index 424e231e21df..eda61b932e12 100644 --- a/l2geth/package.json +++ b/l2geth/package.json @@ -1,6 +1,6 @@ { "name": "@eth-optimism/l2geth", - "version": "0.3.9", + "version": "0.4.0", "private": true, "devDependencies": {} } diff --git a/packages/batch-submitter/CHANGELOG.md b/packages/batch-submitter/CHANGELOG.md index 74311a997ba9..ab121529aaf0 100644 --- a/packages/batch-submitter/CHANGELOG.md +++ b/packages/batch-submitter/CHANGELOG.md @@ -1,5 +1,45 @@ # Changelog +## 0.3.6 + +### Patch Changes + +- f87a2d00: Use dashes instead of colons in contract names +- 52d02b14: Add failure metrics to batch submitter +- 31f517a2: Improved logging of batch submission timeout logs +- 5c89c45f: Move the metric prefix string to a label #1047 +- Updated dependencies [25f09abd] +- Updated dependencies [dd8edc7b] +- Updated dependencies [c87e4c74] +- Updated dependencies [db0dbfb2] +- Updated dependencies [7f5936a8] +- Updated dependencies [f87a2d00] +- Updated dependencies [85da4979] +- Updated dependencies [57ca21a2] +- Updated dependencies [5fc728da] +- Updated dependencies [2e72fd90] +- Updated dependencies [c43b33ec] +- Updated dependencies [26bc63ad] +- Updated dependencies [a0d9e565] +- Updated dependencies [2bd49730] +- Updated dependencies [38355a3b] +- Updated dependencies [3c2c32e1] +- Updated dependencies [d9644c34] +- Updated dependencies [48ece14c] +- Updated dependencies [e04de624] +- Updated dependencies [014dea71] +- Updated dependencies [fa29b03e] +- Updated dependencies [6b46c8ba] +- Updated dependencies [e045f582] +- Updated dependencies [5c89c45f] +- Updated dependencies [df5ff890] +- Updated dependencies [e29fab10] +- Updated dependencies [c2a04893] +- Updated dependencies [baacda34] + - @eth-optimism/contracts@0.4.0 + - @eth-optimism/core-utils@0.4.6 + - @eth-optimism/common-ts@0.1.4 + ## 0.3.5 ### Patch Changes diff --git a/packages/batch-submitter/package.json b/packages/batch-submitter/package.json index 7c365149e514..279771a9eccb 100644 --- a/packages/batch-submitter/package.json +++ b/packages/batch-submitter/package.json @@ -1,6 +1,6 @@ { "name": "@eth-optimism/batch-submitter", - "version": "0.3.5", + "version": "0.3.6", "private": true, "description": "[Optimism] Batch submission for sequencer & aggregators", "main": "dist/index", @@ -31,9 +31,9 @@ "url": "https://github.com/ethereum-optimism/optimism-monorepo.git" }, "dependencies": { - "@eth-optimism/common-ts": "^0.1.3", - "@eth-optimism/contracts": "^0.3.5", - "@eth-optimism/core-utils": "^0.4.5", + "@eth-optimism/common-ts": "^0.1.4", + "@eth-optimism/contracts": "^0.4.0", + "@eth-optimism/core-utils": "^0.4.6", "@eth-optimism/ynatm": "^0.2.2", "@ethersproject/abstract-provider": "^5.0.5", "@ethersproject/providers": "^5.0.14", @@ -46,7 +46,7 @@ "prom-client": "^13.1.0" }, "devDependencies": { - "@eth-optimism/smock": "^1.1.5", + "@eth-optimism/smock": "^1.1.6", "@nomiclabs/hardhat-ethers": "^2.0.2", "@nomiclabs/hardhat-waffle": "^2.0.1", "@types/bluebird": "^3.5.34", diff --git a/packages/common-ts/CHANGELOG.md b/packages/common-ts/CHANGELOG.md index 60781b255f87..8bcba4ec14a7 100644 --- a/packages/common-ts/CHANGELOG.md +++ b/packages/common-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @eth-optimism/common-ts +## 0.1.4 + +### Patch Changes + +- 5c89c45f: Move the metric prefix string to a label #1047 + ## 0.1.3 ### Patch Changes diff --git a/packages/common-ts/package.json b/packages/common-ts/package.json index 9388e2d30e36..c69a22413bc0 100644 --- a/packages/common-ts/package.json +++ b/packages/common-ts/package.json @@ -1,6 +1,6 @@ { "name": "@eth-optimism/common-ts", - "version": "0.1.3", + "version": "0.1.4", "main": "dist/index", "files": [ "dist/*" diff --git a/packages/contracts/CHANGELOG.md b/packages/contracts/CHANGELOG.md index 857f869507d8..1bd6c17ad6a2 100644 --- a/packages/contracts/CHANGELOG.md +++ b/packages/contracts/CHANGELOG.md @@ -1,5 +1,43 @@ # Changelog +## 0.4.0 + +### Minor Changes + +- db0dbfb2: Disables EOA contract upgrades until further notice +- 5fc728da: Add a new Standard Token Bridge, to handle deposits and withdrawals of any ERC20 token. + For projects developing a custom bridge, if you were previously importing `iAbs_BaseCrossDomainMessenger`, you should now + import `iOVM_CrossDomainMessenger`. +- 2e72fd90: Update AddressSet event to speed search up a bit. Breaks AddressSet API. +- e04de624: Add support for ovmCALL with nonzero ETH value + +### Patch Changes + +- 25f09abd: Adds ERC1271 support to default contract account +- dd8edc7b: Update the ECDSAContractAccount import path in the `contract-data.ts` file for connecting ethers contracts to the L2 contracts +- c87e4c74: Migrated from tslint to eslint. The preference for lint exceptions is as follows: line level, block level, file level, package level. +- 7f5936a8: Apply consistent styling to constants +- f87a2d00: Use dashes instead of colons in contract names +- 85da4979: Replaces RingBuffer with a simpler Buffer library +- 57ca21a2: "Adds connectL1Contracts and connectL2Contracts utility functions" +- c43b33ec: Add WETH9 compatible deposit and withdraw functions to OVM_ETH +- 26bc63ad: Deploy new Goerli contracts at d3e743aa7a406c583f7d76f4fda607f592d03e47 +- a0d9e565: ECDSA account interface contract moved to predeploys dir +- 2bd49730: Deploy v0.4.0 rc to Kovan +- 38355a3b: Moved contracts in the "accounts" folder into the "predeploys" folder +- 3c2c32e1: Use predeploy constants lib for EM wrapper +- 48ece14c: Adds a temporary way to fund hardhat accounts when testing locally +- 014dea71: Removes one-off GasPriceOracle deployment file +- fa29b03e: Updates the deployment of the L1MultiMessageRelayer to NOT set the OVM_L2MessageRelayer address in the AddressManager +- 6b46c8ba: Disable upgradability from the ECDSA account instead of the EOA proxy. +- e045f582: Adds new SequencerFeeVault contract to store generated fees +- e29fab10: Token gateways pass additional information: sender and arbitrary data. +- c2a04893: Do not RLP decode the transaction in the OVM_ECDSAContractAccount +- baacda34: Introduce the L1ChugSplashProxy contract +- Updated dependencies [d9644c34] +- Updated dependencies [df5ff890] + - @eth-optimism/core-utils@0.4.6 + ## 0.3.5 ### Patch Changes diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 6b5f12e5aeb6..0d692f4b9a86 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -1,6 +1,6 @@ { "name": "@eth-optimism/contracts", - "version": "0.3.5", + "version": "0.4.0", "main": "dist/index", "files": [ "dist/**/*.js", @@ -50,7 +50,7 @@ "generate-markdown": "node \"./scripts/generate-markdown.js\"" }, "dependencies": { - "@eth-optimism/core-utils": "^0.4.5", + "@eth-optimism/core-utils": "^0.4.6", "@ethersproject/abstract-provider": "^5.0.8", "@ethersproject/abstract-signer": "^5.1.0", "@ethersproject/contracts": "^5.0.5", @@ -59,7 +59,7 @@ "devDependencies": { "@codechecks/client": "0.1.10-beta", "@eth-optimism/hardhat-ovm": "^0.2.2", - "@eth-optimism/smock": "^1.1.3", + "@eth-optimism/smock": "^1.1.6", "@ethersproject/transactions": "^5.0.31", "@nomiclabs/hardhat-ethers": "^2.0.1", "@nomiclabs/hardhat-waffle": "^2.0.1", diff --git a/packages/core-utils/CHANGELOG.md b/packages/core-utils/CHANGELOG.md index 69d1bbdd6ec8..057a58f5c45f 100644 --- a/packages/core-utils/CHANGELOG.md +++ b/packages/core-utils/CHANGELOG.md @@ -1,5 +1,12 @@ # @eth-optimism/core-utils +## 0.4.6 + +### Patch Changes + +- d9644c34: Minor fix on watchers to pick up finalization of transactions on L1 +- df5ff890: improved watcher ability to find transactions during periods of high load + ## 0.4.5 ### Patch Changes diff --git a/packages/core-utils/package.json b/packages/core-utils/package.json index 90407cc36c81..c2edc3479310 100644 --- a/packages/core-utils/package.json +++ b/packages/core-utils/package.json @@ -1,6 +1,6 @@ { "name": "@eth-optimism/core-utils", - "version": "0.4.5", + "version": "0.4.6", "main": "dist/index", "files": [ "dist/*" diff --git a/packages/data-transport-layer/CHANGELOG.md b/packages/data-transport-layer/CHANGELOG.md index cd696595dba6..f25045159f0e 100644 --- a/packages/data-transport-layer/CHANGELOG.md +++ b/packages/data-transport-layer/CHANGELOG.md @@ -1,5 +1,54 @@ # data transport layer +## 0.4.0 + +### Minor Changes + +- 2e72fd90: Update AddressSet event to speed search up a bit. Breaks AddressSet API. +- 8582fc16: Define L1 Starting block via OwnershipTransferred (occurring on block 1) rather than AddressSet (occuring on block 2 onwards) + +### Patch Changes + +- 0b91df42: Adds additional code into the DTL to defend against situations where an RPC provider might be missing an event. +- 8fee7bed: Add extra overflow protection for the DTL types +- ca7d65db: Removes a function that was previously used for backwards compatibility but is no longer necessary +- 16f68159: Have DTL log failed HTTP requests as ERROR instead of INFO +- a415d017: Updates the DTL to use the same L2 chain ID everywhere +- 29431d6a: Add highest L1 and L2 block number Gauge metrics to DTL +- 5c89c45f: Move the metric prefix string to a label #1047 +- b8e2d685: Add replica sync test to integration tests; handle 0 L2 blocks in DTL +- Updated dependencies [25f09abd] +- Updated dependencies [dd8edc7b] +- Updated dependencies [c87e4c74] +- Updated dependencies [db0dbfb2] +- Updated dependencies [7f5936a8] +- Updated dependencies [f87a2d00] +- Updated dependencies [85da4979] +- Updated dependencies [57ca21a2] +- Updated dependencies [5fc728da] +- Updated dependencies [2e72fd90] +- Updated dependencies [c43b33ec] +- Updated dependencies [26bc63ad] +- Updated dependencies [a0d9e565] +- Updated dependencies [2bd49730] +- Updated dependencies [38355a3b] +- Updated dependencies [3c2c32e1] +- Updated dependencies [d9644c34] +- Updated dependencies [48ece14c] +- Updated dependencies [e04de624] +- Updated dependencies [014dea71] +- Updated dependencies [fa29b03e] +- Updated dependencies [6b46c8ba] +- Updated dependencies [e045f582] +- Updated dependencies [5c89c45f] +- Updated dependencies [df5ff890] +- Updated dependencies [e29fab10] +- Updated dependencies [c2a04893] +- Updated dependencies [baacda34] + - @eth-optimism/contracts@0.4.0 + - @eth-optimism/core-utils@0.4.6 + - @eth-optimism/common-ts@0.1.4 + ## 0.3.6 ### Patch Changes diff --git a/packages/data-transport-layer/package.json b/packages/data-transport-layer/package.json index 6b8a695df9dc..321e740100af 100644 --- a/packages/data-transport-layer/package.json +++ b/packages/data-transport-layer/package.json @@ -1,6 +1,6 @@ { "name": "@eth-optimism/data-transport-layer", - "version": "0.3.6", + "version": "0.4.0", "private": true, "main": "dist/index", "files": [ @@ -21,9 +21,9 @@ "build": "tsc -p tsconfig.build.json" }, "dependencies": { - "@eth-optimism/common-ts": "^0.1.3", - "@eth-optimism/contracts": "^0.3.5", - "@eth-optimism/core-utils": "^0.4.5", + "@eth-optimism/common-ts": "^0.1.4", + "@eth-optimism/contracts": "^0.4.0", + "@eth-optimism/core-utils": "^0.4.6", "@ethersproject/providers": "^5.0.21", "@ethersproject/transactions": "^5.0.21", "@sentry/node": "^6.3.1", diff --git a/packages/message-relayer/CHANGELOG.md b/packages/message-relayer/CHANGELOG.md index 0a8a41e3a2bb..3e8dc25f7e5a 100644 --- a/packages/message-relayer/CHANGELOG.md +++ b/packages/message-relayer/CHANGELOG.md @@ -1,5 +1,42 @@ # @eth-optimism/message-relayer +## 0.1.6 + +### Patch Changes + +- 735cd78f: Update relayer package JSON to correctly export all files in dist +- Updated dependencies [25f09abd] +- Updated dependencies [dd8edc7b] +- Updated dependencies [c87e4c74] +- Updated dependencies [db0dbfb2] +- Updated dependencies [7f5936a8] +- Updated dependencies [f87a2d00] +- Updated dependencies [85da4979] +- Updated dependencies [57ca21a2] +- Updated dependencies [5fc728da] +- Updated dependencies [2e72fd90] +- Updated dependencies [c43b33ec] +- Updated dependencies [26bc63ad] +- Updated dependencies [a0d9e565] +- Updated dependencies [2bd49730] +- Updated dependencies [38355a3b] +- Updated dependencies [3c2c32e1] +- Updated dependencies [d9644c34] +- Updated dependencies [48ece14c] +- Updated dependencies [e04de624] +- Updated dependencies [014dea71] +- Updated dependencies [fa29b03e] +- Updated dependencies [6b46c8ba] +- Updated dependencies [e045f582] +- Updated dependencies [5c89c45f] +- Updated dependencies [df5ff890] +- Updated dependencies [e29fab10] +- Updated dependencies [c2a04893] +- Updated dependencies [baacda34] + - @eth-optimism/contracts@0.4.0 + - @eth-optimism/core-utils@0.4.6 + - @eth-optimism/common-ts@0.1.4 + ## 0.1.5 ### Patch Changes diff --git a/packages/message-relayer/package.json b/packages/message-relayer/package.json index ad171597ebe7..442ee6c68214 100644 --- a/packages/message-relayer/package.json +++ b/packages/message-relayer/package.json @@ -1,6 +1,6 @@ { "name": "@eth-optimism/message-relayer", - "version": "0.1.5", + "version": "0.1.6", "description": "[Optimism] Cross Domain Message Relayer service", "main": "dist/index", "types": "dist/index", @@ -29,9 +29,9 @@ "url": "https://github.com/ethereum-optimism/optimism.git" }, "dependencies": { - "@eth-optimism/common-ts": "^0.1.3", - "@eth-optimism/contracts": "^0.3.5", - "@eth-optimism/core-utils": "^0.4.5", + "@eth-optimism/common-ts": "^0.1.4", + "@eth-optimism/contracts": "^0.4.0", + "@eth-optimism/core-utils": "^0.4.6", "@sentry/node": "6.2.5", "bcfg": "^0.1.6", "dotenv": "^8.2.0", @@ -40,7 +40,7 @@ "rlp": "^2.2.6" }, "devDependencies": { - "@eth-optimism/smock": "^1.1.5", + "@eth-optimism/smock": "^1.1.6", "@nomiclabs/hardhat-ethers": "^2.0.2", "@nomiclabs/hardhat-waffle": "^2.0.1", "@types/chai": "^4.2.18", diff --git a/packages/smock/CHANGELOG.md b/packages/smock/CHANGELOG.md index 1140eb913484..800a1779757b 100644 --- a/packages/smock/CHANGELOG.md +++ b/packages/smock/CHANGELOG.md @@ -1,5 +1,14 @@ # @eth-optimism/smock +## 1.1.6 + +### Patch Changes + +- 71349a4e: Minor smock patch to add support for hardhat 2.4.0 and up +- Updated dependencies [d9644c34] +- Updated dependencies [df5ff890] + - @eth-optimism/core-utils@0.4.6 + ## 1.1.5 ### Patch Changes diff --git a/packages/smock/package.json b/packages/smock/package.json index be16bcf0c645..fda76e0efad1 100644 --- a/packages/smock/package.json +++ b/packages/smock/package.json @@ -3,7 +3,7 @@ "files": [ "dist/src/*" ], - "version": "1.1.5", + "version": "1.1.6", "main": "dist/src/index", "types": "dist/src/index", "author": "Optimism PBC", @@ -26,7 +26,7 @@ "hardhat": "^2" }, "dependencies": { - "@eth-optimism/core-utils": "^0.4.5", + "@eth-optimism/core-utils": "^0.4.6", "bn.js": "^5.2.0" }, "devDependencies": { From 588058f1e6a74a8712b15399c5d8d58849cec3bf Mon Sep 17 00:00:00 2001 From: Liam Horne Date: Tue, 22 Jun 2021 17:46:11 -0400 Subject: [PATCH 118/125] build: add husky pre-commit hook to lint (#1146) --- .husky/.gitignore | 1 + .husky/pre-commit | 4 ++++ package.json | 18 +++++++++++------- yarn.lock | 5 +++++ 4 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 .husky/.gitignore create mode 100755 .husky/pre-commit diff --git a/.husky/.gitignore b/.husky/.gitignore new file mode 100644 index 000000000000..31354ec13899 --- /dev/null +++ b/.husky/.gitignore @@ -0,0 +1 @@ +_ diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 000000000000..de124460530c --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +yarn lint:check diff --git a/package.json b/package.json index 163c5ef289ac..676e8cde2f5e 100644 --- a/package.json +++ b/package.json @@ -4,16 +4,19 @@ "author": "Optimism PBC", "license": "MIT", "workspaces": { - "packages": [ - "packages/*", - "l2geth", - "integration-tests", - "specs" - ], - "nohoist": ["examples/*"] + "packages": [ + "packages/*", + "l2geth", + "integration-tests", + "specs" + ], + "nohoist": [ + "examples/*" + ] }, "private": true, "devDependencies": { + "husky": "^6.0.0", "lerna": "^4.0.0", "patch-package": "^6.4.7" }, @@ -27,6 +30,7 @@ "lint:fix": "yarn lerna run lint:fix", "postinstall": "patch-package", "ready": "yarn lint && yarn test", + "prepare": "husky install", "release": "yarn build && yarn changeset publish" }, "dependencies": { diff --git a/yarn.lock b/yarn.lock index 2bc5482d3fac..a6bba0ca48ce 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8302,6 +8302,11 @@ humanize-ms@^1.2.1: dependencies: ms "^2.0.0" +husky@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/husky/-/husky-6.0.0.tgz#810f11869adf51604c32ea577edbc377d7f9319e" + integrity sha512-SQS2gDTB7tBN486QSoKPKQItZw97BMOd+Kdb6ghfpBc0yXyzrddI0oDV5MkDAbuB4X2mO3/nj60TRMcYxwzZeQ== + iconv-lite@0.4.24, iconv-lite@^0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" From 0cd3259d47dd3012646ffbc50187b15d03328164 Mon Sep 17 00:00:00 2001 From: Karl Floersch Date: Tue, 22 Jun 2021 14:53:17 -0700 Subject: [PATCH 119/125] feat[contracts]: add mainnet deploy script (#1147) * Add mainnet deploy script * Update mainnet.sh * Address PR review feedback --- .../scripts/deploy-scripts/mainnet.sh | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100755 packages/contracts/scripts/deploy-scripts/mainnet.sh diff --git a/packages/contracts/scripts/deploy-scripts/mainnet.sh b/packages/contracts/scripts/deploy-scripts/mainnet.sh new file mode 100755 index 000000000000..24601812ae8f --- /dev/null +++ b/packages/contracts/scripts/deploy-scripts/mainnet.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +### All available deploy options at the time of deployment: ### +# --ctc-force-inclusion-period-seconds Number of seconds that the sequencer has to include transactions before the L1 queue. (default: 2592000) +# --ctc-max-transaction-gas-limit Max gas limit for L1 queue transactions. (default: 11000000) +# --deploy-scripts override deploy script folder path +# --em-max-gas-per-queue-per-epoch Maximum gas allowed in a given queue for each epoch. (default: 250000000) +# --em-max-transaction-gas-limit Maximum allowed transaction gas limit. (default: 11000000) +# --em-min-transaction-gas-limit Minimum allowed transaction gas limit. (default: 50000) +# --em-ovm-chain-id Chain ID for the L2 network. (default: 420) +# --em-seconds-per-epoch Number of seconds in each epoch. (default: 0) +# --export export current network deployments +# --export-all export all deployments into one file +# --gasprice gas price to use for transactions +# --l1-block-time-seconds Number of seconds on average between every L1 block. (default: 15) +# --no-compile disable pre compilation +# --no-impersonation do not impersonate unknown accounts +# --ovm-address-manager-owner Address that will own the Lib_AddressManager. Must be provided or this deployment will fail. +# --ovm-proposer-address Address of the account that will propose state roots. Must be provided or this deployment will fail. +# --ovm-relayer-address Address of the message relayer. Must be provided or this deployment will fail. +# --ovm-sequencer-address Address of the sequencer. Must be provided or this deployment will fail. +# --reset whether to delete deployments files first +# --scc-fraud-proof-window Number of seconds until a transaction is considered finalized. (default: 604800) +# --scc-sequencer-publish-window Number of seconds that the sequencer is exclusively allowed to post state roots. (default: 1800) +# --silent whether to remove log +# --tags specify which deploy script to execute via tags, separated by commas +# --watch redeploy on every change of contract or deploy script +# --write whether to write deployments to file + + +### DEPLOYMENT SCRIPT ### +# To be called from root of contracts dir # + +# Required env vars +if [[ -z "$CONTRACTS_DEPLOYER_KEY" ]]; then + echo "Must pass CONTRACTS_DEPLOYER_KEY" + exit 1 +fi +if [[ -z "$CONTRACTS_RPC_URL" ]]; then + echo "Must pass CONTRACTS_RPC_URL" + exit 1 +fi +if [[ -z "$ETHERSCAN_API_KEY" ]]; then + echo "Must pass ETHERSCAN_API_KEY" + exit 1 +fi + +CONTRACTS_TARGET_NETWORK=mainnet \ +npx hardhat deploy \ + --ctc-force-inclusion-period-seconds 12592000 \ + --ctc-max-transaction-gas-limit 11000000 \ + --em-max-gas-per-queue-per-epoch 250000000 \ + --em-max-transaction-gas-limit 11000000 \ + --em-min-transaction-gas-limit 50000 \ + --em-ovm-chain-id 10 \ + --em-seconds-per-epoch 0 \ + --l1-block-time-seconds 15 \ + --ovm-address-manager-owner 0x9BA6e03D8B90dE867373Db8cF1A58d2F7F006b3A \ + --ovm-proposer-address 0x473300df21D047806A082244b417f96b32f13A33 \ + --ovm-relayer-address 0x0000000000000000000000000000000000000000 \ + --ovm-sequencer-address 0x6887246668a3b87F54DeB3b94Ba47a6f63F32985 \ + --reset \ + --scc-fraud-proof-window 604800 \ + --scc-sequencer-publish-window 12592000 \ + --network mainnet + +CONTRACTS_TARGET_NETWORK=mainnet \ +npx hardhat etherscan-verify --network mainnet From 98e02cfad627058e647027061a43293aaad78dfb Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Wed, 23 Jun 2021 04:51:06 -0700 Subject: [PATCH 120/125] feat: mainnet contract deployment 0.4.0 (#1148) * feat: mainnet contract deployment 0.4.0 * feat: deployments readme * chore: add changeset * contracts: remove dead contract * contracts: remove dead config * tests: fix to not test for old contracts --- .changeset/warm-dancers-switch.md | 5 + packages/contracts/deployments/README.md | 37 +- .../mainnet/Lib_AddressManager.json | 54 +-- .../OVM_CanonicalTransactionChain.json | 46 +-- ...OVM_ChainStorageContainer-CTC-batches.json | 117 ++----- .../OVM_ChainStorageContainer-CTC-queue.json | 117 ++----- ...OVM_ChainStorageContainer-SCC-batches.json | 117 ++----- .../mainnet/OVM_ExecutionManager.json | 313 ++++++++++++----- .../mainnet/OVM_FraudVerifier.json | 46 +-- .../mainnet/OVM_L1CrossDomainMessenger.json | 158 +++------ .../deployments/mainnet/OVM_L1ETHGateway.json | 322 ------------------ .../mainnet/OVM_L1MultiMessageRelayer.json | 36 +- .../mainnet/OVM_SafetyChecker.json | 20 +- .../mainnet/OVM_StateCommitmentChain.json | 42 +-- .../mainnet/OVM_StateManagerFactory.json | 20 +- .../mainnet/OVM_StateTransitionerFactory.json | 34 +- .../Proxy__OVM_L1CrossDomainMessenger.json | 40 +-- .../mainnet/Proxy__OVM_L1ETHGateway.json | 118 ------- .../mainnet/Proxy__OVM_L1StandardBridge.json | 177 ++++++++++ .../mainnet/mockOVM_BondManager.json | 34 +- .../43ee6bb8ef92595aa6d0e22a6c464dff.json | 312 ----------------- .../7531d7762a77038a37e7490a7b4b176f.json | 38 +++ ... => ef3f334bac4d7e77d91b457a0d89ab0a.json} | 290 +++++++++------- packages/contracts/src/connect-contracts.ts | 4 - packages/contracts/src/contract-data.ts | 16 - .../contracts/test/connect-contracts.spec.ts | 2 - 26 files changed, 955 insertions(+), 1560 deletions(-) create mode 100644 .changeset/warm-dancers-switch.md delete mode 100644 packages/contracts/deployments/mainnet/OVM_L1ETHGateway.json delete mode 100644 packages/contracts/deployments/mainnet/Proxy__OVM_L1ETHGateway.json create mode 100644 packages/contracts/deployments/mainnet/Proxy__OVM_L1StandardBridge.json delete mode 100644 packages/contracts/deployments/mainnet/solcInputs/43ee6bb8ef92595aa6d0e22a6c464dff.json create mode 100644 packages/contracts/deployments/mainnet/solcInputs/7531d7762a77038a37e7490a7b4b176f.json rename packages/contracts/deployments/mainnet/solcInputs/{f2bdab652d5102f5f11e78dae866798d.json => ef3f334bac4d7e77d91b457a0d89ab0a.json} (60%) diff --git a/.changeset/warm-dancers-switch.md b/.changeset/warm-dancers-switch.md new file mode 100644 index 000000000000..d420f4ca61e8 --- /dev/null +++ b/.changeset/warm-dancers-switch.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/contracts': patch +--- + +Add 0.4.0 deployment artifacts diff --git a/packages/contracts/deployments/README.md b/packages/contracts/deployments/README.md index c48cfa9ace8a..85e9b2e03c92 100644 --- a/packages/contracts/deployments/README.md +++ b/packages/contracts/deployments/README.md @@ -44,31 +44,28 @@ Network : __mainnet (chain id: 1)__ |Contract|Address| |--|--| -|Lib_AddressManager|[0x668E5b997b9aE88a56cd40409119d4Db9e6d752E](https://etherscan.io/address/0x668E5b997b9aE88a56cd40409119d4Db9e6d752E)| -|OVM_CanonicalTransactionChain|[0xa88e220c7FC7F0D845D2624a5dF1DfD6874B9a44](https://etherscan.io/address/0xa88e220c7FC7F0D845D2624a5dF1DfD6874B9a44)| -|OVM_ChainStorageContainer-CTC-batches|[0x28157e8a8E6d22A367c63Ad61dD56d9E6bDCE905](https://etherscan.io/address/0x28157e8a8E6d22A367c63Ad61dD56d9E6bDCE905)| -|OVM_ChainStorageContainer-CTC-queue|[0xD68670eD8800c856613FD3e4C55539A2Ff53cCb3](https://etherscan.io/address/0xD68670eD8800c856613FD3e4C55539A2Ff53cCb3)| -|OVM_ChainStorageContainer-SCC-batches|[0x7B8af5f008A7C5eFD319e68Fd5C9A68008519Caf](https://etherscan.io/address/0x7B8af5f008A7C5eFD319e68Fd5C9A68008519Caf)| -|OVM_ExecutionManager|[0x3f5FA555c434b49D946042955013966Fd108DaC3](https://etherscan.io/address/0x3f5FA555c434b49D946042955013966Fd108DaC3)| -|OVM_FraudVerifier|[0x169CC2f69Cc16da17B71Df2dce6161ef57991bB9](https://etherscan.io/address/0x169CC2f69Cc16da17B71Df2dce6161ef57991bB9)| -|OVM_L1MultiMessageRelayer|[0xc34F5B7279A9276A9D02491c59630fa725B7c36B](https://etherscan.io/address/0xc34F5B7279A9276A9D02491c59630fa725B7c36B)| -|OVM_SafetyChecker|[0xD87eFbBb82f1B7d25469641ee2E0E513f144394C](https://etherscan.io/address/0xD87eFbBb82f1B7d25469641ee2E0E513f144394C)| -|OVM_StateCommitmentChain|[0x6786EB419547a4902d285F70c6acDbC9AefAdB6F](https://etherscan.io/address/0x6786EB419547a4902d285F70c6acDbC9AefAdB6F)| -|OVM_StateManagerFactory|[0xA4C213C1E2bF5594baB0BCdF071ed5B0E946b19e](https://etherscan.io/address/0xA4C213C1E2bF5594baB0BCdF071ed5B0E946b19e)| -|OVM_StateTransitionerFactory|[0xAe4ef5e45C42dA513d2B48E184B64A05c18d8154](https://etherscan.io/address/0xAe4ef5e45C42dA513d2B48E184B64A05c18d8154)| -|Proxy__OVM_L1CrossDomainMessenger|[0x902e5fF5A99C4eC1C21bbab089fdabE32EF0A5DF](https://etherscan.io/address/0x902e5fF5A99C4eC1C21bbab089fdabE32EF0A5DF)| -|Proxy__OVM_L1ETHGateway|[0xe681F80966a8b1fFadECf8068bD6F99034791c95](https://etherscan.io/address/0xe681F80966a8b1fFadECf8068bD6F99034791c95)| -|mockOVM_BondManager|[0x90c5F8d045bBcCc99d907f30E8707F06D95d065b](https://etherscan.io/address/0x90c5F8d045bBcCc99d907f30E8707F06D95d065b)| +|Lib_AddressManager|[0xdE1FCfB0851916CA5101820A69b13a4E276bd81F](https://etherscan.io/address/0xdE1FCfB0851916CA5101820A69b13a4E276bd81F)| +|OVM_CanonicalTransactionChain|[0x4BF681894abEc828B212C906082B444Ceb2f6cf6](https://etherscan.io/address/0x4BF681894abEc828B212C906082B444Ceb2f6cf6)| +|OVM_ChainStorageContainer-CTC-batches|[0x3EA1a3839D8ca9a7ff3c567a9F36f4C4DbECc3eE](https://etherscan.io/address/0x3EA1a3839D8ca9a7ff3c567a9F36f4C4DbECc3eE)| +|OVM_ChainStorageContainer-CTC-queue|[0xA0b912b3Ea71A04065Ff82d3936D518ED6E38039](https://etherscan.io/address/0xA0b912b3Ea71A04065Ff82d3936D518ED6E38039)| +|OVM_ChainStorageContainer-SCC-batches|[0x77eBfdFcC906DDcDa0C42B866f26A8D5A2bb0572](https://etherscan.io/address/0x77eBfdFcC906DDcDa0C42B866f26A8D5A2bb0572)| +|OVM_ExecutionManager|[0x2745C24822f542BbfFB41c6cB20EdF766b5619f5](https://etherscan.io/address/0x2745C24822f542BbfFB41c6cB20EdF766b5619f5)| +|OVM_FraudVerifier|[0x042065416C5c665dc196076745326Af3Cd840D15](https://etherscan.io/address/0x042065416C5c665dc196076745326Af3Cd840D15)| +|OVM_L1MultiMessageRelayer|[0xF26391FBB1f77481f80a7d646AC08ba3817eA891](https://etherscan.io/address/0xF26391FBB1f77481f80a7d646AC08ba3817eA891)| +|OVM_SafetyChecker|[0xfe1F9Cf28ecDb12110aa8086e6FD343EA06035cC](https://etherscan.io/address/0xfe1F9Cf28ecDb12110aa8086e6FD343EA06035cC)| +|OVM_StateCommitmentChain|[0xE969C2724d2448F1d1A6189d3e2aA1F37d5998c1](https://etherscan.io/address/0xE969C2724d2448F1d1A6189d3e2aA1F37d5998c1)| +|OVM_StateManagerFactory|[0xd0e3e318154716BD9d007E1E6B021Eab246ff98d](https://etherscan.io/address/0xd0e3e318154716BD9d007E1E6B021Eab246ff98d)| +|OVM_StateTransitionerFactory|[0x38A6ed6fd76035684caDef38cF49a2FffA782B67](https://etherscan.io/address/0x38A6ed6fd76035684caDef38cF49a2FffA782B67)| +|Proxy__OVM_L1CrossDomainMessenger|[0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1](https://etherscan.io/address/0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1)| +|Proxy__OVM_L1StandardBridge|[0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1](https://etherscan.io/address/0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1)| +|mockOVM_BondManager|[0xCd76de5C57004d47d0216ec7dAbd3c72D8c49057](https://etherscan.io/address/0xCd76de5C57004d47d0216ec7dAbd3c72D8c49057)| --- ## KOVAN diff --git a/packages/contracts/deployments/mainnet/Lib_AddressManager.json b/packages/contracts/deployments/mainnet/Lib_AddressManager.json index e6108b197dc0..0bb340041f27 100644 --- a/packages/contracts/deployments/mainnet/Lib_AddressManager.json +++ b/packages/contracts/deployments/mainnet/Lib_AddressManager.json @@ -1,11 +1,11 @@ { - "address": "0x668E5b997b9aE88a56cd40409119d4Db9e6d752E", + "address": "0xdE1FCfB0851916CA5101820A69b13a4E276bd81F", "abi": [ { "anonymous": false, "inputs": [ { - "indexed": false, + "indexed": true, "internalType": "string", "name": "_name", "type": "string" @@ -15,6 +15,12 @@ "internalType": "address", "name": "_newAddress", "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_oldAddress", + "type": "address" } ], "name": "AddressSet", @@ -110,42 +116,42 @@ "type": "function" } ], - "transactionHash": "0xb7ffb05e540cf02a164869cca8b6f00f5d645148eac465644f27a6d80977f821", + "transactionHash": "0x8803c67a0032b8dea6b0e3a9d2ff1708346a41a8d2945d4e84e5d81862f1cb54", "receipt": { "to": null, - "from": "0xd033f09cB85621F98F7A84C64dB381ac16Eff818", - "contractAddress": "0x668E5b997b9aE88a56cd40409119d4Db9e6d752E", - "transactionIndex": 227, - "gasUsed": "427277", - "logsBloom": "0x00000000000000000000000000000040000000000000000000800000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000200000000000000800000000000000000000000000000020400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000001000000000000000000000000000000", - "blockHash": "0x53e80ac59e7178fc903374bca1e8fbb3c212cd56e6a4763e8cf6a564cf461457", - "transactionHash": "0xb7ffb05e540cf02a164869cca8b6f00f5d645148eac465644f27a6d80977f821", + "from": "0x9996571372066A1545D3435C6935e3F9593A7eF5", + "contractAddress": "0xdE1FCfB0851916CA5101820A69b13a4E276bd81F", + "transactionIndex": 43, + "gasUsed": "425357", + "logsBloom": "0x00800000002000000000000000000000000000000000000000800000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000001000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000040000000000000000000000000000000000000000000", + "blockHash": "0x6eeca8dcaa51370f0048dcc0569ebb0c62ba9841e5414b362aa15915c29428d1", + "transactionHash": "0x8803c67a0032b8dea6b0e3a9d2ff1708346a41a8d2945d4e84e5d81862f1cb54", "logs": [ { - "transactionIndex": 227, - "blockNumber": 12410727, - "transactionHash": "0xb7ffb05e540cf02a164869cca8b6f00f5d645148eac465644f27a6d80977f821", - "address": "0x668E5b997b9aE88a56cd40409119d4Db9e6d752E", + "transactionIndex": 43, + "blockNumber": 12686687, + "transactionHash": "0x8803c67a0032b8dea6b0e3a9d2ff1708346a41a8d2945d4e84e5d81862f1cb54", + "address": "0xdE1FCfB0851916CA5101820A69b13a4E276bd81F", "topics": [ "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "0x0000000000000000000000000000000000000000000000000000000000000000", - "0x000000000000000000000000d033f09cb85621f98f7a84c64db381ac16eff818" + "0x0000000000000000000000009996571372066a1545d3435c6935e3f9593a7ef5" ], "data": "0x", - "logIndex": 58, - "blockHash": "0x53e80ac59e7178fc903374bca1e8fbb3c212cd56e6a4763e8cf6a564cf461457" + "logIndex": 195, + "blockHash": "0x6eeca8dcaa51370f0048dcc0569ebb0c62ba9841e5414b362aa15915c29428d1" } ], - "blockNumber": 12410727, - "cumulativeGasUsed": "6359487", + "blockNumber": 12686687, + "cumulativeGasUsed": "6131161", "status": 1, "byzantium": true }, "args": [], - "solcInputHash": "f2bdab652d5102f5f11e78dae866798d", - "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\":{\"getAddress(string)\":{\"params\":{\"_name\":\"Name to retrieve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"setAddress(string,address)\":{\"params\":{\"_address\":\"Address to associate with the name.\",\"_name\":\"String name to associate an address with.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"Lib_AddressManager\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getAddress(string)\":{\"notice\":\"Retrieves the address associated with a given name.\"},\"setAddress(string,address)\":{\"notice\":\"Changes the address associated with a particular name.\"}},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0xcc9fc5c64f1101a5c6c397594086b1608189a9edc5c9635e1ac38f70aeeeecbf\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50600061001b61006a565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35061006e565b3390565b6106508061007d6000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063715018a61461005c5780638da5cb5b146100665780639b2ea4bd1461008a578063bf40fac11461013b578063f2fde38b146101e1575b600080fd5b610064610207565b005b61006e6102c5565b604080516001600160a01b039092168252519081900360200190f35b610064600480360360408110156100a057600080fd5b8101906020810181356401000000008111156100bb57600080fd5b8201836020820111156100cd57600080fd5b803590602001918460018302840111640100000000831117156100ef57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550505090356001600160a01b031691506102d49050565b61006e6004803603602081101561015157600080fd5b81019060208101813564010000000081111561016c57600080fd5b82018360208201111561017e57600080fd5b803590602001918460018302840111640100000000831117156101a057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610436945050505050565b610064600480360360208110156101f757600080fd5b50356001600160a01b0316610465565b61020f610579565b6001600160a01b03166102206102c5565b6001600160a01b03161461027b576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b6102dc610579565b6001600160a01b03166102ed6102c5565b6001600160a01b031614610348576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b80600160006103568561057d565b815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507f188466739ff00cc68bfb2367d23ae4b855264264fe1624caa8884399af23454c82826040518080602001836001600160a01b03168152602001828103825284818151815260200191508051906020019080838360005b838110156103f75781810151838201526020016103df565b50505050905090810190601f1680156104245780820380516001836020036101000a031916815260200191505b50935050505060405180910390a15050565b6000600160006104458461057d565b81526020810191909152604001600020546001600160a01b031692915050565b61046d610579565b6001600160a01b031661047e6102c5565b6001600160a01b0316146104d9576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03811661051e5760405162461bcd60e51b81526004018080602001828103825260268152602001806105f56026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b6000816040516020018082805190602001908083835b602083106105b25780518252601f199092019160209182019101610593565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405160208183030381529060405280519060200120905091905056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a26469706673582212204a95fb185077bedee9e8a29a2d18e7398dc688fcfeb979fef060e7ac4073b45464736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c8063715018a61461005c5780638da5cb5b146100665780639b2ea4bd1461008a578063bf40fac11461013b578063f2fde38b146101e1575b600080fd5b610064610207565b005b61006e6102c5565b604080516001600160a01b039092168252519081900360200190f35b610064600480360360408110156100a057600080fd5b8101906020810181356401000000008111156100bb57600080fd5b8201836020820111156100cd57600080fd5b803590602001918460018302840111640100000000831117156100ef57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550505090356001600160a01b031691506102d49050565b61006e6004803603602081101561015157600080fd5b81019060208101813564010000000081111561016c57600080fd5b82018360208201111561017e57600080fd5b803590602001918460018302840111640100000000831117156101a057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610436945050505050565b610064600480360360208110156101f757600080fd5b50356001600160a01b0316610465565b61020f610579565b6001600160a01b03166102206102c5565b6001600160a01b03161461027b576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b6102dc610579565b6001600160a01b03166102ed6102c5565b6001600160a01b031614610348576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b80600160006103568561057d565b815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507f188466739ff00cc68bfb2367d23ae4b855264264fe1624caa8884399af23454c82826040518080602001836001600160a01b03168152602001828103825284818151815260200191508051906020019080838360005b838110156103f75781810151838201526020016103df565b50505050905090810190601f1680156104245780820380516001836020036101000a031916815260200191505b50935050505060405180910390a15050565b6000600160006104458461057d565b81526020810191909152604001600020546001600160a01b031692915050565b61046d610579565b6001600160a01b031661047e6102c5565b6001600160a01b0316146104d9576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03811661051e5760405162461bcd60e51b81526004018080602001828103825260268152602001806105f56026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b6000816040516020018082805190602001908083835b602083106105b25780518252601f199092019160209182019101610593565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405160208183030381529060405280519060200120905091905056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a26469706673582212204a95fb185077bedee9e8a29a2d18e7398dc688fcfeb979fef060e7ac4073b45464736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_newAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_oldAddress\",\"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\":{\"getAddress(string)\":{\"params\":{\"_name\":\"Name to retrieve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"setAddress(string,address)\":{\"params\":{\"_address\":\"Address to associate with the name.\",\"_name\":\"String name to associate an address with.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"Lib_AddressManager\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getAddress(string)\":{\"notice\":\"Retrieves the address associated with a given name.\"},\"setAddress(string,address)\":{\"notice\":\"Changes the address associated with a particular name.\"}},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50600061001b61006a565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35061006e565b3390565b6106478061007d6000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063715018a61461005c5780638da5cb5b146100665780639b2ea4bd1461008a578063bf40fac11461013b578063f2fde38b146101e1575b600080fd5b610064610207565b005b61006e6102c5565b604080516001600160a01b039092168252519081900360200190f35b610064600480360360408110156100a057600080fd5b8101906020810181356401000000008111156100bb57600080fd5b8201836020820111156100cd57600080fd5b803590602001918460018302840111640100000000831117156100ef57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550505090356001600160a01b031691506102d49050565b61006e6004803603602081101561015157600080fd5b81019060208101813564010000000081111561016c57600080fd5b82018360208201111561017e57600080fd5b803590602001918460018302840111640100000000831117156101a057600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061042d945050505050565b610064600480360360208110156101f757600080fd5b50356001600160a01b031661045c565b61020f610570565b6001600160a01b03166102206102c5565b6001600160a01b03161461027b576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b6102dc610570565b6001600160a01b03166102ed6102c5565b6001600160a01b031614610348576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600061035383610574565b60008181526001602090815260409182902080546001600160a01b038781166001600160a01b0319831617909255925187519495509216928692918291908401908083835b602083106103b75780518252601f199092019160209182019101610398565b51815160001960209485036101000a01908116901991909116179052604080519490920184900384206001600160a01b03808b16865288169185019190915281519095507f9416a153a346f93d95f94b064ae3f148b6460473c6e82b3f9fc2521b873fcd6c94509283900301919050a250505050565b60006001600061043c84610574565b81526020810191909152604001600020546001600160a01b031692915050565b610464610570565b6001600160a01b03166104756102c5565b6001600160a01b0316146104d0576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166105155760405162461bcd60e51b81526004018080602001828103825260268152602001806105ec6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b6000816040516020018082805190602001908083835b602083106105a95780518252601f19909201916020918201910161058a565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405160208183030381529060405280519060200120905091905056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220b47b03a0c984a0faed73425d34ee172acb8f5010c64751f78c7f645cf8dc2aad64736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c8063715018a61461005c5780638da5cb5b146100665780639b2ea4bd1461008a578063bf40fac11461013b578063f2fde38b146101e1575b600080fd5b610064610207565b005b61006e6102c5565b604080516001600160a01b039092168252519081900360200190f35b610064600480360360408110156100a057600080fd5b8101906020810181356401000000008111156100bb57600080fd5b8201836020820111156100cd57600080fd5b803590602001918460018302840111640100000000831117156100ef57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550505090356001600160a01b031691506102d49050565b61006e6004803603602081101561015157600080fd5b81019060208101813564010000000081111561016c57600080fd5b82018360208201111561017e57600080fd5b803590602001918460018302840111640100000000831117156101a057600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061042d945050505050565b610064600480360360208110156101f757600080fd5b50356001600160a01b031661045c565b61020f610570565b6001600160a01b03166102206102c5565b6001600160a01b03161461027b576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b6102dc610570565b6001600160a01b03166102ed6102c5565b6001600160a01b031614610348576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600061035383610574565b60008181526001602090815260409182902080546001600160a01b038781166001600160a01b0319831617909255925187519495509216928692918291908401908083835b602083106103b75780518252601f199092019160209182019101610398565b51815160001960209485036101000a01908116901991909116179052604080519490920184900384206001600160a01b03808b16865288169185019190915281519095507f9416a153a346f93d95f94b064ae3f148b6460473c6e82b3f9fc2521b873fcd6c94509283900301919050a250505050565b60006001600061043c84610574565b81526020810191909152604001600020546001600160a01b031692915050565b610464610570565b6001600160a01b03166104756102c5565b6001600160a01b0316146104d0576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166105155760405162461bcd60e51b81526004018080602001828103825260268152602001806105ec6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b6000816040516020018082805190602001908083835b602083106105a95780518252601f19909201916020918201910161058a565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405160208183030381529060405280519060200120905091905056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220b47b03a0c984a0faed73425d34ee172acb8f5010c64751f78c7f645cf8dc2aad64736f6c63430007060033", "devdoc": { "kind": "dev", "methods": { @@ -199,7 +205,7 @@ "type": "t_address" }, { - "astId": 12793, + "astId": 15229, "contract": "contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol:Lib_AddressManager", "label": "addresses", "offset": 0, diff --git a/packages/contracts/deployments/mainnet/OVM_CanonicalTransactionChain.json b/packages/contracts/deployments/mainnet/OVM_CanonicalTransactionChain.json index 4764b4327c81..6ea5c289d040 100644 --- a/packages/contracts/deployments/mainnet/OVM_CanonicalTransactionChain.json +++ b/packages/contracts/deployments/mainnet/OVM_CanonicalTransactionChain.json @@ -1,5 +1,5 @@ { - "address": "0xa88e220c7FC7F0D845D2624a5dF1DfD6874B9a44", + "address": "0x4BF681894abEc828B212C906082B444Ceb2f6cf6", "abi": [ { "inputs": [ @@ -601,32 +601,32 @@ "type": "function" } ], - "transactionHash": "0x7d26b7cfd3f595bebab4d22ca651feb308c3f95e475a8d2e80f4b06ffefed461", + "transactionHash": "0x1d9ee5be9b96caee0e7a483a00992f660cf211f141d0852a538369bcdb96dc10", "receipt": { "to": null, - "from": "0xd033f09cB85621F98F7A84C64dB381ac16Eff818", - "contractAddress": "0xa88e220c7FC7F0D845D2624a5dF1DfD6874B9a44", - "transactionIndex": 102, + "from": "0x9996571372066A1545D3435C6935e3F9593A7eF5", + "contractAddress": "0x4BF681894abEc828B212C906082B444Ceb2f6cf6", + "transactionIndex": 78, "gasUsed": "2831026", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xb4aa0366ff1e4f3f49f77d89d9025e4102a8cd2a0b3fd64cd1c1a13b0a7c98f6", - "transactionHash": "0x7d26b7cfd3f595bebab4d22ca651feb308c3f95e475a8d2e80f4b06ffefed461", + "blockHash": "0xe13166f2268960246e812b13f74348464756543f29f24dd6677a7a21f39b61ea", + "transactionHash": "0x1d9ee5be9b96caee0e7a483a00992f660cf211f141d0852a538369bcdb96dc10", "logs": [], - "blockNumber": 12410807, - "cumulativeGasUsed": "8803160", + "blockNumber": 12686738, + "cumulativeGasUsed": "12001114", "status": 1, "byzantium": true }, "args": [ - "0x668E5b997b9aE88a56cd40409119d4Db9e6d752E", - 15769999, - 1213076, - 9000000 + "0xdE1FCfB0851916CA5101820A69b13a4E276bd81F", + 12592000, + 839466, + 11000000 ], - "solcInputHash": "f2bdab652d5102f5f11e78dae866798d", - "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\":\"\",\"type\":\"uint256\"}],\"name\":\"appendQueueBatch\",\"outputs\":[],\"stateMutability\":\"pure\",\"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\":\"transactionHash\",\"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\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"\",\"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\":{\"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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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. param _numQueuedTransactions Number of transactions to append.\"},\"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.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow, so we distribute\\n return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);\\n }\\n}\\n\",\"keccak256\":\"0x363bd3b45201f07c9b71c2edc96533468cf14a3d029fabd82fddceb1eb3ebd9c\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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\\\";\\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/* External Imports */\\nimport { Math } from \\\"@openzeppelin/contracts/math/Math.sol\\\";\\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 = 50000;\\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 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 return _getQueueElement(\\n _index,\\n queue()\\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 return _getQueueLength(\\n queue()\\n );\\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 queueRef = queue();\\n\\n queueRef.push(transactionHash);\\n queueRef.push(timestampAndBlockNumber);\\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 and subtract 1.\\n uint256 queueIndex = queueRef.length() / 2 - 1;\\n emit TransactionEnqueued(\\n msg.sender,\\n _target,\\n _gasLimit,\\n _data,\\n queueIndex,\\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 pure\\n {\\n // TEMPORARY: Disable `appendQueueBatch` for minnet\\n revert(\\\"appendQueueBatch is currently disabled.\\\");\\n\\n // _numQueuedTransactions = 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\\n require(\\n msg.data.length >= nextTransactionPtr,\\n \\\"Not enough BatchContexts provided.\\\"\\n );\\n\\n // Take a reference to the queue and its length so we don't have to keep resolving it.\\n // Length isn't going to change during the course of execution, so it's fine to simply\\n // resolve this once at the start. Saves gas.\\n iOVM_ChainStorageContainer queueRef = queue();\\n uint40 queueLength = _getQueueLength(queueRef);\\n\\n // Reserve some memory to save gas on hashing later on. This is a relatively safe estimate\\n // for the average transaction size that will prevent having to resize this chunk of memory\\n // later on. Saves gas.\\n bytes memory hashMemory = new bytes((msg.data.length / totalElementsToAppend) * 2);\\n\\n // Initialize the array of canonical chain leaves that we will append.\\n bytes32[] memory leaves = new bytes32[](totalElementsToAppend);\\n\\n // Each leaf index corresponds to a tx, either sequenced or enqueued.\\n uint32 leafIndex = 0;\\n\\n // Counter for number of sequencer transactions appended so far.\\n uint32 numSequencerTransactions = 0;\\n\\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 for (uint32 i = 0; i < numContexts; i++) {\\n BatchContext memory nextContext = _getBatchContext(i);\\n\\n if (i == 0) {\\n // Execute a special check for the first batch.\\n _validateFirstBatchContext(nextContext);\\n }\\n\\n // Execute this check on every single batch, including the first one.\\n _validateNextBatchContext(\\n curContext,\\n nextContext,\\n nextQueueIndex,\\n queueRef\\n );\\n\\n // Now we can update our current context.\\n curContext = nextContext;\\n\\n // Process sequencer transactions first.\\n for (uint32 j = 0; j < curContext.numSequencedTransactions; j++) {\\n uint256 txDataLength;\\n assembly {\\n txDataLength := shr(232, calldataload(nextTransactionPtr))\\n }\\n require(\\n txDataLength <= MAX_ROLLUP_TX_SIZE,\\n \\\"Transaction data size exceeds maximum for rollup transaction.\\\"\\n );\\n\\n leaves[leafIndex] = _getSequencerLeafHash(\\n curContext,\\n nextTransactionPtr,\\n txDataLength,\\n hashMemory\\n );\\n\\n nextTransactionPtr += uint40(TX_DATA_HEADER_SIZE + txDataLength);\\n numSequencerTransactions++;\\n leafIndex++;\\n }\\n\\n // Now process any subsequent queue transactions.\\n for (uint32 j = 0; j < curContext.numSubsequentQueueTransactions; j++) {\\n require(\\n nextQueueIndex < queueLength,\\n \\\"Not enough queued transactions to append.\\\"\\n );\\n\\n leaves[leafIndex] = _getQueueLeafHash(nextQueueIndex);\\n nextQueueIndex++;\\n leafIndex++;\\n }\\n }\\n\\n _validateFinalBatchContext(\\n curContext,\\n nextQueueIndex,\\n queueLength,\\n queueRef\\n );\\n\\n require(\\n msg.data.length == 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 blockTimestamp;\\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 blockTimestamp = 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 // curContext.numSubsequentQueueTransactions > 0 which means that we've processed at least one queue element.\\n // We increment nextQueueIndex after processing each queue element,\\n // so the index of the last element we processed is nextQueueIndex - 1.\\n Lib_OVMCodec.QueueElement memory lastElement = _getQueueElement(\\n nextQueueIndex - 1,\\n queueRef\\n );\\n\\n blockTimestamp = lastElement.timestamp;\\n blockNumber = lastElement.blockNumber;\\n }\\n\\n // For efficiency reasons getMerkleRoot modifies the `leaves` argument in place\\n // while calculating the root hash therefore any arguments passed to it must not\\n // be used again afterwards\\n _appendBatch(\\n Lib_MerkleTree.getMerkleRoot(leaves),\\n totalElementsToAppend,\\n numQueuedTransactions,\\n blockTimestamp,\\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 pure\\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 * 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 iOVM_ChainStorageContainer _queueRef\\n )\\n internal\\n view\\n returns (\\n Lib_OVMCodec.QueueElement memory _element\\n )\\n {\\n // The underlying queue data structure stores 2 elements\\n // per insertion, so to get the actual desired queue index\\n // we need to multiply by 2.\\n uint40 trueIndex = uint40(_index * 2);\\n bytes32 transactionHash = _queueRef.get(trueIndex);\\n bytes32 timestampAndBlockNumber = _queueRef.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 transactionHash: transactionHash,\\n timestamp: elementTimestamp,\\n blockNumber: elementBlockNumber\\n });\\n }\\n\\n /**\\n * Retrieves the length of the queue.\\n * @return Length of the queue.\\n */\\n function _getQueueLength(\\n iOVM_ChainStorageContainer _queueRef\\n )\\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.\\n return uint40(_queueRef.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 bytes memory _hashMemory\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n // Only allocate more memory if we didn't reserve enough to begin with.\\n if (BYTES_TILL_TX_DATA + _txDataLength > _hashMemory.length) {\\n _hashMemory = new bytes(BYTES_TILL_TX_DATA + _txDataLength);\\n }\\n\\n uint256 ctxTimestamp = _context.timestamp;\\n uint256 ctxBlockNumber = _context.blockNumber;\\n\\n bytes32 leafHash;\\n assembly {\\n let chainElementStart := add(_hashMemory, 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 iOVM_ChainStorageContainer batchesRef = batches();\\n (uint40 totalElements, uint40 nextQueueIndex,,) = _getBatchExtraData();\\n\\n Lib_OVMCodec.ChainBatchHeader memory header = Lib_OVMCodec.ChainBatchHeader({\\n batchIndex: batchesRef.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 batchesRef.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 have the same context\\n // or a later timestamp and block number.\\n if (getTotalElements() > 0) {\\n (,, uint40 lastTimestamp, uint40 lastBlockNumber) = _getBatchExtraData();\\n\\n require(\\n _firstContext.blockNumber >= lastBlockNumber,\\n \\\"Context block number is lower than last submitted.\\\"\\n );\\n\\n require(\\n _firstContext.timestamp >= lastTimestamp,\\n \\\"Context timestamp is lower than last submitted.\\\"\\n );\\n }\\n\\n // Sequencer cannot submit contexts which are more than the force inclusion period old.\\n require(\\n _firstContext.timestamp + forceInclusionPeriodSeconds >= block.timestamp,\\n \\\"Context timestamp too far in the past.\\\"\\n );\\n\\n require(\\n _firstContext.blockNumber + forceInclusionPeriodBlocks >= block.number,\\n \\\"Context block number too far in the past.\\\"\\n );\\n }\\n\\n /**\\n * Checks that a given batch context has a time context which is below a given que element\\n * @param _context The batch context to validate has values lower.\\n * @param _queueIndex Index of the queue element we are validating came later than the context.\\n * @param _queueRef The storage container for the queue.\\n */\\n function _validateContextBeforeEnqueue(\\n BatchContext memory _context,\\n uint40 _queueIndex,\\n iOVM_ChainStorageContainer _queueRef\\n )\\n internal\\n view\\n {\\n Lib_OVMCodec.QueueElement memory nextQueueElement = _getQueueElement(\\n _queueIndex,\\n _queueRef\\n );\\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 _context.timestamp <= nextQueueElement.timestamp,\\n \\\"Sequencer transaction timestamp exceeds that of next queue element.\\\"\\n );\\n\\n require(\\n _context.blockNumber <= nextQueueElement.blockNumber,\\n \\\"Sequencer transaction blockNumber exceeds that of next queue element.\\\"\\n );\\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 * @param _queueRef The storage container for the queue.\\n */\\n function _validateNextBatchContext(\\n BatchContext memory _prevContext,\\n BatchContext memory _nextContext,\\n uint40 _nextQueueIndex,\\n iOVM_ChainStorageContainer _queueRef\\n )\\n internal\\n view\\n {\\n // All sequencer transactions' times must be greater than or equal to 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 is going to be a queue element pulled in from this context:\\n if (_nextContext.numSubsequentQueueTransactions > 0) {\\n _validateContextBeforeEnqueue(\\n _nextContext,\\n _nextQueueIndex,\\n _queueRef\\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 * @param _queueLength The length of the queue at the start of the batchAppend call.\\n * @param _nextQueueIndex The next element in the queue that will be pulled into the CTC.\\n * @param _queueRef The storage container for the queue.\\n */\\n function _validateFinalBatchContext(\\n BatchContext memory _finalContext,\\n uint40 _nextQueueIndex,\\n uint40 _queueLength,\\n iOVM_ChainStorageContainer _queueRef\\n )\\n internal\\n view\\n {\\n // If the queue is not now empty, check the mononoticity of whatever the next batch that will come in is.\\n if (_queueLength - _nextQueueIndex > 0 && _finalContext.numSubsequentQueueTransactions == 0) {\\n _validateContextBeforeEnqueue(\\n _finalContext,\\n _nextQueueIndex,\\n _queueRef\\n );\\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.transactionHash == 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\":\"0xdc5f311b6840476027f597b9b6ff6c7673988cfed9c9ace625c705175b27abe3\",\"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\\\";\\nimport { Lib_ErrorUtils } from \\\"../../libraries/utils/Lib_ErrorUtils.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_DeployerWhitelist } from \\\"../predeploys/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 * Default Context Values *\\n **************************/\\n\\n uint256 constant DEFAULT_UINT256 = 0xdefa017defa017defa017defa017defa017defa017defa017defa017defa017d;\\n address constant DEFAULT_ADDRESS = 0xdEfa017defA017DeFA017DEfa017DeFA017DeFa0;\\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 Lib_AddressResolver(_libAddressManager)\\n {\\n ovmSafetyChecker = iOVM_SafetyChecker(resolve(\\\"OVM_SafetyChecker\\\"));\\n gasMeterConfig = _gasMeterConfig;\\n globalContext = _globalContext;\\n _resetContext();\\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 external\\n returns (\\n bytes memory\\n )\\n {\\n // Make sure that run() is not re-enterable. This condition should always be satisfied\\n // Once run has been called once, due to the behavior of _isValidInput().\\n if (transactionContext.ovmNUMBER != DEFAULT_UINT256) {\\n return bytes(\\\"\\\");\\n }\\n\\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 (_isValidInput(_transaction) == false) {\\n _resetContext();\\n return bytes(\\\"\\\");\\n }\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\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 (, bytes memory returndata) = ovmCALL(\\n _transaction.gasLimit - gasMeterConfig.minTransactionGasLimit,\\n _transaction.entrypoint,\\n _transaction.data\\n );\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\n // // Update the cumulative gas based on the amount of gas used.\\n // uint256 gasUsed = gasProvided - gasleft();\\n // _updateCumulativeGas(gasUsed, _transaction.l1QueueOrigin);\\n\\n // Wipe the execution context.\\n _resetContext();\\n\\n return returndata;\\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 external\\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 external\\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 external\\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 external\\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 external\\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 source (Sequencer or Queue) this transaction originated from.\\n * @return _queueOrigin Enum indicating the ovmL1QUEUEORIGIN within the current message context.\\n */\\n function ovmL1QUEUEORIGIN()\\n override\\n external\\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 external\\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 Address of the created contract.\\n * @return Revert data, if and only if the creation threw an exception.\\n */\\n function ovmCREATE(\\n bytes memory _bytecode\\n )\\n override\\n public\\n notStatic\\n fixedGasDiscount(40000)\\n returns (\\n address,\\n bytes memory\\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 Address of the created contract.\\n * @return Revert data, if and only if the creation threw an exception.\\n */\\n function ovmCREATE2(\\n bytes memory _bytecode,\\n bytes32 _salt\\n )\\n override\\n external\\n notStatic\\n fixedGasDiscount(40000)\\n returns (\\n address,\\n bytes memory\\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 external\\n returns (\\n uint256 _nonce\\n )\\n {\\n return _getAccountNonce(ovmADDRESS());\\n }\\n\\n /**\\n * Bumps the nonce of the current ovmADDRESS by one.\\n */\\n function ovmINCREMENTNONCE()\\n override\\n external\\n notStatic\\n {\\n address account = ovmADDRESS();\\n uint256 nonce = _getAccountNonce(account);\\n\\n // Prevent overflow.\\n if (nonce + 1 > nonce) {\\n _setAccountNonce(account, nonce + 1);\\n }\\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 // Creates a duplicate of the OVM_ProxyEOA located at 0x42....09. Uses the following\\n // \\\"magic\\\" prefix to deploy an exact copy of the code:\\n // PUSH1 0x0D # size of this prefix in bytes\\n // CODESIZE\\n // SUB # subtract prefix size from codesize\\n // DUP1\\n // PUSH1 0x0D\\n // PUSH1 0x00\\n // CODECOPY # copy everything after prefix into memory at pos 0\\n // PUSH1 0x00\\n // RETURN # return the copied code\\n address proxyEOA = Lib_EthUtils.createContract(abi.encodePacked(\\n hex\\\"600D380380600D6000396000f3\\\",\\n ovmEXTCODECOPY(\\n 0x4200000000000000000000000000000000000009,\\n 0,\\n ovmEXTCODESIZE(0x4200000000000000000000000000000000000009)\\n )\\n ));\\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 external\\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 external\\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\\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 external\\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 external\\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 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 external\\n returns (\\n bytes32 _EXTCODEHASH\\n )\\n {\\n return Lib_EthUtils.getCodeHash(\\n _getAccountEthAddress(_contract)\\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 Whitelisting *\\n ********************************************/\\n\\n /**\\n * Checks whether the given address is on the whitelist 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 semantics perspective, this will appear 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 Final OVM contract address.\\n * @return Revertdata, if and only if the creation threw an exception.\\n */\\n function _createContract(\\n address _contractAddress,\\n bytes memory _bytecode\\n )\\n internal\\n returns (\\n address,\\n bytes memory\\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 the common logic which occurs between call-type and create-type messages,\\n // passing in the creation bytecode and `true` to trigger create-specific logic.\\n (bool success, bytes memory data) = _handleExternalMessage(\\n nextMessageContext,\\n gasleft(),\\n _contractAddress,\\n _bytecode,\\n true\\n );\\n\\n // Yellow paper requires that address returned is zero if the contract deployment fails.\\n return (\\n success ? _contractAddress : address(0),\\n data\\n );\\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 // EVM does not return data in the success case, see: https://github.com/ethereum/go-ethereum/blob/aae7660410f0ef90279e14afaaf2f429fdc2a186/core/vm/instructions.go#L600-L604\\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 _handleExternalMessage(\\n _nextMessageContext,\\n _gasLimit,\\n codeContractAddress,\\n _calldata,\\n false\\n );\\n }\\n\\n /**\\n * Handles all interactions which involve the execution manager calling out to untrusted code (both calls and creates).\\n * Ensures that OVM-related measures are enforced, including L2 gas refunds, nuisance gas, and flagged reversions.\\n *\\n * @param _nextMessageContext Message context to be used for the external message.\\n * @param _gasLimit Amount of gas to be passed into this message.\\n * @param _contract OVM address being called or deployed to\\n * @param _data Data for the message (either calldata or creation code)\\n * @param _isCreate Whether this is a create-type message.\\n * @return Whether or not the message (either a call or deployment) succeeded.\\n * @return Data returned by the message.\\n */\\n function _handleExternalMessage(\\n MessageContext memory _nextMessageContext,\\n uint256 _gasLimit,\\n address _contract,\\n bytes memory _data,\\n bool _isCreate\\n )\\n internal\\n returns (\\n bool,\\n bytes memory\\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. `_contract` 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\\n bool success;\\n bytes memory returndata;\\n if (_isCreate) {\\n // safeCREATE() is a function which replicates a CREATE message, but uses return values\\n // Which match that of CALL (i.e. bool, bytes). This allows many security checks to be\\n // to be shared between untrusted call and create call frames.\\n (success, returndata) = address(this).call(\\n abi.encodeWithSelector(\\n this.safeCREATE.selector,\\n _gasLimit,\\n _data,\\n _contract\\n )\\n );\\n } else {\\n (success, returndata) = _contract.call{gas: _gasLimit}(_data);\\n }\\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 (\\n flag == RevertFlag.INTENTIONAL_REVERT\\n || _isCreate\\n ) {\\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 * Handles the creation-specific safety measures required for OVM contract deployment.\\n * This function sanitizes the return types for creation messages to match calls (bool, bytes),\\n * by being an external function which the EM can call, that mimics the success/fail case of the CREATE.\\n * This allows for consistent handling of both types of messages in _handleExternalMessage().\\n * Having this step occur as a separate call frame also allows us to easily revert the\\n * contract deployment in the event that the code is unsafe.\\n *\\n * @param _gasLimit Amount of gas to be passed into this creation.\\n * @param _creationCode Code to pass into CREATE for deployment.\\n * @param _address OVM address being deployed to.\\n */\\n function safeCREATE(\\n uint _gasLimit,\\n bytes memory _creationCode,\\n address _address\\n )\\n external\\n {\\n // The only way this should callable is from within _createContract(),\\n // and it should DEFINITELY not be callable by a non-EM code contract.\\n if (msg.sender != address(this)) {\\n return;\\n }\\n // Check that there is not already code at this address.\\n if (_hasEmptyAccount(_address) == false) {\\n // Note: in the EVM, this case burns all allotted gas. For improved\\n // developer experience, we do return the remaining gas.\\n _revertWithFlag(\\n RevertFlag.CREATE_COLLISION,\\n Lib_ErrorUtils.encodeRevertString(\\\"A contract has already been deployed to this address\\\")\\n );\\n }\\n\\n // Check the creation bytecode against the OVM_SafetyChecker.\\n if (ovmSafetyChecker.isBytecodeSafe(_creationCode) == false) {\\n _revertWithFlag(\\n RevertFlag.UNSAFE_BYTECODE,\\n Lib_ErrorUtils.encodeRevertString(\\\"Contract creation code contains unsafe opcodes. Did you use the right compiler or pass an unsafe constructor argument?\\\")\\n );\\n }\\n\\n // We always need to initialize the contract with the default account values.\\n _initPendingAccount(_address);\\n\\n // Actually execute the EVM create message.\\n // NOTE: The inline assembly below means we can NOT make any evm calls between here and then.\\n address ethAddress = Lib_EthUtils.createContract(_creationCode);\\n\\n if (ethAddress == address(0)) {\\n // If the creation fails, the EVM lets us grab its revert data. This may contain a revert flag\\n // to be used above in _handleExternalMessage, so we pass the revert data back up unmodified.\\n assembly {\\n returndatacopy(0,0,returndatasize())\\n revert(0, returndatasize())\\n }\\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(\\n RevertFlag.UNSAFE_BYTECODE,\\n Lib_ErrorUtils.encodeRevertString(\\\"Constructor attempted to deploy unsafe bytecode.\\\")\\n );\\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 * 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 ) {\\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 view\\n {\\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 input values of a transaction.\\n * @return _valid Whether or not the transaction data is valid.\\n */\\n function _isValidInput(\\n Lib_OVMCodec.Transaction memory _transaction\\n )\\n view\\n internal\\n returns (\\n bool\\n )\\n {\\n // Prevent reentrancy to run():\\n // This check prevents calling run with the default ovmNumber.\\n // Combined with the first check in run():\\n // if (transactionContext.ovmNUMBER != DEFAULT_UINT256) { return; }\\n // It should be impossible to re-enter since run() returns before any other call frames are created.\\n // Since this value is already being written to storage, we save much gas compared to\\n // using the standard nonReentrant pattern.\\n if (_transaction.blockNumber == DEFAULT_UINT256) {\\n return false;\\n }\\n\\n if (_isValidGasLimit(_transaction.gasLimit, _transaction.l1QueueOrigin) == false) {\\n return false;\\n }\\n\\n return true;\\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 view\\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 = DEFAULT_ADDRESS;\\n transactionContext.ovmTIMESTAMP = DEFAULT_UINT256;\\n transactionContext.ovmNUMBER = DEFAULT_UINT256;\\n transactionContext.ovmGASLIMIT = DEFAULT_UINT256;\\n transactionContext.ovmTXGASLIMIT = DEFAULT_UINT256;\\n transactionContext.ovmL1QUEUEORIGIN = Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE;\\n\\n transactionRecord.ovmGasRefund = DEFAULT_UINT256;\\n\\n messageContext.ovmCALLER = DEFAULT_ADDRESS;\\n messageContext.ovmADDRESS = DEFAULT_ADDRESS;\\n messageContext.isStatic = false;\\n\\n messageRecord.nuisanceGasLeft = DEFAULT_UINT256;\\n\\n // Reset the ovmStateManager.\\n ovmStateManager = iOVM_StateManager(address(0));\\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 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 messageRecord.nuisanceGasLeft = uint(-1);\\n\\n messageContext.ovmADDRESS = _from;\\n\\n bool isCreate = _transaction.entrypoint == address(0);\\n if (isCreate) {\\n (address created, bytes memory revertData) = ovmCREATE(_transaction.data);\\n if (created == address(0)) {\\n return abi.encode(false, revertData);\\n } else {\\n // The eth_call RPC endpoint for to = undefined will return the deployed bytecode\\n // in the success case, differing from standard create messages.\\n return abi.encode(true, Lib_EthUtils.getCode(created));\\n }\\n } else {\\n (bool success, bytes memory returndata) = ovmCALL(\\n _transaction.gasLimit,\\n _transaction.entrypoint,\\n _transaction.data\\n );\\n return abi.encode(success, returndata);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2d8c32b3438f9b9da37e33430527e12658178bd96b0863e20bd02fcaaf162cd4\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/predeploys/OVM_DeployerWhitelist.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Interface Imports */\\nimport { iOVM_DeployerWhitelist } from \\\"../../iOVM/predeploys/iOVM_DeployerWhitelist.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: optimistic-solc\\n * Runtime target: OVM\\n */\\ncontract OVM_DeployerWhitelist is iOVM_DeployerWhitelist {\\n\\n /**********************\\n * Contract Constants *\\n **********************/\\n\\n bool public initialized;\\n bool public allowArbitraryDeployment;\\n address override public owner;\\n mapping (address => bool) public whitelist;\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Blocks functions to anyone except the contract owner.\\n */\\n modifier onlyOwner() {\\n require(\\n msg.sender == 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 external\\n {\\n if (initialized == true) {\\n return;\\n }\\n\\n initialized = true;\\n allowArbitraryDeployment = _allowArbitraryDeployment;\\n owner = _owner;\\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 external\\n onlyOwner\\n {\\n whitelist[_deployer] = _isWhitelisted;\\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 owner = _owner;\\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 allowArbitraryDeployment = _allowArbitraryDeployment;\\n }\\n\\n /**\\n * Permanently enables arbitrary contract deployment and deletes the owner.\\n */\\n function enableArbitraryContractDeployment()\\n override\\n external\\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 external\\n returns (\\n bool\\n )\\n {\\n return (\\n initialized == false\\n || allowArbitraryDeployment == true\\n || whitelist[_deployer]\\n );\\n }\\n}\\n\",\"keccak256\":\"0xb96bfb8eb24503b05de41483cc9fb7a7f81107aa1ca146dc281952f8100848a0\",\"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 * 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\":\"0x2d7973a0ad84c23ec62624d3f1e3aeb198cc72686ff1e6cfa17155556b320c94\",\"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 OUT_OF_GAS,\\n INTENTIONAL_REVERT,\\n EXCEEDS_NUISANCE_GAS,\\n INVALID_STATE_ACCESS,\\n UNSAFE_BYTECODE,\\n CREATE_COLLISION,\\n STATIC_VIOLATION,\\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 }\\n\\n\\n /************************************\\n * Transaction Execution Entrypoint *\\n ************************************/\\n\\n function run(\\n Lib_OVMCodec.Transaction calldata _transaction,\\n address _txStateManager\\n ) external returns (bytes memory);\\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, bytes memory _revertdata);\\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract, bytes memory _revertdata);\\n\\n\\n /*******************************\\n * Account Abstraction Opcodes *\\n ******************************/\\n\\n function ovmGETNONCE() external returns (uint256 _nonce);\\n function ovmINCREMENTNONCE() 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 Context *\\n ***************************************/\\n\\n function getMaxTransactionGasLimit() external view returns (uint _maxTransactionGasLimit);\\n}\\n\",\"keccak256\":\"0xf023d5d6fc6a03bd52f7a57af6e21076de77e8925d065bb79db062e73e43b684\",\"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/predeploys/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 owner() 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\":\"0xdf1f27faf0d26d416bf6d408d146a16de32b4e1772a292c65d39eb7ec2b53ceb\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0xcc9fc5c64f1101a5c6c397594086b1608189a9edc5c9635e1ac38f70aeeeecbf\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_ErrorUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/**\\n * @title Lib_ErrorUtils\\n */\\nlibrary Lib_ErrorUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes an error string into raw solidity-style revert data.\\n * (i.e. ascii bytes, prefixed with bytes4(keccak(\\\"Error(string))\\\"))\\n * Ref: https://docs.soliditylang.org/en/v0.8.2/control-structures.html?highlight=Error(string)#panic-via-assert-and-error-via-require\\n * @param _reason Reason for the reversion.\\n * @return Standard solidity revert data for the given reason.\\n */\\n function encodeRevertString(\\n string memory _reason\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return abi.encodeWithSignature(\\n \\\"Error(string)\\\",\\n _reason\\n );\\n }\\n}\\n\",\"keccak256\":\"0xfc64ec4a81fb50865b502a0004ed154e8598e1a313db77303fc95e41f536e6b7\",\"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 *\\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 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\\n )\\n {\\n bytes memory code;\\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 Full code of the contract.\\n */\\n function getCode(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes memory\\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 Size of the contract's code in bytes.\\n */\\n function getCodeSize(\\n address _address\\n )\\n internal\\n view\\n returns (\\n uint256\\n )\\n {\\n uint256 codeSize;\\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 Hash of the contract's code.\\n */\\n function getCodeHash(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n bytes32 codeHash;\\n assembly {\\n codeHash := extcodehash(_address)\\n }\\n\\n return codeHash;\\n }\\n\\n /**\\n * Creates a contract with some given initialization code.\\n * @param _code Contract initialization code.\\n * @return Address of the created contract.\\n */\\n function createContract(\\n bytes memory _code\\n )\\n internal\\n returns (\\n address\\n )\\n {\\n address created;\\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 to be generated by CREATE.\\n */\\n function getAddressForCREATE(\\n address _creator,\\n uint256 _nonce\\n )\\n internal\\n pure\\n returns (\\n 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 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 (\\n address\\n )\\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\":\"0xf29a67d78e61cb472d524b779b32cfcb39a587f4096500d5419e6425ed367d49\",\"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 * Note that the _elements argument is modified, therefore it must not be used again afterwards\\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 pure\\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 == 1) {\\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 (uint256 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\":\"0xa78edb9fbd34712771a1ebff05bc5e1abec7fc1e9a1bfb709d183099b44fa62a\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506040516200315338038062003153833981016040819052620000349162000067565b600080546001600160a01b0319166001600160a01b039590951694909417909355600191909155600255600355620000b2565b600080600080608085870312156200007d578384fd5b84516001600160a01b038116811462000094578485fd5b60208601516040870151606090970151919890975090945092505050565b61309180620000c26000396000f3fe608060405234801561001057600080fd5b50600436106101425760003560e01c8063876ed5cb116100b8578063cfdf677e1161007c578063cfdf677e1461023f578063d0f8934414610247578063e10d29ee1461024f578063e561dddc14610257578063f722b41a1461025f578063facdc5da1461026757610142565b8063876ed5cb146102175780638d38c6c11461021f578063b8f7700514610227578063c139eb151461022f578063c2cf696f1461023757610142565b80634de569ce1161010a5780634de569ce146101c25780635ae6256d146101e25780636fee07e0146101ea57806378f4b2f2146101ff5780637a167a8a146102075780637aa63a861461020f57610142565b8063138387a414610147578063299ca478146101655780632a7f18be1461017a578063378997701461019a578063461a4478146101af575b600080fd5b61014f61027a565b60405161015c91906124c7565b60405180910390f35b61016d610280565b60405161015c91906123eb565b61018d610188366004612388565b61028f565b60405161015c9190612e4e565b6101a26102b0565b60405161015c9190612e8d565b61016d6101bd36600461221b565b6102c4565b6101d56101d0366004612261565b6103a0565b60405161015c9190612484565b6101a26103da565b6101fd6101f8366004612188565b6103ee565b005b61014f61066d565b6101a2610674565b61014f610689565b61014f6106a4565b61014f6106aa565b6101a26106b0565b61014f6106c7565b61014f6106cd565b61016d6106d2565b6101fd6106f5565b61016d610b69565b61014f610b8c565b6101a2610c06565b6101fd610275366004612388565b610c1e565b60025481565b6000546001600160a01b031681565b610297611ed9565b6102a8826102a3610b69565b610c36565b90505b919050565b6000806102bb610d76565b50935050505090565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561032457818101518382015260200161030c565b50505050905090810190601f1680156103515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561036e57600080fd5b505afa158015610382573d6000803e3d6000fd5b505050506040513d602081101561039857600080fd5b505192915050565b82516000901515600114156103c2576103bb85858585610e24565b90506103d2565b6103bb8585602001518585610fef565b949350505050565b6000806103e5610d76565b94505050505090565b61c3508151111561041a5760405162461bcd60e51b81526004016104119061259b565b60405180910390fd5b60035482111561043c5760405162461bcd60e51b8152600401610411906127a1565b620186a082101561045f5760405162461bcd60e51b815260040161041190612983565b6020820460005a90508181116104875760405162461bcd60e51b815260040161041190612b8a565b60005b825a8303101561049c5760010161048a565b6000338787876040516020016104b594939291906123ff565b60408051601f19818403018152919052805160209091012090504360281b421760006104df610b69565b60405163b298e36b60e01b81529091506001600160a01b0382169063b298e36b9061050e9086906004016124c7565b600060405180830381600087803b15801561052857600080fd5b505af115801561053c573d6000803e3d6000fd5b505060405163b298e36b60e01b81526001600160a01b038416925063b298e36b915061056c9085906004016124c7565b600060405180830381600087803b15801561058657600080fd5b505af115801561059a573d6000803e3d6000fd5b50505050600060016002836001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156105dd57600080fd5b505afa1580156105f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106159190612203565b8161061c57fe5b040390507f4b388aecf9fa6cc92253704e5975a6129a4f735bdbd99567df4ed0094ee4ceb5338b8b8b85426040516106599695949392919061243c565b60405180910390a150505050505050505050565b620186a081565b60008061067f610d76565b5090935050505090565b600080610694610d76565b50505064ffffffffff1692915050565b61c35081565b60035481565b60006106c26106bd610b69565b6110c4565b905090565b60015481565b602081565b60006106c2604051806060016040528060258152602001613003602591396102c4565b60043560d81c60093560e890811c90600c35901c610711610689565b8364ffffffffff16146107365760405162461bcd60e51b815260040161041190612a35565b6107646040518060400160405280600d81526020016c27ab26afa9b2b8bab2b731b2b960991b8152506102c4565b6001600160a01b0316336001600160a01b0316146107945760405162461bcd60e51b815260040161041190612a92565b60008162ffffff16116107b95760405162461bcd60e51b8152600401610411906127fe565b60008262ffffff16116107de5760405162461bcd60e51b815260040161041190612cdf565b600f601062ffffff8316020164ffffffffff81163610156108115760405162461bcd60e51b815260040161041190612d66565b600061081b610b69565b90506000610828826110c4565b9050600062ffffff8616368161083a57fe5b0460020267ffffffffffffffff8111801561085457600080fd5b506040519080825280601f01601f19166020018201604052801561087f576020820181803683370190505b50905060008662ffffff1667ffffffffffffffff811180156108a057600080fd5b506040519080825280602002602001820160405280156108ca578160200160208202803683370190505b50905060008060006108da610674565b90506108e4611ef9565b60005b8a62ffffff168163ffffffff161015610a3b57600061090b8263ffffffff16611147565b905063ffffffff82166109215761092181611197565b61092d8382868d611264565b80925060005b835163ffffffff821610156109b1578b3560e81c61c3508111156109695760405162461bcd60e51b81526004016104119061259b565b61097c858e64ffffffffff16838d6112cf565b898963ffffffff168151811061098e57fe5b60209081029190910101529b909b016003019a6001968701969586019501610933565b5060005b83602001518163ffffffff161015610a31578964ffffffffff168564ffffffffff16106109f45760405162461bcd60e51b815260040161041190612da8565b610a048564ffffffffff16611363565b888863ffffffff1681518110610a1657fe5b602090810291909101015260019687019694850194016109b5565b50506001016108e7565b50610a488183898b6113a8565b3664ffffffffff8a1614610a6e5760405162461bcd60e51b815260040161041190612846565b8a62ffffff168463ffffffff1614610a985760405162461bcd60e51b815260040161041190612894565b6000838c62ffffff160363ffffffff169050600080836020015160001415610acb57505060408201516060830151610af3565b6000610ae16001870364ffffffffff168d610c36565b90508060200151925080604001519150505b610b14610aff8961141b565b8f62ffffff168564ffffffffff16858561184f565b7f602f1aeac0ca2e7a13e281a9ef0ad7838542712ce16780fa2ecffd351f05f89983860384610b41610689565b604051610b5093929190612e9f565b60405180910390a1505050505050505050505050505050565b60006106c2604051806060016040528060238152602001612ee6602391396102c4565b6000610b966106d2565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610bce57600080fd5b505afa158015610be2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c29190612203565b6000610c10610674565b610c186106b0565b03905090565b60405162461bcd60e51b81526004016104119061250b565b610c3e611ed9565b604051634a83e9cd60e11b815260028402906000906001600160a01b03851690639507d39a90610c72908590600401612e8d565b60206040518083038186803b158015610c8a57600080fd5b505afa158015610c9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc29190612203565b90506000846001600160a01b0316639507d39a846001016040518263ffffffff1660e01b8152600401610cf59190612e8d565b60206040518083038186803b158015610d0d57600080fd5b505afa158015610d21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d459190612203565b6040805160608101825293845264ffffffffff828116602086015260289290921c9091169083015250949350505050565b6000806000806000610d866106d2565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b158015610dbe57600080fd5b505afa158015610dd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df691906121dd565b64ffffffffff602882901c811697605083901c82169750607883901c8216965060a09290921c169350915050565b600080610e5c6040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b8152506102c4565b90506000816001600160a01b0316631c4712a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610e9957600080fd5b505afa158015610ead573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed19190612203565b90506000610ede87611a02565b9050610eeb818787611a9b565b610f075760405162461bcd60e51b8152600401610411906126ca565b86606001518860200151148015610f22575060408701518851145b8015610f635750610f4a604051806060016040528060228152602001612f09602291396102c4565b6001600160a01b031688608001516001600160a01b0316145b8015610f725750818860a00151145b8015610f89575060608801516001600160a01b0316155b8015610fa45750600088604001516001811115610fa257fe5b145b8015610fc557508660800151805190602001208860c0015180519060200120145b610fe15760405162461bcd60e51b81526004016104119061276a565b506001979650505050505050565b600080610ffb85611363565b9050611008818585611a9b565b6110245760405162461bcd60e51b815260040161041190612c2a565b6000866060015187608001518860a001518960c0015160405160200161104d94939291906123ff565b60405160208183030381529060405280519060200120905060006110708761028f565b80519091508214801561108e57508751602082015164ffffffffff16145b80156110a857508760200151816040015164ffffffffff16145b610fe15760405162461bcd60e51b815260040161041190612adf565b60006002826001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b15801561110157600080fd5b505afa158015611115573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111399190612203565b8161114057fe5b0492915050565b61114f611ef9565b5060408051608081018252601092909202600f81013560e890811c84526012820135901c6020840152601581013560d890811c92840192909252601a0135901c606082015290565b60006111a1610689565b1115611211576000806111b2610d76565b9350935050508064ffffffffff16836060015110156111e35760405162461bcd60e51b815260040161041190612718565b8164ffffffffff168360400151101561120e5760405162461bcd60e51b8152600401610411906125f8565b50505b4260015482604001510110156112395760405162461bcd60e51b815260040161041190612d20565b4360025482606001510110156112615760405162461bcd60e51b815260040161041190612552565b50565b83604001518360400151101561128c5760405162461bcd60e51b815260040161041190612bd5565b8360600151836060015110156112b45760405162461bcd60e51b815260040161041190612df1565b6020830151156112c9576112c9838383611b8c565b50505050565b60008151836041011115611326578260410167ffffffffffffffff811180156112f757600080fd5b506040519080825280601f01601f191660200182016040528015611322576020820181803683370190505b5091505b6040850151606086015160006020850160018153836001820152826021820152866003890160418301376041870190209350505050949350505050565b60006102a86040518060a00160405280600015158152602001848152602001600081526020016000815260200160405180602001604052806000815250815250611c2d565b600083830364ffffffffff161180156113c357506020840151155b156113d3576113d3848483611b8c565b42846040015111156113f75760405162461bcd60e51b815260040161041190612b45565b43846060015111156112c95760405162461bcd60e51b815260040161041190612904565b60008082511161145c5760405162461bcd60e51b81526004018080602001828103825260348152602001806130286034913960400191505060405180910390fd5b815160011415611482578160008151811061147357fe5b602002602001015190506102ab565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b600184111561182b5750506002820460018084161460005b828110156117a7578a816002028151811061174e57fe5b602002602001015196508a816002026001018151811061176a57fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061179457fe5b6020908102919091010152600101611737565b50801561180a578960018503815181106117bd57fe5b602002602001015195508783601081106117d357fe5b602002015160001b945085602088015284604088015286805190602001208a83815181106117fd57fe5b6020026020010181815250505b80611816576000611819565b60015b60ff168201935060019092019161171f565b8960008151811061183857fe5b602002602001015198505050505050505050919050565b60006118596106d2565b9050600080611866610d76565b50509150915060006040518060a00160405280856001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156118b257600080fd5b505afa1580156118c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ea9190612203565b81526020018a81526020018981526020018464ffffffffff16815260200160405180602001604052806000815250815250905080600001517f127186556e7be68c7e31263195225b4de02820707889540969f62c05cf73525e826020015183604001518460600151856080015160405161196794939291906124e6565b60405180910390a2600061197a82611c75565b90506000611992836040015186018a86018a8a611c9e565b60405163080549db60e21b81529091506001600160a01b03871690632015276c906119c390859085906004016124d0565b600060405180830381600087803b1580156119dd57600080fd5b505af11580156119f1573d6000803e3d6000fd5b505050505050505050505050505050565b6080810151805160009190826041820167ffffffffffffffff81118015611a2857600080fd5b506040519080825280601f01601f191660200182016040528015611a53576020820181803683370190505b5060408601516060870151919250906000602084016001815383600182015282602182015285604182018760208a0160045afa50604190950190942095505050505050919050565b6000611aa56106d2565b8351604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a91611ad391600401612e7c565b60206040518083038186803b158015611aeb57600080fd5b505afa158015611aff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b239190612203565b611b2c84611c75565b14611b495760405162461bcd60e51b815260040161041190612b16565b611b66836020015185846000015185602001518760400151611cbd565b611b825760405162461bcd60e51b81526004016104119061294c565b5060019392505050565b6000611b9f8364ffffffffff1683610c36565b9050600154816020015164ffffffffff16014210611bcf5760405162461bcd60e51b815260040161041190612647565b806020015164ffffffffff1684604001511115611bfe5760405162461bcd60e51b8152600401610411906129cc565b806040015164ffffffffff16846060015111156112c95760405162461bcd60e51b815260040161041190612c74565b8051602080830151604080850151606086015160808701519251600096611c5896909594910161248f565b604051602081830303815290604052805190602001209050919050565b60008160200151826040015183606001518460800151604051602001611c5894939291906124e6565b602892831b9390931760509190911b1760789290921b91909117901b90565b6000808211611cfd5760405162461bcd60e51b8152600401808060200182810382526037815260200180612f7f6037913960400191505060405180910390fd5b818410611d3b5760405162461bcd60e51b8152600401808060200182810382526024815260200180612f2b6024913960400191505060405180910390fd5b611d4482611e42565b835114611d825760405162461bcd60e51b815260040180806020018281038252604d815260200180612fb6604d913960600191505060405180910390fd5b8460005b8451811015611e35578560011660011415611de457848181518110611da757fe5b6020026020010151826040516020018083815260200182815260200192505050604051602081830303815290604052805190602001209150611e29565b81858281518110611df157fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c9501611d86565b5090951495945050505050565b6000808211611e825760405162461bcd60e51b8152600401808060200182810382526030815260200180612f4f6030913960400191505060405180910390fd5b8160011415611e93575060006102ab565b81600060805b60018110611ec3576000196001821b01811b831615611ebb5791821c91908101905b60011c611e99565b506001811b8414611ed2576001015b9392505050565b604080516060810182526000808252602082018190529181019190915290565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b600067ffffffffffffffff831115611f3557fe5b611f48601f8401601f1916602001612ec1565b9050828152838383011115611f5c57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102ab57600080fd5b600082601f830112611f9a578081fd5b611ed283833560208501611f21565b8035600281106102ab57600080fd5b600060a08284031215611fc9578081fd5b60405160a0810167ffffffffffffffff8282108183111715611fe757fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561202457600080fd5b5061203185828601611f8a565b6080830152505092915050565b60006040828403121561204f578081fd5b6040516040810167ffffffffffffffff828210818311171561206d57fe5b816040528293508435835260209150818501358181111561208d57600080fd5b8501601f8101871361209e57600080fd5b8035828111156120aa57fe5b83810292506120ba848401612ec1565b8181528481019083860185850187018b10156120d557600080fd5b600095505b838610156120f85780358352600195909501949186019186016120da565b5080868801525050505050505092915050565b600060a0828403121561211c578081fd5b60405160a0810167ffffffffffffffff828210818311171561213a57fe5b8160405282935084359150811515821461215357600080fd5b818352602085013560208401526040850135604084015260608501356060840152608085013591508082111561202457600080fd5b60008060006060848603121561219c578283fd5b6121a584611f73565b925060208401359150604084013567ffffffffffffffff8111156121c7578182fd5b6121d386828701611f8a565b9150509250925092565b6000602082840312156121ee578081fd5b815164ffffffffff1981168114611ed2578182fd5b600060208284031215612214578081fd5b5051919050565b60006020828403121561222c578081fd5b813567ffffffffffffffff811115612242578182fd5b8201601f81018413612252578182fd5b6103d284823560208401611f21565b60008060008060808587031215612276578081fd5b843567ffffffffffffffff8082111561228d578283fd5b9086019060e082890312156122a0578283fd5b6122aa60e0612ec1565b82358152602083013560208201526122c460408401611fa9565b60408201526122d560608401611f73565b60608201526122e660808401611f73565b608082015260a083013560a082015260c083013582811115612306578485fd5b6123128a828601611f8a565b60c0830152509550602087013591508082111561232d578283fd5b6123398883890161210b565b9450604087013591508082111561234e578283fd5b61235a88838901611fb8565b9350606087013591508082111561236f578283fd5b5061237c8782880161203e565b91505092959194509250565b600060208284031215612399578081fd5b5035919050565b60008151808452815b818110156123c5576020818501810151868301820152016123a9565b818111156123d65782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612432908301846123a0565b9695505050505050565b6001600160a01b038781168252861660208201526040810185905260c06060820181905260009061246f908301866123a0565b60808301949094525060a00152949350505050565b901515815260200190565b6000861515825285602083015284604083015283606083015260a060808301526124bc60a08301846123a0565b979650505050505050565b90815260200190565b91825264ffffffffff1916602082015260400190565b60008582528460208301528360408301526080606083015261243260808301846123a0565b60208082526027908201527f617070656e64517565756542617463682069732063757272656e746c7920646960408201526639b0b13632b21760c91b606082015260800190565b60208082526029908201527f436f6e7465787420626c6f636b206e756d62657220746f6f2066617220696e206040820152683a3432903830b9ba1760b91b606082015260800190565b6020808252603d908201527f5472616e73616374696f6e20646174612073697a652065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b6020808252602f908201527f436f6e746578742074696d657374616d70206973206c6f776572207468616e2060408201526e3630b9ba1039bab136b4ba3a32b21760891b606082015260800190565b6020808252605b908201527f50726576696f75736c7920656e7175657565642062617463686573206861766560408201527f206578706972656420616e64206d75737420626520617070656e64656420626560608201527f666f72652061206e65772073657175656e6365722062617463682e0000000000608082015260a00190565b6020808252602e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e20696e60408201526d31b63ab9b4b7b710383937b7b31760911b606082015260800190565b60208082526032908201527f436f6e7465787420626c6f636b206e756d626572206973206c6f77657220746860408201527130b7103630b9ba1039bab136b4ba3a32b21760711b606082015260800190565b6020808252601e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e2e0000604082015260600190565b6020808252603d908201527f5472616e73616374696f6e20676173206c696d69742065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b60208082526028908201527f4d7573742070726f76696465206174206c65617374206f6e652062617463682060408201526731b7b73a32bc3a1760c11b606082015260800190565b6020808252602e908201527f4e6f7420616c6c2073657175656e636572207472616e73616374696f6e73207760408201526d32b93290383937b1b2b9b9b2b21760911b606082015260800190565b6020808252604a908201527f41637475616c207472616e73616374696f6e20696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420746f74616c20656c656d656e7473206060820152693a379030b83832b7321760b11b608082015260a00190565b60208082526028908201527f436f6e7465787420626c6f636b206e756d6265722069732066726f6d2074686560408201526710333aba3ab9329760c11b606082015260800190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b60208082526029908201527f5472616e73616374696f6e20676173206c696d697420746f6f206c6f7720746f6040820152681032b738bab2bab29760b91b606082015260800190565b60208082526043908201527f53657175656e636572207472616e73616374696f6e2074696d657374616d702060408201527f657863656564732074686174206f66206e65787420717565756520656c656d65606082015262373a1760e91b608082015260a00190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b6020808252602d908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c6564206279207460408201526c34329029b2b8bab2b731b2b91760991b606082015260800190565b6020808252601a908201527f496e76616c6964205175657565207472616e73616374696f6e2e000000000000604082015260600190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b60208082526025908201527f436f6e746578742074696d657374616d702069732066726f6d207468652066756040820152643a3ab9329760d91b606082015260800190565b6020808252602b908201527f496e73756666696369656e742067617320666f72204c322072617465206c696d60408201526a34ba34b73390313ab9371760a91b606082015260800190565b60208082526035908201527f436f6e746578742074696d657374616d702076616c756573206d757374206d6f6040820152743737ba37b734b1b0b6363c9034b731b932b0b9b29760591b606082015260800190565b6020808252602a908201527f496e76616c6964205175657565207472616e73616374696f6e20696e636c757360408201526934b7b710383937b7b31760b11b606082015260800190565b60208082526045908201527f53657175656e636572207472616e73616374696f6e20626c6f636b4e756d626560408201527f7220657863656564732074686174206f66206e65787420717565756520656c6560608201526436b2b73a1760d91b608082015260a00190565b60208082526021908201527f4d75737420617070656e64206174206c65617374206f6e6520656c656d656e746040820152601760f91b606082015260800190565b60208082526026908201527f436f6e746578742074696d657374616d7020746f6f2066617220696e20746865604082015265103830b9ba1760d11b606082015260800190565b60208082526022908201527f4e6f7420656e6f756768204261746368436f6e74657874732070726f76696465604082015261321760f11b606082015260800190565b60208082526029908201527f4e6f7420656e6f75676820717565756564207472616e73616374696f6e732074604082015268379030b83832b7321760b91b606082015260800190565b60208082526037908201527f436f6e7465787420626c6f636b4e756d6265722076616c756573206d7573742060408201527f6d6f6e6f746f6e6963616c6c7920696e6372656173652e000000000000000000606082015260800190565b8151815260208083015164ffffffffff90811691830191909152604092830151169181019190915260600190565b63ffffffff91909116815260200190565b64ffffffffff91909116815260200190565b64ffffffffff9384168152919092166020820152604081019190915260600190565b60405181810167ffffffffffffffff81118282101715612edd57fe5b60405291905056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a4354433a71756575654f564d5f4465636f6d7072657373696f6e507265636f6d70696c65416464726573734c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4f564d5f436861696e53746f72616765436f6e7461696e65723a4354433a626174636865734c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea2646970667358221220828f57135c61279b924bbbcded24811b56f14e0b701fd6564e301e4a1b7d73d364736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101425760003560e01c8063876ed5cb116100b8578063cfdf677e1161007c578063cfdf677e1461023f578063d0f8934414610247578063e10d29ee1461024f578063e561dddc14610257578063f722b41a1461025f578063facdc5da1461026757610142565b8063876ed5cb146102175780638d38c6c11461021f578063b8f7700514610227578063c139eb151461022f578063c2cf696f1461023757610142565b80634de569ce1161010a5780634de569ce146101c25780635ae6256d146101e25780636fee07e0146101ea57806378f4b2f2146101ff5780637a167a8a146102075780637aa63a861461020f57610142565b8063138387a414610147578063299ca478146101655780632a7f18be1461017a578063378997701461019a578063461a4478146101af575b600080fd5b61014f61027a565b60405161015c91906124c7565b60405180910390f35b61016d610280565b60405161015c91906123eb565b61018d610188366004612388565b61028f565b60405161015c9190612e4e565b6101a26102b0565b60405161015c9190612e8d565b61016d6101bd36600461221b565b6102c4565b6101d56101d0366004612261565b6103a0565b60405161015c9190612484565b6101a26103da565b6101fd6101f8366004612188565b6103ee565b005b61014f61066d565b6101a2610674565b61014f610689565b61014f6106a4565b61014f6106aa565b6101a26106b0565b61014f6106c7565b61014f6106cd565b61016d6106d2565b6101fd6106f5565b61016d610b69565b61014f610b8c565b6101a2610c06565b6101fd610275366004612388565b610c1e565b60025481565b6000546001600160a01b031681565b610297611ed9565b6102a8826102a3610b69565b610c36565b90505b919050565b6000806102bb610d76565b50935050505090565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561032457818101518382015260200161030c565b50505050905090810190601f1680156103515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561036e57600080fd5b505afa158015610382573d6000803e3d6000fd5b505050506040513d602081101561039857600080fd5b505192915050565b82516000901515600114156103c2576103bb85858585610e24565b90506103d2565b6103bb8585602001518585610fef565b949350505050565b6000806103e5610d76565b94505050505090565b61c3508151111561041a5760405162461bcd60e51b81526004016104119061259b565b60405180910390fd5b60035482111561043c5760405162461bcd60e51b8152600401610411906127a1565b620186a082101561045f5760405162461bcd60e51b815260040161041190612983565b6020820460005a90508181116104875760405162461bcd60e51b815260040161041190612b8a565b60005b825a8303101561049c5760010161048a565b6000338787876040516020016104b594939291906123ff565b60408051601f19818403018152919052805160209091012090504360281b421760006104df610b69565b60405163b298e36b60e01b81529091506001600160a01b0382169063b298e36b9061050e9086906004016124c7565b600060405180830381600087803b15801561052857600080fd5b505af115801561053c573d6000803e3d6000fd5b505060405163b298e36b60e01b81526001600160a01b038416925063b298e36b915061056c9085906004016124c7565b600060405180830381600087803b15801561058657600080fd5b505af115801561059a573d6000803e3d6000fd5b50505050600060016002836001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156105dd57600080fd5b505afa1580156105f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106159190612203565b8161061c57fe5b040390507f4b388aecf9fa6cc92253704e5975a6129a4f735bdbd99567df4ed0094ee4ceb5338b8b8b85426040516106599695949392919061243c565b60405180910390a150505050505050505050565b620186a081565b60008061067f610d76565b5090935050505090565b600080610694610d76565b50505064ffffffffff1692915050565b61c35081565b60035481565b60006106c26106bd610b69565b6110c4565b905090565b60015481565b602081565b60006106c2604051806060016040528060258152602001613003602591396102c4565b60043560d81c60093560e890811c90600c35901c610711610689565b8364ffffffffff16146107365760405162461bcd60e51b815260040161041190612a35565b6107646040518060400160405280600d81526020016c27ab26afa9b2b8bab2b731b2b960991b8152506102c4565b6001600160a01b0316336001600160a01b0316146107945760405162461bcd60e51b815260040161041190612a92565b60008162ffffff16116107b95760405162461bcd60e51b8152600401610411906127fe565b60008262ffffff16116107de5760405162461bcd60e51b815260040161041190612cdf565b600f601062ffffff8316020164ffffffffff81163610156108115760405162461bcd60e51b815260040161041190612d66565b600061081b610b69565b90506000610828826110c4565b9050600062ffffff8616368161083a57fe5b0460020267ffffffffffffffff8111801561085457600080fd5b506040519080825280601f01601f19166020018201604052801561087f576020820181803683370190505b50905060008662ffffff1667ffffffffffffffff811180156108a057600080fd5b506040519080825280602002602001820160405280156108ca578160200160208202803683370190505b50905060008060006108da610674565b90506108e4611ef9565b60005b8a62ffffff168163ffffffff161015610a3b57600061090b8263ffffffff16611147565b905063ffffffff82166109215761092181611197565b61092d8382868d611264565b80925060005b835163ffffffff821610156109b1578b3560e81c61c3508111156109695760405162461bcd60e51b81526004016104119061259b565b61097c858e64ffffffffff16838d6112cf565b898963ffffffff168151811061098e57fe5b60209081029190910101529b909b016003019a6001968701969586019501610933565b5060005b83602001518163ffffffff161015610a31578964ffffffffff168564ffffffffff16106109f45760405162461bcd60e51b815260040161041190612da8565b610a048564ffffffffff16611363565b888863ffffffff1681518110610a1657fe5b602090810291909101015260019687019694850194016109b5565b50506001016108e7565b50610a488183898b6113a8565b3664ffffffffff8a1614610a6e5760405162461bcd60e51b815260040161041190612846565b8a62ffffff168463ffffffff1614610a985760405162461bcd60e51b815260040161041190612894565b6000838c62ffffff160363ffffffff169050600080836020015160001415610acb57505060408201516060830151610af3565b6000610ae16001870364ffffffffff168d610c36565b90508060200151925080604001519150505b610b14610aff8961141b565b8f62ffffff168564ffffffffff16858561184f565b7f602f1aeac0ca2e7a13e281a9ef0ad7838542712ce16780fa2ecffd351f05f89983860384610b41610689565b604051610b5093929190612e9f565b60405180910390a1505050505050505050505050505050565b60006106c2604051806060016040528060238152602001612ee6602391396102c4565b6000610b966106d2565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610bce57600080fd5b505afa158015610be2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c29190612203565b6000610c10610674565b610c186106b0565b03905090565b60405162461bcd60e51b81526004016104119061250b565b610c3e611ed9565b604051634a83e9cd60e11b815260028402906000906001600160a01b03851690639507d39a90610c72908590600401612e8d565b60206040518083038186803b158015610c8a57600080fd5b505afa158015610c9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc29190612203565b90506000846001600160a01b0316639507d39a846001016040518263ffffffff1660e01b8152600401610cf59190612e8d565b60206040518083038186803b158015610d0d57600080fd5b505afa158015610d21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d459190612203565b6040805160608101825293845264ffffffffff828116602086015260289290921c9091169083015250949350505050565b6000806000806000610d866106d2565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b158015610dbe57600080fd5b505afa158015610dd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df691906121dd565b64ffffffffff602882901c811697605083901c82169750607883901c8216965060a09290921c169350915050565b600080610e5c6040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b8152506102c4565b90506000816001600160a01b0316631c4712a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610e9957600080fd5b505afa158015610ead573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed19190612203565b90506000610ede87611a02565b9050610eeb818787611a9b565b610f075760405162461bcd60e51b8152600401610411906126ca565b86606001518860200151148015610f22575060408701518851145b8015610f635750610f4a604051806060016040528060228152602001612f09602291396102c4565b6001600160a01b031688608001516001600160a01b0316145b8015610f725750818860a00151145b8015610f89575060608801516001600160a01b0316155b8015610fa45750600088604001516001811115610fa257fe5b145b8015610fc557508660800151805190602001208860c0015180519060200120145b610fe15760405162461bcd60e51b81526004016104119061276a565b506001979650505050505050565b600080610ffb85611363565b9050611008818585611a9b565b6110245760405162461bcd60e51b815260040161041190612c2a565b6000866060015187608001518860a001518960c0015160405160200161104d94939291906123ff565b60405160208183030381529060405280519060200120905060006110708761028f565b80519091508214801561108e57508751602082015164ffffffffff16145b80156110a857508760200151816040015164ffffffffff16145b610fe15760405162461bcd60e51b815260040161041190612adf565b60006002826001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b15801561110157600080fd5b505afa158015611115573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111399190612203565b8161114057fe5b0492915050565b61114f611ef9565b5060408051608081018252601092909202600f81013560e890811c84526012820135901c6020840152601581013560d890811c92840192909252601a0135901c606082015290565b60006111a1610689565b1115611211576000806111b2610d76565b9350935050508064ffffffffff16836060015110156111e35760405162461bcd60e51b815260040161041190612718565b8164ffffffffff168360400151101561120e5760405162461bcd60e51b8152600401610411906125f8565b50505b4260015482604001510110156112395760405162461bcd60e51b815260040161041190612d20565b4360025482606001510110156112615760405162461bcd60e51b815260040161041190612552565b50565b83604001518360400151101561128c5760405162461bcd60e51b815260040161041190612bd5565b8360600151836060015110156112b45760405162461bcd60e51b815260040161041190612df1565b6020830151156112c9576112c9838383611b8c565b50505050565b60008151836041011115611326578260410167ffffffffffffffff811180156112f757600080fd5b506040519080825280601f01601f191660200182016040528015611322576020820181803683370190505b5091505b6040850151606086015160006020850160018153836001820152826021820152866003890160418301376041870190209350505050949350505050565b60006102a86040518060a00160405280600015158152602001848152602001600081526020016000815260200160405180602001604052806000815250815250611c2d565b600083830364ffffffffff161180156113c357506020840151155b156113d3576113d3848483611b8c565b42846040015111156113f75760405162461bcd60e51b815260040161041190612b45565b43846060015111156112c95760405162461bcd60e51b815260040161041190612904565b60008082511161145c5760405162461bcd60e51b81526004018080602001828103825260348152602001806130286034913960400191505060405180910390fd5b815160011415611482578160008151811061147357fe5b602002602001015190506102ab565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b600184111561182b5750506002820460018084161460005b828110156117a7578a816002028151811061174e57fe5b602002602001015196508a816002026001018151811061176a57fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061179457fe5b6020908102919091010152600101611737565b50801561180a578960018503815181106117bd57fe5b602002602001015195508783601081106117d357fe5b602002015160001b945085602088015284604088015286805190602001208a83815181106117fd57fe5b6020026020010181815250505b80611816576000611819565b60015b60ff168201935060019092019161171f565b8960008151811061183857fe5b602002602001015198505050505050505050919050565b60006118596106d2565b9050600080611866610d76565b50509150915060006040518060a00160405280856001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156118b257600080fd5b505afa1580156118c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ea9190612203565b81526020018a81526020018981526020018464ffffffffff16815260200160405180602001604052806000815250815250905080600001517f127186556e7be68c7e31263195225b4de02820707889540969f62c05cf73525e826020015183604001518460600151856080015160405161196794939291906124e6565b60405180910390a2600061197a82611c75565b90506000611992836040015186018a86018a8a611c9e565b60405163080549db60e21b81529091506001600160a01b03871690632015276c906119c390859085906004016124d0565b600060405180830381600087803b1580156119dd57600080fd5b505af11580156119f1573d6000803e3d6000fd5b505050505050505050505050505050565b6080810151805160009190826041820167ffffffffffffffff81118015611a2857600080fd5b506040519080825280601f01601f191660200182016040528015611a53576020820181803683370190505b5060408601516060870151919250906000602084016001815383600182015282602182015285604182018760208a0160045afa50604190950190942095505050505050919050565b6000611aa56106d2565b8351604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a91611ad391600401612e7c565b60206040518083038186803b158015611aeb57600080fd5b505afa158015611aff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b239190612203565b611b2c84611c75565b14611b495760405162461bcd60e51b815260040161041190612b16565b611b66836020015185846000015185602001518760400151611cbd565b611b825760405162461bcd60e51b81526004016104119061294c565b5060019392505050565b6000611b9f8364ffffffffff1683610c36565b9050600154816020015164ffffffffff16014210611bcf5760405162461bcd60e51b815260040161041190612647565b806020015164ffffffffff1684604001511115611bfe5760405162461bcd60e51b8152600401610411906129cc565b806040015164ffffffffff16846060015111156112c95760405162461bcd60e51b815260040161041190612c74565b8051602080830151604080850151606086015160808701519251600096611c5896909594910161248f565b604051602081830303815290604052805190602001209050919050565b60008160200151826040015183606001518460800151604051602001611c5894939291906124e6565b602892831b9390931760509190911b1760789290921b91909117901b90565b6000808211611cfd5760405162461bcd60e51b8152600401808060200182810382526037815260200180612f7f6037913960400191505060405180910390fd5b818410611d3b5760405162461bcd60e51b8152600401808060200182810382526024815260200180612f2b6024913960400191505060405180910390fd5b611d4482611e42565b835114611d825760405162461bcd60e51b815260040180806020018281038252604d815260200180612fb6604d913960600191505060405180910390fd5b8460005b8451811015611e35578560011660011415611de457848181518110611da757fe5b6020026020010151826040516020018083815260200182815260200192505050604051602081830303815290604052805190602001209150611e29565b81858281518110611df157fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c9501611d86565b5090951495945050505050565b6000808211611e825760405162461bcd60e51b8152600401808060200182810382526030815260200180612f4f6030913960400191505060405180910390fd5b8160011415611e93575060006102ab565b81600060805b60018110611ec3576000196001821b01811b831615611ebb5791821c91908101905b60011c611e99565b506001811b8414611ed2576001015b9392505050565b604080516060810182526000808252602082018190529181019190915290565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b600067ffffffffffffffff831115611f3557fe5b611f48601f8401601f1916602001612ec1565b9050828152838383011115611f5c57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102ab57600080fd5b600082601f830112611f9a578081fd5b611ed283833560208501611f21565b8035600281106102ab57600080fd5b600060a08284031215611fc9578081fd5b60405160a0810167ffffffffffffffff8282108183111715611fe757fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561202457600080fd5b5061203185828601611f8a565b6080830152505092915050565b60006040828403121561204f578081fd5b6040516040810167ffffffffffffffff828210818311171561206d57fe5b816040528293508435835260209150818501358181111561208d57600080fd5b8501601f8101871361209e57600080fd5b8035828111156120aa57fe5b83810292506120ba848401612ec1565b8181528481019083860185850187018b10156120d557600080fd5b600095505b838610156120f85780358352600195909501949186019186016120da565b5080868801525050505050505092915050565b600060a0828403121561211c578081fd5b60405160a0810167ffffffffffffffff828210818311171561213a57fe5b8160405282935084359150811515821461215357600080fd5b818352602085013560208401526040850135604084015260608501356060840152608085013591508082111561202457600080fd5b60008060006060848603121561219c578283fd5b6121a584611f73565b925060208401359150604084013567ffffffffffffffff8111156121c7578182fd5b6121d386828701611f8a565b9150509250925092565b6000602082840312156121ee578081fd5b815164ffffffffff1981168114611ed2578182fd5b600060208284031215612214578081fd5b5051919050565b60006020828403121561222c578081fd5b813567ffffffffffffffff811115612242578182fd5b8201601f81018413612252578182fd5b6103d284823560208401611f21565b60008060008060808587031215612276578081fd5b843567ffffffffffffffff8082111561228d578283fd5b9086019060e082890312156122a0578283fd5b6122aa60e0612ec1565b82358152602083013560208201526122c460408401611fa9565b60408201526122d560608401611f73565b60608201526122e660808401611f73565b608082015260a083013560a082015260c083013582811115612306578485fd5b6123128a828601611f8a565b60c0830152509550602087013591508082111561232d578283fd5b6123398883890161210b565b9450604087013591508082111561234e578283fd5b61235a88838901611fb8565b9350606087013591508082111561236f578283fd5b5061237c8782880161203e565b91505092959194509250565b600060208284031215612399578081fd5b5035919050565b60008151808452815b818110156123c5576020818501810151868301820152016123a9565b818111156123d65782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612432908301846123a0565b9695505050505050565b6001600160a01b038781168252861660208201526040810185905260c06060820181905260009061246f908301866123a0565b60808301949094525060a00152949350505050565b901515815260200190565b6000861515825285602083015284604083015283606083015260a060808301526124bc60a08301846123a0565b979650505050505050565b90815260200190565b91825264ffffffffff1916602082015260400190565b60008582528460208301528360408301526080606083015261243260808301846123a0565b60208082526027908201527f617070656e64517565756542617463682069732063757272656e746c7920646960408201526639b0b13632b21760c91b606082015260800190565b60208082526029908201527f436f6e7465787420626c6f636b206e756d62657220746f6f2066617220696e206040820152683a3432903830b9ba1760b91b606082015260800190565b6020808252603d908201527f5472616e73616374696f6e20646174612073697a652065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b6020808252602f908201527f436f6e746578742074696d657374616d70206973206c6f776572207468616e2060408201526e3630b9ba1039bab136b4ba3a32b21760891b606082015260800190565b6020808252605b908201527f50726576696f75736c7920656e7175657565642062617463686573206861766560408201527f206578706972656420616e64206d75737420626520617070656e64656420626560608201527f666f72652061206e65772073657175656e6365722062617463682e0000000000608082015260a00190565b6020808252602e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e20696e60408201526d31b63ab9b4b7b710383937b7b31760911b606082015260800190565b60208082526032908201527f436f6e7465787420626c6f636b206e756d626572206973206c6f77657220746860408201527130b7103630b9ba1039bab136b4ba3a32b21760711b606082015260800190565b6020808252601e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e2e0000604082015260600190565b6020808252603d908201527f5472616e73616374696f6e20676173206c696d69742065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b60208082526028908201527f4d7573742070726f76696465206174206c65617374206f6e652062617463682060408201526731b7b73a32bc3a1760c11b606082015260800190565b6020808252602e908201527f4e6f7420616c6c2073657175656e636572207472616e73616374696f6e73207760408201526d32b93290383937b1b2b9b9b2b21760911b606082015260800190565b6020808252604a908201527f41637475616c207472616e73616374696f6e20696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420746f74616c20656c656d656e7473206060820152693a379030b83832b7321760b11b608082015260a00190565b60208082526028908201527f436f6e7465787420626c6f636b206e756d6265722069732066726f6d2074686560408201526710333aba3ab9329760c11b606082015260800190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b60208082526029908201527f5472616e73616374696f6e20676173206c696d697420746f6f206c6f7720746f6040820152681032b738bab2bab29760b91b606082015260800190565b60208082526043908201527f53657175656e636572207472616e73616374696f6e2074696d657374616d702060408201527f657863656564732074686174206f66206e65787420717565756520656c656d65606082015262373a1760e91b608082015260a00190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b6020808252602d908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c6564206279207460408201526c34329029b2b8bab2b731b2b91760991b606082015260800190565b6020808252601a908201527f496e76616c6964205175657565207472616e73616374696f6e2e000000000000604082015260600190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b60208082526025908201527f436f6e746578742074696d657374616d702069732066726f6d207468652066756040820152643a3ab9329760d91b606082015260800190565b6020808252602b908201527f496e73756666696369656e742067617320666f72204c322072617465206c696d60408201526a34ba34b73390313ab9371760a91b606082015260800190565b60208082526035908201527f436f6e746578742074696d657374616d702076616c756573206d757374206d6f6040820152743737ba37b734b1b0b6363c9034b731b932b0b9b29760591b606082015260800190565b6020808252602a908201527f496e76616c6964205175657565207472616e73616374696f6e20696e636c757360408201526934b7b710383937b7b31760b11b606082015260800190565b60208082526045908201527f53657175656e636572207472616e73616374696f6e20626c6f636b4e756d626560408201527f7220657863656564732074686174206f66206e65787420717565756520656c6560608201526436b2b73a1760d91b608082015260a00190565b60208082526021908201527f4d75737420617070656e64206174206c65617374206f6e6520656c656d656e746040820152601760f91b606082015260800190565b60208082526026908201527f436f6e746578742074696d657374616d7020746f6f2066617220696e20746865604082015265103830b9ba1760d11b606082015260800190565b60208082526022908201527f4e6f7420656e6f756768204261746368436f6e74657874732070726f76696465604082015261321760f11b606082015260800190565b60208082526029908201527f4e6f7420656e6f75676820717565756564207472616e73616374696f6e732074604082015268379030b83832b7321760b91b606082015260800190565b60208082526037908201527f436f6e7465787420626c6f636b4e756d6265722076616c756573206d7573742060408201527f6d6f6e6f746f6e6963616c6c7920696e6372656173652e000000000000000000606082015260800190565b8151815260208083015164ffffffffff90811691830191909152604092830151169181019190915260600190565b63ffffffff91909116815260200190565b64ffffffffff91909116815260200190565b64ffffffffff9384168152919092166020820152604081019190915260600190565b60405181810167ffffffffffffffff81118282101715612edd57fe5b60405291905056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a4354433a71756575654f564d5f4465636f6d7072657373696f6e507265636f6d70696c65416464726573734c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4f564d5f436861696e53746f72616765436f6e7461696e65723a4354433a626174636865734c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea2646970667358221220828f57135c61279b924bbbcded24811b56f14e0b701fd6564e301e4a1b7d73d364736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"\",\"type\":\"uint256\"}],\"name\":\"appendQueueBatch\",\"outputs\":[],\"stateMutability\":\"pure\",\"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\":\"transactionHash\",\"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\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"\",\"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\":{\"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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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. param _numQueuedTransactions Number of transactions to append.\"},\"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.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow, so we distribute\\n return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);\\n }\\n}\\n\",\"keccak256\":\"0x363bd3b45201f07c9b71c2edc96533468cf14a3d029fabd82fddceb1eb3ebd9c\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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\\\";\\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/* External Imports */\\nimport { Math } from \\\"@openzeppelin/contracts/math/Math.sol\\\";\\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 = 50000;\\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 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 return _getQueueElement(\\n _index,\\n queue()\\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 return _getQueueLength(\\n queue()\\n );\\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 queueRef = queue();\\n\\n queueRef.push(transactionHash);\\n queueRef.push(timestampAndBlockNumber);\\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 and subtract 1.\\n uint256 queueIndex = queueRef.length() / 2 - 1;\\n emit TransactionEnqueued(\\n msg.sender,\\n _target,\\n _gasLimit,\\n _data,\\n queueIndex,\\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 pure\\n {\\n // TEMPORARY: Disable `appendQueueBatch` for minnet\\n revert(\\\"appendQueueBatch is currently disabled.\\\");\\n\\n // _numQueuedTransactions = 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\\n require(\\n msg.data.length >= nextTransactionPtr,\\n \\\"Not enough BatchContexts provided.\\\"\\n );\\n\\n // Take a reference to the queue and its length so we don't have to keep resolving it.\\n // Length isn't going to change during the course of execution, so it's fine to simply\\n // resolve this once at the start. Saves gas.\\n iOVM_ChainStorageContainer queueRef = queue();\\n uint40 queueLength = _getQueueLength(queueRef);\\n\\n // Reserve some memory to save gas on hashing later on. This is a relatively safe estimate\\n // for the average transaction size that will prevent having to resize this chunk of memory\\n // later on. Saves gas.\\n bytes memory hashMemory = new bytes((msg.data.length / totalElementsToAppend) * 2);\\n\\n // Initialize the array of canonical chain leaves that we will append.\\n bytes32[] memory leaves = new bytes32[](totalElementsToAppend);\\n\\n // Each leaf index corresponds to a tx, either sequenced or enqueued.\\n uint32 leafIndex = 0;\\n\\n // Counter for number of sequencer transactions appended so far.\\n uint32 numSequencerTransactions = 0;\\n\\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 for (uint32 i = 0; i < numContexts; i++) {\\n BatchContext memory nextContext = _getBatchContext(i);\\n\\n if (i == 0) {\\n // Execute a special check for the first batch.\\n _validateFirstBatchContext(nextContext);\\n }\\n\\n // Execute this check on every single batch, including the first one.\\n _validateNextBatchContext(\\n curContext,\\n nextContext,\\n nextQueueIndex,\\n queueRef\\n );\\n\\n // Now we can update our current context.\\n curContext = nextContext;\\n\\n // Process sequencer transactions first.\\n for (uint32 j = 0; j < curContext.numSequencedTransactions; j++) {\\n uint256 txDataLength;\\n assembly {\\n txDataLength := shr(232, calldataload(nextTransactionPtr))\\n }\\n require(\\n txDataLength <= MAX_ROLLUP_TX_SIZE,\\n \\\"Transaction data size exceeds maximum for rollup transaction.\\\"\\n );\\n\\n leaves[leafIndex] = _getSequencerLeafHash(\\n curContext,\\n nextTransactionPtr,\\n txDataLength,\\n hashMemory\\n );\\n\\n nextTransactionPtr += uint40(TX_DATA_HEADER_SIZE + txDataLength);\\n numSequencerTransactions++;\\n leafIndex++;\\n }\\n\\n // Now process any subsequent queue transactions.\\n for (uint32 j = 0; j < curContext.numSubsequentQueueTransactions; j++) {\\n require(\\n nextQueueIndex < queueLength,\\n \\\"Not enough queued transactions to append.\\\"\\n );\\n\\n leaves[leafIndex] = _getQueueLeafHash(nextQueueIndex);\\n nextQueueIndex++;\\n leafIndex++;\\n }\\n }\\n\\n _validateFinalBatchContext(\\n curContext,\\n nextQueueIndex,\\n queueLength,\\n queueRef\\n );\\n\\n require(\\n msg.data.length == 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 blockTimestamp;\\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 blockTimestamp = 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 // curContext.numSubsequentQueueTransactions > 0 which means that we've processed at least one queue element.\\n // We increment nextQueueIndex after processing each queue element,\\n // so the index of the last element we processed is nextQueueIndex - 1.\\n Lib_OVMCodec.QueueElement memory lastElement = _getQueueElement(\\n nextQueueIndex - 1,\\n queueRef\\n );\\n\\n blockTimestamp = lastElement.timestamp;\\n blockNumber = lastElement.blockNumber;\\n }\\n\\n // For efficiency reasons getMerkleRoot modifies the `leaves` argument in place\\n // while calculating the root hash therefore any arguments passed to it must not\\n // be used again afterwards\\n _appendBatch(\\n Lib_MerkleTree.getMerkleRoot(leaves),\\n totalElementsToAppend,\\n numQueuedTransactions,\\n blockTimestamp,\\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 pure\\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 * 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 iOVM_ChainStorageContainer _queueRef\\n )\\n internal\\n view\\n returns (\\n Lib_OVMCodec.QueueElement memory _element\\n )\\n {\\n // The underlying queue data structure stores 2 elements\\n // per insertion, so to get the actual desired queue index\\n // we need to multiply by 2.\\n uint40 trueIndex = uint40(_index * 2);\\n bytes32 transactionHash = _queueRef.get(trueIndex);\\n bytes32 timestampAndBlockNumber = _queueRef.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 transactionHash: transactionHash,\\n timestamp: elementTimestamp,\\n blockNumber: elementBlockNumber\\n });\\n }\\n\\n /**\\n * Retrieves the length of the queue.\\n * @return Length of the queue.\\n */\\n function _getQueueLength(\\n iOVM_ChainStorageContainer _queueRef\\n )\\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.\\n return uint40(_queueRef.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 bytes memory _hashMemory\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n // Only allocate more memory if we didn't reserve enough to begin with.\\n if (BYTES_TILL_TX_DATA + _txDataLength > _hashMemory.length) {\\n _hashMemory = new bytes(BYTES_TILL_TX_DATA + _txDataLength);\\n }\\n\\n uint256 ctxTimestamp = _context.timestamp;\\n uint256 ctxBlockNumber = _context.blockNumber;\\n\\n bytes32 leafHash;\\n assembly {\\n let chainElementStart := add(_hashMemory, 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 iOVM_ChainStorageContainer batchesRef = batches();\\n (uint40 totalElements, uint40 nextQueueIndex,,) = _getBatchExtraData();\\n\\n Lib_OVMCodec.ChainBatchHeader memory header = Lib_OVMCodec.ChainBatchHeader({\\n batchIndex: batchesRef.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 batchesRef.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 have the same context\\n // or a later timestamp and block number.\\n if (getTotalElements() > 0) {\\n (,, uint40 lastTimestamp, uint40 lastBlockNumber) = _getBatchExtraData();\\n\\n require(\\n _firstContext.blockNumber >= lastBlockNumber,\\n \\\"Context block number is lower than last submitted.\\\"\\n );\\n\\n require(\\n _firstContext.timestamp >= lastTimestamp,\\n \\\"Context timestamp is lower than last submitted.\\\"\\n );\\n }\\n\\n // Sequencer cannot submit contexts which are more than the force inclusion period old.\\n require(\\n _firstContext.timestamp + forceInclusionPeriodSeconds >= block.timestamp,\\n \\\"Context timestamp too far in the past.\\\"\\n );\\n\\n require(\\n _firstContext.blockNumber + forceInclusionPeriodBlocks >= block.number,\\n \\\"Context block number too far in the past.\\\"\\n );\\n }\\n\\n /**\\n * Checks that a given batch context has a time context which is below a given que element\\n * @param _context The batch context to validate has values lower.\\n * @param _queueIndex Index of the queue element we are validating came later than the context.\\n * @param _queueRef The storage container for the queue.\\n */\\n function _validateContextBeforeEnqueue(\\n BatchContext memory _context,\\n uint40 _queueIndex,\\n iOVM_ChainStorageContainer _queueRef\\n )\\n internal\\n view\\n {\\n Lib_OVMCodec.QueueElement memory nextQueueElement = _getQueueElement(\\n _queueIndex,\\n _queueRef\\n );\\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 _context.timestamp <= nextQueueElement.timestamp,\\n \\\"Sequencer transaction timestamp exceeds that of next queue element.\\\"\\n );\\n\\n require(\\n _context.blockNumber <= nextQueueElement.blockNumber,\\n \\\"Sequencer transaction blockNumber exceeds that of next queue element.\\\"\\n );\\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 * @param _queueRef The storage container for the queue.\\n */\\n function _validateNextBatchContext(\\n BatchContext memory _prevContext,\\n BatchContext memory _nextContext,\\n uint40 _nextQueueIndex,\\n iOVM_ChainStorageContainer _queueRef\\n )\\n internal\\n view\\n {\\n // All sequencer transactions' times must be greater than or equal to 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 is going to be a queue element pulled in from this context:\\n if (_nextContext.numSubsequentQueueTransactions > 0) {\\n _validateContextBeforeEnqueue(\\n _nextContext,\\n _nextQueueIndex,\\n _queueRef\\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 * @param _queueLength The length of the queue at the start of the batchAppend call.\\n * @param _nextQueueIndex The next element in the queue that will be pulled into the CTC.\\n * @param _queueRef The storage container for the queue.\\n */\\n function _validateFinalBatchContext(\\n BatchContext memory _finalContext,\\n uint40 _nextQueueIndex,\\n uint40 _queueLength,\\n iOVM_ChainStorageContainer _queueRef\\n )\\n internal\\n view\\n {\\n // If the queue is not now empty, check the mononoticity of whatever the next batch that will come in is.\\n if (_queueLength - _nextQueueIndex > 0 && _finalContext.numSubsequentQueueTransactions == 0) {\\n _validateContextBeforeEnqueue(\\n _finalContext,\\n _nextQueueIndex,\\n _queueRef\\n );\\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.transactionHash == 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\":\"0x36760ab13dafc8bb8f71e0906a20059a520e692a69ed8fca09bf6fd43bd6ff15\",\"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_Bytes32Utils } from \\\"../../libraries/utils/Lib_Bytes32Utils.sol\\\";\\nimport { Lib_EthUtils } from \\\"../../libraries/utils/Lib_EthUtils.sol\\\";\\nimport { Lib_ErrorUtils } from \\\"../../libraries/utils/Lib_ErrorUtils.sol\\\";\\nimport { Lib_PredeployAddresses } from \\\"../../libraries/constants/Lib_PredeployAddresses.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_DeployerWhitelist } from \\\"../predeploys/OVM_DeployerWhitelist.sol\\\";\\n\\n/* External Imports */\\nimport { Math } from \\\"@openzeppelin/contracts/math/Math.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 * Native Value Constants *\\n **************************/\\n\\n // Public so we can access and make assertions in integration tests.\\n uint256 public constant CALL_WITH_VALUE_INTRINSIC_GAS = 90000;\\n\\n\\n /**************************\\n * Default Context Values *\\n **************************/\\n\\n uint256 constant DEFAULT_UINT256 = 0xdefa017defa017defa017defa017defa017defa017defa017defa017defa017d;\\n address constant DEFAULT_ADDRESS = 0xdEfa017defA017DeFA017DEfa017DeFA017DeFa0;\\n\\n\\n /*************************************\\n * Container Contract Address Prefix *\\n *************************************/\\n\\n /**\\n * @dev The Execution Manager and State Manager each have this 30 byte prefix, and are uncallable.\\n */\\n address constant CONTAINER_CONTRACT_PREFIX = 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000;\\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 Lib_AddressResolver(_libAddressManager)\\n {\\n ovmSafetyChecker = iOVM_SafetyChecker(resolve(\\\"OVM_SafetyChecker\\\"));\\n gasMeterConfig = _gasMeterConfig;\\n globalContext = _globalContext;\\n _resetContext();\\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 external\\n returns (\\n bytes memory\\n )\\n {\\n // Make sure that run() is not re-enterable. This condition should always be satisfied\\n // Once run has been called once, due to the behavior of _isValidInput().\\n if (transactionContext.ovmNUMBER != DEFAULT_UINT256) {\\n return bytes(\\\"\\\");\\n }\\n\\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 (_isValidInput(_transaction) == false) {\\n _resetContext();\\n return bytes(\\\"\\\");\\n }\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\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 (, bytes memory returndata) = ovmCALL(\\n _transaction.gasLimit - gasMeterConfig.minTransactionGasLimit,\\n _transaction.entrypoint,\\n 0,\\n _transaction.data\\n );\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\n // // Update the cumulative gas based on the amount of gas used.\\n // uint256 gasUsed = gasProvided - gasleft();\\n // _updateCumulativeGas(gasUsed, _transaction.l1QueueOrigin);\\n\\n // Wipe the execution context.\\n _resetContext();\\n\\n return returndata;\\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 external\\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 CALLVALUE.\\n * @return _CALLVALUE Value sent along with the call according to the current message context.\\n */\\n function ovmCALLVALUE()\\n override\\n public\\n view\\n returns (\\n uint256 _CALLVALUE\\n )\\n {\\n return messageContext.ovmCALLVALUE;\\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 external\\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 external\\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 external\\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 external\\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 source (Sequencer or Queue) this transaction originated from.\\n * @return _queueOrigin Enum indicating the ovmL1QUEUEORIGIN within the current message context.\\n */\\n function ovmL1QUEUEORIGIN()\\n override\\n external\\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 external\\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 Address of the created contract.\\n * @return Revert data, if and only if the creation threw an exception.\\n */\\n function ovmCREATE(\\n bytes memory _bytecode\\n )\\n override\\n public\\n notStatic\\n fixedGasDiscount(40000)\\n returns (\\n address,\\n bytes memory\\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 MessageType.ovmCREATE\\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 Address of the created contract.\\n * @return Revert data, if and only if the creation threw an exception.\\n */\\n function ovmCREATE2(\\n bytes memory _bytecode,\\n bytes32 _salt\\n )\\n override\\n external\\n notStatic\\n fixedGasDiscount(40000)\\n returns (\\n address,\\n bytes memory\\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 MessageType.ovmCREATE2\\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 external\\n returns (\\n uint256 _nonce\\n )\\n {\\n return _getAccountNonce(ovmADDRESS());\\n }\\n\\n /**\\n * Bumps the nonce of the current ovmADDRESS by one.\\n */\\n function ovmINCREMENTNONCE()\\n override\\n external\\n notStatic\\n {\\n address account = ovmADDRESS();\\n uint256 nonce = _getAccountNonce(account);\\n\\n // Prevent overflow.\\n if (nonce + 1 > nonce) {\\n _setAccountNonce(account, nonce + 1);\\n }\\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 // Creates a duplicate of the OVM_ProxyEOA located at 0x42....09. Uses the following\\n // \\\"magic\\\" prefix to deploy an exact copy of the code:\\n // PUSH1 0x0D # size of this prefix in bytes\\n // CODESIZE\\n // SUB # subtract prefix size from codesize\\n // DUP1\\n // PUSH1 0x0D\\n // PUSH1 0x00\\n // CODECOPY # copy everything after prefix into memory at pos 0\\n // PUSH1 0x00\\n // RETURN # return the copied code\\n address proxyEOA = Lib_EthUtils.createContract(abi.encodePacked(\\n hex\\\"600D380380600D6000396000f3\\\",\\n ovmEXTCODECOPY(\\n Lib_PredeployAddresses.PROXY_EOA,\\n 0,\\n ovmEXTCODESIZE(Lib_PredeployAddresses.PROXY_EOA)\\n )\\n ));\\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 _value ETH value to pass with the 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 uint256 _value,\\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 nextMessageContext.ovmCALLVALUE = _value;\\n\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata,\\n MessageType.ovmCALL\\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, valueless context.\\n MessageContext memory nextMessageContext = messageContext;\\n nextMessageContext.ovmCALLER = nextMessageContext.ovmADDRESS;\\n nextMessageContext.ovmADDRESS = _address;\\n nextMessageContext.isStatic = true;\\n nextMessageContext.ovmCALLVALUE = 0;\\n\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata,\\n MessageType.ovmSTATICCALL\\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\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata,\\n MessageType.ovmDELEGATECALL\\n );\\n }\\n\\n /**\\n * @notice Legacy ovmCALL function which did not support ETH value; this maintains backwards compatibility.\\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 returns(\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n // Legacy ovmCALL assumed always-0 value.\\n return ovmCALL(\\n _gasLimit,\\n _address,\\n 0,\\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 external\\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 external\\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 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 external\\n returns (\\n bytes32 _EXTCODEHASH\\n )\\n {\\n return Lib_EthUtils.getCodeHash(\\n _getAccountEthAddress(_contract)\\n );\\n }\\n\\n\\n /***************************************\\n * Public Functions: ETH Value Opcodes *\\n ***************************************/\\n\\n /**\\n * @notice Overrides BALANCE.\\n * NOTE: In the future, this could be optimized to directly invoke EM._getContractStorage(...).\\n * @param _contract Address of the contract to query the OVM_ETH balance of.\\n * @return _BALANCE OVM_ETH balance of the requested contract.\\n */\\n function ovmBALANCE(\\n address _contract\\n )\\n override\\n public\\n returns (\\n uint256 _BALANCE\\n )\\n {\\n // Easiest way to get the balance is query OVM_ETH as normal.\\n bytes memory balanceOfCalldata = abi.encodeWithSignature(\\n \\\"balanceOf(address)\\\",\\n _contract\\n );\\n\\n // Static call because this should be a read-only query.\\n (bool success, bytes memory returndata) = ovmSTATICCALL(\\n gasleft(),\\n Lib_PredeployAddresses.OVM_ETH,\\n balanceOfCalldata\\n );\\n\\n // All balanceOf queries should successfully return a uint, otherwise this must be an OOG.\\n if (!success || returndata.length != 32) {\\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\\n }\\n\\n // Return the decoded balance.\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * @notice Overrides SELFBALANCE.\\n * @return _BALANCE OVM_ETH balance of the requesting contract.\\n */\\n function ovmSELFBALANCE()\\n override\\n external\\n returns (\\n uint256 _BALANCE\\n )\\n {\\n return ovmBALANCE(ovmADDRESS());\\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 Whitelisting *\\n ********************************************/\\n\\n /**\\n * Checks whether the given address is on the whitelist 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 semantics perspective, this will appear 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) = ovmSTATICCALL(\\n gasleft(),\\n Lib_PredeployAddresses.DEPLOYER_WHITELIST,\\n abi.encodeWithSelector(\\n OVM_DeployerWhitelist.isDeployerAllowed.selector,\\n _deployerAddress\\n )\\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 Final OVM contract address.\\n * @return Revertdata, if and only if the creation threw an exception.\\n */\\n function _createContract(\\n address _contractAddress,\\n bytes memory _bytecode,\\n MessageType _messageType\\n )\\n internal\\n returns (\\n address,\\n bytes memory\\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 the common logic which occurs between call-type and create-type messages,\\n // passing in the creation bytecode and `true` to trigger create-specific logic.\\n (bool success, bytes memory data) = _handleExternalMessage(\\n nextMessageContext,\\n gasleft(),\\n _contractAddress,\\n _bytecode,\\n _messageType\\n );\\n\\n // Yellow paper requires that address returned is zero if the contract deployment fails.\\n return (\\n success ? _contractAddress : address(0),\\n data\\n );\\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 MessageType _messageType\\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(CONTAINER_CONTRACT_PREFIX)\\n ) {\\n // EVM does not return data in the success case, see: https://github.com/ethereum/go-ethereum/blob/aae7660410f0ef90279e14afaaf2f429fdc2a186/core/vm/instructions.go#L600-L604\\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 _handleExternalMessage(\\n _nextMessageContext,\\n _gasLimit,\\n codeContractAddress,\\n _calldata,\\n _messageType\\n );\\n }\\n\\n /**\\n * Handles all interactions which involve the execution manager calling out to untrusted code (both calls and creates).\\n * Ensures that OVM-related measures are enforced, including L2 gas refunds, nuisance gas, and flagged reversions.\\n *\\n * @param _nextMessageContext Message context to be used for the external message.\\n * @param _gasLimit Amount of gas to be passed into this message. NOTE: this argument is overwritten in some cases to avoid stack-too-deep.\\n * @param _contract OVM address being called or deployed to\\n * @param _data Data for the message (either calldata or creation code)\\n * @param _messageType What type of ovmOPCODE this message corresponds to.\\n * @return Whether or not the message (either a call or deployment) succeeded.\\n * @return Data returned by the message.\\n */\\n function _handleExternalMessage(\\n MessageContext memory _nextMessageContext,\\n // NOTE: this argument is overwritten in some cases to avoid stack-too-deep.\\n uint256 _gasLimit,\\n address _contract,\\n bytes memory _data,\\n MessageType _messageType\\n )\\n internal\\n returns (\\n bool,\\n bytes memory\\n )\\n {\\n uint256 messageValue = _nextMessageContext.ovmCALLVALUE;\\n // If there is value in this message, we need to transfer the ETH over before switching contexts.\\n if (\\n messageValue > 0\\n && _isValueType(_messageType)\\n ) {\\n // Handle out-of-intrinsic gas consistent with EVM behavior -- the subcall \\\"appears to revert\\\" if we don't have enough gas to transfer the ETH.\\n // Similar to dynamic gas cost of value exceeding gas here:\\n // https://github.com/ethereum/go-ethereum/blob/c503f98f6d5e80e079c1d8a3601d188af2a899da/core/vm/interpreter.go#L268-L273\\n if (gasleft() < CALL_WITH_VALUE_INTRINSIC_GAS) {\\n return (false, hex\\\"\\\");\\n }\\n\\n // If there *is* enough gas to transfer ETH, then we need to make sure this amount of gas is reserved (i.e. not\\n // given to the _contract.call below) to guarantee that _handleExternalMessage can't run out of gas.\\n // In particular, in the event that the call fails, we will need to transfer the ETH back to the sender.\\n // Taking the lesser of _gasLimit and gasleft() - CALL_WITH_VALUE_INTRINSIC_GAS guarantees that the second\\n // _attemptForcedEthTransfer below, if needed, always has enough gas to succeed.\\n _gasLimit = Math.min(\\n _gasLimit,\\n gasleft() - CALL_WITH_VALUE_INTRINSIC_GAS // Cannot overflow due to the above check.\\n );\\n\\n // Now transfer the value of the call.\\n // The target is interpreted to be the next message's ovmADDRESS account.\\n bool transferredOvmEth = _attemptForcedEthTransfer(\\n _nextMessageContext.ovmADDRESS,\\n messageValue\\n );\\n\\n // If the ETH transfer fails (should only be possible in the case of insufficient balance), then treat this as a revert.\\n // This mirrors EVM behavior, see https://github.com/ethereum/go-ethereum/blob/2dee31930c9977af2a9fcb518fb9838aa609a7cf/core/vm/evm.go#L298\\n if (!transferredOvmEth) {\\n return (false, hex\\\"\\\");\\n }\\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. `_contract` 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\\n bool success;\\n bytes memory returndata;\\n if (_isCreateType(_messageType)) {\\n // safeCREATE() is a function which replicates a CREATE message, but uses return values\\n // Which match that of CALL (i.e. bool, bytes). This allows many security checks to be\\n // to be shared between untrusted call and create call frames.\\n (success, returndata) = address(this).call{gas: _gasLimit}(\\n abi.encodeWithSelector(\\n this.safeCREATE.selector,\\n _data,\\n _contract\\n )\\n );\\n } else {\\n (success, returndata) = _contract.call{gas: _gasLimit}(_data);\\n }\\n\\n // If the message threw an exception, its value should be returned back to the sender.\\n // So, we force it back, BEFORE returning the messageContext to the previous addresses.\\n // This operation is part of the reason we \\\"reserved the intrinsic gas\\\" above.\\n if (\\n messageValue > 0\\n && _isValueType(_messageType)\\n && !success\\n ) {\\n bool transferredOvmEth = _attemptForcedEthTransfer(\\n prevMessageContext.ovmADDRESS,\\n messageValue\\n );\\n\\n // Since we transferred it in above and the call reverted, the transfer back should always pass.\\n // This code path should NEVER be triggered since we sent `messageValue` worth of OVM_ETH into the target\\n // and reserved sufficient gas to execute the transfer, but in case there is some edge case which has\\n // been missed, we revert the entire frame (and its parent) to make sure the ETH gets sent back.\\n if (!transferredOvmEth) {\\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\\n }\\n }\\n\\n // Switch back to the original message context now that we're out of the call and all OVM_ETH is in the right place.\\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. Additionally, we surface custom error messages\\n // to developers in the case of unsafe creations for improved devex.\\n // All other revert types return no data.\\n if (\\n flag == RevertFlag.INTENTIONAL_REVERT\\n || flag == RevertFlag.UNSAFE_BYTECODE\\n ) {\\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 * Handles the creation-specific safety measures required for OVM contract deployment.\\n * This function sanitizes the return types for creation messages to match calls (bool, bytes),\\n * by being an external function which the EM can call, that mimics the success/fail case of the CREATE.\\n * This allows for consistent handling of both types of messages in _handleExternalMessage().\\n * Having this step occur as a separate call frame also allows us to easily revert the\\n * contract deployment in the event that the code is unsafe.\\n *\\n * @param _creationCode Code to pass into CREATE for deployment.\\n * @param _address OVM address being deployed to.\\n */\\n function safeCREATE(\\n bytes memory _creationCode,\\n address _address\\n )\\n external\\n {\\n // The only way this should callable is from within _createContract(),\\n // and it should DEFINITELY not be callable by a non-EM code contract.\\n if (msg.sender != address(this)) {\\n return;\\n }\\n // Check that there is not already code at this address.\\n if (_hasEmptyAccount(_address) == false) {\\n // Note: in the EVM, this case burns all allotted gas. For improved\\n // developer experience, we do return the remaining gas.\\n _revertWithFlag(\\n RevertFlag.CREATE_COLLISION\\n );\\n }\\n\\n // Check the creation bytecode against the OVM_SafetyChecker.\\n if (ovmSafetyChecker.isBytecodeSafe(_creationCode) == false) {\\n // Note: in the EVM, this case burns all allotted gas. For improved\\n // developer experience, we do return the remaining gas.\\n _revertWithFlag(\\n RevertFlag.UNSAFE_BYTECODE,\\n Lib_ErrorUtils.encodeRevertString(\\\"Contract creation code contains unsafe opcodes. Did you use the right compiler or pass an unsafe constructor argument?\\\")\\n );\\n }\\n\\n // We always need to initialize the contract with the default account values.\\n _initPendingAccount(_address);\\n\\n // Actually execute the EVM create message.\\n // NOTE: The inline assembly below means we can NOT make any evm calls between here and then.\\n address ethAddress = Lib_EthUtils.createContract(_creationCode);\\n\\n if (ethAddress == address(0)) {\\n // If the creation fails, the EVM lets us grab its revert data. This may contain a revert flag\\n // to be used above in _handleExternalMessage, so we pass the revert data back up unmodified.\\n assembly {\\n returndatacopy(0,0,returndatasize())\\n revert(0, returndatasize())\\n }\\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(\\n RevertFlag.UNSAFE_BYTECODE,\\n Lib_ErrorUtils.encodeRevertString(\\\"Constructor attempted to deploy unsafe bytecode.\\\")\\n );\\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 * Internal Functions: Value Manipulation *\\n ******************************************/\\n\\n /**\\n * Invokes an ovmCALL to OVM_ETH.transfer on behalf of the current ovmADDRESS, allowing us to force movement of OVM_ETH in correspondence with ETH's native value functionality.\\n * WARNING: this will send on behalf of whatever the messageContext.ovmADDRESS is in storage at the time of the call.\\n * NOTE: In the future, this could be optimized to directly invoke EM._setContractStorage(...).\\n * @param _to Amount of OVM_ETH to be sent.\\n * @param _value Amount of OVM_ETH to send.\\n * @return _success Whether or not the transfer worked.\\n */\\n function _attemptForcedEthTransfer(\\n address _to,\\n uint256 _value\\n )\\n internal\\n returns(\\n bool _success\\n )\\n {\\n bytes memory transferCalldata = abi.encodeWithSignature(\\n \\\"transfer(address,uint256)\\\",\\n _to,\\n _value\\n );\\n\\n // OVM_ETH inherits from the UniswapV2ERC20 standard. In this implementation, its return type\\n // is a boolean. However, the implementation always returns true if it does not revert.\\n // Thus, success of the call frame is sufficient to infer success of the transfer itself.\\n (bool success, ) = ovmCALL(\\n gasleft(),\\n Lib_PredeployAddresses.OVM_ETH,\\n 0,\\n transferCalldata\\n );\\n\\n return success;\\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 ) {\\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 view\\n {\\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 input values of a transaction.\\n * @return _valid Whether or not the transaction data is valid.\\n */\\n function _isValidInput(\\n Lib_OVMCodec.Transaction memory _transaction\\n )\\n view\\n internal\\n returns (\\n bool\\n )\\n {\\n // Prevent reentrancy to run():\\n // This check prevents calling run with the default ovmNumber.\\n // Combined with the first check in run():\\n // if (transactionContext.ovmNUMBER != DEFAULT_UINT256) { return; }\\n // It should be impossible to re-enter since run() returns before any other call frames are created.\\n // Since this value is already being written to storage, we save much gas compared to\\n // using the standard nonReentrant pattern.\\n if (_transaction.blockNumber == DEFAULT_UINT256) {\\n return false;\\n }\\n\\n if (_isValidGasLimit(_transaction.gasLimit, _transaction.l1QueueOrigin) == false) {\\n return false;\\n }\\n\\n return true;\\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 view\\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 // These conditionals allow us to avoid unneccessary SSTOREs. However, they do mean that the current storage\\n // value for the messageContext MUST equal the _prevMessageContext argument, or an SSTORE might be erroneously skipped.\\n if (_prevMessageContext.ovmCALLER != _nextMessageContext.ovmCALLER) {\\n messageContext.ovmCALLER = _nextMessageContext.ovmCALLER;\\n }\\n\\n if (_prevMessageContext.ovmADDRESS != _nextMessageContext.ovmADDRESS) {\\n messageContext.ovmADDRESS = _nextMessageContext.ovmADDRESS;\\n }\\n\\n if (_prevMessageContext.isStatic != _nextMessageContext.isStatic) {\\n messageContext.isStatic = _nextMessageContext.isStatic;\\n }\\n\\n if (_prevMessageContext.ovmCALLVALUE != _nextMessageContext.ovmCALLVALUE) {\\n messageContext.ovmCALLVALUE = _nextMessageContext.ovmCALLVALUE;\\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 = DEFAULT_ADDRESS;\\n transactionContext.ovmTIMESTAMP = DEFAULT_UINT256;\\n transactionContext.ovmNUMBER = DEFAULT_UINT256;\\n transactionContext.ovmGASLIMIT = DEFAULT_UINT256;\\n transactionContext.ovmTXGASLIMIT = DEFAULT_UINT256;\\n transactionContext.ovmL1QUEUEORIGIN = Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE;\\n\\n transactionRecord.ovmGasRefund = DEFAULT_UINT256;\\n\\n messageContext.ovmCALLER = DEFAULT_ADDRESS;\\n messageContext.ovmADDRESS = DEFAULT_ADDRESS;\\n messageContext.isStatic = false;\\n\\n messageRecord.nuisanceGasLeft = DEFAULT_UINT256;\\n\\n // Reset the ovmStateManager.\\n ovmStateManager = iOVM_StateManager(address(0));\\n }\\n\\n\\n /******************************************\\n * Internal Functions: Message Typechecks *\\n ******************************************/\\n\\n /**\\n * Returns whether or not the given message type is a CREATE-type.\\n * @param _messageType the message type in question.\\n */\\n function _isCreateType(\\n MessageType _messageType\\n )\\n internal\\n pure\\n returns(\\n bool\\n )\\n {\\n return (\\n _messageType == MessageType.ovmCREATE\\n || _messageType == MessageType.ovmCREATE2\\n );\\n }\\n\\n /**\\n * Returns whether or not the given message type (potentially) requires the transfer of ETH value along with the message.\\n * @param _messageType the message type in question.\\n */\\n function _isValueType(\\n MessageType _messageType\\n )\\n internal\\n pure\\n returns(\\n bool\\n )\\n {\\n // ovmSTATICCALL and ovmDELEGATECALL types do not accept or transfer value.\\n return (\\n _messageType == MessageType.ovmCALL\\n || _messageType == MessageType.ovmCREATE\\n || _messageType == MessageType.ovmCREATE2\\n );\\n }\\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 * @param _value the amount of ETH value to send.\\n * @param _ovmStateManager the address of the OVM_StateManager precompile in the L2 state.\\n */\\n function simulateMessage(\\n Lib_OVMCodec.Transaction memory _transaction,\\n address _from,\\n uint256 _value,\\n iOVM_StateManager _ovmStateManager\\n )\\n external\\n returns (\\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 // Initialize the EM's internal state, ignoring nuisance gas.\\n ovmStateManager = _ovmStateManager;\\n _initContext(_transaction);\\n messageRecord.nuisanceGasLeft = uint(-1);\\n\\n // Set the ovmADDRESS to the _from so that the subsequent call frame \\\"comes from\\\" them.\\n messageContext.ovmADDRESS = _from;\\n\\n // Execute the desired message.\\n bool isCreate = _transaction.entrypoint == address(0);\\n if (isCreate) {\\n (address created, bytes memory revertData) = ovmCREATE(_transaction.data);\\n if (created == address(0)) {\\n return abi.encode(false, revertData);\\n } else {\\n // The eth_call RPC endpoint for to = undefined will return the deployed bytecode\\n // in the success case, differing from standard create messages.\\n return abi.encode(true, Lib_EthUtils.getCode(created));\\n }\\n } else {\\n (bool success, bytes memory returndata) = ovmCALL(\\n _transaction.gasLimit,\\n _transaction.entrypoint,\\n _value,\\n _transaction.data\\n );\\n return abi.encode(success, returndata);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x166912c588f2871fd2825ea9288cb3d50a888d4fcafd9fe3cc4461df839acf70\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/predeploys/OVM_DeployerWhitelist.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Interface Imports */\\nimport { iOVM_DeployerWhitelist } from \\\"../../iOVM/predeploys/iOVM_DeployerWhitelist.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: optimistic-solc\\n * Runtime target: OVM\\n */\\ncontract OVM_DeployerWhitelist is iOVM_DeployerWhitelist {\\n\\n /**********************\\n * Contract Constants *\\n **********************/\\n\\n bool public initialized;\\n bool public allowArbitraryDeployment;\\n address override public owner;\\n mapping (address => bool) public whitelist;\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Blocks functions to anyone except the contract owner.\\n */\\n modifier onlyOwner() {\\n require(\\n msg.sender == 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 external\\n {\\n if (initialized == true) {\\n return;\\n }\\n\\n initialized = true;\\n allowArbitraryDeployment = _allowArbitraryDeployment;\\n owner = _owner;\\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 external\\n onlyOwner\\n {\\n whitelist[_deployer] = _isWhitelisted;\\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 owner = _owner;\\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 allowArbitraryDeployment = _allowArbitraryDeployment;\\n }\\n\\n /**\\n * Permanently enables arbitrary contract deployment and deletes the owner.\\n */\\n function enableArbitraryContractDeployment()\\n override\\n external\\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 external\\n returns (\\n bool\\n )\\n {\\n return (\\n initialized == false\\n || allowArbitraryDeployment == true\\n || whitelist[_deployer]\\n );\\n }\\n}\\n\",\"keccak256\":\"0xb96bfb8eb24503b05de41483cc9fb7a7f81107aa1ca146dc281952f8100848a0\",\"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 * 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\",\"keccak256\":\"0x180b9c347e20f1a6efa553b0f2b9a59aebceda92a7484ae6fca4da2bf1d960c3\",\"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 OUT_OF_GAS,\\n INTENTIONAL_REVERT,\\n EXCEEDS_NUISANCE_GAS,\\n INVALID_STATE_ACCESS,\\n UNSAFE_BYTECODE,\\n CREATE_COLLISION,\\n STATIC_VIOLATION,\\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 enum MessageType {\\n ovmCALL,\\n ovmSTATICCALL,\\n ovmDELEGATECALL,\\n ovmCREATE,\\n ovmCREATE2\\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 uint256 ovmCALLVALUE;\\n bool isStatic;\\n }\\n\\n struct MessageRecord {\\n uint256 nuisanceGasLeft;\\n }\\n\\n\\n /************************************\\n * Transaction Execution Entrypoint *\\n ************************************/\\n\\n function run(\\n Lib_OVMCodec.Transaction calldata _transaction,\\n address _txStateManager\\n ) external returns (bytes memory);\\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 ovmCALLVALUE() external view returns (uint _callValue);\\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, bytes memory _revertdata);\\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract, bytes memory _revertdata);\\n\\n\\n /*******************************\\n * Account Abstraction Opcodes *\\n ******************************/\\n\\n function ovmGETNONCE() external returns (uint256 _nonce);\\n function ovmINCREMENTNONCE() external;\\n function ovmCREATEEOA(bytes32 _messageHash, uint8 _v, bytes32 _r, bytes32 _s) external;\\n\\n\\n /****************************\\n * Contract Calling Opcodes *\\n ****************************/\\n\\n // Valueless ovmCALL for maintaining backwards compatibility with legacy OVM bytecode.\\n function ovmCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\\n function ovmCALL(uint256 _gasLimit, address _address, uint256 _value, 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 * ETH Value Opcodes *\\n *********************/\\n\\n function ovmBALANCE(address _contract) external returns (uint256 _balance);\\n function ovmSELFBALANCE() external returns (uint256 _balance);\\n\\n\\n /***************************************\\n * Public Functions: Execution Context *\\n ***************************************/\\n\\n function getMaxTransactionGasLimit() external view returns (uint _maxTransactionGasLimit);\\n}\\n\",\"keccak256\":\"0x87a056425696719488dbd06adbbf89280d86651e75e1f77d9e96b0632c8634cc\",\"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/predeploys/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 owner() 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\":\"0xdf1f27faf0d26d416bf6d408d146a16de32b4e1772a292c65d39eb7ec2b53ceb\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_PredeployAddresses\\n */\\nlibrary Lib_PredeployAddresses {\\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\\n address internal constant ECDSA_CONTRACT_ACCOUNT = 0x4200000000000000000000000000000000000003;\\n address internal constant SEQUENCER_ENTRYPOINT = 0x4200000000000000000000000000000000000005;\\n address payable internal constant OVM_ETH = 0x4200000000000000000000000000000000000006;\\n address internal constant L2_CROSS_DOMAIN_MESSENGER = 0x4200000000000000000000000000000000000007;\\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\\n address internal constant EXECUTION_MANAGER_WRAPPER = 0x420000000000000000000000000000000000000B;\\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\\n address internal constant ERC1820_REGISTRY = 0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24;\\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\\n}\\n\",\"keccak256\":\"0x798dd3fe47c172880978c8e4d35573b25d5135be29a77584e9fac45845748695\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_ErrorUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/**\\n * @title Lib_ErrorUtils\\n */\\nlibrary Lib_ErrorUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes an error string into raw solidity-style revert data.\\n * (i.e. ascii bytes, prefixed with bytes4(keccak(\\\"Error(string))\\\"))\\n * Ref: https://docs.soliditylang.org/en/v0.8.2/control-structures.html?highlight=Error(string)#panic-via-assert-and-error-via-require\\n * @param _reason Reason for the reversion.\\n * @return Standard solidity revert data for the given reason.\\n */\\n function encodeRevertString(\\n string memory _reason\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return abi.encodeWithSignature(\\n \\\"Error(string)\\\",\\n _reason\\n );\\n }\\n}\\n\",\"keccak256\":\"0xfc64ec4a81fb50865b502a0004ed154e8598e1a313db77303fc95e41f536e6b7\",\"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 *\\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 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\\n )\\n {\\n bytes memory code;\\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 Full code of the contract.\\n */\\n function getCode(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes memory\\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 Size of the contract's code in bytes.\\n */\\n function getCodeSize(\\n address _address\\n )\\n internal\\n view\\n returns (\\n uint256\\n )\\n {\\n uint256 codeSize;\\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 Hash of the contract's code.\\n */\\n function getCodeHash(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n bytes32 codeHash;\\n assembly {\\n codeHash := extcodehash(_address)\\n }\\n\\n return codeHash;\\n }\\n\\n /**\\n * Creates a contract with some given initialization code.\\n * @param _code Contract initialization code.\\n * @return Address of the created contract.\\n */\\n function createContract(\\n bytes memory _code\\n )\\n internal\\n returns (\\n address\\n )\\n {\\n address created;\\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 to be generated by CREATE.\\n */\\n function getAddressForCREATE(\\n address _creator,\\n uint256 _nonce\\n )\\n internal\\n pure\\n returns (\\n 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 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 (\\n address\\n )\\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\":\"0xf29a67d78e61cb472d524b779b32cfcb39a587f4096500d5419e6425ed367d49\",\"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 * Note that the _elements argument is modified, therefore it must not be used again afterwards\\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 pure\\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 == 1) {\\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 (uint256 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\":\"0xa78edb9fbd34712771a1ebff05bc5e1abec7fc1e9a1bfb709d183099b44fa62a\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b506040516200315338038062003153833981016040819052620000349162000067565b600080546001600160a01b0319166001600160a01b039590951694909417909355600191909155600255600355620000b2565b600080600080608085870312156200007d578384fd5b84516001600160a01b038116811462000094578485fd5b60208601516040870151606090970151919890975090945092505050565b61309180620000c26000396000f3fe608060405234801561001057600080fd5b50600436106101425760003560e01c8063876ed5cb116100b8578063cfdf677e1161007c578063cfdf677e1461023f578063d0f8934414610247578063e10d29ee1461024f578063e561dddc14610257578063f722b41a1461025f578063facdc5da1461026757610142565b8063876ed5cb146102175780638d38c6c11461021f578063b8f7700514610227578063c139eb151461022f578063c2cf696f1461023757610142565b80634de569ce1161010a5780634de569ce146101c25780635ae6256d146101e25780636fee07e0146101ea57806378f4b2f2146101ff5780637a167a8a146102075780637aa63a861461020f57610142565b8063138387a414610147578063299ca478146101655780632a7f18be1461017a578063378997701461019a578063461a4478146101af575b600080fd5b61014f61027a565b60405161015c91906124c7565b60405180910390f35b61016d610280565b60405161015c91906123eb565b61018d610188366004612388565b61028f565b60405161015c9190612e4e565b6101a26102b0565b60405161015c9190612e8d565b61016d6101bd36600461221b565b6102c4565b6101d56101d0366004612261565b6103a0565b60405161015c9190612484565b6101a26103da565b6101fd6101f8366004612188565b6103ee565b005b61014f61066d565b6101a2610674565b61014f610689565b61014f6106a4565b61014f6106aa565b6101a26106b0565b61014f6106c7565b61014f6106cd565b61016d6106d2565b6101fd6106f5565b61016d610b69565b61014f610b8c565b6101a2610c06565b6101fd610275366004612388565b610c1e565b60025481565b6000546001600160a01b031681565b610297611ed9565b6102a8826102a3610b69565b610c36565b90505b919050565b6000806102bb610d76565b50935050505090565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561032457818101518382015260200161030c565b50505050905090810190601f1680156103515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561036e57600080fd5b505afa158015610382573d6000803e3d6000fd5b505050506040513d602081101561039857600080fd5b505192915050565b82516000901515600114156103c2576103bb85858585610e24565b90506103d2565b6103bb8585602001518585610fef565b949350505050565b6000806103e5610d76565b94505050505090565b61c3508151111561041a5760405162461bcd60e51b81526004016104119061259b565b60405180910390fd5b60035482111561043c5760405162461bcd60e51b8152600401610411906127a1565b620186a082101561045f5760405162461bcd60e51b815260040161041190612983565b6020820460005a90508181116104875760405162461bcd60e51b815260040161041190612b8a565b60005b825a8303101561049c5760010161048a565b6000338787876040516020016104b594939291906123ff565b60408051601f19818403018152919052805160209091012090504360281b421760006104df610b69565b60405163b298e36b60e01b81529091506001600160a01b0382169063b298e36b9061050e9086906004016124c7565b600060405180830381600087803b15801561052857600080fd5b505af115801561053c573d6000803e3d6000fd5b505060405163b298e36b60e01b81526001600160a01b038416925063b298e36b915061056c9085906004016124c7565b600060405180830381600087803b15801561058657600080fd5b505af115801561059a573d6000803e3d6000fd5b50505050600060016002836001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156105dd57600080fd5b505afa1580156105f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106159190612203565b8161061c57fe5b040390507f4b388aecf9fa6cc92253704e5975a6129a4f735bdbd99567df4ed0094ee4ceb5338b8b8b85426040516106599695949392919061243c565b60405180910390a150505050505050505050565b620186a081565b60008061067f610d76565b5090935050505090565b600080610694610d76565b50505064ffffffffff1692915050565b61c35081565b60035481565b60006106c26106bd610b69565b6110c4565b905090565b60015481565b602081565b60006106c2604051806060016040528060258152602001612f08602591396102c4565b60043560d81c60093560e890811c90600c35901c610711610689565b8364ffffffffff16146107365760405162461bcd60e51b815260040161041190612a35565b6107646040518060400160405280600d81526020016c27ab26afa9b2b8bab2b731b2b960991b8152506102c4565b6001600160a01b0316336001600160a01b0316146107945760405162461bcd60e51b815260040161041190612a92565b60008162ffffff16116107b95760405162461bcd60e51b8152600401610411906127fe565b60008262ffffff16116107de5760405162461bcd60e51b815260040161041190612cdf565b600f601062ffffff8316020164ffffffffff81163610156108115760405162461bcd60e51b815260040161041190612d66565b600061081b610b69565b90506000610828826110c4565b9050600062ffffff8616368161083a57fe5b0460020267ffffffffffffffff8111801561085457600080fd5b506040519080825280601f01601f19166020018201604052801561087f576020820181803683370190505b50905060008662ffffff1667ffffffffffffffff811180156108a057600080fd5b506040519080825280602002602001820160405280156108ca578160200160208202803683370190505b50905060008060006108da610674565b90506108e4611ef9565b60005b8a62ffffff168163ffffffff161015610a3b57600061090b8263ffffffff16611147565b905063ffffffff82166109215761092181611197565b61092d8382868d611264565b80925060005b835163ffffffff821610156109b1578b3560e81c61c3508111156109695760405162461bcd60e51b81526004016104119061259b565b61097c858e64ffffffffff16838d6112cf565b898963ffffffff168151811061098e57fe5b60209081029190910101529b909b016003019a6001968701969586019501610933565b5060005b83602001518163ffffffff161015610a31578964ffffffffff168564ffffffffff16106109f45760405162461bcd60e51b815260040161041190612da8565b610a048564ffffffffff16611363565b888863ffffffff1681518110610a1657fe5b602090810291909101015260019687019694850194016109b5565b50506001016108e7565b50610a488183898b6113a8565b3664ffffffffff8a1614610a6e5760405162461bcd60e51b815260040161041190612846565b8a62ffffff168463ffffffff1614610a985760405162461bcd60e51b815260040161041190612894565b6000838c62ffffff160363ffffffff169050600080836020015160001415610acb57505060408201516060830151610af3565b6000610ae16001870364ffffffffff168d610c36565b90508060200151925080604001519150505b610b14610aff8961141b565b8f62ffffff168564ffffffffff16858561184f565b7f602f1aeac0ca2e7a13e281a9ef0ad7838542712ce16780fa2ecffd351f05f89983860384610b41610689565b604051610b5093929190612e9f565b60405180910390a1505050505050505050505050505050565b60006106c2604051806060016040528060238152602001613005602391396102c4565b6000610b966106d2565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610bce57600080fd5b505afa158015610be2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c29190612203565b6000610c10610674565b610c186106b0565b03905090565b60405162461bcd60e51b81526004016104119061250b565b610c3e611ed9565b604051634a83e9cd60e11b815260028402906000906001600160a01b03851690639507d39a90610c72908590600401612e8d565b60206040518083038186803b158015610c8a57600080fd5b505afa158015610c9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc29190612203565b90506000846001600160a01b0316639507d39a846001016040518263ffffffff1660e01b8152600401610cf59190612e8d565b60206040518083038186803b158015610d0d57600080fd5b505afa158015610d21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d459190612203565b6040805160608101825293845264ffffffffff828116602086015260289290921c9091169083015250949350505050565b6000806000806000610d866106d2565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b158015610dbe57600080fd5b505afa158015610dd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df691906121dd565b64ffffffffff602882901c811697605083901c82169750607883901c8216965060a09290921c169350915050565b600080610e5c6040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b8152506102c4565b90506000816001600160a01b0316631c4712a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610e9957600080fd5b505afa158015610ead573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed19190612203565b90506000610ede87611a02565b9050610eeb818787611a9b565b610f075760405162461bcd60e51b8152600401610411906126ca565b86606001518860200151148015610f22575060408701518851145b8015610f635750610f4a604051806060016040528060228152602001612ee6602291396102c4565b6001600160a01b031688608001516001600160a01b0316145b8015610f725750818860a00151145b8015610f89575060608801516001600160a01b0316155b8015610fa45750600088604001516001811115610fa257fe5b145b8015610fc557508660800151805190602001208860c0015180519060200120145b610fe15760405162461bcd60e51b81526004016104119061276a565b506001979650505050505050565b600080610ffb85611363565b9050611008818585611a9b565b6110245760405162461bcd60e51b815260040161041190612c2a565b6000866060015187608001518860a001518960c0015160405160200161104d94939291906123ff565b60405160208183030381529060405280519060200120905060006110708761028f565b80519091508214801561108e57508751602082015164ffffffffff16145b80156110a857508760200151816040015164ffffffffff16145b610fe15760405162461bcd60e51b815260040161041190612adf565b60006002826001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b15801561110157600080fd5b505afa158015611115573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111399190612203565b8161114057fe5b0492915050565b61114f611ef9565b5060408051608081018252601092909202600f81013560e890811c84526012820135901c6020840152601581013560d890811c92840192909252601a0135901c606082015290565b60006111a1610689565b1115611211576000806111b2610d76565b9350935050508064ffffffffff16836060015110156111e35760405162461bcd60e51b815260040161041190612718565b8164ffffffffff168360400151101561120e5760405162461bcd60e51b8152600401610411906125f8565b50505b4260015482604001510110156112395760405162461bcd60e51b815260040161041190612d20565b4360025482606001510110156112615760405162461bcd60e51b815260040161041190612552565b50565b83604001518360400151101561128c5760405162461bcd60e51b815260040161041190612bd5565b8360600151836060015110156112b45760405162461bcd60e51b815260040161041190612df1565b6020830151156112c9576112c9838383611b8c565b50505050565b60008151836041011115611326578260410167ffffffffffffffff811180156112f757600080fd5b506040519080825280601f01601f191660200182016040528015611322576020820181803683370190505b5091505b6040850151606086015160006020850160018153836001820152826021820152866003890160418301376041870190209350505050949350505050565b60006102a86040518060a00160405280600015158152602001848152602001600081526020016000815260200160405180602001604052806000815250815250611c2d565b600083830364ffffffffff161180156113c357506020840151155b156113d3576113d3848483611b8c565b42846040015111156113f75760405162461bcd60e51b815260040161041190612b45565b43846060015111156112c95760405162461bcd60e51b815260040161041190612904565b60008082511161145c5760405162461bcd60e51b81526004018080602001828103825260348152602001806130286034913960400191505060405180910390fd5b815160011415611482578160008151811061147357fe5b602002602001015190506102ab565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b600184111561182b5750506002820460018084161460005b828110156117a7578a816002028151811061174e57fe5b602002602001015196508a816002026001018151811061176a57fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061179457fe5b6020908102919091010152600101611737565b50801561180a578960018503815181106117bd57fe5b602002602001015195508783601081106117d357fe5b602002015160001b945085602088015284604088015286805190602001208a83815181106117fd57fe5b6020026020010181815250505b80611816576000611819565b60015b60ff168201935060019092019161171f565b8960008151811061183857fe5b602002602001015198505050505050505050919050565b60006118596106d2565b9050600080611866610d76565b50509150915060006040518060a00160405280856001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156118b257600080fd5b505afa1580156118c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ea9190612203565b81526020018a81526020018981526020018464ffffffffff16815260200160405180602001604052806000815250815250905080600001517f127186556e7be68c7e31263195225b4de02820707889540969f62c05cf73525e826020015183604001518460600151856080015160405161196794939291906124e6565b60405180910390a2600061197a82611c75565b90506000611992836040015186018a86018a8a611c9e565b60405163080549db60e21b81529091506001600160a01b03871690632015276c906119c390859085906004016124d0565b600060405180830381600087803b1580156119dd57600080fd5b505af11580156119f1573d6000803e3d6000fd5b505050505050505050505050505050565b6080810151805160009190826041820167ffffffffffffffff81118015611a2857600080fd5b506040519080825280601f01601f191660200182016040528015611a53576020820181803683370190505b5060408601516060870151919250906000602084016001815383600182015282602182015285604182018760208a0160045afa50604190950190942095505050505050919050565b6000611aa56106d2565b8351604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a91611ad391600401612e7c565b60206040518083038186803b158015611aeb57600080fd5b505afa158015611aff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b239190612203565b611b2c84611c75565b14611b495760405162461bcd60e51b815260040161041190612b16565b611b66836020015185846000015185602001518760400151611cbd565b611b825760405162461bcd60e51b81526004016104119061294c565b5060019392505050565b6000611b9f8364ffffffffff1683610c36565b9050600154816020015164ffffffffff16014210611bcf5760405162461bcd60e51b815260040161041190612647565b806020015164ffffffffff1684604001511115611bfe5760405162461bcd60e51b8152600401610411906129cc565b806040015164ffffffffff16846060015111156112c95760405162461bcd60e51b815260040161041190612c74565b8051602080830151604080850151606086015160808701519251600096611c5896909594910161248f565b604051602081830303815290604052805190602001209050919050565b60008160200151826040015183606001518460800151604051602001611c5894939291906124e6565b602892831b9390931760509190911b1760789290921b91909117901b90565b6000808211611cfd5760405162461bcd60e51b8152600401808060200182810382526037815260200180612f816037913960400191505060405180910390fd5b818410611d3b5760405162461bcd60e51b8152600401808060200182810382526024815260200180612f2d6024913960400191505060405180910390fd5b611d4482611e42565b835114611d825760405162461bcd60e51b815260040180806020018281038252604d815260200180612fb8604d913960600191505060405180910390fd5b8460005b8451811015611e35578560011660011415611de457848181518110611da757fe5b6020026020010151826040516020018083815260200182815260200192505050604051602081830303815290604052805190602001209150611e29565b81858281518110611df157fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c9501611d86565b5090951495945050505050565b6000808211611e825760405162461bcd60e51b8152600401808060200182810382526030815260200180612f516030913960400191505060405180910390fd5b8160011415611e93575060006102ab565b81600060805b60018110611ec3576000196001821b01811b831615611ebb5791821c91908101905b60011c611e99565b506001811b8414611ed2576001015b9392505050565b604080516060810182526000808252602082018190529181019190915290565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b600067ffffffffffffffff831115611f3557fe5b611f48601f8401601f1916602001612ec1565b9050828152838383011115611f5c57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102ab57600080fd5b600082601f830112611f9a578081fd5b611ed283833560208501611f21565b8035600281106102ab57600080fd5b600060a08284031215611fc9578081fd5b60405160a0810167ffffffffffffffff8282108183111715611fe757fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561202457600080fd5b5061203185828601611f8a565b6080830152505092915050565b60006040828403121561204f578081fd5b6040516040810167ffffffffffffffff828210818311171561206d57fe5b816040528293508435835260209150818501358181111561208d57600080fd5b8501601f8101871361209e57600080fd5b8035828111156120aa57fe5b83810292506120ba848401612ec1565b8181528481019083860185850187018b10156120d557600080fd5b600095505b838610156120f85780358352600195909501949186019186016120da565b5080868801525050505050505092915050565b600060a0828403121561211c578081fd5b60405160a0810167ffffffffffffffff828210818311171561213a57fe5b8160405282935084359150811515821461215357600080fd5b818352602085013560208401526040850135604084015260608501356060840152608085013591508082111561202457600080fd5b60008060006060848603121561219c578283fd5b6121a584611f73565b925060208401359150604084013567ffffffffffffffff8111156121c7578182fd5b6121d386828701611f8a565b9150509250925092565b6000602082840312156121ee578081fd5b815164ffffffffff1981168114611ed2578182fd5b600060208284031215612214578081fd5b5051919050565b60006020828403121561222c578081fd5b813567ffffffffffffffff811115612242578182fd5b8201601f81018413612252578182fd5b6103d284823560208401611f21565b60008060008060808587031215612276578081fd5b843567ffffffffffffffff8082111561228d578283fd5b9086019060e082890312156122a0578283fd5b6122aa60e0612ec1565b82358152602083013560208201526122c460408401611fa9565b60408201526122d560608401611f73565b60608201526122e660808401611f73565b608082015260a083013560a082015260c083013582811115612306578485fd5b6123128a828601611f8a565b60c0830152509550602087013591508082111561232d578283fd5b6123398883890161210b565b9450604087013591508082111561234e578283fd5b61235a88838901611fb8565b9350606087013591508082111561236f578283fd5b5061237c8782880161203e565b91505092959194509250565b600060208284031215612399578081fd5b5035919050565b60008151808452815b818110156123c5576020818501810151868301820152016123a9565b818111156123d65782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612432908301846123a0565b9695505050505050565b6001600160a01b038781168252861660208201526040810185905260c06060820181905260009061246f908301866123a0565b60808301949094525060a00152949350505050565b901515815260200190565b6000861515825285602083015284604083015283606083015260a060808301526124bc60a08301846123a0565b979650505050505050565b90815260200190565b91825264ffffffffff1916602082015260400190565b60008582528460208301528360408301526080606083015261243260808301846123a0565b60208082526027908201527f617070656e64517565756542617463682069732063757272656e746c7920646960408201526639b0b13632b21760c91b606082015260800190565b60208082526029908201527f436f6e7465787420626c6f636b206e756d62657220746f6f2066617220696e206040820152683a3432903830b9ba1760b91b606082015260800190565b6020808252603d908201527f5472616e73616374696f6e20646174612073697a652065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b6020808252602f908201527f436f6e746578742074696d657374616d70206973206c6f776572207468616e2060408201526e3630b9ba1039bab136b4ba3a32b21760891b606082015260800190565b6020808252605b908201527f50726576696f75736c7920656e7175657565642062617463686573206861766560408201527f206578706972656420616e64206d75737420626520617070656e64656420626560608201527f666f72652061206e65772073657175656e6365722062617463682e0000000000608082015260a00190565b6020808252602e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e20696e60408201526d31b63ab9b4b7b710383937b7b31760911b606082015260800190565b60208082526032908201527f436f6e7465787420626c6f636b206e756d626572206973206c6f77657220746860408201527130b7103630b9ba1039bab136b4ba3a32b21760711b606082015260800190565b6020808252601e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e2e0000604082015260600190565b6020808252603d908201527f5472616e73616374696f6e20676173206c696d69742065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b60208082526028908201527f4d7573742070726f76696465206174206c65617374206f6e652062617463682060408201526731b7b73a32bc3a1760c11b606082015260800190565b6020808252602e908201527f4e6f7420616c6c2073657175656e636572207472616e73616374696f6e73207760408201526d32b93290383937b1b2b9b9b2b21760911b606082015260800190565b6020808252604a908201527f41637475616c207472616e73616374696f6e20696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420746f74616c20656c656d656e7473206060820152693a379030b83832b7321760b11b608082015260a00190565b60208082526028908201527f436f6e7465787420626c6f636b206e756d6265722069732066726f6d2074686560408201526710333aba3ab9329760c11b606082015260800190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b60208082526029908201527f5472616e73616374696f6e20676173206c696d697420746f6f206c6f7720746f6040820152681032b738bab2bab29760b91b606082015260800190565b60208082526043908201527f53657175656e636572207472616e73616374696f6e2074696d657374616d702060408201527f657863656564732074686174206f66206e65787420717565756520656c656d65606082015262373a1760e91b608082015260a00190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b6020808252602d908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c6564206279207460408201526c34329029b2b8bab2b731b2b91760991b606082015260800190565b6020808252601a908201527f496e76616c6964205175657565207472616e73616374696f6e2e000000000000604082015260600190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b60208082526025908201527f436f6e746578742074696d657374616d702069732066726f6d207468652066756040820152643a3ab9329760d91b606082015260800190565b6020808252602b908201527f496e73756666696369656e742067617320666f72204c322072617465206c696d60408201526a34ba34b73390313ab9371760a91b606082015260800190565b60208082526035908201527f436f6e746578742074696d657374616d702076616c756573206d757374206d6f6040820152743737ba37b734b1b0b6363c9034b731b932b0b9b29760591b606082015260800190565b6020808252602a908201527f496e76616c6964205175657565207472616e73616374696f6e20696e636c757360408201526934b7b710383937b7b31760b11b606082015260800190565b60208082526045908201527f53657175656e636572207472616e73616374696f6e20626c6f636b4e756d626560408201527f7220657863656564732074686174206f66206e65787420717565756520656c6560608201526436b2b73a1760d91b608082015260a00190565b60208082526021908201527f4d75737420617070656e64206174206c65617374206f6e6520656c656d656e746040820152601760f91b606082015260800190565b60208082526026908201527f436f6e746578742074696d657374616d7020746f6f2066617220696e20746865604082015265103830b9ba1760d11b606082015260800190565b60208082526022908201527f4e6f7420656e6f756768204261746368436f6e74657874732070726f76696465604082015261321760f11b606082015260800190565b60208082526029908201527f4e6f7420656e6f75676820717565756564207472616e73616374696f6e732074604082015268379030b83832b7321760b91b606082015260800190565b60208082526037908201527f436f6e7465787420626c6f636b4e756d6265722076616c756573206d7573742060408201527f6d6f6e6f746f6e6963616c6c7920696e6372656173652e000000000000000000606082015260800190565b8151815260208083015164ffffffffff90811691830191909152604092830151169181019190915260600190565b63ffffffff91909116815260200190565b64ffffffffff91909116815260200190565b64ffffffffff9384168152919092166020820152604081019190915260600190565b60405181810167ffffffffffffffff81118282101715612edd57fe5b60405291905056fe4f564d5f4465636f6d7072657373696f6e507265636f6d70696c65416464726573734f564d5f436861696e53746f72616765436f6e7461696e65722d4354432d626174636865734c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4f564d5f436861696e53746f72616765436f6e7461696e65722d4354432d71756575654c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea2646970667358221220ccd26d70e29e57df01efbc12fcd4152555b136a977c6cd56cd6a3e465f2e8fef64736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101425760003560e01c8063876ed5cb116100b8578063cfdf677e1161007c578063cfdf677e1461023f578063d0f8934414610247578063e10d29ee1461024f578063e561dddc14610257578063f722b41a1461025f578063facdc5da1461026757610142565b8063876ed5cb146102175780638d38c6c11461021f578063b8f7700514610227578063c139eb151461022f578063c2cf696f1461023757610142565b80634de569ce1161010a5780634de569ce146101c25780635ae6256d146101e25780636fee07e0146101ea57806378f4b2f2146101ff5780637a167a8a146102075780637aa63a861461020f57610142565b8063138387a414610147578063299ca478146101655780632a7f18be1461017a578063378997701461019a578063461a4478146101af575b600080fd5b61014f61027a565b60405161015c91906124c7565b60405180910390f35b61016d610280565b60405161015c91906123eb565b61018d610188366004612388565b61028f565b60405161015c9190612e4e565b6101a26102b0565b60405161015c9190612e8d565b61016d6101bd36600461221b565b6102c4565b6101d56101d0366004612261565b6103a0565b60405161015c9190612484565b6101a26103da565b6101fd6101f8366004612188565b6103ee565b005b61014f61066d565b6101a2610674565b61014f610689565b61014f6106a4565b61014f6106aa565b6101a26106b0565b61014f6106c7565b61014f6106cd565b61016d6106d2565b6101fd6106f5565b61016d610b69565b61014f610b8c565b6101a2610c06565b6101fd610275366004612388565b610c1e565b60025481565b6000546001600160a01b031681565b610297611ed9565b6102a8826102a3610b69565b610c36565b90505b919050565b6000806102bb610d76565b50935050505090565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561032457818101518382015260200161030c565b50505050905090810190601f1680156103515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561036e57600080fd5b505afa158015610382573d6000803e3d6000fd5b505050506040513d602081101561039857600080fd5b505192915050565b82516000901515600114156103c2576103bb85858585610e24565b90506103d2565b6103bb8585602001518585610fef565b949350505050565b6000806103e5610d76565b94505050505090565b61c3508151111561041a5760405162461bcd60e51b81526004016104119061259b565b60405180910390fd5b60035482111561043c5760405162461bcd60e51b8152600401610411906127a1565b620186a082101561045f5760405162461bcd60e51b815260040161041190612983565b6020820460005a90508181116104875760405162461bcd60e51b815260040161041190612b8a565b60005b825a8303101561049c5760010161048a565b6000338787876040516020016104b594939291906123ff565b60408051601f19818403018152919052805160209091012090504360281b421760006104df610b69565b60405163b298e36b60e01b81529091506001600160a01b0382169063b298e36b9061050e9086906004016124c7565b600060405180830381600087803b15801561052857600080fd5b505af115801561053c573d6000803e3d6000fd5b505060405163b298e36b60e01b81526001600160a01b038416925063b298e36b915061056c9085906004016124c7565b600060405180830381600087803b15801561058657600080fd5b505af115801561059a573d6000803e3d6000fd5b50505050600060016002836001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156105dd57600080fd5b505afa1580156105f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106159190612203565b8161061c57fe5b040390507f4b388aecf9fa6cc92253704e5975a6129a4f735bdbd99567df4ed0094ee4ceb5338b8b8b85426040516106599695949392919061243c565b60405180910390a150505050505050505050565b620186a081565b60008061067f610d76565b5090935050505090565b600080610694610d76565b50505064ffffffffff1692915050565b61c35081565b60035481565b60006106c26106bd610b69565b6110c4565b905090565b60015481565b602081565b60006106c2604051806060016040528060258152602001612f08602591396102c4565b60043560d81c60093560e890811c90600c35901c610711610689565b8364ffffffffff16146107365760405162461bcd60e51b815260040161041190612a35565b6107646040518060400160405280600d81526020016c27ab26afa9b2b8bab2b731b2b960991b8152506102c4565b6001600160a01b0316336001600160a01b0316146107945760405162461bcd60e51b815260040161041190612a92565b60008162ffffff16116107b95760405162461bcd60e51b8152600401610411906127fe565b60008262ffffff16116107de5760405162461bcd60e51b815260040161041190612cdf565b600f601062ffffff8316020164ffffffffff81163610156108115760405162461bcd60e51b815260040161041190612d66565b600061081b610b69565b90506000610828826110c4565b9050600062ffffff8616368161083a57fe5b0460020267ffffffffffffffff8111801561085457600080fd5b506040519080825280601f01601f19166020018201604052801561087f576020820181803683370190505b50905060008662ffffff1667ffffffffffffffff811180156108a057600080fd5b506040519080825280602002602001820160405280156108ca578160200160208202803683370190505b50905060008060006108da610674565b90506108e4611ef9565b60005b8a62ffffff168163ffffffff161015610a3b57600061090b8263ffffffff16611147565b905063ffffffff82166109215761092181611197565b61092d8382868d611264565b80925060005b835163ffffffff821610156109b1578b3560e81c61c3508111156109695760405162461bcd60e51b81526004016104119061259b565b61097c858e64ffffffffff16838d6112cf565b898963ffffffff168151811061098e57fe5b60209081029190910101529b909b016003019a6001968701969586019501610933565b5060005b83602001518163ffffffff161015610a31578964ffffffffff168564ffffffffff16106109f45760405162461bcd60e51b815260040161041190612da8565b610a048564ffffffffff16611363565b888863ffffffff1681518110610a1657fe5b602090810291909101015260019687019694850194016109b5565b50506001016108e7565b50610a488183898b6113a8565b3664ffffffffff8a1614610a6e5760405162461bcd60e51b815260040161041190612846565b8a62ffffff168463ffffffff1614610a985760405162461bcd60e51b815260040161041190612894565b6000838c62ffffff160363ffffffff169050600080836020015160001415610acb57505060408201516060830151610af3565b6000610ae16001870364ffffffffff168d610c36565b90508060200151925080604001519150505b610b14610aff8961141b565b8f62ffffff168564ffffffffff16858561184f565b7f602f1aeac0ca2e7a13e281a9ef0ad7838542712ce16780fa2ecffd351f05f89983860384610b41610689565b604051610b5093929190612e9f565b60405180910390a1505050505050505050505050505050565b60006106c2604051806060016040528060238152602001613005602391396102c4565b6000610b966106d2565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610bce57600080fd5b505afa158015610be2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c29190612203565b6000610c10610674565b610c186106b0565b03905090565b60405162461bcd60e51b81526004016104119061250b565b610c3e611ed9565b604051634a83e9cd60e11b815260028402906000906001600160a01b03851690639507d39a90610c72908590600401612e8d565b60206040518083038186803b158015610c8a57600080fd5b505afa158015610c9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc29190612203565b90506000846001600160a01b0316639507d39a846001016040518263ffffffff1660e01b8152600401610cf59190612e8d565b60206040518083038186803b158015610d0d57600080fd5b505afa158015610d21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d459190612203565b6040805160608101825293845264ffffffffff828116602086015260289290921c9091169083015250949350505050565b6000806000806000610d866106d2565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b158015610dbe57600080fd5b505afa158015610dd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df691906121dd565b64ffffffffff602882901c811697605083901c82169750607883901c8216965060a09290921c169350915050565b600080610e5c6040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b8152506102c4565b90506000816001600160a01b0316631c4712a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610e9957600080fd5b505afa158015610ead573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed19190612203565b90506000610ede87611a02565b9050610eeb818787611a9b565b610f075760405162461bcd60e51b8152600401610411906126ca565b86606001518860200151148015610f22575060408701518851145b8015610f635750610f4a604051806060016040528060228152602001612ee6602291396102c4565b6001600160a01b031688608001516001600160a01b0316145b8015610f725750818860a00151145b8015610f89575060608801516001600160a01b0316155b8015610fa45750600088604001516001811115610fa257fe5b145b8015610fc557508660800151805190602001208860c0015180519060200120145b610fe15760405162461bcd60e51b81526004016104119061276a565b506001979650505050505050565b600080610ffb85611363565b9050611008818585611a9b565b6110245760405162461bcd60e51b815260040161041190612c2a565b6000866060015187608001518860a001518960c0015160405160200161104d94939291906123ff565b60405160208183030381529060405280519060200120905060006110708761028f565b80519091508214801561108e57508751602082015164ffffffffff16145b80156110a857508760200151816040015164ffffffffff16145b610fe15760405162461bcd60e51b815260040161041190612adf565b60006002826001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b15801561110157600080fd5b505afa158015611115573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111399190612203565b8161114057fe5b0492915050565b61114f611ef9565b5060408051608081018252601092909202600f81013560e890811c84526012820135901c6020840152601581013560d890811c92840192909252601a0135901c606082015290565b60006111a1610689565b1115611211576000806111b2610d76565b9350935050508064ffffffffff16836060015110156111e35760405162461bcd60e51b815260040161041190612718565b8164ffffffffff168360400151101561120e5760405162461bcd60e51b8152600401610411906125f8565b50505b4260015482604001510110156112395760405162461bcd60e51b815260040161041190612d20565b4360025482606001510110156112615760405162461bcd60e51b815260040161041190612552565b50565b83604001518360400151101561128c5760405162461bcd60e51b815260040161041190612bd5565b8360600151836060015110156112b45760405162461bcd60e51b815260040161041190612df1565b6020830151156112c9576112c9838383611b8c565b50505050565b60008151836041011115611326578260410167ffffffffffffffff811180156112f757600080fd5b506040519080825280601f01601f191660200182016040528015611322576020820181803683370190505b5091505b6040850151606086015160006020850160018153836001820152826021820152866003890160418301376041870190209350505050949350505050565b60006102a86040518060a00160405280600015158152602001848152602001600081526020016000815260200160405180602001604052806000815250815250611c2d565b600083830364ffffffffff161180156113c357506020840151155b156113d3576113d3848483611b8c565b42846040015111156113f75760405162461bcd60e51b815260040161041190612b45565b43846060015111156112c95760405162461bcd60e51b815260040161041190612904565b60008082511161145c5760405162461bcd60e51b81526004018080602001828103825260348152602001806130286034913960400191505060405180910390fd5b815160011415611482578160008151811061147357fe5b602002602001015190506102ab565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b600184111561182b5750506002820460018084161460005b828110156117a7578a816002028151811061174e57fe5b602002602001015196508a816002026001018151811061176a57fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061179457fe5b6020908102919091010152600101611737565b50801561180a578960018503815181106117bd57fe5b602002602001015195508783601081106117d357fe5b602002015160001b945085602088015284604088015286805190602001208a83815181106117fd57fe5b6020026020010181815250505b80611816576000611819565b60015b60ff168201935060019092019161171f565b8960008151811061183857fe5b602002602001015198505050505050505050919050565b60006118596106d2565b9050600080611866610d76565b50509150915060006040518060a00160405280856001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156118b257600080fd5b505afa1580156118c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ea9190612203565b81526020018a81526020018981526020018464ffffffffff16815260200160405180602001604052806000815250815250905080600001517f127186556e7be68c7e31263195225b4de02820707889540969f62c05cf73525e826020015183604001518460600151856080015160405161196794939291906124e6565b60405180910390a2600061197a82611c75565b90506000611992836040015186018a86018a8a611c9e565b60405163080549db60e21b81529091506001600160a01b03871690632015276c906119c390859085906004016124d0565b600060405180830381600087803b1580156119dd57600080fd5b505af11580156119f1573d6000803e3d6000fd5b505050505050505050505050505050565b6080810151805160009190826041820167ffffffffffffffff81118015611a2857600080fd5b506040519080825280601f01601f191660200182016040528015611a53576020820181803683370190505b5060408601516060870151919250906000602084016001815383600182015282602182015285604182018760208a0160045afa50604190950190942095505050505050919050565b6000611aa56106d2565b8351604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a91611ad391600401612e7c565b60206040518083038186803b158015611aeb57600080fd5b505afa158015611aff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b239190612203565b611b2c84611c75565b14611b495760405162461bcd60e51b815260040161041190612b16565b611b66836020015185846000015185602001518760400151611cbd565b611b825760405162461bcd60e51b81526004016104119061294c565b5060019392505050565b6000611b9f8364ffffffffff1683610c36565b9050600154816020015164ffffffffff16014210611bcf5760405162461bcd60e51b815260040161041190612647565b806020015164ffffffffff1684604001511115611bfe5760405162461bcd60e51b8152600401610411906129cc565b806040015164ffffffffff16846060015111156112c95760405162461bcd60e51b815260040161041190612c74565b8051602080830151604080850151606086015160808701519251600096611c5896909594910161248f565b604051602081830303815290604052805190602001209050919050565b60008160200151826040015183606001518460800151604051602001611c5894939291906124e6565b602892831b9390931760509190911b1760789290921b91909117901b90565b6000808211611cfd5760405162461bcd60e51b8152600401808060200182810382526037815260200180612f816037913960400191505060405180910390fd5b818410611d3b5760405162461bcd60e51b8152600401808060200182810382526024815260200180612f2d6024913960400191505060405180910390fd5b611d4482611e42565b835114611d825760405162461bcd60e51b815260040180806020018281038252604d815260200180612fb8604d913960600191505060405180910390fd5b8460005b8451811015611e35578560011660011415611de457848181518110611da757fe5b6020026020010151826040516020018083815260200182815260200192505050604051602081830303815290604052805190602001209150611e29565b81858281518110611df157fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c9501611d86565b5090951495945050505050565b6000808211611e825760405162461bcd60e51b8152600401808060200182810382526030815260200180612f516030913960400191505060405180910390fd5b8160011415611e93575060006102ab565b81600060805b60018110611ec3576000196001821b01811b831615611ebb5791821c91908101905b60011c611e99565b506001811b8414611ed2576001015b9392505050565b604080516060810182526000808252602082018190529181019190915290565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b600067ffffffffffffffff831115611f3557fe5b611f48601f8401601f1916602001612ec1565b9050828152838383011115611f5c57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102ab57600080fd5b600082601f830112611f9a578081fd5b611ed283833560208501611f21565b8035600281106102ab57600080fd5b600060a08284031215611fc9578081fd5b60405160a0810167ffffffffffffffff8282108183111715611fe757fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561202457600080fd5b5061203185828601611f8a565b6080830152505092915050565b60006040828403121561204f578081fd5b6040516040810167ffffffffffffffff828210818311171561206d57fe5b816040528293508435835260209150818501358181111561208d57600080fd5b8501601f8101871361209e57600080fd5b8035828111156120aa57fe5b83810292506120ba848401612ec1565b8181528481019083860185850187018b10156120d557600080fd5b600095505b838610156120f85780358352600195909501949186019186016120da565b5080868801525050505050505092915050565b600060a0828403121561211c578081fd5b60405160a0810167ffffffffffffffff828210818311171561213a57fe5b8160405282935084359150811515821461215357600080fd5b818352602085013560208401526040850135604084015260608501356060840152608085013591508082111561202457600080fd5b60008060006060848603121561219c578283fd5b6121a584611f73565b925060208401359150604084013567ffffffffffffffff8111156121c7578182fd5b6121d386828701611f8a565b9150509250925092565b6000602082840312156121ee578081fd5b815164ffffffffff1981168114611ed2578182fd5b600060208284031215612214578081fd5b5051919050565b60006020828403121561222c578081fd5b813567ffffffffffffffff811115612242578182fd5b8201601f81018413612252578182fd5b6103d284823560208401611f21565b60008060008060808587031215612276578081fd5b843567ffffffffffffffff8082111561228d578283fd5b9086019060e082890312156122a0578283fd5b6122aa60e0612ec1565b82358152602083013560208201526122c460408401611fa9565b60408201526122d560608401611f73565b60608201526122e660808401611f73565b608082015260a083013560a082015260c083013582811115612306578485fd5b6123128a828601611f8a565b60c0830152509550602087013591508082111561232d578283fd5b6123398883890161210b565b9450604087013591508082111561234e578283fd5b61235a88838901611fb8565b9350606087013591508082111561236f578283fd5b5061237c8782880161203e565b91505092959194509250565b600060208284031215612399578081fd5b5035919050565b60008151808452815b818110156123c5576020818501810151868301820152016123a9565b818111156123d65782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612432908301846123a0565b9695505050505050565b6001600160a01b038781168252861660208201526040810185905260c06060820181905260009061246f908301866123a0565b60808301949094525060a00152949350505050565b901515815260200190565b6000861515825285602083015284604083015283606083015260a060808301526124bc60a08301846123a0565b979650505050505050565b90815260200190565b91825264ffffffffff1916602082015260400190565b60008582528460208301528360408301526080606083015261243260808301846123a0565b60208082526027908201527f617070656e64517565756542617463682069732063757272656e746c7920646960408201526639b0b13632b21760c91b606082015260800190565b60208082526029908201527f436f6e7465787420626c6f636b206e756d62657220746f6f2066617220696e206040820152683a3432903830b9ba1760b91b606082015260800190565b6020808252603d908201527f5472616e73616374696f6e20646174612073697a652065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b6020808252602f908201527f436f6e746578742074696d657374616d70206973206c6f776572207468616e2060408201526e3630b9ba1039bab136b4ba3a32b21760891b606082015260800190565b6020808252605b908201527f50726576696f75736c7920656e7175657565642062617463686573206861766560408201527f206578706972656420616e64206d75737420626520617070656e64656420626560608201527f666f72652061206e65772073657175656e6365722062617463682e0000000000608082015260a00190565b6020808252602e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e20696e60408201526d31b63ab9b4b7b710383937b7b31760911b606082015260800190565b60208082526032908201527f436f6e7465787420626c6f636b206e756d626572206973206c6f77657220746860408201527130b7103630b9ba1039bab136b4ba3a32b21760711b606082015260800190565b6020808252601e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e2e0000604082015260600190565b6020808252603d908201527f5472616e73616374696f6e20676173206c696d69742065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b60208082526028908201527f4d7573742070726f76696465206174206c65617374206f6e652062617463682060408201526731b7b73a32bc3a1760c11b606082015260800190565b6020808252602e908201527f4e6f7420616c6c2073657175656e636572207472616e73616374696f6e73207760408201526d32b93290383937b1b2b9b9b2b21760911b606082015260800190565b6020808252604a908201527f41637475616c207472616e73616374696f6e20696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420746f74616c20656c656d656e7473206060820152693a379030b83832b7321760b11b608082015260a00190565b60208082526028908201527f436f6e7465787420626c6f636b206e756d6265722069732066726f6d2074686560408201526710333aba3ab9329760c11b606082015260800190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b60208082526029908201527f5472616e73616374696f6e20676173206c696d697420746f6f206c6f7720746f6040820152681032b738bab2bab29760b91b606082015260800190565b60208082526043908201527f53657175656e636572207472616e73616374696f6e2074696d657374616d702060408201527f657863656564732074686174206f66206e65787420717565756520656c656d65606082015262373a1760e91b608082015260a00190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b6020808252602d908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c6564206279207460408201526c34329029b2b8bab2b731b2b91760991b606082015260800190565b6020808252601a908201527f496e76616c6964205175657565207472616e73616374696f6e2e000000000000604082015260600190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b60208082526025908201527f436f6e746578742074696d657374616d702069732066726f6d207468652066756040820152643a3ab9329760d91b606082015260800190565b6020808252602b908201527f496e73756666696369656e742067617320666f72204c322072617465206c696d60408201526a34ba34b73390313ab9371760a91b606082015260800190565b60208082526035908201527f436f6e746578742074696d657374616d702076616c756573206d757374206d6f6040820152743737ba37b734b1b0b6363c9034b731b932b0b9b29760591b606082015260800190565b6020808252602a908201527f496e76616c6964205175657565207472616e73616374696f6e20696e636c757360408201526934b7b710383937b7b31760b11b606082015260800190565b60208082526045908201527f53657175656e636572207472616e73616374696f6e20626c6f636b4e756d626560408201527f7220657863656564732074686174206f66206e65787420717565756520656c6560608201526436b2b73a1760d91b608082015260a00190565b60208082526021908201527f4d75737420617070656e64206174206c65617374206f6e6520656c656d656e746040820152601760f91b606082015260800190565b60208082526026908201527f436f6e746578742074696d657374616d7020746f6f2066617220696e20746865604082015265103830b9ba1760d11b606082015260800190565b60208082526022908201527f4e6f7420656e6f756768204261746368436f6e74657874732070726f76696465604082015261321760f11b606082015260800190565b60208082526029908201527f4e6f7420656e6f75676820717565756564207472616e73616374696f6e732074604082015268379030b83832b7321760b91b606082015260800190565b60208082526037908201527f436f6e7465787420626c6f636b4e756d6265722076616c756573206d7573742060408201527f6d6f6e6f746f6e6963616c6c7920696e6372656173652e000000000000000000606082015260800190565b8151815260208083015164ffffffffff90811691830191909152604092830151169181019190915260600190565b63ffffffff91909116815260200190565b64ffffffffff91909116815260200190565b64ffffffffff9384168152919092166020820152604081019190915260600190565b60405181810167ffffffffffffffff81118282101715612edd57fe5b60405291905056fe4f564d5f4465636f6d7072657373696f6e507265636f6d70696c65416464726573734f564d5f436861696e53746f72616765436f6e7461696e65722d4354432d626174636865734c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4f564d5f436861696e53746f72616765436f6e7461696e65722d4354432d71756575654c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea2646970667358221220ccd26d70e29e57df01efbc12fcd4152555b136a977c6cd56cd6a3e465f2e8fef64736f6c63430007060033", "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", @@ -771,15 +771,15 @@ "storageLayout": { "storage": [ { - "astId": 12856, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol:OVM_CanonicalTransactionChain", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12849" + "type": "t_contract(Lib_AddressManager)15296" }, { - "astId": 2987, + "astId": 4440, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol:OVM_CanonicalTransactionChain", "label": "forceInclusionPeriodSeconds", "offset": 0, @@ -787,7 +787,7 @@ "type": "t_uint256" }, { - "astId": 2989, + "astId": 4442, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol:OVM_CanonicalTransactionChain", "label": "forceInclusionPeriodBlocks", "offset": 0, @@ -795,7 +795,7 @@ "type": "t_uint256" }, { - "astId": 2991, + "astId": 4444, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol:OVM_CanonicalTransactionChain", "label": "maxTransactionGasLimit", "offset": 0, @@ -804,7 +804,7 @@ } ], "types": { - "t_contract(Lib_AddressManager)12849": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" diff --git a/packages/contracts/deployments/mainnet/OVM_ChainStorageContainer-CTC-batches.json b/packages/contracts/deployments/mainnet/OVM_ChainStorageContainer-CTC-batches.json index 5d6f0414194d..9701451365b2 100644 --- a/packages/contracts/deployments/mainnet/OVM_ChainStorageContainer-CTC-batches.json +++ b/packages/contracts/deployments/mainnet/OVM_ChainStorageContainer-CTC-batches.json @@ -1,5 +1,5 @@ { - "address": "0x28157e8a8E6d22A367c63Ad61dD56d9E6bDCE905", + "address": "0x3EA1a3839D8ca9a7ff3c567a9F36f4C4DbECc3eE", "abi": [ { "inputs": [ @@ -181,45 +181,32 @@ "outputs": [], "stateMutability": "nonpayable", "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "setNextOverwritableIndex", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" } ], - "transactionHash": "0xbe02f28d8c1f2bbdb313fa33aeccf01d34bf65bdd69e77615c2f0562ba0a857f", + "transactionHash": "0xe0d45f4a030041b3dba25f9bc08deae8d33aa926e982802f5b1d72fdde467f9f", "receipt": { "to": null, - "from": "0xd033f09cB85621F98F7A84C64dB381ac16Eff818", - "contractAddress": "0x28157e8a8E6d22A367c63Ad61dD56d9E6bDCE905", - "transactionIndex": 189, - "gasUsed": "971002", + "from": "0x9996571372066A1545D3435C6935e3F9593A7eF5", + "contractAddress": "0x3EA1a3839D8ca9a7ff3c567a9F36f4C4DbECc3eE", + "transactionIndex": 38, + "gasUsed": "742305", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x62b05e0c36dd4480a01d855db04dbdf3521a9edeb48955250e88751fc67b4a4b", - "transactionHash": "0xbe02f28d8c1f2bbdb313fa33aeccf01d34bf65bdd69e77615c2f0562ba0a857f", + "blockHash": "0xec616f78b211010e691e570afb70772d17015902f0e45eabda2fd98639a3e47c", + "transactionHash": "0xe0d45f4a030041b3dba25f9bc08deae8d33aa926e982802f5b1d72fdde467f9f", "logs": [], - "blockNumber": 12410762, - "cumulativeGasUsed": "11273913", + "blockNumber": 12686718, + "cumulativeGasUsed": "3675593", "status": 1, "byzantium": true }, "args": [ - "0x668E5b997b9aE88a56cd40409119d4Db9e6d752E", + "0xdE1FCfB0851916CA5101820A69b13a4E276bd81F", "OVM_CanonicalTransactionChain" ], - "solcInputHash": "f2bdab652d5102f5f11e78dae866798d", - "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\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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 distinct 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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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).\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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 distinct 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 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 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\":\"0x93325c961516aa2a22bf1aacf4029353d5e3b693e04b485753170337b50224e6\",\"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 * 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\":\"0x2d7973a0ad84c23ec62624d3f1e3aeb198cc72686ff1e6cfa17155556b320c94\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0xcc9fc5c64f1101a5c6c397594086b1608189a9edc5c9635e1ac38f70aeeeecbf\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 * 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 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 {\\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\":\"0xe30fc56d4499f98582e1f800dfa3b343f171163a557266c31a56449d5fd3ffae\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506040516200118d3803806200118d833981810160405260408110156200003757600080fd5b8151602083018051604051929492938301929190846401000000008211156200005f57600080fd5b9083019060208201858111156200007557600080fd5b82516401000000008111828201881017156200009057600080fd5b82525081516020918201929091019080838360005b83811015620000bf578181015183820152602001620000a5565b50505050905090810190601f168015620000ed5780820380516001836020036101000a031916815260200191505b506040525050600080546001600160a01b0319166001600160a01b038516179055508051620001249060019060208401906200012d565b505050620001d9565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282620001655760008555620001b0565b82601f106200018057805160ff1916838001178555620001b0565b82800160010185558215620001b0579182015b82811115620001b057825182559160200191906001019062000193565b50620001be929150620001c2565b5090565b5b80821115620001be5760008155600101620001c3565b610fa480620001e96000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80634651d91e116100715780634651d91e1461021a5780638da5cb5b146102375780639507d39a146102b4578063b298e36b146102d1578063ccf8f969146102ee578063fa9e936c14610311576100b4565b8063167fd681146100b95780631f7b6d32146100e65780632015276c1461010057806329061de21461012b578063299ca47814610150578063461a447814610174575b600080fd5b6100e4600480360360408110156100cf57600080fd5b508035906020013564ffffffffff191661032e565b005b6100ee610423565b60408051918252519081900360200190f35b6100e46004803603604081101561011657600080fd5b508035906020013564ffffffffff191661043b565b6100e46004803603602081101561014157600080fd5b503564ffffffffff19166104f7565b6101586105b5565b604080516001600160a01b039092168252519081900360200190f35b6101586004803603602081101561018a57600080fd5b8101906020810181356401000000008111156101a557600080fd5b8201836020820111156101b757600080fd5b803590602001918460018302840111640100000000831117156101d957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105c4945050505050565b6100e46004803603602081101561023057600080fd5b50356106a0565b61023f61075b565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610279578181015183820152602001610261565b50505050905090810190601f1680156102a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100ee600480360360208110156102ca57600080fd5b50356107e8565b6100e4600480360360208110156102e757600080fd5b5035610802565b6102f66108bd565b6040805164ffffffffff199092168252519081900360200190f35b6100e46004803603602081101561032757600080fd5b50356108ce565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526103c493909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b820191906000526020600020905b81548152906001019060200180831161039d57829003601f168201915b50505050506105c4565b6001600160a01b0316336001600160a01b0316146104135760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610983565b5050565b600061042f6002610a75565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261049c93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146104eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610a89565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261055893909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146105a75760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610b90565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561062457818101518382015260200161060c565b50505050905090810190601f1680156106515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561066e57600080fd5b505afa158015610682573d6000803e3d6000fd5b505050506040513d602081101561069857600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261070193909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146107505760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610bba565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107e05780601f106107b5576101008083540402835291602001916107e0565b820191906000526020600020905b8154815290600101906020018083116107c357829003601f168201915b505050505081565b60006107fc600264ffffffffff8416610be0565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261086393909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146108b25760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610de9565b60006108c96002610e0f565b905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261092f93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b03161461097e5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b600855565b600061098e84610e26565b9050806000015164ffffffffff168364ffffffffff161080156109c35750806060015164ffffffffff168364ffffffffff1610155b610a0b576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b806080015164ffffffffff168364ffffffffff161015610a4d576040810180516000190167ffffffffffffffff169052606081015164ffffffffff1660808201525b64ffffffffff8316815264ffffffffff1982166020820152610a6f8482610e86565b50505050565b600080610a8183610e26565b519392505050565b6000610a9484610e26565b90506000610ab9826040015167ffffffffffffffff1686610edc90919063ffffffff16565b8054909150610ac757601081555b8054608083015183510364ffffffffff1610610b3e578460060154826080015164ffffffffff161015610b365760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610b2f908690610edc565b9050610b3e565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610b888684610e86565b505050505050565b6000610b9b83610e26565b64ffffffffff19831660208201529050610bb58382610e86565b505050565b6000610bc583610e26565b9050610bb5828260200151856109839092919063ffffffff16565b600080610bec84610e26565b805190915064ffffffffff168310610c42576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c65826040015167ffffffffffffffff1686610edc90919063ffffffff16565b90506000610c8d836040015160010167ffffffffffffffff1687610edc90919063ffffffff16565b9050826080015164ffffffffff168510610d1a576080830151825464ffffffffff9091168603908110610cfe576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506107fc9050565b6080830151606084015164ffffffffff9182168781039290911610610d7d576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610dca576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b81540360009081526001909101602052604090205492506107fc915050565b6000610df483610e26565b9050610bb582826020015185610a899092919063ffffffff16565b600080610e1b83610e26565b602001519392505050565b610e2e610efc565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b80516020820151604080840151606085015160808601518754858717969483901b8417606883901b1795939291908714610ebe578689555b85896001015414610ed157600189018690555b505050505050505050565b60006002820615610ef05782600401610ef5565b826002015b9392505050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122014fd994dbf02ce54f07982ffcab79a1d699dc0313a3c136f6482cba97b52de4264736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80634651d91e116100715780634651d91e1461021a5780638da5cb5b146102375780639507d39a146102b4578063b298e36b146102d1578063ccf8f969146102ee578063fa9e936c14610311576100b4565b8063167fd681146100b95780631f7b6d32146100e65780632015276c1461010057806329061de21461012b578063299ca47814610150578063461a447814610174575b600080fd5b6100e4600480360360408110156100cf57600080fd5b508035906020013564ffffffffff191661032e565b005b6100ee610423565b60408051918252519081900360200190f35b6100e46004803603604081101561011657600080fd5b508035906020013564ffffffffff191661043b565b6100e46004803603602081101561014157600080fd5b503564ffffffffff19166104f7565b6101586105b5565b604080516001600160a01b039092168252519081900360200190f35b6101586004803603602081101561018a57600080fd5b8101906020810181356401000000008111156101a557600080fd5b8201836020820111156101b757600080fd5b803590602001918460018302840111640100000000831117156101d957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105c4945050505050565b6100e46004803603602081101561023057600080fd5b50356106a0565b61023f61075b565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610279578181015183820152602001610261565b50505050905090810190601f1680156102a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100ee600480360360208110156102ca57600080fd5b50356107e8565b6100e4600480360360208110156102e757600080fd5b5035610802565b6102f66108bd565b6040805164ffffffffff199092168252519081900360200190f35b6100e46004803603602081101561032757600080fd5b50356108ce565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526103c493909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b820191906000526020600020905b81548152906001019060200180831161039d57829003601f168201915b50505050506105c4565b6001600160a01b0316336001600160a01b0316146104135760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610983565b5050565b600061042f6002610a75565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261049c93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146104eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610a89565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261055893909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146105a75760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610b90565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561062457818101518382015260200161060c565b50505050905090810190601f1680156106515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561066e57600080fd5b505afa158015610682573d6000803e3d6000fd5b505050506040513d602081101561069857600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261070193909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146107505760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610bba565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107e05780601f106107b5576101008083540402835291602001916107e0565b820191906000526020600020905b8154815290600101906020018083116107c357829003601f168201915b505050505081565b60006107fc600264ffffffffff8416610be0565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261086393909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146108b25760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610de9565b60006108c96002610e0f565b905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261092f93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b03161461097e5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b600855565b600061098e84610e26565b9050806000015164ffffffffff168364ffffffffff161080156109c35750806060015164ffffffffff168364ffffffffff1610155b610a0b576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b806080015164ffffffffff168364ffffffffff161015610a4d576040810180516000190167ffffffffffffffff169052606081015164ffffffffff1660808201525b64ffffffffff8316815264ffffffffff1982166020820152610a6f8482610e86565b50505050565b600080610a8183610e26565b519392505050565b6000610a9484610e26565b90506000610ab9826040015167ffffffffffffffff1686610edc90919063ffffffff16565b8054909150610ac757601081555b8054608083015183510364ffffffffff1610610b3e578460060154826080015164ffffffffff161015610b365760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610b2f908690610edc565b9050610b3e565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610b888684610e86565b505050505050565b6000610b9b83610e26565b64ffffffffff19831660208201529050610bb58382610e86565b505050565b6000610bc583610e26565b9050610bb5828260200151856109839092919063ffffffff16565b600080610bec84610e26565b805190915064ffffffffff168310610c42576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c65826040015167ffffffffffffffff1686610edc90919063ffffffff16565b90506000610c8d836040015160010167ffffffffffffffff1687610edc90919063ffffffff16565b9050826080015164ffffffffff168510610d1a576080830151825464ffffffffff9091168603908110610cfe576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506107fc9050565b6080830151606084015164ffffffffff9182168781039290911610610d7d576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610dca576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b81540360009081526001909101602052604090205492506107fc915050565b6000610df483610e26565b9050610bb582826020015185610a899092919063ffffffff16565b600080610e1b83610e26565b602001519392505050565b610e2e610efc565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b80516020820151604080840151606085015160808601518754858717969483901b8417606883901b1795939291908714610ebe578689555b85896001015414610ed157600189018690555b505050505050505050565b60006002820615610ef05782600401610ef5565b826002015b9392505050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122014fd994dbf02ce54f07982ffcab79a1d699dc0313a3c136f6482cba97b52de4264736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"setGlobalMetadata\",\"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 distinct 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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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).\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"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.\"}},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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_Buffer } from \\\"../../libraries/utils/Lib_Buffer.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 distinct 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_Buffer for Lib_Buffer.Buffer;\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n string public owner;\\n Lib_Buffer.Buffer 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 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 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\",\"keccak256\":\"0xace1f7a38106e7e95084ca6b39ea9e706cd561fb37c595afa362bb2a39a676ff\",\"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 * 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\",\"keccak256\":\"0x180b9c347e20f1a6efa553b0f2b9a59aebceda92a7484ae6fca4da2bf1d960c3\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Buffer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Buffer\\n * @dev This library implements a bytes32 storage array with some additional gas-optimized\\n * functionality. In particular, it encodes its length as a uint40, and tightly packs this with an\\n * overwritable \\\"extra data\\\" field so we can store more information with a single SSTORE.\\n */\\nlibrary Lib_Buffer {\\n\\n /*************\\n * Libraries *\\n *************/\\n\\n using Lib_Buffer for Buffer;\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Buffer {\\n bytes32 context;\\n mapping (uint256 => bytes32) buf;\\n }\\n\\n struct BufferContext {\\n // Stores the length of the array. Uint40 is way more elements than we'll ever reasonably\\n // need in an array and we get an extra 27 bytes of extra data to play with.\\n uint40 length;\\n\\n // Arbitrary extra data that can be modified whenever the length is updated. Useful for\\n // squeezing out some gas optimizations.\\n bytes27 extraData;\\n }\\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 Global extra data.\\n */\\n function push(\\n Buffer storage _self,\\n bytes32 _value,\\n bytes27 _extraData\\n )\\n internal\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n _self.buf[ctx.length] = _value;\\n\\n // Bump the global index and insert our extra data, then save the context.\\n ctx.length++;\\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 Buffer storage _self,\\n bytes32 _value\\n )\\n internal\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n _self.push(\\n _value,\\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 Buffer storage _self,\\n uint256 _index\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n return _self.buf[_index];\\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 Buffer storage _self,\\n uint40 _index,\\n bytes27 _extraData\\n )\\n internal\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n // Set our length and extra data, save the context.\\n ctx.length = _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 Buffer storage _self,\\n uint40 _index\\n )\\n internal\\n {\\n BufferContext 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 Buffer storage _self\\n )\\n internal\\n view\\n returns (\\n uint40\\n )\\n {\\n BufferContext memory ctx = _self.getContext();\\n return ctx.length;\\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 Buffer storage _self,\\n bytes27 _extraData\\n )\\n internal\\n {\\n BufferContext 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 Buffer storage _self\\n )\\n internal\\n view\\n returns (\\n bytes27\\n )\\n {\\n BufferContext memory ctx = _self.getContext();\\n return ctx.extraData;\\n }\\n\\n /**\\n * Sets the current buffer context.\\n * @param _self Buffer to access.\\n * @param _ctx Current buffer context.\\n */\\n function setContext(\\n Buffer storage _self,\\n BufferContext memory _ctx\\n )\\n internal\\n {\\n bytes32 context;\\n uint40 length = _ctx.length;\\n bytes27 extraData = _ctx.extraData;\\n assembly {\\n context := length\\n context := or(context, extraData)\\n }\\n\\n if (_self.context != context) {\\n _self.context = context;\\n }\\n }\\n\\n /**\\n * Retrieves the current buffer context.\\n * @param _self Buffer to access.\\n * @return Current buffer context.\\n */\\n function getContext(\\n Buffer storage _self\\n )\\n internal\\n view\\n returns (\\n BufferContext memory\\n )\\n {\\n bytes32 context = _self.context;\\n uint40 length;\\n bytes27 extraData;\\n assembly {\\n length := and(context, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\\n extraData := and(context, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000)\\n }\\n\\n return BufferContext({\\n length: length,\\n extraData: extraData\\n });\\n }\\n}\\n\",\"keccak256\":\"0xbce4f4db3d80b2cb252177752eee1ca38482731d1e2e5d165c7fce2e04c487fb\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405162000d5538038062000d558339818101604052604081101561003557600080fd5b81516020830180516040519294929383019291908464010000000082111561005c57600080fd5b90830190602082018581111561007157600080fd5b825164010000000081118282018810171561008b57600080fd5b82525081516020918201929091019080838360005b838110156100b85781810151838201526020016100a0565b50505050905090810190601f1680156100e55780820380516001836020036101000a031916815260200191505b506040525050600080546001600160a01b0319166001600160a01b03851617905550805161011a906001906020840190610122565b5050506101c3565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282610158576000855561019e565b82601f1061017157805160ff191683800117855561019e565b8280016001018555821561019e579182015b8281111561019e578251825591602001919060010190610183565b506101aa9291506101ae565b5090565b5b808211156101aa57600081556001016101af565b610b8280620001d36000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c8063461a447811610071578063461a4478146101695780634651d91e1461020f5780638da5cb5b1461022c5780639507d39a146102a9578063b298e36b146102c6578063ccf8f969146102e3576100a9565b8063167fd681146100ae5780631f7b6d32146100db5780632015276c146100f557806329061de214610120578063299ca47814610145575b600080fd5b6100d9600480360360408110156100c457600080fd5b508035906020013564ffffffffff1916610306565b005b6100e36103fb565b60408051918252519081900360200190f35b6100d96004803603604081101561010b57600080fd5b508035906020013564ffffffffff1916610413565b6100d96004803603602081101561013657600080fd5b503564ffffffffff19166104cf565b61014d61058d565b604080516001600160a01b039092168252519081900360200190f35b61014d6004803603602081101561017f57600080fd5b81019060208101813564010000000081111561019a57600080fd5b8201836020820111156101ac57600080fd5b803590602001918460018302840111640100000000831117156101ce57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061059c945050505050565b6100d96004803603602081101561022557600080fd5b5035610678565b610234610733565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561026e578181015183820152602001610256565b50505050905090810190601f16801561029b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100e3600480360360208110156102bf57600080fd5b50356107c0565b6100d9600480360360208110156102dc57600080fd5b50356107da565b6102eb610895565b6040805164ffffffffff199092168252519081900360200190f35b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261039c93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b820191906000526020600020905b81548152906001019060200180831161037557829003601f168201915b505050505061059c565b6001600160a01b0316336001600160a01b0316146103eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f7600283836108a6565b5050565b60006104076002610938565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261047493909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146104c35760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f76002838361094c565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261053093909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461057f5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a60028261099a565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156105fc5781810151838201526020016105e4565b50505050905090810190601f1680156106295780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561064657600080fd5b505afa15801561065a573d6000803e3d6000fd5b505050506040513d602081101561067057600080fd5b505192915050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526106d993909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146107285760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a6002826109c4565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107b85780601f1061078d576101008083540402835291602001916107b8565b820191906000526020600020905b81548152906001019060200180831161079b57829003601f168201915b505050505081565b60006107d4600264ffffffffff84166109ea565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261083b93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461088a5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a600282610a64565b60006108a16002610a8a565b905090565b60006108b184610aa1565b9050806000015164ffffffffff168364ffffffffff1610610910576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b64ffffffffff8316815264ffffffffff19821660208201526109328482610ad1565b50505050565b60008061094483610aa1565b519392505050565b600061095784610aa1565b805164ffffffffff9081166000908152600180880160209081526040909220879055835101909116825264ffffffffff1984169082015290506109328482610ad1565b60006109a583610aa1565b64ffffffffff198316602082015290506109bf8382610ad1565b505050565b60006109cf83610aa1565b90506109bf828260200151856108a69092919063ffffffff16565b6000806109f684610aa1565b805190915064ffffffffff168310610a4c576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b50506000908152600191909101602052604090205490565b6000610a6f83610aa1565b90506109bf8282602001518561094c9092919063ffffffff16565b600080610a9683610aa1565b602001519392505050565b610aa9610af1565b50546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b8051602082015183548183179291908314610aea578285555b5050505050565b60408051808201909152600080825260208201529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122038869143d4598418a0ef5faf124214a16dc032f21ac35b7170b13b796c6eb00464736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c8063461a447811610071578063461a4478146101695780634651d91e1461020f5780638da5cb5b1461022c5780639507d39a146102a9578063b298e36b146102c6578063ccf8f969146102e3576100a9565b8063167fd681146100ae5780631f7b6d32146100db5780632015276c146100f557806329061de214610120578063299ca47814610145575b600080fd5b6100d9600480360360408110156100c457600080fd5b508035906020013564ffffffffff1916610306565b005b6100e36103fb565b60408051918252519081900360200190f35b6100d96004803603604081101561010b57600080fd5b508035906020013564ffffffffff1916610413565b6100d96004803603602081101561013657600080fd5b503564ffffffffff19166104cf565b61014d61058d565b604080516001600160a01b039092168252519081900360200190f35b61014d6004803603602081101561017f57600080fd5b81019060208101813564010000000081111561019a57600080fd5b8201836020820111156101ac57600080fd5b803590602001918460018302840111640100000000831117156101ce57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061059c945050505050565b6100d96004803603602081101561022557600080fd5b5035610678565b610234610733565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561026e578181015183820152602001610256565b50505050905090810190601f16801561029b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100e3600480360360208110156102bf57600080fd5b50356107c0565b6100d9600480360360208110156102dc57600080fd5b50356107da565b6102eb610895565b6040805164ffffffffff199092168252519081900360200190f35b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261039c93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b820191906000526020600020905b81548152906001019060200180831161037557829003601f168201915b505050505061059c565b6001600160a01b0316336001600160a01b0316146103eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f7600283836108a6565b5050565b60006104076002610938565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261047493909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146104c35760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f76002838361094c565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261053093909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461057f5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a60028261099a565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156105fc5781810151838201526020016105e4565b50505050905090810190601f1680156106295780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561064657600080fd5b505afa15801561065a573d6000803e3d6000fd5b505050506040513d602081101561067057600080fd5b505192915050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526106d993909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146107285760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a6002826109c4565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107b85780601f1061078d576101008083540402835291602001916107b8565b820191906000526020600020905b81548152906001019060200180831161079b57829003601f168201915b505050505081565b60006107d4600264ffffffffff84166109ea565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261083b93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461088a5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a600282610a64565b60006108a16002610a8a565b905090565b60006108b184610aa1565b9050806000015164ffffffffff168364ffffffffff1610610910576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b64ffffffffff8316815264ffffffffff19821660208201526109328482610ad1565b50505050565b60008061094483610aa1565b519392505050565b600061095784610aa1565b805164ffffffffff9081166000908152600180880160209081526040909220879055835101909116825264ffffffffff1984169082015290506109328482610ad1565b60006109a583610aa1565b64ffffffffff198316602082015290506109bf8382610ad1565b505050565b60006109cf83610aa1565b90506109bf828260200151856108a69092919063ffffffff16565b6000806109f684610aa1565b805190915064ffffffffff168310610a4c576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b50506000908152600191909101602052604090205490565b6000610a6f83610aa1565b90506109bf8282602001518561094c9092919063ffffffff16565b600080610a9683610aa1565b602001519392505050565b610aa9610af1565b50546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b8051602082015183548183179291908314610aea578285555b5050505050565b60408051808201909152600080825260208201529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122038869143d4598418a0ef5faf124214a16dc032f21ac35b7170b13b796c6eb00464736f6c63430007060033", "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 distinct 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", @@ -316,9 +303,6 @@ }, "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 @@ -326,15 +310,15 @@ "storageLayout": { "storage": [ { - "astId": 12856, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12849" + "type": "t_contract(Lib_AddressManager)15296" }, { - "astId": 4510, + "astId": 5963, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "owner", "offset": 0, @@ -342,12 +326,12 @@ "type": "t_string_storage" }, { - "astId": 4512, + "astId": 5965, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "buffer", "offset": 0, "slot": "2", - "type": "t_struct(RingBuffer)18001_storage" + "type": "t_struct(Buffer)18996_storage" } ], "types": { @@ -356,7 +340,7 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(Lib_AddressManager)12849": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" @@ -373,20 +357,20 @@ "label": "string", "numberOfBytes": "32" }, - "t_struct(Buffer)17990_storage": { + "t_struct(Buffer)18996_storage": { "encoding": "inplace", - "label": "struct Lib_RingBuffer.Buffer", + "label": "struct Lib_Buffer.Buffer", "members": [ { - "astId": 17985, + "astId": 18991, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "length", + "label": "context", "offset": 0, "slot": "0", - "type": "t_uint256" + "type": "t_bytes32" }, { - "astId": 17989, + "astId": 18995, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "buf", "offset": 0, @@ -396,53 +380,6 @@ ], "numberOfBytes": "64" }, - "t_struct(RingBuffer)18001_storage": { - "encoding": "inplace", - "label": "struct Lib_RingBuffer.RingBuffer", - "members": [ - { - "astId": 17992, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "contextA", - "offset": 0, - "slot": "0", - "type": "t_bytes32" - }, - { - "astId": 17994, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "contextB", - "offset": 0, - "slot": "1", - "type": "t_bytes32" - }, - { - "astId": 17996, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "bufferA", - "offset": 0, - "slot": "2", - "type": "t_struct(Buffer)17990_storage" - }, - { - "astId": 17998, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "bufferB", - "offset": 0, - "slot": "4", - "type": "t_struct(Buffer)17990_storage" - }, - { - "astId": 18000, - "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", diff --git a/packages/contracts/deployments/mainnet/OVM_ChainStorageContainer-CTC-queue.json b/packages/contracts/deployments/mainnet/OVM_ChainStorageContainer-CTC-queue.json index 36e619bfd4d0..bfc5731c837f 100644 --- a/packages/contracts/deployments/mainnet/OVM_ChainStorageContainer-CTC-queue.json +++ b/packages/contracts/deployments/mainnet/OVM_ChainStorageContainer-CTC-queue.json @@ -1,5 +1,5 @@ { - "address": "0xD68670eD8800c856613FD3e4C55539A2Ff53cCb3", + "address": "0xA0b912b3Ea71A04065Ff82d3936D518ED6E38039", "abi": [ { "inputs": [ @@ -181,45 +181,32 @@ "outputs": [], "stateMutability": "nonpayable", "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "setNextOverwritableIndex", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" } ], - "transactionHash": "0xf1dd8ad4c30d6b02c0a0a91895066f27e09d74d731e67f5f45c51a544805c479", + "transactionHash": "0x303b4b6fa874b4fb22505d30e63ae87cec14f16aa0ecc7e5ae96e17fa7181cae", "receipt": { "to": null, - "from": "0xd033f09cB85621F98F7A84C64dB381ac16Eff818", - "contractAddress": "0xD68670eD8800c856613FD3e4C55539A2Ff53cCb3", - "transactionIndex": 53, - "gasUsed": "971002", + "from": "0x9996571372066A1545D3435C6935e3F9593A7eF5", + "contractAddress": "0xA0b912b3Ea71A04065Ff82d3936D518ED6E38039", + "transactionIndex": 34, + "gasUsed": "742305", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x7b19add9aa95a53b76a43bc2f3711d1f6a0264b78325a19132700e12f866158c", - "transactionHash": "0xf1dd8ad4c30d6b02c0a0a91895066f27e09d74d731e67f5f45c51a544805c479", + "blockHash": "0xb7c0d0c81f3c12ac1a787074e42f191b99f360d8785207a53fd89088febc9def", + "transactionHash": "0x303b4b6fa874b4fb22505d30e63ae87cec14f16aa0ecc7e5ae96e17fa7181cae", "logs": [], - "blockNumber": 12410800, - "cumulativeGasUsed": "4007149", + "blockNumber": 12686722, + "cumulativeGasUsed": "3144313", "status": 1, "byzantium": true }, "args": [ - "0x668E5b997b9aE88a56cd40409119d4Db9e6d752E", + "0xdE1FCfB0851916CA5101820A69b13a4E276bd81F", "OVM_CanonicalTransactionChain" ], - "solcInputHash": "f2bdab652d5102f5f11e78dae866798d", - "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\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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 distinct 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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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).\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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 distinct 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 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 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\":\"0x93325c961516aa2a22bf1aacf4029353d5e3b693e04b485753170337b50224e6\",\"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 * 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\":\"0x2d7973a0ad84c23ec62624d3f1e3aeb198cc72686ff1e6cfa17155556b320c94\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0xcc9fc5c64f1101a5c6c397594086b1608189a9edc5c9635e1ac38f70aeeeecbf\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 * 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 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 {\\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\":\"0xe30fc56d4499f98582e1f800dfa3b343f171163a557266c31a56449d5fd3ffae\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506040516200118d3803806200118d833981810160405260408110156200003757600080fd5b8151602083018051604051929492938301929190846401000000008211156200005f57600080fd5b9083019060208201858111156200007557600080fd5b82516401000000008111828201881017156200009057600080fd5b82525081516020918201929091019080838360005b83811015620000bf578181015183820152602001620000a5565b50505050905090810190601f168015620000ed5780820380516001836020036101000a031916815260200191505b506040525050600080546001600160a01b0319166001600160a01b038516179055508051620001249060019060208401906200012d565b505050620001d9565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282620001655760008555620001b0565b82601f106200018057805160ff1916838001178555620001b0565b82800160010185558215620001b0579182015b82811115620001b057825182559160200191906001019062000193565b50620001be929150620001c2565b5090565b5b80821115620001be5760008155600101620001c3565b610fa480620001e96000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80634651d91e116100715780634651d91e1461021a5780638da5cb5b146102375780639507d39a146102b4578063b298e36b146102d1578063ccf8f969146102ee578063fa9e936c14610311576100b4565b8063167fd681146100b95780631f7b6d32146100e65780632015276c1461010057806329061de21461012b578063299ca47814610150578063461a447814610174575b600080fd5b6100e4600480360360408110156100cf57600080fd5b508035906020013564ffffffffff191661032e565b005b6100ee610423565b60408051918252519081900360200190f35b6100e46004803603604081101561011657600080fd5b508035906020013564ffffffffff191661043b565b6100e46004803603602081101561014157600080fd5b503564ffffffffff19166104f7565b6101586105b5565b604080516001600160a01b039092168252519081900360200190f35b6101586004803603602081101561018a57600080fd5b8101906020810181356401000000008111156101a557600080fd5b8201836020820111156101b757600080fd5b803590602001918460018302840111640100000000831117156101d957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105c4945050505050565b6100e46004803603602081101561023057600080fd5b50356106a0565b61023f61075b565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610279578181015183820152602001610261565b50505050905090810190601f1680156102a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100ee600480360360208110156102ca57600080fd5b50356107e8565b6100e4600480360360208110156102e757600080fd5b5035610802565b6102f66108bd565b6040805164ffffffffff199092168252519081900360200190f35b6100e46004803603602081101561032757600080fd5b50356108ce565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526103c493909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b820191906000526020600020905b81548152906001019060200180831161039d57829003601f168201915b50505050506105c4565b6001600160a01b0316336001600160a01b0316146104135760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610983565b5050565b600061042f6002610a75565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261049c93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146104eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610a89565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261055893909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146105a75760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610b90565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561062457818101518382015260200161060c565b50505050905090810190601f1680156106515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561066e57600080fd5b505afa158015610682573d6000803e3d6000fd5b505050506040513d602081101561069857600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261070193909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146107505760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610bba565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107e05780601f106107b5576101008083540402835291602001916107e0565b820191906000526020600020905b8154815290600101906020018083116107c357829003601f168201915b505050505081565b60006107fc600264ffffffffff8416610be0565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261086393909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146108b25760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610de9565b60006108c96002610e0f565b905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261092f93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b03161461097e5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b600855565b600061098e84610e26565b9050806000015164ffffffffff168364ffffffffff161080156109c35750806060015164ffffffffff168364ffffffffff1610155b610a0b576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b806080015164ffffffffff168364ffffffffff161015610a4d576040810180516000190167ffffffffffffffff169052606081015164ffffffffff1660808201525b64ffffffffff8316815264ffffffffff1982166020820152610a6f8482610e86565b50505050565b600080610a8183610e26565b519392505050565b6000610a9484610e26565b90506000610ab9826040015167ffffffffffffffff1686610edc90919063ffffffff16565b8054909150610ac757601081555b8054608083015183510364ffffffffff1610610b3e578460060154826080015164ffffffffff161015610b365760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610b2f908690610edc565b9050610b3e565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610b888684610e86565b505050505050565b6000610b9b83610e26565b64ffffffffff19831660208201529050610bb58382610e86565b505050565b6000610bc583610e26565b9050610bb5828260200151856109839092919063ffffffff16565b600080610bec84610e26565b805190915064ffffffffff168310610c42576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c65826040015167ffffffffffffffff1686610edc90919063ffffffff16565b90506000610c8d836040015160010167ffffffffffffffff1687610edc90919063ffffffff16565b9050826080015164ffffffffff168510610d1a576080830151825464ffffffffff9091168603908110610cfe576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506107fc9050565b6080830151606084015164ffffffffff9182168781039290911610610d7d576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610dca576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b81540360009081526001909101602052604090205492506107fc915050565b6000610df483610e26565b9050610bb582826020015185610a899092919063ffffffff16565b600080610e1b83610e26565b602001519392505050565b610e2e610efc565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b80516020820151604080840151606085015160808601518754858717969483901b8417606883901b1795939291908714610ebe578689555b85896001015414610ed157600189018690555b505050505050505050565b60006002820615610ef05782600401610ef5565b826002015b9392505050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122014fd994dbf02ce54f07982ffcab79a1d699dc0313a3c136f6482cba97b52de4264736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80634651d91e116100715780634651d91e1461021a5780638da5cb5b146102375780639507d39a146102b4578063b298e36b146102d1578063ccf8f969146102ee578063fa9e936c14610311576100b4565b8063167fd681146100b95780631f7b6d32146100e65780632015276c1461010057806329061de21461012b578063299ca47814610150578063461a447814610174575b600080fd5b6100e4600480360360408110156100cf57600080fd5b508035906020013564ffffffffff191661032e565b005b6100ee610423565b60408051918252519081900360200190f35b6100e46004803603604081101561011657600080fd5b508035906020013564ffffffffff191661043b565b6100e46004803603602081101561014157600080fd5b503564ffffffffff19166104f7565b6101586105b5565b604080516001600160a01b039092168252519081900360200190f35b6101586004803603602081101561018a57600080fd5b8101906020810181356401000000008111156101a557600080fd5b8201836020820111156101b757600080fd5b803590602001918460018302840111640100000000831117156101d957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105c4945050505050565b6100e46004803603602081101561023057600080fd5b50356106a0565b61023f61075b565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610279578181015183820152602001610261565b50505050905090810190601f1680156102a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100ee600480360360208110156102ca57600080fd5b50356107e8565b6100e4600480360360208110156102e757600080fd5b5035610802565b6102f66108bd565b6040805164ffffffffff199092168252519081900360200190f35b6100e46004803603602081101561032757600080fd5b50356108ce565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526103c493909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b820191906000526020600020905b81548152906001019060200180831161039d57829003601f168201915b50505050506105c4565b6001600160a01b0316336001600160a01b0316146104135760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610983565b5050565b600061042f6002610a75565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261049c93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146104eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610a89565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261055893909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146105a75760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610b90565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561062457818101518382015260200161060c565b50505050905090810190601f1680156106515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561066e57600080fd5b505afa158015610682573d6000803e3d6000fd5b505050506040513d602081101561069857600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261070193909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146107505760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610bba565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107e05780601f106107b5576101008083540402835291602001916107e0565b820191906000526020600020905b8154815290600101906020018083116107c357829003601f168201915b505050505081565b60006107fc600264ffffffffff8416610be0565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261086393909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146108b25760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610de9565b60006108c96002610e0f565b905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261092f93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b03161461097e5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b600855565b600061098e84610e26565b9050806000015164ffffffffff168364ffffffffff161080156109c35750806060015164ffffffffff168364ffffffffff1610155b610a0b576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b806080015164ffffffffff168364ffffffffff161015610a4d576040810180516000190167ffffffffffffffff169052606081015164ffffffffff1660808201525b64ffffffffff8316815264ffffffffff1982166020820152610a6f8482610e86565b50505050565b600080610a8183610e26565b519392505050565b6000610a9484610e26565b90506000610ab9826040015167ffffffffffffffff1686610edc90919063ffffffff16565b8054909150610ac757601081555b8054608083015183510364ffffffffff1610610b3e578460060154826080015164ffffffffff161015610b365760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610b2f908690610edc565b9050610b3e565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610b888684610e86565b505050505050565b6000610b9b83610e26565b64ffffffffff19831660208201529050610bb58382610e86565b505050565b6000610bc583610e26565b9050610bb5828260200151856109839092919063ffffffff16565b600080610bec84610e26565b805190915064ffffffffff168310610c42576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c65826040015167ffffffffffffffff1686610edc90919063ffffffff16565b90506000610c8d836040015160010167ffffffffffffffff1687610edc90919063ffffffff16565b9050826080015164ffffffffff168510610d1a576080830151825464ffffffffff9091168603908110610cfe576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506107fc9050565b6080830151606084015164ffffffffff9182168781039290911610610d7d576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610dca576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b81540360009081526001909101602052604090205492506107fc915050565b6000610df483610e26565b9050610bb582826020015185610a899092919063ffffffff16565b600080610e1b83610e26565b602001519392505050565b610e2e610efc565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b80516020820151604080840151606085015160808601518754858717969483901b8417606883901b1795939291908714610ebe578689555b85896001015414610ed157600189018690555b505050505050505050565b60006002820615610ef05782600401610ef5565b826002015b9392505050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122014fd994dbf02ce54f07982ffcab79a1d699dc0313a3c136f6482cba97b52de4264736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"setGlobalMetadata\",\"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 distinct 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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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).\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"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.\"}},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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_Buffer } from \\\"../../libraries/utils/Lib_Buffer.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 distinct 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_Buffer for Lib_Buffer.Buffer;\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n string public owner;\\n Lib_Buffer.Buffer 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 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 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\",\"keccak256\":\"0xace1f7a38106e7e95084ca6b39ea9e706cd561fb37c595afa362bb2a39a676ff\",\"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 * 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\",\"keccak256\":\"0x180b9c347e20f1a6efa553b0f2b9a59aebceda92a7484ae6fca4da2bf1d960c3\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Buffer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Buffer\\n * @dev This library implements a bytes32 storage array with some additional gas-optimized\\n * functionality. In particular, it encodes its length as a uint40, and tightly packs this with an\\n * overwritable \\\"extra data\\\" field so we can store more information with a single SSTORE.\\n */\\nlibrary Lib_Buffer {\\n\\n /*************\\n * Libraries *\\n *************/\\n\\n using Lib_Buffer for Buffer;\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Buffer {\\n bytes32 context;\\n mapping (uint256 => bytes32) buf;\\n }\\n\\n struct BufferContext {\\n // Stores the length of the array. Uint40 is way more elements than we'll ever reasonably\\n // need in an array and we get an extra 27 bytes of extra data to play with.\\n uint40 length;\\n\\n // Arbitrary extra data that can be modified whenever the length is updated. Useful for\\n // squeezing out some gas optimizations.\\n bytes27 extraData;\\n }\\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 Global extra data.\\n */\\n function push(\\n Buffer storage _self,\\n bytes32 _value,\\n bytes27 _extraData\\n )\\n internal\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n _self.buf[ctx.length] = _value;\\n\\n // Bump the global index and insert our extra data, then save the context.\\n ctx.length++;\\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 Buffer storage _self,\\n bytes32 _value\\n )\\n internal\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n _self.push(\\n _value,\\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 Buffer storage _self,\\n uint256 _index\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n return _self.buf[_index];\\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 Buffer storage _self,\\n uint40 _index,\\n bytes27 _extraData\\n )\\n internal\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n // Set our length and extra data, save the context.\\n ctx.length = _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 Buffer storage _self,\\n uint40 _index\\n )\\n internal\\n {\\n BufferContext 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 Buffer storage _self\\n )\\n internal\\n view\\n returns (\\n uint40\\n )\\n {\\n BufferContext memory ctx = _self.getContext();\\n return ctx.length;\\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 Buffer storage _self,\\n bytes27 _extraData\\n )\\n internal\\n {\\n BufferContext 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 Buffer storage _self\\n )\\n internal\\n view\\n returns (\\n bytes27\\n )\\n {\\n BufferContext memory ctx = _self.getContext();\\n return ctx.extraData;\\n }\\n\\n /**\\n * Sets the current buffer context.\\n * @param _self Buffer to access.\\n * @param _ctx Current buffer context.\\n */\\n function setContext(\\n Buffer storage _self,\\n BufferContext memory _ctx\\n )\\n internal\\n {\\n bytes32 context;\\n uint40 length = _ctx.length;\\n bytes27 extraData = _ctx.extraData;\\n assembly {\\n context := length\\n context := or(context, extraData)\\n }\\n\\n if (_self.context != context) {\\n _self.context = context;\\n }\\n }\\n\\n /**\\n * Retrieves the current buffer context.\\n * @param _self Buffer to access.\\n * @return Current buffer context.\\n */\\n function getContext(\\n Buffer storage _self\\n )\\n internal\\n view\\n returns (\\n BufferContext memory\\n )\\n {\\n bytes32 context = _self.context;\\n uint40 length;\\n bytes27 extraData;\\n assembly {\\n length := and(context, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\\n extraData := and(context, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000)\\n }\\n\\n return BufferContext({\\n length: length,\\n extraData: extraData\\n });\\n }\\n}\\n\",\"keccak256\":\"0xbce4f4db3d80b2cb252177752eee1ca38482731d1e2e5d165c7fce2e04c487fb\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405162000d5538038062000d558339818101604052604081101561003557600080fd5b81516020830180516040519294929383019291908464010000000082111561005c57600080fd5b90830190602082018581111561007157600080fd5b825164010000000081118282018810171561008b57600080fd5b82525081516020918201929091019080838360005b838110156100b85781810151838201526020016100a0565b50505050905090810190601f1680156100e55780820380516001836020036101000a031916815260200191505b506040525050600080546001600160a01b0319166001600160a01b03851617905550805161011a906001906020840190610122565b5050506101c3565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282610158576000855561019e565b82601f1061017157805160ff191683800117855561019e565b8280016001018555821561019e579182015b8281111561019e578251825591602001919060010190610183565b506101aa9291506101ae565b5090565b5b808211156101aa57600081556001016101af565b610b8280620001d36000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c8063461a447811610071578063461a4478146101695780634651d91e1461020f5780638da5cb5b1461022c5780639507d39a146102a9578063b298e36b146102c6578063ccf8f969146102e3576100a9565b8063167fd681146100ae5780631f7b6d32146100db5780632015276c146100f557806329061de214610120578063299ca47814610145575b600080fd5b6100d9600480360360408110156100c457600080fd5b508035906020013564ffffffffff1916610306565b005b6100e36103fb565b60408051918252519081900360200190f35b6100d96004803603604081101561010b57600080fd5b508035906020013564ffffffffff1916610413565b6100d96004803603602081101561013657600080fd5b503564ffffffffff19166104cf565b61014d61058d565b604080516001600160a01b039092168252519081900360200190f35b61014d6004803603602081101561017f57600080fd5b81019060208101813564010000000081111561019a57600080fd5b8201836020820111156101ac57600080fd5b803590602001918460018302840111640100000000831117156101ce57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061059c945050505050565b6100d96004803603602081101561022557600080fd5b5035610678565b610234610733565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561026e578181015183820152602001610256565b50505050905090810190601f16801561029b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100e3600480360360208110156102bf57600080fd5b50356107c0565b6100d9600480360360208110156102dc57600080fd5b50356107da565b6102eb610895565b6040805164ffffffffff199092168252519081900360200190f35b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261039c93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b820191906000526020600020905b81548152906001019060200180831161037557829003601f168201915b505050505061059c565b6001600160a01b0316336001600160a01b0316146103eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f7600283836108a6565b5050565b60006104076002610938565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261047493909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146104c35760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f76002838361094c565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261053093909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461057f5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a60028261099a565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156105fc5781810151838201526020016105e4565b50505050905090810190601f1680156106295780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561064657600080fd5b505afa15801561065a573d6000803e3d6000fd5b505050506040513d602081101561067057600080fd5b505192915050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526106d993909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146107285760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a6002826109c4565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107b85780601f1061078d576101008083540402835291602001916107b8565b820191906000526020600020905b81548152906001019060200180831161079b57829003601f168201915b505050505081565b60006107d4600264ffffffffff84166109ea565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261083b93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461088a5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a600282610a64565b60006108a16002610a8a565b905090565b60006108b184610aa1565b9050806000015164ffffffffff168364ffffffffff1610610910576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b64ffffffffff8316815264ffffffffff19821660208201526109328482610ad1565b50505050565b60008061094483610aa1565b519392505050565b600061095784610aa1565b805164ffffffffff9081166000908152600180880160209081526040909220879055835101909116825264ffffffffff1984169082015290506109328482610ad1565b60006109a583610aa1565b64ffffffffff198316602082015290506109bf8382610ad1565b505050565b60006109cf83610aa1565b90506109bf828260200151856108a69092919063ffffffff16565b6000806109f684610aa1565b805190915064ffffffffff168310610a4c576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b50506000908152600191909101602052604090205490565b6000610a6f83610aa1565b90506109bf8282602001518561094c9092919063ffffffff16565b600080610a9683610aa1565b602001519392505050565b610aa9610af1565b50546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b8051602082015183548183179291908314610aea578285555b5050505050565b60408051808201909152600080825260208201529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122038869143d4598418a0ef5faf124214a16dc032f21ac35b7170b13b796c6eb00464736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c8063461a447811610071578063461a4478146101695780634651d91e1461020f5780638da5cb5b1461022c5780639507d39a146102a9578063b298e36b146102c6578063ccf8f969146102e3576100a9565b8063167fd681146100ae5780631f7b6d32146100db5780632015276c146100f557806329061de214610120578063299ca47814610145575b600080fd5b6100d9600480360360408110156100c457600080fd5b508035906020013564ffffffffff1916610306565b005b6100e36103fb565b60408051918252519081900360200190f35b6100d96004803603604081101561010b57600080fd5b508035906020013564ffffffffff1916610413565b6100d96004803603602081101561013657600080fd5b503564ffffffffff19166104cf565b61014d61058d565b604080516001600160a01b039092168252519081900360200190f35b61014d6004803603602081101561017f57600080fd5b81019060208101813564010000000081111561019a57600080fd5b8201836020820111156101ac57600080fd5b803590602001918460018302840111640100000000831117156101ce57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061059c945050505050565b6100d96004803603602081101561022557600080fd5b5035610678565b610234610733565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561026e578181015183820152602001610256565b50505050905090810190601f16801561029b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100e3600480360360208110156102bf57600080fd5b50356107c0565b6100d9600480360360208110156102dc57600080fd5b50356107da565b6102eb610895565b6040805164ffffffffff199092168252519081900360200190f35b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261039c93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b820191906000526020600020905b81548152906001019060200180831161037557829003601f168201915b505050505061059c565b6001600160a01b0316336001600160a01b0316146103eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f7600283836108a6565b5050565b60006104076002610938565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261047493909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146104c35760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f76002838361094c565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261053093909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461057f5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a60028261099a565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156105fc5781810151838201526020016105e4565b50505050905090810190601f1680156106295780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561064657600080fd5b505afa15801561065a573d6000803e3d6000fd5b505050506040513d602081101561067057600080fd5b505192915050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526106d993909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146107285760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a6002826109c4565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107b85780601f1061078d576101008083540402835291602001916107b8565b820191906000526020600020905b81548152906001019060200180831161079b57829003601f168201915b505050505081565b60006107d4600264ffffffffff84166109ea565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261083b93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461088a5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a600282610a64565b60006108a16002610a8a565b905090565b60006108b184610aa1565b9050806000015164ffffffffff168364ffffffffff1610610910576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b64ffffffffff8316815264ffffffffff19821660208201526109328482610ad1565b50505050565b60008061094483610aa1565b519392505050565b600061095784610aa1565b805164ffffffffff9081166000908152600180880160209081526040909220879055835101909116825264ffffffffff1984169082015290506109328482610ad1565b60006109a583610aa1565b64ffffffffff198316602082015290506109bf8382610ad1565b505050565b60006109cf83610aa1565b90506109bf828260200151856108a69092919063ffffffff16565b6000806109f684610aa1565b805190915064ffffffffff168310610a4c576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b50506000908152600191909101602052604090205490565b6000610a6f83610aa1565b90506109bf8282602001518561094c9092919063ffffffff16565b600080610a9683610aa1565b602001519392505050565b610aa9610af1565b50546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b8051602082015183548183179291908314610aea578285555b5050505050565b60408051808201909152600080825260208201529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122038869143d4598418a0ef5faf124214a16dc032f21ac35b7170b13b796c6eb00464736f6c63430007060033", "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 distinct 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", @@ -316,9 +303,6 @@ }, "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 @@ -326,15 +310,15 @@ "storageLayout": { "storage": [ { - "astId": 12856, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12849" + "type": "t_contract(Lib_AddressManager)15296" }, { - "astId": 4510, + "astId": 5963, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "owner", "offset": 0, @@ -342,12 +326,12 @@ "type": "t_string_storage" }, { - "astId": 4512, + "astId": 5965, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "buffer", "offset": 0, "slot": "2", - "type": "t_struct(RingBuffer)18001_storage" + "type": "t_struct(Buffer)18996_storage" } ], "types": { @@ -356,7 +340,7 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(Lib_AddressManager)12849": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" @@ -373,20 +357,20 @@ "label": "string", "numberOfBytes": "32" }, - "t_struct(Buffer)17990_storage": { + "t_struct(Buffer)18996_storage": { "encoding": "inplace", - "label": "struct Lib_RingBuffer.Buffer", + "label": "struct Lib_Buffer.Buffer", "members": [ { - "astId": 17985, + "astId": 18991, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "length", + "label": "context", "offset": 0, "slot": "0", - "type": "t_uint256" + "type": "t_bytes32" }, { - "astId": 17989, + "astId": 18995, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "buf", "offset": 0, @@ -396,53 +380,6 @@ ], "numberOfBytes": "64" }, - "t_struct(RingBuffer)18001_storage": { - "encoding": "inplace", - "label": "struct Lib_RingBuffer.RingBuffer", - "members": [ - { - "astId": 17992, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "contextA", - "offset": 0, - "slot": "0", - "type": "t_bytes32" - }, - { - "astId": 17994, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "contextB", - "offset": 0, - "slot": "1", - "type": "t_bytes32" - }, - { - "astId": 17996, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "bufferA", - "offset": 0, - "slot": "2", - "type": "t_struct(Buffer)17990_storage" - }, - { - "astId": 17998, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "bufferB", - "offset": 0, - "slot": "4", - "type": "t_struct(Buffer)17990_storage" - }, - { - "astId": 18000, - "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", diff --git a/packages/contracts/deployments/mainnet/OVM_ChainStorageContainer-SCC-batches.json b/packages/contracts/deployments/mainnet/OVM_ChainStorageContainer-SCC-batches.json index d8843c21963e..40a182852b88 100644 --- a/packages/contracts/deployments/mainnet/OVM_ChainStorageContainer-SCC-batches.json +++ b/packages/contracts/deployments/mainnet/OVM_ChainStorageContainer-SCC-batches.json @@ -1,5 +1,5 @@ { - "address": "0x7B8af5f008A7C5eFD319e68Fd5C9A68008519Caf", + "address": "0x77eBfdFcC906DDcDa0C42B866f26A8D5A2bb0572", "abi": [ { "inputs": [ @@ -181,45 +181,32 @@ "outputs": [], "stateMutability": "nonpayable", "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "setNextOverwritableIndex", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" } ], - "transactionHash": "0x5274f8966076b554ddddba99f5987fba45eeaa071324c4d68d01c40b6160d456", + "transactionHash": "0x6dd405591892918f5eee4d7e2f6ef5c01d495dbbc1d450736223e6c20f9af39f", "receipt": { "to": null, - "from": "0xd033f09cB85621F98F7A84C64dB381ac16Eff818", - "contractAddress": "0x7B8af5f008A7C5eFD319e68Fd5C9A68008519Caf", - "transactionIndex": 22, - "gasUsed": "970942", + "from": "0x9996571372066A1545D3435C6935e3F9593A7eF5", + "contractAddress": "0x77eBfdFcC906DDcDa0C42B866f26A8D5A2bb0572", + "transactionIndex": 64, + "gasUsed": "742245", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x9f27b2f9ffda2c799731c954123668232f423fdbc10da7c2031500488b2ba3c8", - "transactionHash": "0x5274f8966076b554ddddba99f5987fba45eeaa071324c4d68d01c40b6160d456", + "blockHash": "0xe77d2ff428e415a5672679356a6775cce3b66e50ee3b4e803122a3d2abacb8c6", + "transactionHash": "0x6dd405591892918f5eee4d7e2f6ef5c01d495dbbc1d450736223e6c20f9af39f", "logs": [], - "blockNumber": 12410803, - "cumulativeGasUsed": "2690196", + "blockNumber": 12686734, + "cumulativeGasUsed": "5613466", "status": 1, "byzantium": true }, "args": [ - "0x668E5b997b9aE88a56cd40409119d4Db9e6d752E", + "0xdE1FCfB0851916CA5101820A69b13a4E276bd81F", "OVM_StateCommitmentChain" ], - "solcInputHash": "f2bdab652d5102f5f11e78dae866798d", - "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\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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 distinct 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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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).\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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 distinct 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 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 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\":\"0x93325c961516aa2a22bf1aacf4029353d5e3b693e04b485753170337b50224e6\",\"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 * 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\":\"0x2d7973a0ad84c23ec62624d3f1e3aeb198cc72686ff1e6cfa17155556b320c94\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0xcc9fc5c64f1101a5c6c397594086b1608189a9edc5c9635e1ac38f70aeeeecbf\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 * 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 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 {\\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\":\"0xe30fc56d4499f98582e1f800dfa3b343f171163a557266c31a56449d5fd3ffae\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506040516200118d3803806200118d833981810160405260408110156200003757600080fd5b8151602083018051604051929492938301929190846401000000008211156200005f57600080fd5b9083019060208201858111156200007557600080fd5b82516401000000008111828201881017156200009057600080fd5b82525081516020918201929091019080838360005b83811015620000bf578181015183820152602001620000a5565b50505050905090810190601f168015620000ed5780820380516001836020036101000a031916815260200191505b506040525050600080546001600160a01b0319166001600160a01b038516179055508051620001249060019060208401906200012d565b505050620001d9565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282620001655760008555620001b0565b82601f106200018057805160ff1916838001178555620001b0565b82800160010185558215620001b0579182015b82811115620001b057825182559160200191906001019062000193565b50620001be929150620001c2565b5090565b5b80821115620001be5760008155600101620001c3565b610fa480620001e96000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80634651d91e116100715780634651d91e1461021a5780638da5cb5b146102375780639507d39a146102b4578063b298e36b146102d1578063ccf8f969146102ee578063fa9e936c14610311576100b4565b8063167fd681146100b95780631f7b6d32146100e65780632015276c1461010057806329061de21461012b578063299ca47814610150578063461a447814610174575b600080fd5b6100e4600480360360408110156100cf57600080fd5b508035906020013564ffffffffff191661032e565b005b6100ee610423565b60408051918252519081900360200190f35b6100e46004803603604081101561011657600080fd5b508035906020013564ffffffffff191661043b565b6100e46004803603602081101561014157600080fd5b503564ffffffffff19166104f7565b6101586105b5565b604080516001600160a01b039092168252519081900360200190f35b6101586004803603602081101561018a57600080fd5b8101906020810181356401000000008111156101a557600080fd5b8201836020820111156101b757600080fd5b803590602001918460018302840111640100000000831117156101d957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105c4945050505050565b6100e46004803603602081101561023057600080fd5b50356106a0565b61023f61075b565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610279578181015183820152602001610261565b50505050905090810190601f1680156102a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100ee600480360360208110156102ca57600080fd5b50356107e8565b6100e4600480360360208110156102e757600080fd5b5035610802565b6102f66108bd565b6040805164ffffffffff199092168252519081900360200190f35b6100e46004803603602081101561032757600080fd5b50356108ce565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526103c493909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b820191906000526020600020905b81548152906001019060200180831161039d57829003601f168201915b50505050506105c4565b6001600160a01b0316336001600160a01b0316146104135760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610983565b5050565b600061042f6002610a75565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261049c93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146104eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610a89565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261055893909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146105a75760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610b90565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561062457818101518382015260200161060c565b50505050905090810190601f1680156106515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561066e57600080fd5b505afa158015610682573d6000803e3d6000fd5b505050506040513d602081101561069857600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261070193909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146107505760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610bba565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107e05780601f106107b5576101008083540402835291602001916107e0565b820191906000526020600020905b8154815290600101906020018083116107c357829003601f168201915b505050505081565b60006107fc600264ffffffffff8416610be0565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261086393909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146108b25760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610de9565b60006108c96002610e0f565b905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261092f93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b03161461097e5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b600855565b600061098e84610e26565b9050806000015164ffffffffff168364ffffffffff161080156109c35750806060015164ffffffffff168364ffffffffff1610155b610a0b576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b806080015164ffffffffff168364ffffffffff161015610a4d576040810180516000190167ffffffffffffffff169052606081015164ffffffffff1660808201525b64ffffffffff8316815264ffffffffff1982166020820152610a6f8482610e86565b50505050565b600080610a8183610e26565b519392505050565b6000610a9484610e26565b90506000610ab9826040015167ffffffffffffffff1686610edc90919063ffffffff16565b8054909150610ac757601081555b8054608083015183510364ffffffffff1610610b3e578460060154826080015164ffffffffff161015610b365760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610b2f908690610edc565b9050610b3e565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610b888684610e86565b505050505050565b6000610b9b83610e26565b64ffffffffff19831660208201529050610bb58382610e86565b505050565b6000610bc583610e26565b9050610bb5828260200151856109839092919063ffffffff16565b600080610bec84610e26565b805190915064ffffffffff168310610c42576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c65826040015167ffffffffffffffff1686610edc90919063ffffffff16565b90506000610c8d836040015160010167ffffffffffffffff1687610edc90919063ffffffff16565b9050826080015164ffffffffff168510610d1a576080830151825464ffffffffff9091168603908110610cfe576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506107fc9050565b6080830151606084015164ffffffffff9182168781039290911610610d7d576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610dca576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b81540360009081526001909101602052604090205492506107fc915050565b6000610df483610e26565b9050610bb582826020015185610a899092919063ffffffff16565b600080610e1b83610e26565b602001519392505050565b610e2e610efc565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b80516020820151604080840151606085015160808601518754858717969483901b8417606883901b1795939291908714610ebe578689555b85896001015414610ed157600189018690555b505050505050505050565b60006002820615610ef05782600401610ef5565b826002015b9392505050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122014fd994dbf02ce54f07982ffcab79a1d699dc0313a3c136f6482cba97b52de4264736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80634651d91e116100715780634651d91e1461021a5780638da5cb5b146102375780639507d39a146102b4578063b298e36b146102d1578063ccf8f969146102ee578063fa9e936c14610311576100b4565b8063167fd681146100b95780631f7b6d32146100e65780632015276c1461010057806329061de21461012b578063299ca47814610150578063461a447814610174575b600080fd5b6100e4600480360360408110156100cf57600080fd5b508035906020013564ffffffffff191661032e565b005b6100ee610423565b60408051918252519081900360200190f35b6100e46004803603604081101561011657600080fd5b508035906020013564ffffffffff191661043b565b6100e46004803603602081101561014157600080fd5b503564ffffffffff19166104f7565b6101586105b5565b604080516001600160a01b039092168252519081900360200190f35b6101586004803603602081101561018a57600080fd5b8101906020810181356401000000008111156101a557600080fd5b8201836020820111156101b757600080fd5b803590602001918460018302840111640100000000831117156101d957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105c4945050505050565b6100e46004803603602081101561023057600080fd5b50356106a0565b61023f61075b565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610279578181015183820152602001610261565b50505050905090810190601f1680156102a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100ee600480360360208110156102ca57600080fd5b50356107e8565b6100e4600480360360208110156102e757600080fd5b5035610802565b6102f66108bd565b6040805164ffffffffff199092168252519081900360200190f35b6100e46004803603602081101561032757600080fd5b50356108ce565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526103c493909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b820191906000526020600020905b81548152906001019060200180831161039d57829003601f168201915b50505050506105c4565b6001600160a01b0316336001600160a01b0316146104135760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610983565b5050565b600061042f6002610a75565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261049c93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146104eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b61041f60028383610a89565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261055893909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146105a75760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610b90565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561062457818101518382015260200161060c565b50505050905090810190601f1680156106515780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561066e57600080fd5b505afa158015610682573d6000803e3d6000fd5b505050506040513d602081101561069857600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261070193909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146107505760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610bba565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107e05780601f106107b5576101008083540402835291602001916107e0565b820191906000526020600020905b8154815290600101906020018083116107c357829003601f168201915b505050505081565b60006107fc600264ffffffffff8416610be0565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261086393909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b0316146108b25760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b6105b2600282610de9565b60006108c96002610e0f565b905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261092f93909290918301828280156103ba5780601f1061038f576101008083540402835291602001916103ba565b6001600160a01b0316336001600160a01b03161461097e5760405162461bcd60e51b8152600401808060200182810382526044815260200180610f2b6044913960600191505060405180910390fd5b600855565b600061098e84610e26565b9050806000015164ffffffffff168364ffffffffff161080156109c35750806060015164ffffffffff168364ffffffffff1610155b610a0b576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b806080015164ffffffffff168364ffffffffff161015610a4d576040810180516000190167ffffffffffffffff169052606081015164ffffffffff1660808201525b64ffffffffff8316815264ffffffffff1982166020820152610a6f8482610e86565b50505050565b600080610a8183610e26565b519392505050565b6000610a9484610e26565b90506000610ab9826040015167ffffffffffffffff1686610edc90919063ffffffff16565b8054909150610ac757601081555b8054608083015183510364ffffffffff1610610b3e578460060154826080015164ffffffffff161015610b365760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610b2f908690610edc565b9050610b3e565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610b888684610e86565b505050505050565b6000610b9b83610e26565b64ffffffffff19831660208201529050610bb58382610e86565b505050565b6000610bc583610e26565b9050610bb5828260200151856109839092919063ffffffff16565b600080610bec84610e26565b805190915064ffffffffff168310610c42576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c65826040015167ffffffffffffffff1686610edc90919063ffffffff16565b90506000610c8d836040015160010167ffffffffffffffff1687610edc90919063ffffffff16565b9050826080015164ffffffffff168510610d1a576080830151825464ffffffffff9091168603908110610cfe576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506107fc9050565b6080830151606084015164ffffffffff9182168781039290911610610d7d576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610dca576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b81540360009081526001909101602052604090205492506107fc915050565b6000610df483610e26565b9050610bb582826020015185610a899092919063ffffffff16565b600080610e1b83610e26565b602001519392505050565b610e2e610efc565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b80516020820151604080840151606085015160808601518754858717969483901b8417606883901b1795939291908714610ebe578689555b85896001015414610ed157600189018690555b505050505050505050565b60006002820615610ef05782600401610ef5565b826002015b9392505050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122014fd994dbf02ce54f07982ffcab79a1d699dc0313a3c136f6482cba97b52de4264736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"setGlobalMetadata\",\"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 distinct 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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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).\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"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.\"}},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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_Buffer } from \\\"../../libraries/utils/Lib_Buffer.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 distinct 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_Buffer for Lib_Buffer.Buffer;\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n string public owner;\\n Lib_Buffer.Buffer 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 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 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\",\"keccak256\":\"0xace1f7a38106e7e95084ca6b39ea9e706cd561fb37c595afa362bb2a39a676ff\",\"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 * 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\",\"keccak256\":\"0x180b9c347e20f1a6efa553b0f2b9a59aebceda92a7484ae6fca4da2bf1d960c3\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Buffer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Buffer\\n * @dev This library implements a bytes32 storage array with some additional gas-optimized\\n * functionality. In particular, it encodes its length as a uint40, and tightly packs this with an\\n * overwritable \\\"extra data\\\" field so we can store more information with a single SSTORE.\\n */\\nlibrary Lib_Buffer {\\n\\n /*************\\n * Libraries *\\n *************/\\n\\n using Lib_Buffer for Buffer;\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Buffer {\\n bytes32 context;\\n mapping (uint256 => bytes32) buf;\\n }\\n\\n struct BufferContext {\\n // Stores the length of the array. Uint40 is way more elements than we'll ever reasonably\\n // need in an array and we get an extra 27 bytes of extra data to play with.\\n uint40 length;\\n\\n // Arbitrary extra data that can be modified whenever the length is updated. Useful for\\n // squeezing out some gas optimizations.\\n bytes27 extraData;\\n }\\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 Global extra data.\\n */\\n function push(\\n Buffer storage _self,\\n bytes32 _value,\\n bytes27 _extraData\\n )\\n internal\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n _self.buf[ctx.length] = _value;\\n\\n // Bump the global index and insert our extra data, then save the context.\\n ctx.length++;\\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 Buffer storage _self,\\n bytes32 _value\\n )\\n internal\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n _self.push(\\n _value,\\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 Buffer storage _self,\\n uint256 _index\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n return _self.buf[_index];\\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 Buffer storage _self,\\n uint40 _index,\\n bytes27 _extraData\\n )\\n internal\\n {\\n BufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n // Set our length and extra data, save the context.\\n ctx.length = _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 Buffer storage _self,\\n uint40 _index\\n )\\n internal\\n {\\n BufferContext 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 Buffer storage _self\\n )\\n internal\\n view\\n returns (\\n uint40\\n )\\n {\\n BufferContext memory ctx = _self.getContext();\\n return ctx.length;\\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 Buffer storage _self,\\n bytes27 _extraData\\n )\\n internal\\n {\\n BufferContext 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 Buffer storage _self\\n )\\n internal\\n view\\n returns (\\n bytes27\\n )\\n {\\n BufferContext memory ctx = _self.getContext();\\n return ctx.extraData;\\n }\\n\\n /**\\n * Sets the current buffer context.\\n * @param _self Buffer to access.\\n * @param _ctx Current buffer context.\\n */\\n function setContext(\\n Buffer storage _self,\\n BufferContext memory _ctx\\n )\\n internal\\n {\\n bytes32 context;\\n uint40 length = _ctx.length;\\n bytes27 extraData = _ctx.extraData;\\n assembly {\\n context := length\\n context := or(context, extraData)\\n }\\n\\n if (_self.context != context) {\\n _self.context = context;\\n }\\n }\\n\\n /**\\n * Retrieves the current buffer context.\\n * @param _self Buffer to access.\\n * @return Current buffer context.\\n */\\n function getContext(\\n Buffer storage _self\\n )\\n internal\\n view\\n returns (\\n BufferContext memory\\n )\\n {\\n bytes32 context = _self.context;\\n uint40 length;\\n bytes27 extraData;\\n assembly {\\n length := and(context, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\\n extraData := and(context, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000)\\n }\\n\\n return BufferContext({\\n length: length,\\n extraData: extraData\\n });\\n }\\n}\\n\",\"keccak256\":\"0xbce4f4db3d80b2cb252177752eee1ca38482731d1e2e5d165c7fce2e04c487fb\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405162000d5538038062000d558339818101604052604081101561003557600080fd5b81516020830180516040519294929383019291908464010000000082111561005c57600080fd5b90830190602082018581111561007157600080fd5b825164010000000081118282018810171561008b57600080fd5b82525081516020918201929091019080838360005b838110156100b85781810151838201526020016100a0565b50505050905090810190601f1680156100e55780820380516001836020036101000a031916815260200191505b506040525050600080546001600160a01b0319166001600160a01b03851617905550805161011a906001906020840190610122565b5050506101c3565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282610158576000855561019e565b82601f1061017157805160ff191683800117855561019e565b8280016001018555821561019e579182015b8281111561019e578251825591602001919060010190610183565b506101aa9291506101ae565b5090565b5b808211156101aa57600081556001016101af565b610b8280620001d36000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c8063461a447811610071578063461a4478146101695780634651d91e1461020f5780638da5cb5b1461022c5780639507d39a146102a9578063b298e36b146102c6578063ccf8f969146102e3576100a9565b8063167fd681146100ae5780631f7b6d32146100db5780632015276c146100f557806329061de214610120578063299ca47814610145575b600080fd5b6100d9600480360360408110156100c457600080fd5b508035906020013564ffffffffff1916610306565b005b6100e36103fb565b60408051918252519081900360200190f35b6100d96004803603604081101561010b57600080fd5b508035906020013564ffffffffff1916610413565b6100d96004803603602081101561013657600080fd5b503564ffffffffff19166104cf565b61014d61058d565b604080516001600160a01b039092168252519081900360200190f35b61014d6004803603602081101561017f57600080fd5b81019060208101813564010000000081111561019a57600080fd5b8201836020820111156101ac57600080fd5b803590602001918460018302840111640100000000831117156101ce57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061059c945050505050565b6100d96004803603602081101561022557600080fd5b5035610678565b610234610733565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561026e578181015183820152602001610256565b50505050905090810190601f16801561029b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100e3600480360360208110156102bf57600080fd5b50356107c0565b6100d9600480360360208110156102dc57600080fd5b50356107da565b6102eb610895565b6040805164ffffffffff199092168252519081900360200190f35b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261039c93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b820191906000526020600020905b81548152906001019060200180831161037557829003601f168201915b505050505061059c565b6001600160a01b0316336001600160a01b0316146103eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f7600283836108a6565b5050565b60006104076002610938565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261047493909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146104c35760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f76002838361094c565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261053093909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461057f5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a60028261099a565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156105fc5781810151838201526020016105e4565b50505050905090810190601f1680156106295780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561064657600080fd5b505afa15801561065a573d6000803e3d6000fd5b505050506040513d602081101561067057600080fd5b505192915050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526106d993909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146107285760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a6002826109c4565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107b85780601f1061078d576101008083540402835291602001916107b8565b820191906000526020600020905b81548152906001019060200180831161079b57829003601f168201915b505050505081565b60006107d4600264ffffffffff84166109ea565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261083b93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461088a5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a600282610a64565b60006108a16002610a8a565b905090565b60006108b184610aa1565b9050806000015164ffffffffff168364ffffffffff1610610910576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b64ffffffffff8316815264ffffffffff19821660208201526109328482610ad1565b50505050565b60008061094483610aa1565b519392505050565b600061095784610aa1565b805164ffffffffff9081166000908152600180880160209081526040909220879055835101909116825264ffffffffff1984169082015290506109328482610ad1565b60006109a583610aa1565b64ffffffffff198316602082015290506109bf8382610ad1565b505050565b60006109cf83610aa1565b90506109bf828260200151856108a69092919063ffffffff16565b6000806109f684610aa1565b805190915064ffffffffff168310610a4c576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b50506000908152600191909101602052604090205490565b6000610a6f83610aa1565b90506109bf8282602001518561094c9092919063ffffffff16565b600080610a9683610aa1565b602001519392505050565b610aa9610af1565b50546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b8051602082015183548183179291908314610aea578285555b5050505050565b60408051808201909152600080825260208201529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122038869143d4598418a0ef5faf124214a16dc032f21ac35b7170b13b796c6eb00464736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c8063461a447811610071578063461a4478146101695780634651d91e1461020f5780638da5cb5b1461022c5780639507d39a146102a9578063b298e36b146102c6578063ccf8f969146102e3576100a9565b8063167fd681146100ae5780631f7b6d32146100db5780632015276c146100f557806329061de214610120578063299ca47814610145575b600080fd5b6100d9600480360360408110156100c457600080fd5b508035906020013564ffffffffff1916610306565b005b6100e36103fb565b60408051918252519081900360200190f35b6100d96004803603604081101561010b57600080fd5b508035906020013564ffffffffff1916610413565b6100d96004803603602081101561013657600080fd5b503564ffffffffff19166104cf565b61014d61058d565b604080516001600160a01b039092168252519081900360200190f35b61014d6004803603602081101561017f57600080fd5b81019060208101813564010000000081111561019a57600080fd5b8201836020820111156101ac57600080fd5b803590602001918460018302840111640100000000831117156101ce57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061059c945050505050565b6100d96004803603602081101561022557600080fd5b5035610678565b610234610733565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561026e578181015183820152602001610256565b50505050905090810190601f16801561029b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100e3600480360360208110156102bf57600080fd5b50356107c0565b6100d9600480360360208110156102dc57600080fd5b50356107da565b6102eb610895565b6040805164ffffffffff199092168252519081900360200190f35b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261039c93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b820191906000526020600020905b81548152906001019060200180831161037557829003601f168201915b505050505061059c565b6001600160a01b0316336001600160a01b0316146103eb5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f7600283836108a6565b5050565b60006104076002610938565b64ffffffffff16905090565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261047493909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146104c35760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b6103f76002838361094c565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261053093909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461057f5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a60028261099a565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156105fc5781810151838201526020016105e4565b50505050905090810190601f1680156106295780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561064657600080fd5b505afa15801561065a573d6000803e3d6000fd5b505050506040513d602081101561067057600080fd5b505192915050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526106d993909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b0316146107285760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a6002826109c4565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107b85780601f1061078d576101008083540402835291602001916107b8565b820191906000526020600020905b81548152906001019060200180831161079b57829003601f168201915b505050505081565b60006107d4600264ffffffffff84166109ea565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261083b93909290918301828280156103925780601f1061036757610100808354040283529160200191610392565b6001600160a01b0316336001600160a01b03161461088a5760405162461bcd60e51b8152600401808060200182810382526044815260200180610b096044913960600191505060405180910390fd5b61058a600282610a64565b60006108a16002610a8a565b905090565b60006108b184610aa1565b9050806000015164ffffffffff168364ffffffffff1610610910576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b64ffffffffff8316815264ffffffffff19821660208201526109328482610ad1565b50505050565b60008061094483610aa1565b519392505050565b600061095784610aa1565b805164ffffffffff9081166000908152600180880160209081526040909220879055835101909116825264ffffffffff1984169082015290506109328482610ad1565b60006109a583610aa1565b64ffffffffff198316602082015290506109bf8382610ad1565b505050565b60006109cf83610aa1565b90506109bf828260200151856108a69092919063ffffffff16565b6000806109f684610aa1565b805190915064ffffffffff168310610a4c576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b50506000908152600191909101602052604090205490565b6000610a6f83610aa1565b90506109bf8282602001518561094c9092919063ffffffff16565b600080610a9683610aa1565b602001519392505050565b610aa9610af1565b50546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b8051602082015183548183179291908314610aea578285555b5050505050565b60408051808201909152600080825260208201529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122038869143d4598418a0ef5faf124214a16dc032f21ac35b7170b13b796c6eb00464736f6c63430007060033", "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 distinct 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", @@ -316,9 +303,6 @@ }, "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 @@ -326,15 +310,15 @@ "storageLayout": { "storage": [ { - "astId": 12856, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12849" + "type": "t_contract(Lib_AddressManager)15296" }, { - "astId": 4510, + "astId": 5963, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "owner", "offset": 0, @@ -342,12 +326,12 @@ "type": "t_string_storage" }, { - "astId": 4512, + "astId": 5965, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "buffer", "offset": 0, "slot": "2", - "type": "t_struct(RingBuffer)18001_storage" + "type": "t_struct(Buffer)18996_storage" } ], "types": { @@ -356,7 +340,7 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(Lib_AddressManager)12849": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" @@ -373,20 +357,20 @@ "label": "string", "numberOfBytes": "32" }, - "t_struct(Buffer)17990_storage": { + "t_struct(Buffer)18996_storage": { "encoding": "inplace", - "label": "struct Lib_RingBuffer.Buffer", + "label": "struct Lib_Buffer.Buffer", "members": [ { - "astId": 17985, + "astId": 18991, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "length", + "label": "context", "offset": 0, "slot": "0", - "type": "t_uint256" + "type": "t_bytes32" }, { - "astId": 17989, + "astId": 18995, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", "label": "buf", "offset": 0, @@ -396,53 +380,6 @@ ], "numberOfBytes": "64" }, - "t_struct(RingBuffer)18001_storage": { - "encoding": "inplace", - "label": "struct Lib_RingBuffer.RingBuffer", - "members": [ - { - "astId": 17992, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "contextA", - "offset": 0, - "slot": "0", - "type": "t_bytes32" - }, - { - "astId": 17994, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "contextB", - "offset": 0, - "slot": "1", - "type": "t_bytes32" - }, - { - "astId": 17996, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "bufferA", - "offset": 0, - "slot": "2", - "type": "t_struct(Buffer)17990_storage" - }, - { - "astId": 17998, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "bufferB", - "offset": 0, - "slot": "4", - "type": "t_struct(Buffer)17990_storage" - }, - { - "astId": 18000, - "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", diff --git a/packages/contracts/deployments/mainnet/OVM_ExecutionManager.json b/packages/contracts/deployments/mainnet/OVM_ExecutionManager.json index 19fa7860cdb1..d5b45ec1df0d 100644 --- a/packages/contracts/deployments/mainnet/OVM_ExecutionManager.json +++ b/packages/contracts/deployments/mainnet/OVM_ExecutionManager.json @@ -1,5 +1,5 @@ { - "address": "0x3f5FA555c434b49D946042955013966Fd108DaC3", + "address": "0x2745C24822f542BbfFB41c6cB20EdF766b5619f5", "abi": [ { "inputs": [ @@ -51,6 +51,19 @@ "stateMutability": "nonpayable", "type": "constructor" }, + { + "inputs": [], + "name": "CALL_WITH_VALUE_INTRINSIC_GAS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "getMaxTransactionGasLimit", @@ -90,6 +103,64 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contract", + "type": "address" + } + ], + "name": "ovmBALANCE", + "outputs": [ + { + "internalType": "uint256", + "name": "_BALANCE", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_gasLimit", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_address", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + }, + { + "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": [ { @@ -137,6 +208,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "ovmCALLVALUE", + "outputs": [ + { + "internalType": "uint256", + "name": "_CALLVALUE", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "ovmCHAINID", @@ -417,6 +501,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "ovmSELFBALANCE", + "outputs": [ + { + "internalType": "uint256", + "name": "_BALANCE", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -583,11 +680,6 @@ }, { "inputs": [ - { - "internalType": "uint256", - "name": "_gasLimit", - "type": "uint256" - }, { "internalType": "bytes", "name": "_creationCode", @@ -653,6 +745,11 @@ "name": "_from", "type": "address" }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + }, { "internalType": "contract iOVM_StateManager", "name": "_ovmStateManager", @@ -671,38 +768,38 @@ "type": "function" } ], - "transactionHash": "0xde8005c84c3179ad305e8a09dc97d3147344df3658bb76d7570a7721066f7eee", + "transactionHash": "0x294f7e2920d42cc8e21231f37e159c99c1569b22b8775f3819ada1ebe1bc08fc", "receipt": { "to": null, - "from": "0xd033f09cB85621F98F7A84C64dB381ac16Eff818", - "contractAddress": "0x3f5FA555c434b49D946042955013966Fd108DaC3", - "transactionIndex": 194, - "gasUsed": "2944657", + "from": "0x9996571372066A1545D3435C6935e3F9593A7eF5", + "contractAddress": "0x2745C24822f542BbfFB41c6cB20EdF766b5619f5", + "transactionIndex": 132, + "gasUsed": "3122024", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x9dd55e729aebcd0316698d6b7efebeef7ee1cc12d129ec22595107be4ee9c554", - "transactionHash": "0xde8005c84c3179ad305e8a09dc97d3147344df3658bb76d7570a7721066f7eee", + "blockHash": "0xf62c27762cbb4a60129940cee91357f619a1d442400c16243e5f3c3690c02b4a", + "transactionHash": "0x294f7e2920d42cc8e21231f37e159c99c1569b22b8775f3819ada1ebe1bc08fc", "logs": [], - "blockNumber": 12410837, - "cumulativeGasUsed": "10740618", + "blockNumber": 12686762, + "cumulativeGasUsed": "11718241", "status": 1, "byzantium": true }, "args": [ - "0x668E5b997b9aE88a56cd40409119d4Db9e6d752E", + "0xdE1FCfB0851916CA5101820A69b13a4E276bd81F", { - "minTransactionGasLimit": 100000, - "maxTransactionGasLimit": 9000000, - "maxGasPerQueuePerEpoch": 99999999999, + "minTransactionGasLimit": 50000, + "maxTransactionGasLimit": 11000000, + "maxGasPerQueuePerEpoch": 250000000, "secondsPerEpoch": 0 }, { "ovmCHAINID": 10 } ], - "solcInputHash": "f2bdab652d5102f5f11e78dae866798d", - "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\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":\"\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_bytecode\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"ovmCREATE2\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"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\":\"ovmINCREMENTNONCE\",\"outputs\":[],\"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\":\"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\":\"\",\"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\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_creationCode\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"}],\"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\":\"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\":{\"_0\":\"Address of the created contract.\",\"_1\":\"Revert data, if and only if the creation threw an exception.\"}},\"ovmCREATE2(bytes,bytes32)\":{\"params\":{\"_bytecode\":\"Code to be used to CREATE2 a new contract.\",\"_salt\":\"Value used to determine the contract's address.\"},\"returns\":{\"_0\":\"Address of the created contract.\",\"_1\":\"Revert data, if and only if the creation threw an exception.\"}},\"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\":\"Enum indicating 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.\"}},\"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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"run((uint256,uint256,uint8,address,address,uint256,bytes),address)\":{\"params\":{\"_ovmStateManager\":\"iOVM_StateManager implementation providing account state.\",\"_transaction\":\"Transaction data to be executed.\"}},\"safeCREATE(uint256,bytes,address)\":{\"params\":{\"_address\":\"OVM address being deployed to.\",\"_creationCode\":\"Code to pass into CREATE for deployment.\",\"_gasLimit\":\"Amount of gas to be passed into this creation.\"}},\"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.\"},\"ovmINCREMENTNONCE()\":{\"notice\":\"Bumps the nonce of the current ovmADDRESS by one.\"},\"ovmL1QUEUEORIGIN()\":{\"notice\":\"Specifies from which source (Sequencer or 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.\"},\"ovmSLOAD(bytes32)\":{\"notice\":\"Overrides SLOAD.\"},\"ovmSSTORE(bytes32,bytes32)\":{\"notice\":\"Overrides SSTORE.\"},\"ovmSTATICCALL(uint256,address,bytes)\":{\"notice\":\"Overrides STATICCALL.\"},\"ovmTIMESTAMP()\":{\"notice\":\"Overrides TIMESTAMP.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"run((uint256,uint256,uint8,address,address,uint256,bytes),address)\":{\"notice\":\"Starts the execution of a transaction via the OVM_ExecutionManager.\"},\"safeCREATE(uint256,bytes,address)\":{\"notice\":\"Handles the creation-specific safety measures required for OVM contract deployment. This function sanitizes the return types for creation messages to match calls (bool, bytes), by being an external function which the EM can call, that mimics the success/fail case of the CREATE. This allows for consistent handling of both types of messages in _handleExternalMessage(). Having this step occur as a separate call frame also allows us to easily revert the contract deployment in the event that the code is unsafe.\"},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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\\\";\\nimport { Lib_ErrorUtils } from \\\"../../libraries/utils/Lib_ErrorUtils.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_DeployerWhitelist } from \\\"../predeploys/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 * Default Context Values *\\n **************************/\\n\\n uint256 constant DEFAULT_UINT256 = 0xdefa017defa017defa017defa017defa017defa017defa017defa017defa017d;\\n address constant DEFAULT_ADDRESS = 0xdEfa017defA017DeFA017DEfa017DeFA017DeFa0;\\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 Lib_AddressResolver(_libAddressManager)\\n {\\n ovmSafetyChecker = iOVM_SafetyChecker(resolve(\\\"OVM_SafetyChecker\\\"));\\n gasMeterConfig = _gasMeterConfig;\\n globalContext = _globalContext;\\n _resetContext();\\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 external\\n returns (\\n bytes memory\\n )\\n {\\n // Make sure that run() is not re-enterable. This condition should always be satisfied\\n // Once run has been called once, due to the behavior of _isValidInput().\\n if (transactionContext.ovmNUMBER != DEFAULT_UINT256) {\\n return bytes(\\\"\\\");\\n }\\n\\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 (_isValidInput(_transaction) == false) {\\n _resetContext();\\n return bytes(\\\"\\\");\\n }\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\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 (, bytes memory returndata) = ovmCALL(\\n _transaction.gasLimit - gasMeterConfig.minTransactionGasLimit,\\n _transaction.entrypoint,\\n _transaction.data\\n );\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\n // // Update the cumulative gas based on the amount of gas used.\\n // uint256 gasUsed = gasProvided - gasleft();\\n // _updateCumulativeGas(gasUsed, _transaction.l1QueueOrigin);\\n\\n // Wipe the execution context.\\n _resetContext();\\n\\n return returndata;\\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 external\\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 external\\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 external\\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 external\\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 external\\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 source (Sequencer or Queue) this transaction originated from.\\n * @return _queueOrigin Enum indicating the ovmL1QUEUEORIGIN within the current message context.\\n */\\n function ovmL1QUEUEORIGIN()\\n override\\n external\\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 external\\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 Address of the created contract.\\n * @return Revert data, if and only if the creation threw an exception.\\n */\\n function ovmCREATE(\\n bytes memory _bytecode\\n )\\n override\\n public\\n notStatic\\n fixedGasDiscount(40000)\\n returns (\\n address,\\n bytes memory\\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 Address of the created contract.\\n * @return Revert data, if and only if the creation threw an exception.\\n */\\n function ovmCREATE2(\\n bytes memory _bytecode,\\n bytes32 _salt\\n )\\n override\\n external\\n notStatic\\n fixedGasDiscount(40000)\\n returns (\\n address,\\n bytes memory\\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 external\\n returns (\\n uint256 _nonce\\n )\\n {\\n return _getAccountNonce(ovmADDRESS());\\n }\\n\\n /**\\n * Bumps the nonce of the current ovmADDRESS by one.\\n */\\n function ovmINCREMENTNONCE()\\n override\\n external\\n notStatic\\n {\\n address account = ovmADDRESS();\\n uint256 nonce = _getAccountNonce(account);\\n\\n // Prevent overflow.\\n if (nonce + 1 > nonce) {\\n _setAccountNonce(account, nonce + 1);\\n }\\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 // Creates a duplicate of the OVM_ProxyEOA located at 0x42....09. Uses the following\\n // \\\"magic\\\" prefix to deploy an exact copy of the code:\\n // PUSH1 0x0D # size of this prefix in bytes\\n // CODESIZE\\n // SUB # subtract prefix size from codesize\\n // DUP1\\n // PUSH1 0x0D\\n // PUSH1 0x00\\n // CODECOPY # copy everything after prefix into memory at pos 0\\n // PUSH1 0x00\\n // RETURN # return the copied code\\n address proxyEOA = Lib_EthUtils.createContract(abi.encodePacked(\\n hex\\\"600D380380600D6000396000f3\\\",\\n ovmEXTCODECOPY(\\n 0x4200000000000000000000000000000000000009,\\n 0,\\n ovmEXTCODESIZE(0x4200000000000000000000000000000000000009)\\n )\\n ));\\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 external\\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 external\\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\\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 external\\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 external\\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 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 external\\n returns (\\n bytes32 _EXTCODEHASH\\n )\\n {\\n return Lib_EthUtils.getCodeHash(\\n _getAccountEthAddress(_contract)\\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 Whitelisting *\\n ********************************************/\\n\\n /**\\n * Checks whether the given address is on the whitelist 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 semantics perspective, this will appear 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 Final OVM contract address.\\n * @return Revertdata, if and only if the creation threw an exception.\\n */\\n function _createContract(\\n address _contractAddress,\\n bytes memory _bytecode\\n )\\n internal\\n returns (\\n address,\\n bytes memory\\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 the common logic which occurs between call-type and create-type messages,\\n // passing in the creation bytecode and `true` to trigger create-specific logic.\\n (bool success, bytes memory data) = _handleExternalMessage(\\n nextMessageContext,\\n gasleft(),\\n _contractAddress,\\n _bytecode,\\n true\\n );\\n\\n // Yellow paper requires that address returned is zero if the contract deployment fails.\\n return (\\n success ? _contractAddress : address(0),\\n data\\n );\\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 // EVM does not return data in the success case, see: https://github.com/ethereum/go-ethereum/blob/aae7660410f0ef90279e14afaaf2f429fdc2a186/core/vm/instructions.go#L600-L604\\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 _handleExternalMessage(\\n _nextMessageContext,\\n _gasLimit,\\n codeContractAddress,\\n _calldata,\\n false\\n );\\n }\\n\\n /**\\n * Handles all interactions which involve the execution manager calling out to untrusted code (both calls and creates).\\n * Ensures that OVM-related measures are enforced, including L2 gas refunds, nuisance gas, and flagged reversions.\\n *\\n * @param _nextMessageContext Message context to be used for the external message.\\n * @param _gasLimit Amount of gas to be passed into this message.\\n * @param _contract OVM address being called or deployed to\\n * @param _data Data for the message (either calldata or creation code)\\n * @param _isCreate Whether this is a create-type message.\\n * @return Whether or not the message (either a call or deployment) succeeded.\\n * @return Data returned by the message.\\n */\\n function _handleExternalMessage(\\n MessageContext memory _nextMessageContext,\\n uint256 _gasLimit,\\n address _contract,\\n bytes memory _data,\\n bool _isCreate\\n )\\n internal\\n returns (\\n bool,\\n bytes memory\\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. `_contract` 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\\n bool success;\\n bytes memory returndata;\\n if (_isCreate) {\\n // safeCREATE() is a function which replicates a CREATE message, but uses return values\\n // Which match that of CALL (i.e. bool, bytes). This allows many security checks to be\\n // to be shared between untrusted call and create call frames.\\n (success, returndata) = address(this).call(\\n abi.encodeWithSelector(\\n this.safeCREATE.selector,\\n _gasLimit,\\n _data,\\n _contract\\n )\\n );\\n } else {\\n (success, returndata) = _contract.call{gas: _gasLimit}(_data);\\n }\\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 (\\n flag == RevertFlag.INTENTIONAL_REVERT\\n || _isCreate\\n ) {\\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 * Handles the creation-specific safety measures required for OVM contract deployment.\\n * This function sanitizes the return types for creation messages to match calls (bool, bytes),\\n * by being an external function which the EM can call, that mimics the success/fail case of the CREATE.\\n * This allows for consistent handling of both types of messages in _handleExternalMessage().\\n * Having this step occur as a separate call frame also allows us to easily revert the\\n * contract deployment in the event that the code is unsafe.\\n *\\n * @param _gasLimit Amount of gas to be passed into this creation.\\n * @param _creationCode Code to pass into CREATE for deployment.\\n * @param _address OVM address being deployed to.\\n */\\n function safeCREATE(\\n uint _gasLimit,\\n bytes memory _creationCode,\\n address _address\\n )\\n external\\n {\\n // The only way this should callable is from within _createContract(),\\n // and it should DEFINITELY not be callable by a non-EM code contract.\\n if (msg.sender != address(this)) {\\n return;\\n }\\n // Check that there is not already code at this address.\\n if (_hasEmptyAccount(_address) == false) {\\n // Note: in the EVM, this case burns all allotted gas. For improved\\n // developer experience, we do return the remaining gas.\\n _revertWithFlag(\\n RevertFlag.CREATE_COLLISION,\\n Lib_ErrorUtils.encodeRevertString(\\\"A contract has already been deployed to this address\\\")\\n );\\n }\\n\\n // Check the creation bytecode against the OVM_SafetyChecker.\\n if (ovmSafetyChecker.isBytecodeSafe(_creationCode) == false) {\\n _revertWithFlag(\\n RevertFlag.UNSAFE_BYTECODE,\\n Lib_ErrorUtils.encodeRevertString(\\\"Contract creation code contains unsafe opcodes. Did you use the right compiler or pass an unsafe constructor argument?\\\")\\n );\\n }\\n\\n // We always need to initialize the contract with the default account values.\\n _initPendingAccount(_address);\\n\\n // Actually execute the EVM create message.\\n // NOTE: The inline assembly below means we can NOT make any evm calls between here and then.\\n address ethAddress = Lib_EthUtils.createContract(_creationCode);\\n\\n if (ethAddress == address(0)) {\\n // If the creation fails, the EVM lets us grab its revert data. This may contain a revert flag\\n // to be used above in _handleExternalMessage, so we pass the revert data back up unmodified.\\n assembly {\\n returndatacopy(0,0,returndatasize())\\n revert(0, returndatasize())\\n }\\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(\\n RevertFlag.UNSAFE_BYTECODE,\\n Lib_ErrorUtils.encodeRevertString(\\\"Constructor attempted to deploy unsafe bytecode.\\\")\\n );\\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 * 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 ) {\\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 view\\n {\\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 input values of a transaction.\\n * @return _valid Whether or not the transaction data is valid.\\n */\\n function _isValidInput(\\n Lib_OVMCodec.Transaction memory _transaction\\n )\\n view\\n internal\\n returns (\\n bool\\n )\\n {\\n // Prevent reentrancy to run():\\n // This check prevents calling run with the default ovmNumber.\\n // Combined with the first check in run():\\n // if (transactionContext.ovmNUMBER != DEFAULT_UINT256) { return; }\\n // It should be impossible to re-enter since run() returns before any other call frames are created.\\n // Since this value is already being written to storage, we save much gas compared to\\n // using the standard nonReentrant pattern.\\n if (_transaction.blockNumber == DEFAULT_UINT256) {\\n return false;\\n }\\n\\n if (_isValidGasLimit(_transaction.gasLimit, _transaction.l1QueueOrigin) == false) {\\n return false;\\n }\\n\\n return true;\\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 view\\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 = DEFAULT_ADDRESS;\\n transactionContext.ovmTIMESTAMP = DEFAULT_UINT256;\\n transactionContext.ovmNUMBER = DEFAULT_UINT256;\\n transactionContext.ovmGASLIMIT = DEFAULT_UINT256;\\n transactionContext.ovmTXGASLIMIT = DEFAULT_UINT256;\\n transactionContext.ovmL1QUEUEORIGIN = Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE;\\n\\n transactionRecord.ovmGasRefund = DEFAULT_UINT256;\\n\\n messageContext.ovmCALLER = DEFAULT_ADDRESS;\\n messageContext.ovmADDRESS = DEFAULT_ADDRESS;\\n messageContext.isStatic = false;\\n\\n messageRecord.nuisanceGasLeft = DEFAULT_UINT256;\\n\\n // Reset the ovmStateManager.\\n ovmStateManager = iOVM_StateManager(address(0));\\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 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 messageRecord.nuisanceGasLeft = uint(-1);\\n\\n messageContext.ovmADDRESS = _from;\\n\\n bool isCreate = _transaction.entrypoint == address(0);\\n if (isCreate) {\\n (address created, bytes memory revertData) = ovmCREATE(_transaction.data);\\n if (created == address(0)) {\\n return abi.encode(false, revertData);\\n } else {\\n // The eth_call RPC endpoint for to = undefined will return the deployed bytecode\\n // in the success case, differing from standard create messages.\\n return abi.encode(true, Lib_EthUtils.getCode(created));\\n }\\n } else {\\n (bool success, bytes memory returndata) = ovmCALL(\\n _transaction.gasLimit,\\n _transaction.entrypoint,\\n _transaction.data\\n );\\n return abi.encode(success, returndata);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2d8c32b3438f9b9da37e33430527e12658178bd96b0863e20bd02fcaaf162cd4\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/predeploys/OVM_DeployerWhitelist.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Interface Imports */\\nimport { iOVM_DeployerWhitelist } from \\\"../../iOVM/predeploys/iOVM_DeployerWhitelist.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: optimistic-solc\\n * Runtime target: OVM\\n */\\ncontract OVM_DeployerWhitelist is iOVM_DeployerWhitelist {\\n\\n /**********************\\n * Contract Constants *\\n **********************/\\n\\n bool public initialized;\\n bool public allowArbitraryDeployment;\\n address override public owner;\\n mapping (address => bool) public whitelist;\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Blocks functions to anyone except the contract owner.\\n */\\n modifier onlyOwner() {\\n require(\\n msg.sender == 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 external\\n {\\n if (initialized == true) {\\n return;\\n }\\n\\n initialized = true;\\n allowArbitraryDeployment = _allowArbitraryDeployment;\\n owner = _owner;\\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 external\\n onlyOwner\\n {\\n whitelist[_deployer] = _isWhitelisted;\\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 owner = _owner;\\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 allowArbitraryDeployment = _allowArbitraryDeployment;\\n }\\n\\n /**\\n * Permanently enables arbitrary contract deployment and deletes the owner.\\n */\\n function enableArbitraryContractDeployment()\\n override\\n external\\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 external\\n returns (\\n bool\\n )\\n {\\n return (\\n initialized == false\\n || allowArbitraryDeployment == true\\n || whitelist[_deployer]\\n );\\n }\\n}\\n\",\"keccak256\":\"0xb96bfb8eb24503b05de41483cc9fb7a7f81107aa1ca146dc281952f8100848a0\",\"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 OUT_OF_GAS,\\n INTENTIONAL_REVERT,\\n EXCEEDS_NUISANCE_GAS,\\n INVALID_STATE_ACCESS,\\n UNSAFE_BYTECODE,\\n CREATE_COLLISION,\\n STATIC_VIOLATION,\\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 }\\n\\n\\n /************************************\\n * Transaction Execution Entrypoint *\\n ************************************/\\n\\n function run(\\n Lib_OVMCodec.Transaction calldata _transaction,\\n address _txStateManager\\n ) external returns (bytes memory);\\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, bytes memory _revertdata);\\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract, bytes memory _revertdata);\\n\\n\\n /*******************************\\n * Account Abstraction Opcodes *\\n ******************************/\\n\\n function ovmGETNONCE() external returns (uint256 _nonce);\\n function ovmINCREMENTNONCE() 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 Context *\\n ***************************************/\\n\\n function getMaxTransactionGasLimit() external view returns (uint _maxTransactionGasLimit);\\n}\\n\",\"keccak256\":\"0xf023d5d6fc6a03bd52f7a57af6e21076de77e8925d065bb79db062e73e43b684\",\"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/predeploys/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 owner() 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\":\"0xdf1f27faf0d26d416bf6d408d146a16de32b4e1772a292c65d39eb7ec2b53ceb\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0xcc9fc5c64f1101a5c6c397594086b1608189a9edc5c9635e1ac38f70aeeeecbf\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_ErrorUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/**\\n * @title Lib_ErrorUtils\\n */\\nlibrary Lib_ErrorUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes an error string into raw solidity-style revert data.\\n * (i.e. ascii bytes, prefixed with bytes4(keccak(\\\"Error(string))\\\"))\\n * Ref: https://docs.soliditylang.org/en/v0.8.2/control-structures.html?highlight=Error(string)#panic-via-assert-and-error-via-require\\n * @param _reason Reason for the reversion.\\n * @return Standard solidity revert data for the given reason.\\n */\\n function encodeRevertString(\\n string memory _reason\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return abi.encodeWithSignature(\\n \\\"Error(string)\\\",\\n _reason\\n );\\n }\\n}\\n\",\"keccak256\":\"0xfc64ec4a81fb50865b502a0004ed154e8598e1a313db77303fc95e41f536e6b7\",\"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 *\\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 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\\n )\\n {\\n bytes memory code;\\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 Full code of the contract.\\n */\\n function getCode(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes memory\\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 Size of the contract's code in bytes.\\n */\\n function getCodeSize(\\n address _address\\n )\\n internal\\n view\\n returns (\\n uint256\\n )\\n {\\n uint256 codeSize;\\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 Hash of the contract's code.\\n */\\n function getCodeHash(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n bytes32 codeHash;\\n assembly {\\n codeHash := extcodehash(_address)\\n }\\n\\n return codeHash;\\n }\\n\\n /**\\n * Creates a contract with some given initialization code.\\n * @param _code Contract initialization code.\\n * @return Address of the created contract.\\n */\\n function createContract(\\n bytes memory _code\\n )\\n internal\\n returns (\\n address\\n )\\n {\\n address created;\\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 to be generated by CREATE.\\n */\\n function getAddressForCREATE(\\n address _creator,\\n uint256 _nonce\\n )\\n internal\\n pure\\n returns (\\n 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 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 (\\n address\\n )\\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\":\"0xf29a67d78e61cb472d524b779b32cfcb39a587f4096500d5419e6425ed367d49\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506040516200317038038062003170833981016040819052620000349162000292565b600080546001600160a01b0319166001600160a01b03851617905560408051808201909152601181527027ab26afa9b0b332ba3ca1b432b1b5b2b960791b60208201526200008290620000d7565b600180546001600160a01b0319166001600160a01b039290921691909117905581516003556020820151600455604082015160055560608201516006558051600755620000ce620001b9565b50505062000337565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015620001395781810151838201526020016200011f565b50505050905090810190601f168015620001675780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156200018557600080fd5b505afa1580156200019a573d6000803e3d6000fd5b505050506040513d6020811015620001b157600080fd5b505192915050565b600d80546001600160a01b031990811673defa017defa017defa017defa017defa017defa09081179092557fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d6009819055600a819055600b819055600c8190556008805460ff191690556010819055600e8054831684179055600f8054831690931760ff60a01b1916909255601191909155600280549091169055565b60006020828403121562000268578081fd5b604051602081016001600160401b03811182821017156200028557fe5b6040529151825250919050565b600080600083850360c0811215620002a8578384fd5b84516001600160a01b0381168114620002bf578485fd5b93506080601f1982011215620002d3578283fd5b50604051608081016001600160401b0381118282101715620002f157fe5b806040525060208501518152604085015160208201526060850151604082015260808501516060820152809250506200032e8560a0860162000256565b90509250925092565b612e2980620003476000396000f3fe608060405234801561001057600080fd5b50600436106101c45760003560e01c80637cebbe94116100f957806399ccd98b11610097578063bdbf8c3611610071578063bdbf8c361461037e578063c1fb2ea214610386578063fcb6829b1461038e578063ffe73914146103a1576101c4565b806399ccd98b146103505780639be3ad67146103635780639dc9dc9314610376576101c4565b806385979f76116100d357806385979f761461031a5780638bb42e151461032d5780639058025614610340578063996d79a514610348576101c4565b80637cebbe94146102de5780638435035b146102e65780638540661f146102f9576101c4565b8063299ca478116101665780635a98c361116101405780635a98c3611461029b57806373509064146102a3578063741a33eb146102ab578063746c32f1146102be576101c4565b8063299ca478146102605780632a2a7adb14610275578063461a447814610288576101c4565b80631c4712a7116101a25780631c4712a71461022857806320160f3a1461023057806322bd64c01461023857806324749d5c1461024d576101c4565b806303daa959146101c9578063101185a4146101f257806314aa2ff714610207575b600080fd5b6101dc6101d7366004612604565b6103b4565b6040516101e99190612a58565b60405180910390f35b6101fa6103f9565b6040516101e99190612b43565b61021a610215366004612696565b610402565b6040516101e9929190612ad3565b6101dc61049a565b6101dc6104a0565b61024b610246366004612634565b6104a6565b005b6101dc61025b366004612578565b610509565b610268610524565b6040516101e99190612a61565b61024b610283366004612696565b610533565b6102686102963660046127af565b610541565b6101dc61061d565b610268610623565b61024b6102b9366004612655565b610632565b6102d16102cc3660046125b0565b61079f565b6040516101e99190612b30565b61024b6107be565b6101dc6102f4366004612578565b610815565b61030c6103073660046128a4565b610828565b6040516101e9929190612af7565b61030c6103283660046128a4565b6108a1565b6102d161033b366004612843565b6108f0565b6101dc6109f1565b6102686109f7565b61021a61035e3660046126d0565b610a06565b6102d16103713660046127f4565b610a99565b610268610bfb565b6101dc610c0a565b6101dc610c10565b61024b61039c3660046128fa565b610c27565b61030c6103af3660046128a4565b610e11565b6000619c4060005a905060006103c86109f7565b90506103d48186610e62565b93505060005a82039050808310156103f157601080548483030190555b505050919050565b60085460ff1690565b600f5460009060609060ff600160a01b9091041615156001141561042a5761042a6006610ef0565b619c4060005a9050600061043c6109f7565b905061044781610f09565b600061045b8261045684610f8e565b611019565b905061046781886110b3565b95509550505060005a8203905080831015610489576010805484019055610492565b60108054820190555b505050915091565b60045490565b600b5490565b600f5460ff600160a01b909104161515600114156104c8576104c86006610ef0565b61ea6060005a905060006104da6109f7565b90506104e7818686611139565b5060005a820390508083101561050257601080548483030190555b5050505050565b600061051c610517836111bb565b611246565b90505b919050565b6000546001600160a01b031681565b61053e60018261124a565b50565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156105a1578181015183820152602001610589565b50505050905090810190601f1680156105ce5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156105eb57600080fd5b505afa1580156105ff573d6000803e3d6000fd5b505050506040513d602081101561061557600080fd5b505192915050565b600a5490565b600e546001600160a01b031690565b600f5460ff600160a01b90910416151560011415610654576106546006610ef0565b600060018585601b0185856040516000815260200160405260405161067c9493929190612b12565b6020604051602081039080840390855afa15801561069e573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166106da576106da604051806060016040528060388152602001612ce260389139610533565b6106e381611260565b6106ed5750610799565b6106f6816112eb565b600f80546001600160a01b038381166001600160a01b031983161790925516600061075361072f6009602160991b01836102cc82610815565b60405160200161073f9190612a22565b604051602081830303815290604052611352565b600f80546001600160a01b0319166001600160a01b038516179055905061078a838261077e81611365565b8051906020012061137b565b6107958360006113b8565b5050505b50505050565b60606107b46107ad856111bb565b8484611429565b90505b9392505050565b600f5460ff600160a01b909104161515600114156107e0576107e06006610ef0565b60006107ea6109f7565b905060006107f782610f8e565b9050808160010111156108115761081182826001016113b8565b5050565b600061051c610823836111bb565b61144d565b600060606201388060005a60408051606081018252600f546001600160a01b0390811682528916602082015260019181019190915290915061086c81898989611451565b945094505060005a820390508083101561088d576010805484019055610896565b60108054820190555b505050935093915050565b60006060620186a060005a60408051606081018252600f5460ff600160a01b8204161515928201929092526001600160a01b039182168152908816602082015290915061086c81898989611451565b606033156108fd57600080fd5b600280546001600160a01b0319166001600160a01b038416179055610921846114e2565b600019601155600f80546001600160a01b0319166001600160a01b03858116919091179091556080850151161580156109c0576000806109648760c00151610402565b90925090506001600160a01b0382166109a45760008160405160200161098b929190612af7565b60405160208183030381529060405293505050506107b7565b60016109af83611365565b60405160200161098b929190612af7565b6000806109da8760a0015188608001518960c001516108a1565b91509150818160405160200161098b929190612af7565b60075490565b600f546001600160a01b031690565b600f5460009060609060ff600160a01b90910416151560011415610a2e57610a2e6006610ef0565b619c4060005a90506000610a406109f7565b9050610a4b81610f09565b6000610a58828989611554565b9050610a6481896110b3565b95509550505060005a8203905080831015610a86576010805484019055610a8f565b60108054820190555b5050509250929050565b600a546060907fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d14610ada5750604080516020810190915260008152610bf5565b600280546001600160a01b0319166001600160a01b038481169190911791829055604051630d15d41560e41b815291169063d15d415090610b1f903390600401612a61565b60206040518083038186803b158015610b3757600080fd5b505afa158015610b4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6f91906125e4565b610b945760405162461bcd60e51b8152600401610b8b90612bbf565b60405180910390fd5b610b9d836114e2565b610ba68361159a565b610bc757610bb26115f6565b50604080516020810190915260008152610bf5565b6000610be76003600001548560a001510385608001518660c001516108a1565b915050610bf26115f6565b90505b92915050565b600d546001600160a01b031690565b60095490565b6000610c22610c1d6109f7565b610f8e565b905090565b333014610c3357610e0c565b610c3c81611260565b610c6b57610c6b6005610c66604051806060016040528060348152602001612d9060349139611693565b61124a565b6001546040516352275acd60e11b81526001600160a01b039091169063a44eb59a90610c9b908590600401612b30565b60206040518083038186803b158015610cb357600080fd5b505afa158015610cc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ceb91906125e4565b610d1557610d156004610c666040518060a0016040528060768152602001612d1a60769139611693565b610d1e816112eb565b6000610d2983611352565b90506001600160a01b038116610d43573d6000803e3d6000fd5b6000610d4e82611365565b6001546040516352275acd60e11b81529192506001600160a01b03169063a44eb59a90610d7f908490600401612b30565b60206040518083038186803b158015610d9757600080fd5b505afa158015610dab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcf91906125e4565b610df957610df96004610c66604051806060016040528060308152602001612dc460309139611693565b6105028383610e0785611246565b61137b565b505050565b60006060619c4060005a60408051606081018252600e546001600160a01b039081168252600f549081166020830152600160a01b900460ff1615159181019190915290915061086c81898989611451565b6000610e6e83836116d6565b600254604051631aaf392f60e01b81526001600160a01b0390911690631aaf392f90610ea09086908690600401612a99565b60206040518083038186803b158015610eb857600080fd5b505afa158015610ecc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf2919061261c565b61053e816040518060200160405280600081525061124a565b600080610f585a6002602160991b0185604051602401610f299190612a61565b60408051601f198184030181529190526020810180516001600160e01b031663b1540a0160e01b1790526108a1565b91509150600081806020019051810190610f7291906125e4565b9050801580610f7f575082155b15610799576107996007610ef0565b6000610f9982611811565b60025460405163d126199f60e01b81526001600160a01b039091169063d126199f90610fc9908590600401612a61565b60206040518083038186803b158015610fe157600080fd5b505afa158015610ff5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051c919061261c565b60408051600280825260608201909252600091829190816020015b606081526020019060019003908161103457905050905061105484611958565b8160008151811061106157fe5b602002602001018190525061107583611982565b8160018151811061108257fe5b6020026020010181905250600061109882611995565b90506110aa81805190602001206119d9565b95945050505050565b600060606110d56110c26109f7565b6110cd610c1d6109f7565b6001016113b8565b60408051606081018252600f5460ff600160a01b8204161515928201929092526001600160a01b039182168152908516602082015260008061111b835a898960016119dc565b915091508161112b57600061112d565b865b97909650945050505050565b806111448484610e62565b141561114f57610e0c565b6111598383611c4a565b600254604051635c17d62960e01b81526001600160a01b0390911690635c17d6299061118d90869086908690600401612ab2565b600060405180830381600087803b1580156111a757600080fd5b505af1158015610795573d6000803e3d6000fd5b60006111c682611811565b600254604051637c8ee70360e01b81526001600160a01b0390911690637c8ee703906111f6908590600401612a61565b60206040518083038186803b15801561120e57600080fd5b505afa158015611222573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051c9190612594565b3f90565b60006112568383611d5c565b9050805160208201fd5b600061126b82611811565b6002546040516307a1294560e01b81526001600160a01b03909116906307a129459061129b908590600401612a61565b60206040518083038186803b1580156112b357600080fd5b505afa1580156112c7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051c91906125e4565b6112f481611811565b600254604051637e78a4d160e11b81526001600160a01b039091169063fcf149a290611324908490600401612a61565b600060405180830381600087803b15801561133e57600080fd5b505af1158015610502573d6000803e3d6000fd5b6000808251602084016000f09392505050565b606061051c8260006113768561144d565b611429565b61138483611e05565b6002546040516368510af960e11b81526001600160a01b039091169063d0a215f29061118d90869086908690600401612a75565b6113c182611e05565b6002546040516374855dc360e11b81526001600160a01b039091169063e90abb86906113f39085908590600401612a99565b600060405180830381600087803b15801561140d57600080fd5b505af1158015611421573d6000803e3d6000fd5b505050505050565b6060806040519050602083018101604052828152828460208301873c949350505050565b3b90565b6000606073ffffffffffffffffffffffffffffffffffff0000841673deaddeaddeaddeaddeaddeaddeaddeaddead000014156114a05750506040805160208101909152600081526001906114d9565b60006064856001600160a01b0316106114c1576114bc856111bb565b6114c3565b845b90506114d38787838760006119dc565b92509250505b94509492505050565b80516009556020810151600a5560a0810151600c5560408101516008805460ff19166001838181111561151157fe5b02179055506060810151600d80546001600160a01b0319166001600160a01b03909216919091179055600554600b5560a081015161154e90611f14565b60115550565b60008060ff60f81b85848680519060200120604051602001611579949392919061299e565b6040516020818303038152906040528051906020012090506110aa816119d9565b60007fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d826020015114156115d05750600061051f565b6115e28260a001518360400151611f27565b6115ee5750600061051f565b506001919050565b600d80546001600160a01b031990811673defa017defa017defa017defa017defa017defa09081179092557fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d6009819055600a819055600b819055600c8190556008805460ff191690556010819055600e8054831684179055600f8054831690931760ff60a01b1916909255601191909155600280549091169055565b6060816040516024016116a69190612b30565b60408051601f198184030181529190526020810180516001600160e01b031662461bcd60e51b1790529050919050565b6175305a10156116ea576116ea6000610ef0565b600254604051630ad2267960e01b81526001600160a01b0390911690630ad226799061171c9085908590600401612a99565b60206040518083038186803b15801561173457600080fd5b505afa158015611748573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176c91906125e4565b61177a5761177a6003610ef0565b600254604051632bcdee1960e21b81526000916001600160a01b03169063af37b864906117ad9086908690600401612a99565b602060405180830381600087803b1580156117c757600080fd5b505af11580156117db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ff91906125e4565b905080610e0c57610e0c614e20611f57565b6175305a1015611825576118256000610ef0565b60025460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf90611855908490600401612a61565b60206040518083038186803b15801561186d57600080fd5b505afa158015611881573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118a591906125e4565b6118b3576118b36003610ef0565b600254604051633ecdecc760e21b81526000916001600160a01b03169063fb37b31c906118e4908590600401612a61565b602060405180830381600087803b1580156118fe57600080fd5b505af1158015611912573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061193691906125e4565b905080610811576108116175306064611951610823866111bb565b0201611f57565b606061051c8260405160200161196e9190612981565b604051602081830303815290604052611f77565b606061051c61199083611fc9565b611f77565b606060006119a2836120cd565b90506119b0815160c06121cd565b816040516020016119c29291906129f3565b604051602081830303815290604052915050919050565b90565b6040805160608082018352600e546001600160a01b039081168352600f549081166020840152600160a01b900460ff1615159282019290925260009190611a23818961231d565b6011546000611a3189611f14565b60118190559050600060608715611aed57604051309063fcb6829b60e01b90611a62908e908d908f90602401612c2b565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051611aa091906129d7565b6000604051808303816000865af19150503d8060008114611add576040519150601f19603f3d011682016040523d82523d6000602084013e611ae2565b606091505b509092509050611b50565b896001600160a01b03168b8a604051611b0691906129d7565b60006040518083038160008787f1925050503d8060008114611b44576040519150601f19603f3d011682016040523d82523d6000602084013e611b49565b606091505b5090925090505b611b5a8c8661231d565b60115482611c3257600080600080611b71866123d1565b929650909450925090506003846007811115611b8957fe5b1415611b9857611b9884610ef0565b6001846007811115611ba657fe5b1480611bbd57506004846007811115611bbb57fe5b145b80611bd357506006846007811115611bd157fe5b145b80611be957506007846007811115611be757fe5b145b15611bf45760108290555b6001846007811115611c0257fe5b1480611c0b57508c5b15611c1857809550611c2b565b6040518060200160405280600081525095505b5090925050505b90920390920360115590999098509650505050505050565b611c5482826116d6565b60025460405163af3dc01160e01b81526000916001600160a01b03169063af3dc01190611c879086908690600401612a99565b602060405180830381600087803b158015611ca157600080fd5b505af1158015611cb5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cd991906125e4565b905080610e0c57611ce983611e05565b600260009054906101000a90046001600160a01b03166001600160a01b031663c3fd9b256040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611d3957600080fd5b505af1158015611d4d573d6000803e3d6000fd5b50505050610e0c614e20611f57565b60606000836007811115611d6c57fe5b1415611d875750604080516020810190915260008152610bf5565b6003836007811115611d9557fe5b1415611dd357604080516020808201835260008083529251611dbd9387939092839201612b57565b6040516020818303038152906040529050610bf5565b601154601054604051611dee92869290918690602001612b93565b604051602081830303815290604052905092915050565b611e0e81611811565b60025460405163011b1f7960e41b81526000916001600160a01b0316906311b1f79090611e3f908590600401612a61565b602060405180830381600087803b158015611e5957600080fd5b505af1158015611e6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e9191906125e4565b90508061081157600260009054906101000a90046001600160a01b03166001600160a01b03166333f943056040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611ee857600080fd5b505af1158015611efc573d6000803e3d6000fd5b505050506108116175306064611951610823866111bb565b60005a8210611f23575a61051c565b5090565b600454600090831115611f3c57506000610bf5565b600354831015611f4e57506000610bf5565b50600192915050565b601154811115611f6b57611f6b6002610ef0565b60118054919091039055565b60608082516001148015611f9f5750608083600081518110611f9557fe5b016020015160f81c105b15611fab57508161051c565b611fb7835160806121cd565b83604051602001611dee9291906129f3565b6060600082604051602001611fde9190612a58565b604051602081830303815290604052905060005b60208110156120285781818151811061200757fe5b01602001516001600160f81b0319161561202057612028565b600101611ff2565b6000816020036001600160401b038111801561204357600080fd5b506040519080825280601f01601f19166020018201604052801561206e576020820181803683370190505b50905060005b81518110156120c457835160018401938591811061208e57fe5b602001015160f81c60f81b8282815181106120a557fe5b60200101906001600160f81b031916908160001a905350600101612074565b50949350505050565b60608151600014156120ee575060408051600081526020810190915261051f565b6000805b83518110156121215783818151811061210757fe5b6020026020010151518201915080806001019150506120f2565b6000826001600160401b038111801561213957600080fd5b506040519080825280601f01601f191660200182016040528015612164576020820181803683370190505b50600092509050602081015b85518310156120c457600086848151811061218757fe5b6020026020010151905060006020820190506121a583828451612424565b8785815181106121b157fe5b6020026020010151518301925050508280600101935050612170565b6060806038841015612227576040805160018082528183019092529060208201818036833701905050905082840160f81b8160008151811061220b57fe5b60200101906001600160f81b031916908160001a905350610bf2565b600060015b80868161223557fe5b041561224a576001909101906101000261222c565b816001016001600160401b038111801561226357600080fd5b506040519080825280601f01601f19166020018201604052801561228e576020820181803683370190505b50925084820160370160f81b836000815181106122a757fe5b60200101906001600160f81b031916908160001a905350600190505b818111612313576101008183036101000a87816122dc57fe5b04816122e457fe5b0660f81b8382815181106122f457fe5b60200101906001600160f81b031916908160001a9053506001016122c3565b5050905092915050565b805182516001600160a01b03908116911614612355578051600e80546001600160a01b0319166001600160a01b039092169190911790555b80602001516001600160a01b031682602001516001600160a01b03161461239b576020810151600f80546001600160a01b0319166001600160a01b039092169190911790555b8060400151151582604001511515146108115760400151600f8054911515600160a01b0260ff60a01b1990921691909117905550565b60008060006060845160001415612400575050604080516020810190915260008082529250829150819061241d565b848060200190518101906124149190612712565b93509350935093505b9193509193565b8282825b60208110612447578151835260209283019290910190601f1901612428565b905182516020929092036101000a6000190180199091169116179052505050565b600061247b61247684612c7f565b612c5c565b905082815283838301111561248f57600080fd5b828260208301376000602084830101529392505050565b803561051f81612ccc565b600082601f8301126124c1578081fd5b610bf283833560208501612468565b80356002811061051f57600080fd5b600060e082840312156124f0578081fd5b6124fa60e0612c5c565b90508135815260208201356020820152612516604083016124d0565b6040820152612527606083016124a6565b6060820152612538608083016124a6565b608082015260a082013560a082015260c08201356001600160401b0381111561256057600080fd5b61256c848285016124b1565b60c08301525092915050565b600060208284031215612589578081fd5b8135610bf281612ccc565b6000602082840312156125a5578081fd5b8151610bf281612ccc565b6000806000606084860312156125c4578182fd5b83356125cf81612ccc565b95602085013595506040909401359392505050565b6000602082840312156125f5578081fd5b81518015158114610bf2578182fd5b600060208284031215612615578081fd5b5035919050565b60006020828403121561262d578081fd5b5051919050565b60008060408385031215612646578182fd5b50508035926020909101359150565b6000806000806080858703121561266a578081fd5b84359350602085013560ff81168114612681578182fd5b93969395505050506040820135916060013590565b6000602082840312156126a7578081fd5b81356001600160401b038111156126bc578182fd5b6126c8848285016124b1565b949350505050565b600080604083850312156126e2578182fd5b82356001600160401b038111156126f7578283fd5b612703858286016124b1565b95602094909401359450505050565b60008060008060808587031215612727578182fd5b845160088110612735578283fd5b80945050602085015192506040850151915060608501516001600160401b0381111561275f578182fd5b8501601f8101871361276f578182fd5b805161277d61247682612c7f565b818152886020838501011115612791578384fd5b6127a2826020830160208601612ca0565b9598949750929550505050565b6000602082840312156127c0578081fd5b81356001600160401b038111156127d5578182fd5b8201601f810184136127e5578182fd5b6126c884823560208401612468565b60008060408385031215612806578182fd5b82356001600160401b0381111561281b578283fd5b612827858286016124df565b925050602083013561283881612ccc565b809150509250929050565b600080600060608486031215612857578081fd5b83356001600160401b0381111561286c578182fd5b612878868287016124df565b935050602084013561288981612ccc565b9150604084013561289981612ccc565b809150509250925092565b6000806000606084860312156128b8578081fd5b8335925060208401356128ca81612ccc565b915060408401356001600160401b038111156128e4578182fd5b6128f0868287016124b1565b9150509250925092565b60008060006060848603121561290e578081fd5b8335925060208401356001600160401b0381111561292a578182fd5b612936868287016124b1565b925050604084013561289981612ccc565b6000815180845261295f816020860160208601612ca0565b601f01601f19169290920160200192915050565b6008811061297d57fe5b9052565b60609190911b6bffffffffffffffffffffffff1916815260140190565b6001600160f81b031994909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b600082516129e9818460208701612ca0565b9190910192915050565b60008351612a05818460208801612ca0565b835190830190612a19818360208801612ca0565b01949350505050565b6c600d380380600d6000396000f360981b81528151600090612a4b81600d850160208701612ca0565b91909101600d0192915050565b90815260200190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b03831681526040602082018190526000906107b490830184612947565b60008315158252604060208301526107b46040830184612947565b93845260ff9290921660208401526040830152606082015260800190565b600060208252610bf26020830184612947565b6020810160028310612b5157fe5b91905290565b6000612b638287612973565b60ff8516602083015260ff8416604083015260806060830152612b896080830184612947565b9695505050505050565b6000612b9f8287612973565b84602083015283604083015260806060830152612b896080830184612947565b60208082526046908201527f4f6e6c792061757468656e746963617465642061646472657373657320696e2060408201527f6f766d53746174654d616e616765722063616e2063616c6c20746869732066756060820152653731ba34b7b760d11b608082015260a00190565b600084825260606020830152612c446060830185612947565b905060018060a01b0383166040830152949350505050565b6040518181016001600160401b0381118282101715612c7757fe5b604052919050565b60006001600160401b03821115612c9257fe5b50601f01601f191660200190565b60005b83811015612cbb578181015183820152602001612ca3565b838111156107995750506000910152565b6001600160a01b038116811461053e57600080fdfe5369676e61747572652070726f766964656420666f7220454f4120636f6e7472616374206372656174696f6e20697320696e76616c69642e436f6e7472616374206372656174696f6e20636f646520636f6e7461696e7320756e73616665206f70636f6465732e2044696420796f75207573652074686520726967687420636f6d70696c6572206f72207061737320616e20756e7361666520636f6e7374727563746f7220617267756d656e743f4120636f6e74726163742068617320616c7265616479206265656e206465706c6f79656420746f20746869732061646472657373436f6e7374727563746f7220617474656d7074656420746f206465706c6f7920756e736166652062797465636f64652ea264697066735822122037659553997f9c397990c7f057ea0856b2adcea1b4d101ba588eaa7204c18d2f64736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101c45760003560e01c80637cebbe94116100f957806399ccd98b11610097578063bdbf8c3611610071578063bdbf8c361461037e578063c1fb2ea214610386578063fcb6829b1461038e578063ffe73914146103a1576101c4565b806399ccd98b146103505780639be3ad67146103635780639dc9dc9314610376576101c4565b806385979f76116100d357806385979f761461031a5780638bb42e151461032d5780639058025614610340578063996d79a514610348576101c4565b80637cebbe94146102de5780638435035b146102e65780638540661f146102f9576101c4565b8063299ca478116101665780635a98c361116101405780635a98c3611461029b57806373509064146102a3578063741a33eb146102ab578063746c32f1146102be576101c4565b8063299ca478146102605780632a2a7adb14610275578063461a447814610288576101c4565b80631c4712a7116101a25780631c4712a71461022857806320160f3a1461023057806322bd64c01461023857806324749d5c1461024d576101c4565b806303daa959146101c9578063101185a4146101f257806314aa2ff714610207575b600080fd5b6101dc6101d7366004612604565b6103b4565b6040516101e99190612a58565b60405180910390f35b6101fa6103f9565b6040516101e99190612b43565b61021a610215366004612696565b610402565b6040516101e9929190612ad3565b6101dc61049a565b6101dc6104a0565b61024b610246366004612634565b6104a6565b005b6101dc61025b366004612578565b610509565b610268610524565b6040516101e99190612a61565b61024b610283366004612696565b610533565b6102686102963660046127af565b610541565b6101dc61061d565b610268610623565b61024b6102b9366004612655565b610632565b6102d16102cc3660046125b0565b61079f565b6040516101e99190612b30565b61024b6107be565b6101dc6102f4366004612578565b610815565b61030c6103073660046128a4565b610828565b6040516101e9929190612af7565b61030c6103283660046128a4565b6108a1565b6102d161033b366004612843565b6108f0565b6101dc6109f1565b6102686109f7565b61021a61035e3660046126d0565b610a06565b6102d16103713660046127f4565b610a99565b610268610bfb565b6101dc610c0a565b6101dc610c10565b61024b61039c3660046128fa565b610c27565b61030c6103af3660046128a4565b610e11565b6000619c4060005a905060006103c86109f7565b90506103d48186610e62565b93505060005a82039050808310156103f157601080548483030190555b505050919050565b60085460ff1690565b600f5460009060609060ff600160a01b9091041615156001141561042a5761042a6006610ef0565b619c4060005a9050600061043c6109f7565b905061044781610f09565b600061045b8261045684610f8e565b611019565b905061046781886110b3565b95509550505060005a8203905080831015610489576010805484019055610492565b60108054820190555b505050915091565b60045490565b600b5490565b600f5460ff600160a01b909104161515600114156104c8576104c86006610ef0565b61ea6060005a905060006104da6109f7565b90506104e7818686611139565b5060005a820390508083101561050257601080548483030190555b5050505050565b600061051c610517836111bb565b611246565b90505b919050565b6000546001600160a01b031681565b61053e60018261124a565b50565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156105a1578181015183820152602001610589565b50505050905090810190601f1680156105ce5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156105eb57600080fd5b505afa1580156105ff573d6000803e3d6000fd5b505050506040513d602081101561061557600080fd5b505192915050565b600a5490565b600e546001600160a01b031690565b600f5460ff600160a01b90910416151560011415610654576106546006610ef0565b600060018585601b0185856040516000815260200160405260405161067c9493929190612b12565b6020604051602081039080840390855afa15801561069e573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166106da576106da604051806060016040528060388152602001612ce260389139610533565b6106e381611260565b6106ed5750610799565b6106f6816112eb565b600f80546001600160a01b038381166001600160a01b031983161790925516600061075361072f6009602160991b01836102cc82610815565b60405160200161073f9190612a22565b604051602081830303815290604052611352565b600f80546001600160a01b0319166001600160a01b038516179055905061078a838261077e81611365565b8051906020012061137b565b6107958360006113b8565b5050505b50505050565b60606107b46107ad856111bb565b8484611429565b90505b9392505050565b600f5460ff600160a01b909104161515600114156107e0576107e06006610ef0565b60006107ea6109f7565b905060006107f782610f8e565b9050808160010111156108115761081182826001016113b8565b5050565b600061051c610823836111bb565b61144d565b600060606201388060005a60408051606081018252600f546001600160a01b0390811682528916602082015260019181019190915290915061086c81898989611451565b945094505060005a820390508083101561088d576010805484019055610896565b60108054820190555b505050935093915050565b60006060620186a060005a60408051606081018252600f5460ff600160a01b8204161515928201929092526001600160a01b039182168152908816602082015290915061086c81898989611451565b606033156108fd57600080fd5b600280546001600160a01b0319166001600160a01b038416179055610921846114e2565b600019601155600f80546001600160a01b0319166001600160a01b03858116919091179091556080850151161580156109c0576000806109648760c00151610402565b90925090506001600160a01b0382166109a45760008160405160200161098b929190612af7565b60405160208183030381529060405293505050506107b7565b60016109af83611365565b60405160200161098b929190612af7565b6000806109da8760a0015188608001518960c001516108a1565b91509150818160405160200161098b929190612af7565b60075490565b600f546001600160a01b031690565b600f5460009060609060ff600160a01b90910416151560011415610a2e57610a2e6006610ef0565b619c4060005a90506000610a406109f7565b9050610a4b81610f09565b6000610a58828989611554565b9050610a6481896110b3565b95509550505060005a8203905080831015610a86576010805484019055610a8f565b60108054820190555b5050509250929050565b600a546060907fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d14610ada5750604080516020810190915260008152610bf5565b600280546001600160a01b0319166001600160a01b038481169190911791829055604051630d15d41560e41b815291169063d15d415090610b1f903390600401612a61565b60206040518083038186803b158015610b3757600080fd5b505afa158015610b4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6f91906125e4565b610b945760405162461bcd60e51b8152600401610b8b90612bbf565b60405180910390fd5b610b9d836114e2565b610ba68361159a565b610bc757610bb26115f6565b50604080516020810190915260008152610bf5565b6000610be76003600001548560a001510385608001518660c001516108a1565b915050610bf26115f6565b90505b92915050565b600d546001600160a01b031690565b60095490565b6000610c22610c1d6109f7565b610f8e565b905090565b333014610c3357610e0c565b610c3c81611260565b610c6b57610c6b6005610c66604051806060016040528060348152602001612d9060349139611693565b61124a565b6001546040516352275acd60e11b81526001600160a01b039091169063a44eb59a90610c9b908590600401612b30565b60206040518083038186803b158015610cb357600080fd5b505afa158015610cc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ceb91906125e4565b610d1557610d156004610c666040518060a0016040528060768152602001612d1a60769139611693565b610d1e816112eb565b6000610d2983611352565b90506001600160a01b038116610d43573d6000803e3d6000fd5b6000610d4e82611365565b6001546040516352275acd60e11b81529192506001600160a01b03169063a44eb59a90610d7f908490600401612b30565b60206040518083038186803b158015610d9757600080fd5b505afa158015610dab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcf91906125e4565b610df957610df96004610c66604051806060016040528060308152602001612dc460309139611693565b6105028383610e0785611246565b61137b565b505050565b60006060619c4060005a60408051606081018252600e546001600160a01b039081168252600f549081166020830152600160a01b900460ff1615159181019190915290915061086c81898989611451565b6000610e6e83836116d6565b600254604051631aaf392f60e01b81526001600160a01b0390911690631aaf392f90610ea09086908690600401612a99565b60206040518083038186803b158015610eb857600080fd5b505afa158015610ecc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf2919061261c565b61053e816040518060200160405280600081525061124a565b600080610f585a6002602160991b0185604051602401610f299190612a61565b60408051601f198184030181529190526020810180516001600160e01b031663b1540a0160e01b1790526108a1565b91509150600081806020019051810190610f7291906125e4565b9050801580610f7f575082155b15610799576107996007610ef0565b6000610f9982611811565b60025460405163d126199f60e01b81526001600160a01b039091169063d126199f90610fc9908590600401612a61565b60206040518083038186803b158015610fe157600080fd5b505afa158015610ff5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051c919061261c565b60408051600280825260608201909252600091829190816020015b606081526020019060019003908161103457905050905061105484611958565b8160008151811061106157fe5b602002602001018190525061107583611982565b8160018151811061108257fe5b6020026020010181905250600061109882611995565b90506110aa81805190602001206119d9565b95945050505050565b600060606110d56110c26109f7565b6110cd610c1d6109f7565b6001016113b8565b60408051606081018252600f5460ff600160a01b8204161515928201929092526001600160a01b039182168152908516602082015260008061111b835a898960016119dc565b915091508161112b57600061112d565b865b97909650945050505050565b806111448484610e62565b141561114f57610e0c565b6111598383611c4a565b600254604051635c17d62960e01b81526001600160a01b0390911690635c17d6299061118d90869086908690600401612ab2565b600060405180830381600087803b1580156111a757600080fd5b505af1158015610795573d6000803e3d6000fd5b60006111c682611811565b600254604051637c8ee70360e01b81526001600160a01b0390911690637c8ee703906111f6908590600401612a61565b60206040518083038186803b15801561120e57600080fd5b505afa158015611222573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051c9190612594565b3f90565b60006112568383611d5c565b9050805160208201fd5b600061126b82611811565b6002546040516307a1294560e01b81526001600160a01b03909116906307a129459061129b908590600401612a61565b60206040518083038186803b1580156112b357600080fd5b505afa1580156112c7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051c91906125e4565b6112f481611811565b600254604051637e78a4d160e11b81526001600160a01b039091169063fcf149a290611324908490600401612a61565b600060405180830381600087803b15801561133e57600080fd5b505af1158015610502573d6000803e3d6000fd5b6000808251602084016000f09392505050565b606061051c8260006113768561144d565b611429565b61138483611e05565b6002546040516368510af960e11b81526001600160a01b039091169063d0a215f29061118d90869086908690600401612a75565b6113c182611e05565b6002546040516374855dc360e11b81526001600160a01b039091169063e90abb86906113f39085908590600401612a99565b600060405180830381600087803b15801561140d57600080fd5b505af1158015611421573d6000803e3d6000fd5b505050505050565b6060806040519050602083018101604052828152828460208301873c949350505050565b3b90565b6000606073ffffffffffffffffffffffffffffffffffff0000841673deaddeaddeaddeaddeaddeaddeaddeaddead000014156114a05750506040805160208101909152600081526001906114d9565b60006064856001600160a01b0316106114c1576114bc856111bb565b6114c3565b845b90506114d38787838760006119dc565b92509250505b94509492505050565b80516009556020810151600a5560a0810151600c5560408101516008805460ff19166001838181111561151157fe5b02179055506060810151600d80546001600160a01b0319166001600160a01b03909216919091179055600554600b5560a081015161154e90611f14565b60115550565b60008060ff60f81b85848680519060200120604051602001611579949392919061299e565b6040516020818303038152906040528051906020012090506110aa816119d9565b60007fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d826020015114156115d05750600061051f565b6115e28260a001518360400151611f27565b6115ee5750600061051f565b506001919050565b600d80546001600160a01b031990811673defa017defa017defa017defa017defa017defa09081179092557fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d6009819055600a819055600b819055600c8190556008805460ff191690556010819055600e8054831684179055600f8054831690931760ff60a01b1916909255601191909155600280549091169055565b6060816040516024016116a69190612b30565b60408051601f198184030181529190526020810180516001600160e01b031662461bcd60e51b1790529050919050565b6175305a10156116ea576116ea6000610ef0565b600254604051630ad2267960e01b81526001600160a01b0390911690630ad226799061171c9085908590600401612a99565b60206040518083038186803b15801561173457600080fd5b505afa158015611748573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176c91906125e4565b61177a5761177a6003610ef0565b600254604051632bcdee1960e21b81526000916001600160a01b03169063af37b864906117ad9086908690600401612a99565b602060405180830381600087803b1580156117c757600080fd5b505af11580156117db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ff91906125e4565b905080610e0c57610e0c614e20611f57565b6175305a1015611825576118256000610ef0565b60025460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf90611855908490600401612a61565b60206040518083038186803b15801561186d57600080fd5b505afa158015611881573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118a591906125e4565b6118b3576118b36003610ef0565b600254604051633ecdecc760e21b81526000916001600160a01b03169063fb37b31c906118e4908590600401612a61565b602060405180830381600087803b1580156118fe57600080fd5b505af1158015611912573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061193691906125e4565b905080610811576108116175306064611951610823866111bb565b0201611f57565b606061051c8260405160200161196e9190612981565b604051602081830303815290604052611f77565b606061051c61199083611fc9565b611f77565b606060006119a2836120cd565b90506119b0815160c06121cd565b816040516020016119c29291906129f3565b604051602081830303815290604052915050919050565b90565b6040805160608082018352600e546001600160a01b039081168352600f549081166020840152600160a01b900460ff1615159282019290925260009190611a23818961231d565b6011546000611a3189611f14565b60118190559050600060608715611aed57604051309063fcb6829b60e01b90611a62908e908d908f90602401612c2b565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051611aa091906129d7565b6000604051808303816000865af19150503d8060008114611add576040519150601f19603f3d011682016040523d82523d6000602084013e611ae2565b606091505b509092509050611b50565b896001600160a01b03168b8a604051611b0691906129d7565b60006040518083038160008787f1925050503d8060008114611b44576040519150601f19603f3d011682016040523d82523d6000602084013e611b49565b606091505b5090925090505b611b5a8c8661231d565b60115482611c3257600080600080611b71866123d1565b929650909450925090506003846007811115611b8957fe5b1415611b9857611b9884610ef0565b6001846007811115611ba657fe5b1480611bbd57506004846007811115611bbb57fe5b145b80611bd357506006846007811115611bd157fe5b145b80611be957506007846007811115611be757fe5b145b15611bf45760108290555b6001846007811115611c0257fe5b1480611c0b57508c5b15611c1857809550611c2b565b6040518060200160405280600081525095505b5090925050505b90920390920360115590999098509650505050505050565b611c5482826116d6565b60025460405163af3dc01160e01b81526000916001600160a01b03169063af3dc01190611c879086908690600401612a99565b602060405180830381600087803b158015611ca157600080fd5b505af1158015611cb5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cd991906125e4565b905080610e0c57611ce983611e05565b600260009054906101000a90046001600160a01b03166001600160a01b031663c3fd9b256040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611d3957600080fd5b505af1158015611d4d573d6000803e3d6000fd5b50505050610e0c614e20611f57565b60606000836007811115611d6c57fe5b1415611d875750604080516020810190915260008152610bf5565b6003836007811115611d9557fe5b1415611dd357604080516020808201835260008083529251611dbd9387939092839201612b57565b6040516020818303038152906040529050610bf5565b601154601054604051611dee92869290918690602001612b93565b604051602081830303815290604052905092915050565b611e0e81611811565b60025460405163011b1f7960e41b81526000916001600160a01b0316906311b1f79090611e3f908590600401612a61565b602060405180830381600087803b158015611e5957600080fd5b505af1158015611e6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e9191906125e4565b90508061081157600260009054906101000a90046001600160a01b03166001600160a01b03166333f943056040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611ee857600080fd5b505af1158015611efc573d6000803e3d6000fd5b505050506108116175306064611951610823866111bb565b60005a8210611f23575a61051c565b5090565b600454600090831115611f3c57506000610bf5565b600354831015611f4e57506000610bf5565b50600192915050565b601154811115611f6b57611f6b6002610ef0565b60118054919091039055565b60608082516001148015611f9f5750608083600081518110611f9557fe5b016020015160f81c105b15611fab57508161051c565b611fb7835160806121cd565b83604051602001611dee9291906129f3565b6060600082604051602001611fde9190612a58565b604051602081830303815290604052905060005b60208110156120285781818151811061200757fe5b01602001516001600160f81b0319161561202057612028565b600101611ff2565b6000816020036001600160401b038111801561204357600080fd5b506040519080825280601f01601f19166020018201604052801561206e576020820181803683370190505b50905060005b81518110156120c457835160018401938591811061208e57fe5b602001015160f81c60f81b8282815181106120a557fe5b60200101906001600160f81b031916908160001a905350600101612074565b50949350505050565b60608151600014156120ee575060408051600081526020810190915261051f565b6000805b83518110156121215783818151811061210757fe5b6020026020010151518201915080806001019150506120f2565b6000826001600160401b038111801561213957600080fd5b506040519080825280601f01601f191660200182016040528015612164576020820181803683370190505b50600092509050602081015b85518310156120c457600086848151811061218757fe5b6020026020010151905060006020820190506121a583828451612424565b8785815181106121b157fe5b6020026020010151518301925050508280600101935050612170565b6060806038841015612227576040805160018082528183019092529060208201818036833701905050905082840160f81b8160008151811061220b57fe5b60200101906001600160f81b031916908160001a905350610bf2565b600060015b80868161223557fe5b041561224a576001909101906101000261222c565b816001016001600160401b038111801561226357600080fd5b506040519080825280601f01601f19166020018201604052801561228e576020820181803683370190505b50925084820160370160f81b836000815181106122a757fe5b60200101906001600160f81b031916908160001a905350600190505b818111612313576101008183036101000a87816122dc57fe5b04816122e457fe5b0660f81b8382815181106122f457fe5b60200101906001600160f81b031916908160001a9053506001016122c3565b5050905092915050565b805182516001600160a01b03908116911614612355578051600e80546001600160a01b0319166001600160a01b039092169190911790555b80602001516001600160a01b031682602001516001600160a01b03161461239b576020810151600f80546001600160a01b0319166001600160a01b039092169190911790555b8060400151151582604001511515146108115760400151600f8054911515600160a01b0260ff60a01b1990921691909117905550565b60008060006060845160001415612400575050604080516020810190915260008082529250829150819061241d565b848060200190518101906124149190612712565b93509350935093505b9193509193565b8282825b60208110612447578151835260209283019290910190601f1901612428565b905182516020929092036101000a6000190180199091169116179052505050565b600061247b61247684612c7f565b612c5c565b905082815283838301111561248f57600080fd5b828260208301376000602084830101529392505050565b803561051f81612ccc565b600082601f8301126124c1578081fd5b610bf283833560208501612468565b80356002811061051f57600080fd5b600060e082840312156124f0578081fd5b6124fa60e0612c5c565b90508135815260208201356020820152612516604083016124d0565b6040820152612527606083016124a6565b6060820152612538608083016124a6565b608082015260a082013560a082015260c08201356001600160401b0381111561256057600080fd5b61256c848285016124b1565b60c08301525092915050565b600060208284031215612589578081fd5b8135610bf281612ccc565b6000602082840312156125a5578081fd5b8151610bf281612ccc565b6000806000606084860312156125c4578182fd5b83356125cf81612ccc565b95602085013595506040909401359392505050565b6000602082840312156125f5578081fd5b81518015158114610bf2578182fd5b600060208284031215612615578081fd5b5035919050565b60006020828403121561262d578081fd5b5051919050565b60008060408385031215612646578182fd5b50508035926020909101359150565b6000806000806080858703121561266a578081fd5b84359350602085013560ff81168114612681578182fd5b93969395505050506040820135916060013590565b6000602082840312156126a7578081fd5b81356001600160401b038111156126bc578182fd5b6126c8848285016124b1565b949350505050565b600080604083850312156126e2578182fd5b82356001600160401b038111156126f7578283fd5b612703858286016124b1565b95602094909401359450505050565b60008060008060808587031215612727578182fd5b845160088110612735578283fd5b80945050602085015192506040850151915060608501516001600160401b0381111561275f578182fd5b8501601f8101871361276f578182fd5b805161277d61247682612c7f565b818152886020838501011115612791578384fd5b6127a2826020830160208601612ca0565b9598949750929550505050565b6000602082840312156127c0578081fd5b81356001600160401b038111156127d5578182fd5b8201601f810184136127e5578182fd5b6126c884823560208401612468565b60008060408385031215612806578182fd5b82356001600160401b0381111561281b578283fd5b612827858286016124df565b925050602083013561283881612ccc565b809150509250929050565b600080600060608486031215612857578081fd5b83356001600160401b0381111561286c578182fd5b612878868287016124df565b935050602084013561288981612ccc565b9150604084013561289981612ccc565b809150509250925092565b6000806000606084860312156128b8578081fd5b8335925060208401356128ca81612ccc565b915060408401356001600160401b038111156128e4578182fd5b6128f0868287016124b1565b9150509250925092565b60008060006060848603121561290e578081fd5b8335925060208401356001600160401b0381111561292a578182fd5b612936868287016124b1565b925050604084013561289981612ccc565b6000815180845261295f816020860160208601612ca0565b601f01601f19169290920160200192915050565b6008811061297d57fe5b9052565b60609190911b6bffffffffffffffffffffffff1916815260140190565b6001600160f81b031994909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b600082516129e9818460208701612ca0565b9190910192915050565b60008351612a05818460208801612ca0565b835190830190612a19818360208801612ca0565b01949350505050565b6c600d380380600d6000396000f360981b81528151600090612a4b81600d850160208701612ca0565b91909101600d0192915050565b90815260200190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b03831681526040602082018190526000906107b490830184612947565b60008315158252604060208301526107b46040830184612947565b93845260ff9290921660208401526040830152606082015260800190565b600060208252610bf26020830184612947565b6020810160028310612b5157fe5b91905290565b6000612b638287612973565b60ff8516602083015260ff8416604083015260806060830152612b896080830184612947565b9695505050505050565b6000612b9f8287612973565b84602083015283604083015260806060830152612b896080830184612947565b60208082526046908201527f4f6e6c792061757468656e746963617465642061646472657373657320696e2060408201527f6f766d53746174654d616e616765722063616e2063616c6c20746869732066756060820152653731ba34b7b760d11b608082015260a00190565b600084825260606020830152612c446060830185612947565b905060018060a01b0383166040830152949350505050565b6040518181016001600160401b0381118282101715612c7757fe5b604052919050565b60006001600160401b03821115612c9257fe5b50601f01601f191660200190565b60005b83811015612cbb578181015183820152602001612ca3565b838111156107995750506000910152565b6001600160a01b038116811461053e57600080fdfe5369676e61747572652070726f766964656420666f7220454f4120636f6e7472616374206372656174696f6e20697320696e76616c69642e436f6e7472616374206372656174696f6e20636f646520636f6e7461696e7320756e73616665206f70636f6465732e2044696420796f75207573652074686520726967687420636f6d70696c6572206f72207061737320616e20756e7361666520636f6e7374727563746f7220617267756d656e743f4120636f6e74726163742068617320616c7265616479206265656e206465706c6f79656420746f20746869732061646472657373436f6e7374727563746f7220617474656d7074656420746f206465706c6f7920756e736166652062797465636f64652ea264697066735822122037659553997f9c397990c7f057ea0856b2adcea1b4d101ba588eaa7204c18d2f64736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"CALL_WITH_VALUE_INTRINSIC_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMaxTransactionGasLimit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxTransactionGasLimit\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ovmADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_ADDRESS\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"name\":\"ovmBALANCE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_BALANCE\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"},{\"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\":[{\"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\":\"ovmCALLVALUE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_CALLVALUE\",\"type\":\"uint256\"}],\"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\":\"\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_bytecode\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"ovmCREATE2\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"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\":\"ovmINCREMENTNONCE\",\"outputs\":[],\"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\":[],\"name\":\"ovmSELFBALANCE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_BALANCE\",\"type\":\"uint256\"}],\"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\":\"\",\"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\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_creationCode\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"}],\"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\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"},{\"internalType\":\"contract iOVM_StateManager\",\"name\":\"_ovmStateManager\",\"type\":\"address\"}],\"name\":\"simulateMessage\",\"outputs\":[{\"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.\"}},\"ovmBALANCE(address)\":{\"params\":{\"_contract\":\"Address of the contract to query the OVM_ETH balance of.\"},\"returns\":{\"_BALANCE\":\"OVM_ETH balance of the requested contract.\"}},\"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).\"}},\"ovmCALL(uint256,address,uint256,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.\",\"_value\":\"ETH value to pass with the 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.\"}},\"ovmCALLVALUE()\":{\"returns\":{\"_CALLVALUE\":\"Value sent along with the call according to 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\":{\"_0\":\"Address of the created contract.\",\"_1\":\"Revert data, if and only if the creation threw an exception.\"}},\"ovmCREATE2(bytes,bytes32)\":{\"params\":{\"_bytecode\":\"Code to be used to CREATE2 a new contract.\",\"_salt\":\"Value used to determine the contract's address.\"},\"returns\":{\"_0\":\"Address of the created contract.\",\"_1\":\"Revert data, if and only if the creation threw an exception.\"}},\"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\":\"Enum indicating 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.\"}},\"ovmSELFBALANCE()\":{\"returns\":{\"_BALANCE\":\"OVM_ETH balance of the requesting 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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"run((uint256,uint256,uint8,address,address,uint256,bytes),address)\":{\"params\":{\"_ovmStateManager\":\"iOVM_StateManager implementation providing account state.\",\"_transaction\":\"Transaction data to be executed.\"}},\"safeCREATE(bytes,address)\":{\"params\":{\"_address\":\"OVM address being deployed to.\",\"_creationCode\":\"Code to pass into CREATE for deployment.\"}},\"simulateMessage((uint256,uint256,uint8,address,address,uint256,bytes),address,uint256,address)\":{\"params\":{\"_from\":\"the OVM account the simulated call should be from.\",\"_ovmStateManager\":\"the address of the OVM_StateManager precompile in the L2 state.\",\"_transaction\":\"the message transaction to simulate.\",\"_value\":\"the amount of ETH value to send.\"}}},\"stateVariables\":{\"CONTAINER_CONTRACT_PREFIX\":{\"details\":\"The Execution Manager and State Manager each have this 30 byte prefix, and are uncallable.\"}},\"title\":\"OVM_ExecutionManager\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"ovmADDRESS()\":{\"notice\":\"Overrides ADDRESS.\"},\"ovmBALANCE(address)\":{\"notice\":\"Overrides BALANCE. NOTE: In the future, this could be optimized to directly invoke EM._getContractStorage(...).\"},\"ovmCALL(uint256,address,bytes)\":{\"notice\":\"Legacy ovmCALL function which did not support ETH value; this maintains backwards compatibility.\"},\"ovmCALL(uint256,address,uint256,bytes)\":{\"notice\":\"Overrides CALL.\"},\"ovmCALLER()\":{\"notice\":\"Overrides CALLER.\"},\"ovmCALLVALUE()\":{\"notice\":\"Overrides CALLVALUE.\"},\"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.\"},\"ovmINCREMENTNONCE()\":{\"notice\":\"Bumps the nonce of the current ovmADDRESS by one.\"},\"ovmL1QUEUEORIGIN()\":{\"notice\":\"Specifies from which source (Sequencer or 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.\"},\"ovmSELFBALANCE()\":{\"notice\":\"Overrides SELFBALANCE.\"},\"ovmSLOAD(bytes32)\":{\"notice\":\"Overrides SLOAD.\"},\"ovmSSTORE(bytes32,bytes32)\":{\"notice\":\"Overrides SSTORE.\"},\"ovmSTATICCALL(uint256,address,bytes)\":{\"notice\":\"Overrides STATICCALL.\"},\"ovmTIMESTAMP()\":{\"notice\":\"Overrides TIMESTAMP.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"run((uint256,uint256,uint8,address,address,uint256,bytes),address)\":{\"notice\":\"Starts the execution of a transaction via the OVM_ExecutionManager.\"},\"safeCREATE(bytes,address)\":{\"notice\":\"Handles the creation-specific safety measures required for OVM contract deployment. This function sanitizes the return types for creation messages to match calls (bool, bytes), by being an external function which the EM can call, that mimics the success/fail case of the CREATE. This allows for consistent handling of both types of messages in _handleExternalMessage(). Having this step occur as a separate call frame also allows us to easily revert the contract deployment in the event that the code is unsafe.\"},\"simulateMessage((uint256,uint256,uint8,address,address,uint256,bytes),address,uint256,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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow, so we distribute\\n return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);\\n }\\n}\\n\",\"keccak256\":\"0x363bd3b45201f07c9b71c2edc96533468cf14a3d029fabd82fddceb1eb3ebd9c\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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_Bytes32Utils } from \\\"../../libraries/utils/Lib_Bytes32Utils.sol\\\";\\nimport { Lib_EthUtils } from \\\"../../libraries/utils/Lib_EthUtils.sol\\\";\\nimport { Lib_ErrorUtils } from \\\"../../libraries/utils/Lib_ErrorUtils.sol\\\";\\nimport { Lib_PredeployAddresses } from \\\"../../libraries/constants/Lib_PredeployAddresses.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_DeployerWhitelist } from \\\"../predeploys/OVM_DeployerWhitelist.sol\\\";\\n\\n/* External Imports */\\nimport { Math } from \\\"@openzeppelin/contracts/math/Math.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 * Native Value Constants *\\n **************************/\\n\\n // Public so we can access and make assertions in integration tests.\\n uint256 public constant CALL_WITH_VALUE_INTRINSIC_GAS = 90000;\\n\\n\\n /**************************\\n * Default Context Values *\\n **************************/\\n\\n uint256 constant DEFAULT_UINT256 = 0xdefa017defa017defa017defa017defa017defa017defa017defa017defa017d;\\n address constant DEFAULT_ADDRESS = 0xdEfa017defA017DeFA017DEfa017DeFA017DeFa0;\\n\\n\\n /*************************************\\n * Container Contract Address Prefix *\\n *************************************/\\n\\n /**\\n * @dev The Execution Manager and State Manager each have this 30 byte prefix, and are uncallable.\\n */\\n address constant CONTAINER_CONTRACT_PREFIX = 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000;\\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 Lib_AddressResolver(_libAddressManager)\\n {\\n ovmSafetyChecker = iOVM_SafetyChecker(resolve(\\\"OVM_SafetyChecker\\\"));\\n gasMeterConfig = _gasMeterConfig;\\n globalContext = _globalContext;\\n _resetContext();\\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 external\\n returns (\\n bytes memory\\n )\\n {\\n // Make sure that run() is not re-enterable. This condition should always be satisfied\\n // Once run has been called once, due to the behavior of _isValidInput().\\n if (transactionContext.ovmNUMBER != DEFAULT_UINT256) {\\n return bytes(\\\"\\\");\\n }\\n\\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 (_isValidInput(_transaction) == false) {\\n _resetContext();\\n return bytes(\\\"\\\");\\n }\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\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 (, bytes memory returndata) = ovmCALL(\\n _transaction.gasLimit - gasMeterConfig.minTransactionGasLimit,\\n _transaction.entrypoint,\\n 0,\\n _transaction.data\\n );\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\n // // Update the cumulative gas based on the amount of gas used.\\n // uint256 gasUsed = gasProvided - gasleft();\\n // _updateCumulativeGas(gasUsed, _transaction.l1QueueOrigin);\\n\\n // Wipe the execution context.\\n _resetContext();\\n\\n return returndata;\\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 external\\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 CALLVALUE.\\n * @return _CALLVALUE Value sent along with the call according to the current message context.\\n */\\n function ovmCALLVALUE()\\n override\\n public\\n view\\n returns (\\n uint256 _CALLVALUE\\n )\\n {\\n return messageContext.ovmCALLVALUE;\\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 external\\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 external\\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 external\\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 external\\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 source (Sequencer or Queue) this transaction originated from.\\n * @return _queueOrigin Enum indicating the ovmL1QUEUEORIGIN within the current message context.\\n */\\n function ovmL1QUEUEORIGIN()\\n override\\n external\\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 external\\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 Address of the created contract.\\n * @return Revert data, if and only if the creation threw an exception.\\n */\\n function ovmCREATE(\\n bytes memory _bytecode\\n )\\n override\\n public\\n notStatic\\n fixedGasDiscount(40000)\\n returns (\\n address,\\n bytes memory\\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 MessageType.ovmCREATE\\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 Address of the created contract.\\n * @return Revert data, if and only if the creation threw an exception.\\n */\\n function ovmCREATE2(\\n bytes memory _bytecode,\\n bytes32 _salt\\n )\\n override\\n external\\n notStatic\\n fixedGasDiscount(40000)\\n returns (\\n address,\\n bytes memory\\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 MessageType.ovmCREATE2\\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 external\\n returns (\\n uint256 _nonce\\n )\\n {\\n return _getAccountNonce(ovmADDRESS());\\n }\\n\\n /**\\n * Bumps the nonce of the current ovmADDRESS by one.\\n */\\n function ovmINCREMENTNONCE()\\n override\\n external\\n notStatic\\n {\\n address account = ovmADDRESS();\\n uint256 nonce = _getAccountNonce(account);\\n\\n // Prevent overflow.\\n if (nonce + 1 > nonce) {\\n _setAccountNonce(account, nonce + 1);\\n }\\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 // Creates a duplicate of the OVM_ProxyEOA located at 0x42....09. Uses the following\\n // \\\"magic\\\" prefix to deploy an exact copy of the code:\\n // PUSH1 0x0D # size of this prefix in bytes\\n // CODESIZE\\n // SUB # subtract prefix size from codesize\\n // DUP1\\n // PUSH1 0x0D\\n // PUSH1 0x00\\n // CODECOPY # copy everything after prefix into memory at pos 0\\n // PUSH1 0x00\\n // RETURN # return the copied code\\n address proxyEOA = Lib_EthUtils.createContract(abi.encodePacked(\\n hex\\\"600D380380600D6000396000f3\\\",\\n ovmEXTCODECOPY(\\n Lib_PredeployAddresses.PROXY_EOA,\\n 0,\\n ovmEXTCODESIZE(Lib_PredeployAddresses.PROXY_EOA)\\n )\\n ));\\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 _value ETH value to pass with the 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 uint256 _value,\\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 nextMessageContext.ovmCALLVALUE = _value;\\n\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata,\\n MessageType.ovmCALL\\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, valueless context.\\n MessageContext memory nextMessageContext = messageContext;\\n nextMessageContext.ovmCALLER = nextMessageContext.ovmADDRESS;\\n nextMessageContext.ovmADDRESS = _address;\\n nextMessageContext.isStatic = true;\\n nextMessageContext.ovmCALLVALUE = 0;\\n\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata,\\n MessageType.ovmSTATICCALL\\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\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata,\\n MessageType.ovmDELEGATECALL\\n );\\n }\\n\\n /**\\n * @notice Legacy ovmCALL function which did not support ETH value; this maintains backwards compatibility.\\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 returns(\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n // Legacy ovmCALL assumed always-0 value.\\n return ovmCALL(\\n _gasLimit,\\n _address,\\n 0,\\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 external\\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 external\\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 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 external\\n returns (\\n bytes32 _EXTCODEHASH\\n )\\n {\\n return Lib_EthUtils.getCodeHash(\\n _getAccountEthAddress(_contract)\\n );\\n }\\n\\n\\n /***************************************\\n * Public Functions: ETH Value Opcodes *\\n ***************************************/\\n\\n /**\\n * @notice Overrides BALANCE.\\n * NOTE: In the future, this could be optimized to directly invoke EM._getContractStorage(...).\\n * @param _contract Address of the contract to query the OVM_ETH balance of.\\n * @return _BALANCE OVM_ETH balance of the requested contract.\\n */\\n function ovmBALANCE(\\n address _contract\\n )\\n override\\n public\\n returns (\\n uint256 _BALANCE\\n )\\n {\\n // Easiest way to get the balance is query OVM_ETH as normal.\\n bytes memory balanceOfCalldata = abi.encodeWithSignature(\\n \\\"balanceOf(address)\\\",\\n _contract\\n );\\n\\n // Static call because this should be a read-only query.\\n (bool success, bytes memory returndata) = ovmSTATICCALL(\\n gasleft(),\\n Lib_PredeployAddresses.OVM_ETH,\\n balanceOfCalldata\\n );\\n\\n // All balanceOf queries should successfully return a uint, otherwise this must be an OOG.\\n if (!success || returndata.length != 32) {\\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\\n }\\n\\n // Return the decoded balance.\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * @notice Overrides SELFBALANCE.\\n * @return _BALANCE OVM_ETH balance of the requesting contract.\\n */\\n function ovmSELFBALANCE()\\n override\\n external\\n returns (\\n uint256 _BALANCE\\n )\\n {\\n return ovmBALANCE(ovmADDRESS());\\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 Whitelisting *\\n ********************************************/\\n\\n /**\\n * Checks whether the given address is on the whitelist 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 semantics perspective, this will appear 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) = ovmSTATICCALL(\\n gasleft(),\\n Lib_PredeployAddresses.DEPLOYER_WHITELIST,\\n abi.encodeWithSelector(\\n OVM_DeployerWhitelist.isDeployerAllowed.selector,\\n _deployerAddress\\n )\\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 Final OVM contract address.\\n * @return Revertdata, if and only if the creation threw an exception.\\n */\\n function _createContract(\\n address _contractAddress,\\n bytes memory _bytecode,\\n MessageType _messageType\\n )\\n internal\\n returns (\\n address,\\n bytes memory\\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 the common logic which occurs between call-type and create-type messages,\\n // passing in the creation bytecode and `true` to trigger create-specific logic.\\n (bool success, bytes memory data) = _handleExternalMessage(\\n nextMessageContext,\\n gasleft(),\\n _contractAddress,\\n _bytecode,\\n _messageType\\n );\\n\\n // Yellow paper requires that address returned is zero if the contract deployment fails.\\n return (\\n success ? _contractAddress : address(0),\\n data\\n );\\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 MessageType _messageType\\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(CONTAINER_CONTRACT_PREFIX)\\n ) {\\n // EVM does not return data in the success case, see: https://github.com/ethereum/go-ethereum/blob/aae7660410f0ef90279e14afaaf2f429fdc2a186/core/vm/instructions.go#L600-L604\\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 _handleExternalMessage(\\n _nextMessageContext,\\n _gasLimit,\\n codeContractAddress,\\n _calldata,\\n _messageType\\n );\\n }\\n\\n /**\\n * Handles all interactions which involve the execution manager calling out to untrusted code (both calls and creates).\\n * Ensures that OVM-related measures are enforced, including L2 gas refunds, nuisance gas, and flagged reversions.\\n *\\n * @param _nextMessageContext Message context to be used for the external message.\\n * @param _gasLimit Amount of gas to be passed into this message. NOTE: this argument is overwritten in some cases to avoid stack-too-deep.\\n * @param _contract OVM address being called or deployed to\\n * @param _data Data for the message (either calldata or creation code)\\n * @param _messageType What type of ovmOPCODE this message corresponds to.\\n * @return Whether or not the message (either a call or deployment) succeeded.\\n * @return Data returned by the message.\\n */\\n function _handleExternalMessage(\\n MessageContext memory _nextMessageContext,\\n // NOTE: this argument is overwritten in some cases to avoid stack-too-deep.\\n uint256 _gasLimit,\\n address _contract,\\n bytes memory _data,\\n MessageType _messageType\\n )\\n internal\\n returns (\\n bool,\\n bytes memory\\n )\\n {\\n uint256 messageValue = _nextMessageContext.ovmCALLVALUE;\\n // If there is value in this message, we need to transfer the ETH over before switching contexts.\\n if (\\n messageValue > 0\\n && _isValueType(_messageType)\\n ) {\\n // Handle out-of-intrinsic gas consistent with EVM behavior -- the subcall \\\"appears to revert\\\" if we don't have enough gas to transfer the ETH.\\n // Similar to dynamic gas cost of value exceeding gas here:\\n // https://github.com/ethereum/go-ethereum/blob/c503f98f6d5e80e079c1d8a3601d188af2a899da/core/vm/interpreter.go#L268-L273\\n if (gasleft() < CALL_WITH_VALUE_INTRINSIC_GAS) {\\n return (false, hex\\\"\\\");\\n }\\n\\n // If there *is* enough gas to transfer ETH, then we need to make sure this amount of gas is reserved (i.e. not\\n // given to the _contract.call below) to guarantee that _handleExternalMessage can't run out of gas.\\n // In particular, in the event that the call fails, we will need to transfer the ETH back to the sender.\\n // Taking the lesser of _gasLimit and gasleft() - CALL_WITH_VALUE_INTRINSIC_GAS guarantees that the second\\n // _attemptForcedEthTransfer below, if needed, always has enough gas to succeed.\\n _gasLimit = Math.min(\\n _gasLimit,\\n gasleft() - CALL_WITH_VALUE_INTRINSIC_GAS // Cannot overflow due to the above check.\\n );\\n\\n // Now transfer the value of the call.\\n // The target is interpreted to be the next message's ovmADDRESS account.\\n bool transferredOvmEth = _attemptForcedEthTransfer(\\n _nextMessageContext.ovmADDRESS,\\n messageValue\\n );\\n\\n // If the ETH transfer fails (should only be possible in the case of insufficient balance), then treat this as a revert.\\n // This mirrors EVM behavior, see https://github.com/ethereum/go-ethereum/blob/2dee31930c9977af2a9fcb518fb9838aa609a7cf/core/vm/evm.go#L298\\n if (!transferredOvmEth) {\\n return (false, hex\\\"\\\");\\n }\\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. `_contract` 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\\n bool success;\\n bytes memory returndata;\\n if (_isCreateType(_messageType)) {\\n // safeCREATE() is a function which replicates a CREATE message, but uses return values\\n // Which match that of CALL (i.e. bool, bytes). This allows many security checks to be\\n // to be shared between untrusted call and create call frames.\\n (success, returndata) = address(this).call{gas: _gasLimit}(\\n abi.encodeWithSelector(\\n this.safeCREATE.selector,\\n _data,\\n _contract\\n )\\n );\\n } else {\\n (success, returndata) = _contract.call{gas: _gasLimit}(_data);\\n }\\n\\n // If the message threw an exception, its value should be returned back to the sender.\\n // So, we force it back, BEFORE returning the messageContext to the previous addresses.\\n // This operation is part of the reason we \\\"reserved the intrinsic gas\\\" above.\\n if (\\n messageValue > 0\\n && _isValueType(_messageType)\\n && !success\\n ) {\\n bool transferredOvmEth = _attemptForcedEthTransfer(\\n prevMessageContext.ovmADDRESS,\\n messageValue\\n );\\n\\n // Since we transferred it in above and the call reverted, the transfer back should always pass.\\n // This code path should NEVER be triggered since we sent `messageValue` worth of OVM_ETH into the target\\n // and reserved sufficient gas to execute the transfer, but in case there is some edge case which has\\n // been missed, we revert the entire frame (and its parent) to make sure the ETH gets sent back.\\n if (!transferredOvmEth) {\\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\\n }\\n }\\n\\n // Switch back to the original message context now that we're out of the call and all OVM_ETH is in the right place.\\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. Additionally, we surface custom error messages\\n // to developers in the case of unsafe creations for improved devex.\\n // All other revert types return no data.\\n if (\\n flag == RevertFlag.INTENTIONAL_REVERT\\n || flag == RevertFlag.UNSAFE_BYTECODE\\n ) {\\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 * Handles the creation-specific safety measures required for OVM contract deployment.\\n * This function sanitizes the return types for creation messages to match calls (bool, bytes),\\n * by being an external function which the EM can call, that mimics the success/fail case of the CREATE.\\n * This allows for consistent handling of both types of messages in _handleExternalMessage().\\n * Having this step occur as a separate call frame also allows us to easily revert the\\n * contract deployment in the event that the code is unsafe.\\n *\\n * @param _creationCode Code to pass into CREATE for deployment.\\n * @param _address OVM address being deployed to.\\n */\\n function safeCREATE(\\n bytes memory _creationCode,\\n address _address\\n )\\n external\\n {\\n // The only way this should callable is from within _createContract(),\\n // and it should DEFINITELY not be callable by a non-EM code contract.\\n if (msg.sender != address(this)) {\\n return;\\n }\\n // Check that there is not already code at this address.\\n if (_hasEmptyAccount(_address) == false) {\\n // Note: in the EVM, this case burns all allotted gas. For improved\\n // developer experience, we do return the remaining gas.\\n _revertWithFlag(\\n RevertFlag.CREATE_COLLISION\\n );\\n }\\n\\n // Check the creation bytecode against the OVM_SafetyChecker.\\n if (ovmSafetyChecker.isBytecodeSafe(_creationCode) == false) {\\n // Note: in the EVM, this case burns all allotted gas. For improved\\n // developer experience, we do return the remaining gas.\\n _revertWithFlag(\\n RevertFlag.UNSAFE_BYTECODE,\\n Lib_ErrorUtils.encodeRevertString(\\\"Contract creation code contains unsafe opcodes. Did you use the right compiler or pass an unsafe constructor argument?\\\")\\n );\\n }\\n\\n // We always need to initialize the contract with the default account values.\\n _initPendingAccount(_address);\\n\\n // Actually execute the EVM create message.\\n // NOTE: The inline assembly below means we can NOT make any evm calls between here and then.\\n address ethAddress = Lib_EthUtils.createContract(_creationCode);\\n\\n if (ethAddress == address(0)) {\\n // If the creation fails, the EVM lets us grab its revert data. This may contain a revert flag\\n // to be used above in _handleExternalMessage, so we pass the revert data back up unmodified.\\n assembly {\\n returndatacopy(0,0,returndatasize())\\n revert(0, returndatasize())\\n }\\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(\\n RevertFlag.UNSAFE_BYTECODE,\\n Lib_ErrorUtils.encodeRevertString(\\\"Constructor attempted to deploy unsafe bytecode.\\\")\\n );\\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 * Internal Functions: Value Manipulation *\\n ******************************************/\\n\\n /**\\n * Invokes an ovmCALL to OVM_ETH.transfer on behalf of the current ovmADDRESS, allowing us to force movement of OVM_ETH in correspondence with ETH's native value functionality.\\n * WARNING: this will send on behalf of whatever the messageContext.ovmADDRESS is in storage at the time of the call.\\n * NOTE: In the future, this could be optimized to directly invoke EM._setContractStorage(...).\\n * @param _to Amount of OVM_ETH to be sent.\\n * @param _value Amount of OVM_ETH to send.\\n * @return _success Whether or not the transfer worked.\\n */\\n function _attemptForcedEthTransfer(\\n address _to,\\n uint256 _value\\n )\\n internal\\n returns(\\n bool _success\\n )\\n {\\n bytes memory transferCalldata = abi.encodeWithSignature(\\n \\\"transfer(address,uint256)\\\",\\n _to,\\n _value\\n );\\n\\n // OVM_ETH inherits from the UniswapV2ERC20 standard. In this implementation, its return type\\n // is a boolean. However, the implementation always returns true if it does not revert.\\n // Thus, success of the call frame is sufficient to infer success of the transfer itself.\\n (bool success, ) = ovmCALL(\\n gasleft(),\\n Lib_PredeployAddresses.OVM_ETH,\\n 0,\\n transferCalldata\\n );\\n\\n return success;\\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 ) {\\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 view\\n {\\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 input values of a transaction.\\n * @return _valid Whether or not the transaction data is valid.\\n */\\n function _isValidInput(\\n Lib_OVMCodec.Transaction memory _transaction\\n )\\n view\\n internal\\n returns (\\n bool\\n )\\n {\\n // Prevent reentrancy to run():\\n // This check prevents calling run with the default ovmNumber.\\n // Combined with the first check in run():\\n // if (transactionContext.ovmNUMBER != DEFAULT_UINT256) { return; }\\n // It should be impossible to re-enter since run() returns before any other call frames are created.\\n // Since this value is already being written to storage, we save much gas compared to\\n // using the standard nonReentrant pattern.\\n if (_transaction.blockNumber == DEFAULT_UINT256) {\\n return false;\\n }\\n\\n if (_isValidGasLimit(_transaction.gasLimit, _transaction.l1QueueOrigin) == false) {\\n return false;\\n }\\n\\n return true;\\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 view\\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 // These conditionals allow us to avoid unneccessary SSTOREs. However, they do mean that the current storage\\n // value for the messageContext MUST equal the _prevMessageContext argument, or an SSTORE might be erroneously skipped.\\n if (_prevMessageContext.ovmCALLER != _nextMessageContext.ovmCALLER) {\\n messageContext.ovmCALLER = _nextMessageContext.ovmCALLER;\\n }\\n\\n if (_prevMessageContext.ovmADDRESS != _nextMessageContext.ovmADDRESS) {\\n messageContext.ovmADDRESS = _nextMessageContext.ovmADDRESS;\\n }\\n\\n if (_prevMessageContext.isStatic != _nextMessageContext.isStatic) {\\n messageContext.isStatic = _nextMessageContext.isStatic;\\n }\\n\\n if (_prevMessageContext.ovmCALLVALUE != _nextMessageContext.ovmCALLVALUE) {\\n messageContext.ovmCALLVALUE = _nextMessageContext.ovmCALLVALUE;\\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 = DEFAULT_ADDRESS;\\n transactionContext.ovmTIMESTAMP = DEFAULT_UINT256;\\n transactionContext.ovmNUMBER = DEFAULT_UINT256;\\n transactionContext.ovmGASLIMIT = DEFAULT_UINT256;\\n transactionContext.ovmTXGASLIMIT = DEFAULT_UINT256;\\n transactionContext.ovmL1QUEUEORIGIN = Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE;\\n\\n transactionRecord.ovmGasRefund = DEFAULT_UINT256;\\n\\n messageContext.ovmCALLER = DEFAULT_ADDRESS;\\n messageContext.ovmADDRESS = DEFAULT_ADDRESS;\\n messageContext.isStatic = false;\\n\\n messageRecord.nuisanceGasLeft = DEFAULT_UINT256;\\n\\n // Reset the ovmStateManager.\\n ovmStateManager = iOVM_StateManager(address(0));\\n }\\n\\n\\n /******************************************\\n * Internal Functions: Message Typechecks *\\n ******************************************/\\n\\n /**\\n * Returns whether or not the given message type is a CREATE-type.\\n * @param _messageType the message type in question.\\n */\\n function _isCreateType(\\n MessageType _messageType\\n )\\n internal\\n pure\\n returns(\\n bool\\n )\\n {\\n return (\\n _messageType == MessageType.ovmCREATE\\n || _messageType == MessageType.ovmCREATE2\\n );\\n }\\n\\n /**\\n * Returns whether or not the given message type (potentially) requires the transfer of ETH value along with the message.\\n * @param _messageType the message type in question.\\n */\\n function _isValueType(\\n MessageType _messageType\\n )\\n internal\\n pure\\n returns(\\n bool\\n )\\n {\\n // ovmSTATICCALL and ovmDELEGATECALL types do not accept or transfer value.\\n return (\\n _messageType == MessageType.ovmCALL\\n || _messageType == MessageType.ovmCREATE\\n || _messageType == MessageType.ovmCREATE2\\n );\\n }\\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 * @param _value the amount of ETH value to send.\\n * @param _ovmStateManager the address of the OVM_StateManager precompile in the L2 state.\\n */\\n function simulateMessage(\\n Lib_OVMCodec.Transaction memory _transaction,\\n address _from,\\n uint256 _value,\\n iOVM_StateManager _ovmStateManager\\n )\\n external\\n returns (\\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 // Initialize the EM's internal state, ignoring nuisance gas.\\n ovmStateManager = _ovmStateManager;\\n _initContext(_transaction);\\n messageRecord.nuisanceGasLeft = uint(-1);\\n\\n // Set the ovmADDRESS to the _from so that the subsequent call frame \\\"comes from\\\" them.\\n messageContext.ovmADDRESS = _from;\\n\\n // Execute the desired message.\\n bool isCreate = _transaction.entrypoint == address(0);\\n if (isCreate) {\\n (address created, bytes memory revertData) = ovmCREATE(_transaction.data);\\n if (created == address(0)) {\\n return abi.encode(false, revertData);\\n } else {\\n // The eth_call RPC endpoint for to = undefined will return the deployed bytecode\\n // in the success case, differing from standard create messages.\\n return abi.encode(true, Lib_EthUtils.getCode(created));\\n }\\n } else {\\n (bool success, bytes memory returndata) = ovmCALL(\\n _transaction.gasLimit,\\n _transaction.entrypoint,\\n _value,\\n _transaction.data\\n );\\n return abi.encode(success, returndata);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x166912c588f2871fd2825ea9288cb3d50a888d4fcafd9fe3cc4461df839acf70\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/predeploys/OVM_DeployerWhitelist.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Interface Imports */\\nimport { iOVM_DeployerWhitelist } from \\\"../../iOVM/predeploys/iOVM_DeployerWhitelist.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: optimistic-solc\\n * Runtime target: OVM\\n */\\ncontract OVM_DeployerWhitelist is iOVM_DeployerWhitelist {\\n\\n /**********************\\n * Contract Constants *\\n **********************/\\n\\n bool public initialized;\\n bool public allowArbitraryDeployment;\\n address override public owner;\\n mapping (address => bool) public whitelist;\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Blocks functions to anyone except the contract owner.\\n */\\n modifier onlyOwner() {\\n require(\\n msg.sender == 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 external\\n {\\n if (initialized == true) {\\n return;\\n }\\n\\n initialized = true;\\n allowArbitraryDeployment = _allowArbitraryDeployment;\\n owner = _owner;\\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 external\\n onlyOwner\\n {\\n whitelist[_deployer] = _isWhitelisted;\\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 owner = _owner;\\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 allowArbitraryDeployment = _allowArbitraryDeployment;\\n }\\n\\n /**\\n * Permanently enables arbitrary contract deployment and deletes the owner.\\n */\\n function enableArbitraryContractDeployment()\\n override\\n external\\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 external\\n returns (\\n bool\\n )\\n {\\n return (\\n initialized == false\\n || allowArbitraryDeployment == true\\n || whitelist[_deployer]\\n );\\n }\\n}\\n\",\"keccak256\":\"0xb96bfb8eb24503b05de41483cc9fb7a7f81107aa1ca146dc281952f8100848a0\",\"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 OUT_OF_GAS,\\n INTENTIONAL_REVERT,\\n EXCEEDS_NUISANCE_GAS,\\n INVALID_STATE_ACCESS,\\n UNSAFE_BYTECODE,\\n CREATE_COLLISION,\\n STATIC_VIOLATION,\\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 enum MessageType {\\n ovmCALL,\\n ovmSTATICCALL,\\n ovmDELEGATECALL,\\n ovmCREATE,\\n ovmCREATE2\\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 uint256 ovmCALLVALUE;\\n bool isStatic;\\n }\\n\\n struct MessageRecord {\\n uint256 nuisanceGasLeft;\\n }\\n\\n\\n /************************************\\n * Transaction Execution Entrypoint *\\n ************************************/\\n\\n function run(\\n Lib_OVMCodec.Transaction calldata _transaction,\\n address _txStateManager\\n ) external returns (bytes memory);\\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 ovmCALLVALUE() external view returns (uint _callValue);\\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, bytes memory _revertdata);\\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract, bytes memory _revertdata);\\n\\n\\n /*******************************\\n * Account Abstraction Opcodes *\\n ******************************/\\n\\n function ovmGETNONCE() external returns (uint256 _nonce);\\n function ovmINCREMENTNONCE() external;\\n function ovmCREATEEOA(bytes32 _messageHash, uint8 _v, bytes32 _r, bytes32 _s) external;\\n\\n\\n /****************************\\n * Contract Calling Opcodes *\\n ****************************/\\n\\n // Valueless ovmCALL for maintaining backwards compatibility with legacy OVM bytecode.\\n function ovmCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\\n function ovmCALL(uint256 _gasLimit, address _address, uint256 _value, 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 * ETH Value Opcodes *\\n *********************/\\n\\n function ovmBALANCE(address _contract) external returns (uint256 _balance);\\n function ovmSELFBALANCE() external returns (uint256 _balance);\\n\\n\\n /***************************************\\n * Public Functions: Execution Context *\\n ***************************************/\\n\\n function getMaxTransactionGasLimit() external view returns (uint _maxTransactionGasLimit);\\n}\\n\",\"keccak256\":\"0x87a056425696719488dbd06adbbf89280d86651e75e1f77d9e96b0632c8634cc\",\"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/predeploys/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 owner() 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\":\"0xdf1f27faf0d26d416bf6d408d146a16de32b4e1772a292c65d39eb7ec2b53ceb\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_PredeployAddresses\\n */\\nlibrary Lib_PredeployAddresses {\\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\\n address internal constant ECDSA_CONTRACT_ACCOUNT = 0x4200000000000000000000000000000000000003;\\n address internal constant SEQUENCER_ENTRYPOINT = 0x4200000000000000000000000000000000000005;\\n address payable internal constant OVM_ETH = 0x4200000000000000000000000000000000000006;\\n address internal constant L2_CROSS_DOMAIN_MESSENGER = 0x4200000000000000000000000000000000000007;\\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\\n address internal constant EXECUTION_MANAGER_WRAPPER = 0x420000000000000000000000000000000000000B;\\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\\n address internal constant ERC1820_REGISTRY = 0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24;\\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\\n}\\n\",\"keccak256\":\"0x798dd3fe47c172880978c8e4d35573b25d5135be29a77584e9fac45845748695\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_ErrorUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/**\\n * @title Lib_ErrorUtils\\n */\\nlibrary Lib_ErrorUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes an error string into raw solidity-style revert data.\\n * (i.e. ascii bytes, prefixed with bytes4(keccak(\\\"Error(string))\\\"))\\n * Ref: https://docs.soliditylang.org/en/v0.8.2/control-structures.html?highlight=Error(string)#panic-via-assert-and-error-via-require\\n * @param _reason Reason for the reversion.\\n * @return Standard solidity revert data for the given reason.\\n */\\n function encodeRevertString(\\n string memory _reason\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return abi.encodeWithSignature(\\n \\\"Error(string)\\\",\\n _reason\\n );\\n }\\n}\\n\",\"keccak256\":\"0xfc64ec4a81fb50865b502a0004ed154e8598e1a313db77303fc95e41f536e6b7\",\"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 *\\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 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\\n )\\n {\\n bytes memory code;\\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 Full code of the contract.\\n */\\n function getCode(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes memory\\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 Size of the contract's code in bytes.\\n */\\n function getCodeSize(\\n address _address\\n )\\n internal\\n view\\n returns (\\n uint256\\n )\\n {\\n uint256 codeSize;\\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 Hash of the contract's code.\\n */\\n function getCodeHash(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n bytes32 codeHash;\\n assembly {\\n codeHash := extcodehash(_address)\\n }\\n\\n return codeHash;\\n }\\n\\n /**\\n * Creates a contract with some given initialization code.\\n * @param _code Contract initialization code.\\n * @return Address of the created contract.\\n */\\n function createContract(\\n bytes memory _code\\n )\\n internal\\n returns (\\n address\\n )\\n {\\n address created;\\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 to be generated by CREATE.\\n */\\n function getAddressForCREATE(\\n address _creator,\\n uint256 _nonce\\n )\\n internal\\n pure\\n returns (\\n 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 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 (\\n address\\n )\\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\":\"0xf29a67d78e61cb472d524b779b32cfcb39a587f4096500d5419e6425ed367d49\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50604051620034a0380380620034a0833981016040819052620000349162000297565b600080546001600160a01b0319166001600160a01b03851617905560408051808201909152601181527027ab26afa9b0b332ba3ca1b432b1b5b2b960791b60208201526200008290620000d7565b600180546001600160a01b0319166001600160a01b039290921691909117905581516003556020820151600455604082015160055560608201516006558051600755620000ce620001b9565b5050506200033c565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015620001395781810151838201526020016200011f565b50505050905090810190601f168015620001675780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156200018557600080fd5b505afa1580156200019a573d6000803e3d6000fd5b505050506040513d6020811015620001b157600080fd5b505192915050565b600d805473defa017defa017defa017defa017defa017defa06001600160a01b031991821681179092557fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d6009819055600a819055600b819055600c8190556008805460ff199081169091556012829055600e8054841685179055600f8054841690941790935560118054909316909255601391909155600280549091169055565b6000602082840312156200026d578081fd5b604051602081016001600160401b03811182821017156200028a57fe5b6040529151825250919050565b600080600083850360c0811215620002ad578384fd5b84516001600160a01b0381168114620002c4578485fd5b93506080601f1982011215620002d8578283fd5b50604051608081016001600160401b0381118282101715620002f657fe5b80604052506020850151815260408501516020820152606085015160408201526080850151606082015280925050620003338560a086016200025b565b90509250925092565b613154806200034c6000396000f3fe608060405234801561001057600080fd5b50600436106101fb5760003560e01c8063741a33eb1161011a578063996d79a5116100ad578063a8c4c5ec1161007c578063a8c4c5ec146103eb578063bdbf8c36146103f3578063c1fb2ea2146103fb578063f573102114610403578063ffe7391414610416576101fb565b8063996d79a5146103b557806399ccd98b146103bd5780639be3ad67146103d05780639dc9dc93146103e3576101fb565b80638435035b116100e95780638435035b146103745780638540661f1461038757806385979f761461039a57806390580256146103ad576101fb565b8063741a33eb14610326578063746c32f11461033957806376427cac146103595780637cebbe941461036c576101fb565b806322bd64c011610192578063461a447811610161578063461a4478146102e25780635a98c361146102f55780635b99d1c5146102fd578063735090641461031e576101fb565b806322bd64c01461029257806324749d5c146102a7578063299ca478146102ba5780632a2a7adb146102cf576101fb565b806314aa2ff7116101ce57806314aa2ff7146102595780631c4712a71461027a5780631f64338b1461028257806320160f3a1461028a576101fb565b806303daa9591461020057806308bf7dbf146102295780630a5635ae14610231578063101185a414610244575b600080fd5b61021361020e366004612924565b610429565b6040516102209190612dbe565b60405180910390f35b61021361046e565b61021361023f366004612898565b610480565b61024c610516565b6040516102209190612ed3565b61026c6102673660046129b6565b61051f565b604051610220929190612e39565b6102136105b1565b6102136105b7565b6102136105be565b6102a56102a0366004612954565b6105c4565b005b6102136102b5366004612898565b61061f565b6102c2610638565b6040516102209190612dc7565b6102a56102dd3660046129b6565b610647565b6102c26102f0366004612b16565b610655565b610213610731565b61031061030b366004612c4d565b610737565b604051610220929190612e5d565b6102c26107bd565b6102a5610334366004612975565b6107cc565b61034c6103473660046128d0565b610931565b6040516102209190612e96565b61034c610367366004612b8e565b61094e565b6102a5610a50565b610213610382366004612898565b610a9f565b610310610395366004612bf7565b610ab2565b6103106103a8366004612bf7565b610b39565b610213610b56565b6102c2610b5c565b61026c6103cb366004612a37565b610b6b565b61034c6103de366004612b5b565b610bf8565b6102c2610d5a565b610213610d69565b610213610d6f565b610213610d75565b6102a56104113660046129e8565b610d87565b610310610424366004612bf7565b610f50565b6000619c4060005a9050600061043d610b5c565b90506104498186610fa5565b93505060005a820390508083101561046657601280548483030190555b505050919050565b600061047b61023f610b5c565b905090565b600080826040516024016104949190612dc7565b60408051601f198184030181529190526020810180516001600160e01b03166370a0823160e01b17905290506000806104d55a6006602160991b0185610ab2565b915091508115806104e857508051602014155b156104f7576104f76000611033565b8080602001905181019061050b919061293c565b93505050505b919050565b60085460ff1690565b60115460009060609060ff1615156001141561053f5761053f6006611033565b619c4060005a90506000610551610b5c565b905061055c8161104c565b60006105708261056b846110e1565b61116c565b905061057e81886003611206565b95509550505060005a82039050808310156105a05760128054840190556105a9565b60128054820190555b505050915091565b60045490565b62015f9081565b600b5490565b60115460ff161515600114156105de576105de6006611033565b61ea6060005a905060006105f0610b5c565b90506105fd818686611290565b5060005a820390508083101561061857601280548483030190555b5050505050565b600061063261062d83611317565b6113a2565b92915050565b6000546001600160a01b031681565b6106526001826113a6565b50565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156106b557818101518382015260200161069d565b50505050905090810190601f1680156106e25780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156106ff57600080fd5b505afa158015610713573d6000803e3d6000fd5b505050506040513d602081101561072957600080fd5b505192915050565b600a5490565b60006060620186a060005a60408051608081018252600f5460115460ff16151560608301526001600160a01b0390811682528a166020820152908101889052909150610787818a8a8960006113bc565b945094505060005a82039050808310156107a85760128054840190556107b1565b60128054820190555b50505094509492505050565b600e546001600160a01b031690565b60115460ff161515600114156107e6576107e66006611033565b600060018585601b0185856040516000815260200160405260405161080e9493929190612e78565b6020604051602081039080840390855afa158015610830573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661086c5761086c60405180606001604052806038815260200161304160389139610647565b6108758161144d565b61087f575061092b565b610888816114d8565b600f80546001600160a01b038381166001600160a01b03198316179092551660006108e56108c16009602160991b018361034782610a9f565b6040516020016108d19190612d88565b60405160208183030381529060405261153f565b600f80546001600160a01b0319166001600160a01b038516179055905061091c838261091081611552565b80519060200120611568565b6109278360006115a5565b5050505b50505050565b606061094661093f85611317565b8484611616565b949350505050565b6060331561095b57600080fd5b600280546001600160a01b0319166001600160a01b03841617905561097f8561163a565b600019601355600f80546001600160a01b0319166001600160a01b0386811691909117909155608086015116158015610a1e576000806109c28860c0015161051f565b90925090506001600160a01b038216610a02576000816040516020016109e9929190612e5d565b6040516020818303038152906040529350505050610946565b6001610a0d83611552565b6040516020016109e9929190612e5d565b600080610a398860a001518960800151888b60c00151610737565b9150915081816040516020016109e9929190612e5d565b60115460ff16151560011415610a6a57610a6a6006611033565b6000610a74610b5c565b90506000610a81826110e1565b905080816001011115610a9b57610a9b82826001016115a5565b5050565b6000610632610aad83611317565b6116ac565b600060606201388060005a60408051608081018252600f546001600160a01b03908116825289166020820152600160608201819052600092820192909252919250610b049082908a908a908a906113bc565b945094505060005a8203905080831015610b25576012805484019055610b2e565b60128054820190555b505050935093915050565b60006060610b4a8585600086610737565b91509150935093915050565b60075490565b600f546001600160a01b031690565b60115460009060609060ff16151560011415610b8b57610b8b6006611033565b619c4060005a90506000610b9d610b5c565b9050610ba88161104c565b6000610bb58289896116b0565b9050610bc381896004611206565b95509550505060005a8203905080831015610be5576012805484019055610bee565b60128054820190555b5050509250929050565b600a546060907fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d14610c395750604080516020810190915260008152610632565b600280546001600160a01b0319166001600160a01b038481169190911791829055604051630d15d41560e41b815291169063d15d415090610c7e903390600401612dc7565b60206040518083038186803b158015610c9657600080fd5b505afa158015610caa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cce9190612904565b610cf35760405162461bcd60e51b8152600401610cea90612f4f565b60405180910390fd5b610cfc8361163a565b610d05836116f6565b610d2657610d11611752565b50604080516020810190915260008152610632565b6000610d486003600001548560a0015103856080015160008760c00151610737565b915050610d53611752565b9392505050565b600d546001600160a01b031690565b60105490565b60095490565b600061047b610d82610b5c565b6110e1565b333014610d9357610a9b565b610d9c8161144d565b610daa57610daa6005611033565b6001546040516352275acd60e11b81526001600160a01b039091169063a44eb59a90610dda908590600401612e96565b60206040518083038186803b158015610df257600080fd5b505afa158015610e06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2a9190612904565b610e5957610e596004610e546040518060a0016040528060768152602001613079607691396117f4565b6113a6565b610e62816114d8565b6000610e6d8361153f565b90506001600160a01b038116610e87573d6000803e3d6000fd5b6000610e9282611552565b6001546040516352275acd60e11b81529192506001600160a01b03169063a44eb59a90610ec3908490600401612e96565b60206040518083038186803b158015610edb57600080fd5b505afa158015610eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f139190612904565b610f3d57610f3d6004610e546040518060600160405280603081526020016130ef603091396117f4565b61092b8383610f4b856113a2565b611568565b60006060619c4060005a60408051608081018252600e546001600160a01b039081168252600f541660208201526010549181019190915260115460ff1615156060820152909150610b048189898960026113bc565b6000610fb18383611837565b600254604051631aaf392f60e01b81526001600160a01b0390911690631aaf392f90610fe39086908690600401612dff565b60206040518083038186803b158015610ffb57600080fd5b505afa15801561100f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d53919061293c565b61065281604051806020016040528060008152506113a6565b6000806110ab5a6002602160991b0163b1540a0160e01b866040516024016110749190612dc7565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610ab2565b915091506000818060200190518101906110c59190612904565b90508015806110d2575082155b1561092b5761092b6007611033565b60006110ec82611972565b60025460405163d126199f60e01b81526001600160a01b039091169063d126199f9061111c908590600401612dc7565b60206040518083038186803b15801561113457600080fd5b505afa158015611148573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610632919061293c565b60408051600280825260608201909252600091829190816020015b60608152602001906001900390816111875790505090506111a784611ab9565b816000815181106111b457fe5b60200260200101819052506111c883611ae3565b816001815181106111d557fe5b602002602001018190525060006111eb82611af6565b90506111fd8180519060200120611b3a565b95945050505050565b60006060611228611215610b5c565b611220610d82610b5c565b6001016115a5565b60408051608081018252600f546010549282019290925260115460ff16151560608201526001600160a01b0391821681529086166020820152600080611271835a8a8a8a611b3d565b9150915081611281576000611283565b875b9890975095505050505050565b8061129b8484610fa5565b14156112a657611312565b6112b08383611e9a565b600254604051635c17d62960e01b81526001600160a01b0390911690635c17d629906112e490869086908690600401612e18565b600060405180830381600087803b1580156112fe57600080fd5b505af1158015610927573d6000803e3d6000fd5b505050565b600061132282611972565b600254604051637c8ee70360e01b81526001600160a01b0390911690637c8ee70390611352908590600401612dc7565b60206040518083038186803b15801561136a57600080fd5b505afa15801561137e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063291906128b4565b3f90565b60006113b28383611fac565b9050805160208201fd5b6000606073ffffffffffffffffffffffffffffffffffff0000851673deaddeaddeaddeaddeaddeaddeaddeaddead0000141561140b575050604080516020810190915260008152600190611443565b60006064866001600160a01b03161061142c5761142786611317565b61142e565b855b905061143d8888838888611b3d565b92509250505b9550959350505050565b600061145882611972565b6002546040516307a1294560e01b81526001600160a01b03909116906307a1294590611488908590600401612dc7565b60206040518083038186803b1580156114a057600080fd5b505afa1580156114b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106329190612904565b6114e181611972565b600254604051637e78a4d160e11b81526001600160a01b039091169063fcf149a290611511908490600401612dc7565b600060405180830381600087803b15801561152b57600080fd5b505af1158015610618573d6000803e3d6000fd5b6000808251602084016000f09392505050565b6060610632826000611563856116ac565b611616565b61157183612055565b6002546040516368510af960e11b81526001600160a01b039091169063d0a215f2906112e490869086908690600401612ddb565b6115ae82612055565b6002546040516374855dc360e11b81526001600160a01b039091169063e90abb86906115e09085908590600401612dff565b600060405180830381600087803b1580156115fa57600080fd5b505af115801561160e573d6000803e3d6000fd5b505050505050565b6060806040519050602083018101604052828152828460208301873c949350505050565b80516009556020810151600a5560a0810151600c5560408101516008805460ff19166001838181111561166957fe5b02179055506060810151600d80546001600160a01b0319166001600160a01b03909216919091179055600554600b5560a08101516116a690612164565b60135550565b3b90565b60008060ff60f81b858486805190602001206040516020016116d59493929190612d04565b6040516020818303038152906040528051906020012090506111fd81611b3a565b60007fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d8260200151141561172c57506000610511565b61173e8260a001518360400151612177565b61174a57506000610511565b506001919050565b600d805473defa017defa017defa017defa017defa017defa06001600160a01b031991821681179092557fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d6009819055600a819055600b819055600c8190556008805460ff199081169091556012829055600e8054841685179055600f8054841690941790935560118054909316909255601391909155600280549091169055565b6060816040516024016118079190612e96565b60408051601f198184030181529190526020810180516001600160e01b031662461bcd60e51b1790529050919050565b6175305a101561184b5761184b6000611033565b600254604051630ad2267960e01b81526001600160a01b0390911690630ad226799061187d9085908590600401612dff565b60206040518083038186803b15801561189557600080fd5b505afa1580156118a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118cd9190612904565b6118db576118db6003611033565b600254604051632bcdee1960e21b81526000916001600160a01b03169063af37b8649061190e9086908690600401612dff565b602060405180830381600087803b15801561192857600080fd5b505af115801561193c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119609190612904565b90508061131257611312614e206121a7565b6175305a1015611986576119866000611033565b60025460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf906119b6908490600401612dc7565b60206040518083038186803b1580156119ce57600080fd5b505afa1580156119e2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a069190612904565b611a1457611a146003611033565b600254604051633ecdecc760e21b81526000916001600160a01b03169063fb37b31c90611a45908590600401612dc7565b602060405180830381600087803b158015611a5f57600080fd5b505af1158015611a73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a979190612904565b905080610a9b57610a9b6175306064611ab2610aad86611317565b02016121a7565b606061063282604051602001611acf9190612ce7565b6040516020818303038152906040526121c7565b6060610632611af183612219565b6121c7565b60606000611b038361231d565b9050611b11815160c061241d565b81604051602001611b23929190612d59565b604051602081830303815290604052915050919050565b90565b60408501516000906060908015801590611b5b5750611b5b8461256d565b15611bcb5762015f905a1015611b84575050604080516020810190915260008082529150611443565b611b938762015f905a036125af565b96506000611ba58960200151836125c5565b905080611bc957600060405180602001604052806000815250935093505050611443565b505b60408051608081018252600e546001600160a01b039081168252600f541660208201526010549181019190915260115460ff1615156060820152611c0f818a612627565b6013546000611c1d8a612164565b6013819055905060006060611c31896126e8565b15611ce857306001600160a01b03168c63f573102160e01b8c8e604051602401611c5c929190612ea9565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051611c9a9190612d3d565b60006040518083038160008787f1925050503d8060008114611cd8576040519150601f19603f3d011682016040523d82523d6000602084013e611cdd565b606091505b509092509050611d4b565b8a6001600160a01b03168c8b604051611d019190612d3d565b60006040518083038160008787f1925050503d8060008114611d3f576040519150601f19603f3d011682016040523d82523d6000602084013e611d44565b606091505b5090925090505b600086118015611d5f5750611d5f8961256d565b8015611d69575081155b15611d91576000611d7e8660200151886125c5565b905080611d8f57611d8f6000611033565b505b611d9b8d86612627565b60135482611e8157600080600080611db2866126f1565b929650909450925090506003846007811115611dca57fe5b1415611dd957611dd984611033565b6001846007811115611de757fe5b1480611dfe57506004846007811115611dfc57fe5b145b80611e1457506006846007811115611e1257fe5b145b80611e2a57506007846007811115611e2857fe5b145b15611e355760128290555b6001846007811115611e4357fe5b1480611e5a57506004846007811115611e5857fe5b145b15611e6757809550611e7a565b6040518060200160405280600081525095505b5090925050505b909203909203601355909a909950975050505050505050565b611ea48282611837565b60025460405163af3dc01160e01b81526000916001600160a01b03169063af3dc01190611ed79086908690600401612dff565b602060405180830381600087803b158015611ef157600080fd5b505af1158015611f05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f299190612904565b90508061131257611f3983612055565b600260009054906101000a90046001600160a01b03166001600160a01b031663c3fd9b256040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611f8957600080fd5b505af1158015611f9d573d6000803e3d6000fd5b50505050611312614e206121a7565b60606000836007811115611fbc57fe5b1415611fd75750604080516020810190915260008152610632565b6003836007811115611fe557fe5b14156120235760408051602080820183526000808352925161200d9387939092839201612ee7565b6040516020818303038152906040529050610632565b60135460125460405161203e92869290918690602001612f23565b604051602081830303815290604052905092915050565b61205e81611972565b60025460405163011b1f7960e41b81526000916001600160a01b0316906311b1f7909061208f908590600401612dc7565b602060405180830381600087803b1580156120a957600080fd5b505af11580156120bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120e19190612904565b905080610a9b57600260009054906101000a90046001600160a01b03166001600160a01b03166333f943056040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561213857600080fd5b505af115801561214c573d6000803e3d6000fd5b50505050610a9b6175306064611ab2610aad86611317565b60005a8210612173575a610632565b5090565b60045460009083111561218c57506000610632565b60035483101561219e57506000610632565b50600192915050565b6013548111156121bb576121bb6002611033565b60138054919091039055565b606080825160011480156121ef57506080836000815181106121e557fe5b016020015160f81c105b156121fb575081610632565b6122078351608061241d565b8360405160200161203e929190612d59565b606060008260405160200161222e9190612dbe565b604051602081830303815290604052905060005b60208110156122785781818151811061225757fe5b01602001516001600160f81b0319161561227057612278565b600101612242565b6000816020036001600160401b038111801561229357600080fd5b506040519080825280601f01601f1916602001820160405280156122be576020820181803683370190505b50905060005b81518110156123145783516001840193859181106122de57fe5b602001015160f81c60f81b8282815181106122f557fe5b60200101906001600160f81b031916908160001a9053506001016122c4565b50949350505050565b606081516000141561233e5750604080516000815260208101909152610511565b6000805b83518110156123715783818151811061235757fe5b602002602001015151820191508080600101915050612342565b6000826001600160401b038111801561238957600080fd5b506040519080825280601f01601f1916602001820160405280156123b4576020820181803683370190505b50600092509050602081015b85518310156123145760008684815181106123d757fe5b6020026020010151905060006020820190506123f583828451612744565b87858151811061240157fe5b60200260200101515183019250505082806001019350506123c0565b6060806038841015612477576040805160018082528183019092529060208201818036833701905050905082840160f81b8160008151811061245b57fe5b60200101906001600160f81b031916908160001a905350610d53565b600060015b80868161248557fe5b041561249a576001909101906101000261247c565b816001016001600160401b03811180156124b357600080fd5b506040519080825280601f01601f1916602001820160405280156124de576020820181803683370190505b50925084820160370160f81b836000815181106124f757fe5b60200101906001600160f81b031916908160001a905350600190505b818111612563576101008183036101000a878161252c57fe5b048161253457fe5b0660f81b83828151811061254457fe5b60200101906001600160f81b031916908160001a905350600101612513565b5050905092915050565b60008082600481111561257c57fe5b1480612594575060035b82600481111561259257fe5b145b80610632575060048260048111156125a857fe5b1492915050565b60008183106125be5781610d53565b5090919050565b60008083836040516024016125db929190612dff565b60408051601f198184030181529190526020810180516001600160e01b031663a9059cbb60e01b1790529050600061261d5a6006602160991b01600085610737565b5095945050505050565b805182516001600160a01b0390811691161461265f578051600e80546001600160a01b0319166001600160a01b039092169190911790555b80602001516001600160a01b031682602001516001600160a01b0316146126a5576020810151600f80546001600160a01b0319166001600160a01b039092169190911790555b8060600151151582606001511515146126cf5760608101516011805460ff19169115159190911790555b8060400151826040015114610a9b576040015160105550565b60006003612586565b60008060006060845160001415612720575050604080516020810190915260008082529250829150819061273d565b848060200190518101906127349190612a79565b93509350935093505b9193509193565b8282825b60208110612767578151835260209283019290910190601f1901612748565b905182516020929092036101000a6000190180199091169116179052505050565b600061279b61279684612fde565b612fbb565b90508281528383830111156127af57600080fd5b828260208301376000602084830101529392505050565b80356105118161302b565b600082601f8301126127e1578081fd5b610d5383833560208501612788565b80356002811061051157600080fd5b600060e08284031215612810578081fd5b61281a60e0612fbb565b90508135815260208201356020820152612836604083016127f0565b6040820152612847606083016127c6565b6060820152612858608083016127c6565b608082015260a082013560a082015260c08201356001600160401b0381111561288057600080fd5b61288c848285016127d1565b60c08301525092915050565b6000602082840312156128a9578081fd5b8135610d538161302b565b6000602082840312156128c5578081fd5b8151610d538161302b565b6000806000606084860312156128e4578182fd5b83356128ef8161302b565b95602085013595506040909401359392505050565b600060208284031215612915578081fd5b81518015158114610d53578182fd5b600060208284031215612935578081fd5b5035919050565b60006020828403121561294d578081fd5b5051919050565b60008060408385031215612966578182fd5b50508035926020909101359150565b6000806000806080858703121561298a578081fd5b84359350602085013560ff811681146129a1578182fd5b93969395505050506040820135916060013590565b6000602082840312156129c7578081fd5b81356001600160401b038111156129dc578182fd5b610946848285016127d1565b600080604083850312156129fa578182fd5b82356001600160401b03811115612a0f578283fd5b612a1b858286016127d1565b9250506020830135612a2c8161302b565b809150509250929050565b60008060408385031215612a49578182fd5b82356001600160401b03811115612a5e578283fd5b612a6a858286016127d1565b95602094909401359450505050565b60008060008060808587031215612a8e578182fd5b845160088110612a9c578283fd5b80945050602085015192506040850151915060608501516001600160401b03811115612ac6578182fd5b8501601f81018713612ad6578182fd5b8051612ae461279682612fde565b818152886020838501011115612af8578384fd5b612b09826020830160208601612fff565b9598949750929550505050565b600060208284031215612b27578081fd5b81356001600160401b03811115612b3c578182fd5b8201601f81018413612b4c578182fd5b61094684823560208401612788565b60008060408385031215612b6d578182fd5b82356001600160401b03811115612b82578283fd5b612a1b858286016127ff565b60008060008060808587031215612ba3578182fd5b84356001600160401b03811115612bb8578283fd5b612bc4878288016127ff565b9450506020850135612bd58161302b565b9250604085013591506060850135612bec8161302b565b939692955090935050565b600080600060608486031215612c0b578081fd5b833592506020840135612c1d8161302b565b915060408401356001600160401b03811115612c37578182fd5b612c43868287016127d1565b9150509250925092565b60008060008060808587031215612c62578182fd5b843593506020850135612c748161302b565b92506040850135915060608501356001600160401b03811115612c95578182fd5b612ca1878288016127d1565b91505092959194509250565b60008151808452612cc5816020860160208601612fff565b601f01601f19169290920160200192915050565b60088110612ce357fe5b9052565b60609190911b6bffffffffffffffffffffffff1916815260140190565b6001600160f81b031994909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b60008251612d4f818460208701612fff565b9190910192915050565b60008351612d6b818460208801612fff565b835190830190612d7f818360208801612fff565b01949350505050565b6c600d380380600d6000396000f360981b81528151600090612db181600d850160208701612fff565b91909101600d0192915050565b90815260200190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b038316815260406020820181905260009061094690830184612cad565b60008315158252604060208301526109466040830184612cad565b93845260ff9290921660208401526040830152606082015260800190565b600060208252610d536020830184612cad565b600060408252612ebc6040830185612cad565b905060018060a01b03831660208301529392505050565b6020810160028310612ee157fe5b91905290565b6000612ef38287612cd9565b60ff8516602083015260ff8416604083015260806060830152612f196080830184612cad565b9695505050505050565b6000612f2f8287612cd9565b84602083015283604083015260806060830152612f196080830184612cad565b60208082526046908201527f4f6e6c792061757468656e746963617465642061646472657373657320696e2060408201527f6f766d53746174654d616e616765722063616e2063616c6c20746869732066756060820152653731ba34b7b760d11b608082015260a00190565b6040518181016001600160401b0381118282101715612fd657fe5b604052919050565b60006001600160401b03821115612ff157fe5b50601f01601f191660200190565b60005b8381101561301a578181015183820152602001613002565b8381111561092b5750506000910152565b6001600160a01b038116811461065257600080fdfe5369676e61747572652070726f766964656420666f7220454f4120636f6e7472616374206372656174696f6e20697320696e76616c69642e436f6e7472616374206372656174696f6e20636f646520636f6e7461696e7320756e73616665206f70636f6465732e2044696420796f75207573652074686520726967687420636f6d70696c6572206f72207061737320616e20756e7361666520636f6e7374727563746f7220617267756d656e743f436f6e7374727563746f7220617474656d7074656420746f206465706c6f7920756e736166652062797465636f64652ea2646970667358221220fe0b47506ec2f40df111ba865323ee43ffbd7ef91f30eae2dfc209de19a78c0a64736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101fb5760003560e01c8063741a33eb1161011a578063996d79a5116100ad578063a8c4c5ec1161007c578063a8c4c5ec146103eb578063bdbf8c36146103f3578063c1fb2ea2146103fb578063f573102114610403578063ffe7391414610416576101fb565b8063996d79a5146103b557806399ccd98b146103bd5780639be3ad67146103d05780639dc9dc93146103e3576101fb565b80638435035b116100e95780638435035b146103745780638540661f1461038757806385979f761461039a57806390580256146103ad576101fb565b8063741a33eb14610326578063746c32f11461033957806376427cac146103595780637cebbe941461036c576101fb565b806322bd64c011610192578063461a447811610161578063461a4478146102e25780635a98c361146102f55780635b99d1c5146102fd578063735090641461031e576101fb565b806322bd64c01461029257806324749d5c146102a7578063299ca478146102ba5780632a2a7adb146102cf576101fb565b806314aa2ff7116101ce57806314aa2ff7146102595780631c4712a71461027a5780631f64338b1461028257806320160f3a1461028a576101fb565b806303daa9591461020057806308bf7dbf146102295780630a5635ae14610231578063101185a414610244575b600080fd5b61021361020e366004612924565b610429565b6040516102209190612dbe565b60405180910390f35b61021361046e565b61021361023f366004612898565b610480565b61024c610516565b6040516102209190612ed3565b61026c6102673660046129b6565b61051f565b604051610220929190612e39565b6102136105b1565b6102136105b7565b6102136105be565b6102a56102a0366004612954565b6105c4565b005b6102136102b5366004612898565b61061f565b6102c2610638565b6040516102209190612dc7565b6102a56102dd3660046129b6565b610647565b6102c26102f0366004612b16565b610655565b610213610731565b61031061030b366004612c4d565b610737565b604051610220929190612e5d565b6102c26107bd565b6102a5610334366004612975565b6107cc565b61034c6103473660046128d0565b610931565b6040516102209190612e96565b61034c610367366004612b8e565b61094e565b6102a5610a50565b610213610382366004612898565b610a9f565b610310610395366004612bf7565b610ab2565b6103106103a8366004612bf7565b610b39565b610213610b56565b6102c2610b5c565b61026c6103cb366004612a37565b610b6b565b61034c6103de366004612b5b565b610bf8565b6102c2610d5a565b610213610d69565b610213610d6f565b610213610d75565b6102a56104113660046129e8565b610d87565b610310610424366004612bf7565b610f50565b6000619c4060005a9050600061043d610b5c565b90506104498186610fa5565b93505060005a820390508083101561046657601280548483030190555b505050919050565b600061047b61023f610b5c565b905090565b600080826040516024016104949190612dc7565b60408051601f198184030181529190526020810180516001600160e01b03166370a0823160e01b17905290506000806104d55a6006602160991b0185610ab2565b915091508115806104e857508051602014155b156104f7576104f76000611033565b8080602001905181019061050b919061293c565b93505050505b919050565b60085460ff1690565b60115460009060609060ff1615156001141561053f5761053f6006611033565b619c4060005a90506000610551610b5c565b905061055c8161104c565b60006105708261056b846110e1565b61116c565b905061057e81886003611206565b95509550505060005a82039050808310156105a05760128054840190556105a9565b60128054820190555b505050915091565b60045490565b62015f9081565b600b5490565b60115460ff161515600114156105de576105de6006611033565b61ea6060005a905060006105f0610b5c565b90506105fd818686611290565b5060005a820390508083101561061857601280548483030190555b5050505050565b600061063261062d83611317565b6113a2565b92915050565b6000546001600160a01b031681565b6106526001826113a6565b50565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156106b557818101518382015260200161069d565b50505050905090810190601f1680156106e25780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156106ff57600080fd5b505afa158015610713573d6000803e3d6000fd5b505050506040513d602081101561072957600080fd5b505192915050565b600a5490565b60006060620186a060005a60408051608081018252600f5460115460ff16151560608301526001600160a01b0390811682528a166020820152908101889052909150610787818a8a8960006113bc565b945094505060005a82039050808310156107a85760128054840190556107b1565b60128054820190555b50505094509492505050565b600e546001600160a01b031690565b60115460ff161515600114156107e6576107e66006611033565b600060018585601b0185856040516000815260200160405260405161080e9493929190612e78565b6020604051602081039080840390855afa158015610830573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661086c5761086c60405180606001604052806038815260200161304160389139610647565b6108758161144d565b61087f575061092b565b610888816114d8565b600f80546001600160a01b038381166001600160a01b03198316179092551660006108e56108c16009602160991b018361034782610a9f565b6040516020016108d19190612d88565b60405160208183030381529060405261153f565b600f80546001600160a01b0319166001600160a01b038516179055905061091c838261091081611552565b80519060200120611568565b6109278360006115a5565b5050505b50505050565b606061094661093f85611317565b8484611616565b949350505050565b6060331561095b57600080fd5b600280546001600160a01b0319166001600160a01b03841617905561097f8561163a565b600019601355600f80546001600160a01b0319166001600160a01b0386811691909117909155608086015116158015610a1e576000806109c28860c0015161051f565b90925090506001600160a01b038216610a02576000816040516020016109e9929190612e5d565b6040516020818303038152906040529350505050610946565b6001610a0d83611552565b6040516020016109e9929190612e5d565b600080610a398860a001518960800151888b60c00151610737565b9150915081816040516020016109e9929190612e5d565b60115460ff16151560011415610a6a57610a6a6006611033565b6000610a74610b5c565b90506000610a81826110e1565b905080816001011115610a9b57610a9b82826001016115a5565b5050565b6000610632610aad83611317565b6116ac565b600060606201388060005a60408051608081018252600f546001600160a01b03908116825289166020820152600160608201819052600092820192909252919250610b049082908a908a908a906113bc565b945094505060005a8203905080831015610b25576012805484019055610b2e565b60128054820190555b505050935093915050565b60006060610b4a8585600086610737565b91509150935093915050565b60075490565b600f546001600160a01b031690565b60115460009060609060ff16151560011415610b8b57610b8b6006611033565b619c4060005a90506000610b9d610b5c565b9050610ba88161104c565b6000610bb58289896116b0565b9050610bc381896004611206565b95509550505060005a8203905080831015610be5576012805484019055610bee565b60128054820190555b5050509250929050565b600a546060907fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d14610c395750604080516020810190915260008152610632565b600280546001600160a01b0319166001600160a01b038481169190911791829055604051630d15d41560e41b815291169063d15d415090610c7e903390600401612dc7565b60206040518083038186803b158015610c9657600080fd5b505afa158015610caa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cce9190612904565b610cf35760405162461bcd60e51b8152600401610cea90612f4f565b60405180910390fd5b610cfc8361163a565b610d05836116f6565b610d2657610d11611752565b50604080516020810190915260008152610632565b6000610d486003600001548560a0015103856080015160008760c00151610737565b915050610d53611752565b9392505050565b600d546001600160a01b031690565b60105490565b60095490565b600061047b610d82610b5c565b6110e1565b333014610d9357610a9b565b610d9c8161144d565b610daa57610daa6005611033565b6001546040516352275acd60e11b81526001600160a01b039091169063a44eb59a90610dda908590600401612e96565b60206040518083038186803b158015610df257600080fd5b505afa158015610e06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2a9190612904565b610e5957610e596004610e546040518060a0016040528060768152602001613079607691396117f4565b6113a6565b610e62816114d8565b6000610e6d8361153f565b90506001600160a01b038116610e87573d6000803e3d6000fd5b6000610e9282611552565b6001546040516352275acd60e11b81529192506001600160a01b03169063a44eb59a90610ec3908490600401612e96565b60206040518083038186803b158015610edb57600080fd5b505afa158015610eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f139190612904565b610f3d57610f3d6004610e546040518060600160405280603081526020016130ef603091396117f4565b61092b8383610f4b856113a2565b611568565b60006060619c4060005a60408051608081018252600e546001600160a01b039081168252600f541660208201526010549181019190915260115460ff1615156060820152909150610b048189898960026113bc565b6000610fb18383611837565b600254604051631aaf392f60e01b81526001600160a01b0390911690631aaf392f90610fe39086908690600401612dff565b60206040518083038186803b158015610ffb57600080fd5b505afa15801561100f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d53919061293c565b61065281604051806020016040528060008152506113a6565b6000806110ab5a6002602160991b0163b1540a0160e01b866040516024016110749190612dc7565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610ab2565b915091506000818060200190518101906110c59190612904565b90508015806110d2575082155b1561092b5761092b6007611033565b60006110ec82611972565b60025460405163d126199f60e01b81526001600160a01b039091169063d126199f9061111c908590600401612dc7565b60206040518083038186803b15801561113457600080fd5b505afa158015611148573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610632919061293c565b60408051600280825260608201909252600091829190816020015b60608152602001906001900390816111875790505090506111a784611ab9565b816000815181106111b457fe5b60200260200101819052506111c883611ae3565b816001815181106111d557fe5b602002602001018190525060006111eb82611af6565b90506111fd8180519060200120611b3a565b95945050505050565b60006060611228611215610b5c565b611220610d82610b5c565b6001016115a5565b60408051608081018252600f546010549282019290925260115460ff16151560608201526001600160a01b0391821681529086166020820152600080611271835a8a8a8a611b3d565b9150915081611281576000611283565b875b9890975095505050505050565b8061129b8484610fa5565b14156112a657611312565b6112b08383611e9a565b600254604051635c17d62960e01b81526001600160a01b0390911690635c17d629906112e490869086908690600401612e18565b600060405180830381600087803b1580156112fe57600080fd5b505af1158015610927573d6000803e3d6000fd5b505050565b600061132282611972565b600254604051637c8ee70360e01b81526001600160a01b0390911690637c8ee70390611352908590600401612dc7565b60206040518083038186803b15801561136a57600080fd5b505afa15801561137e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063291906128b4565b3f90565b60006113b28383611fac565b9050805160208201fd5b6000606073ffffffffffffffffffffffffffffffffffff0000851673deaddeaddeaddeaddeaddeaddeaddeaddead0000141561140b575050604080516020810190915260008152600190611443565b60006064866001600160a01b03161061142c5761142786611317565b61142e565b855b905061143d8888838888611b3d565b92509250505b9550959350505050565b600061145882611972565b6002546040516307a1294560e01b81526001600160a01b03909116906307a1294590611488908590600401612dc7565b60206040518083038186803b1580156114a057600080fd5b505afa1580156114b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106329190612904565b6114e181611972565b600254604051637e78a4d160e11b81526001600160a01b039091169063fcf149a290611511908490600401612dc7565b600060405180830381600087803b15801561152b57600080fd5b505af1158015610618573d6000803e3d6000fd5b6000808251602084016000f09392505050565b6060610632826000611563856116ac565b611616565b61157183612055565b6002546040516368510af960e11b81526001600160a01b039091169063d0a215f2906112e490869086908690600401612ddb565b6115ae82612055565b6002546040516374855dc360e11b81526001600160a01b039091169063e90abb86906115e09085908590600401612dff565b600060405180830381600087803b1580156115fa57600080fd5b505af115801561160e573d6000803e3d6000fd5b505050505050565b6060806040519050602083018101604052828152828460208301873c949350505050565b80516009556020810151600a5560a0810151600c5560408101516008805460ff19166001838181111561166957fe5b02179055506060810151600d80546001600160a01b0319166001600160a01b03909216919091179055600554600b5560a08101516116a690612164565b60135550565b3b90565b60008060ff60f81b858486805190602001206040516020016116d59493929190612d04565b6040516020818303038152906040528051906020012090506111fd81611b3a565b60007fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d8260200151141561172c57506000610511565b61173e8260a001518360400151612177565b61174a57506000610511565b506001919050565b600d805473defa017defa017defa017defa017defa017defa06001600160a01b031991821681179092557fdefa017defa017defa017defa017defa017defa017defa017defa017defa017d6009819055600a819055600b819055600c8190556008805460ff199081169091556012829055600e8054841685179055600f8054841690941790935560118054909316909255601391909155600280549091169055565b6060816040516024016118079190612e96565b60408051601f198184030181529190526020810180516001600160e01b031662461bcd60e51b1790529050919050565b6175305a101561184b5761184b6000611033565b600254604051630ad2267960e01b81526001600160a01b0390911690630ad226799061187d9085908590600401612dff565b60206040518083038186803b15801561189557600080fd5b505afa1580156118a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118cd9190612904565b6118db576118db6003611033565b600254604051632bcdee1960e21b81526000916001600160a01b03169063af37b8649061190e9086908690600401612dff565b602060405180830381600087803b15801561192857600080fd5b505af115801561193c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119609190612904565b90508061131257611312614e206121a7565b6175305a1015611986576119866000611033565b60025460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf906119b6908490600401612dc7565b60206040518083038186803b1580156119ce57600080fd5b505afa1580156119e2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a069190612904565b611a1457611a146003611033565b600254604051633ecdecc760e21b81526000916001600160a01b03169063fb37b31c90611a45908590600401612dc7565b602060405180830381600087803b158015611a5f57600080fd5b505af1158015611a73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a979190612904565b905080610a9b57610a9b6175306064611ab2610aad86611317565b02016121a7565b606061063282604051602001611acf9190612ce7565b6040516020818303038152906040526121c7565b6060610632611af183612219565b6121c7565b60606000611b038361231d565b9050611b11815160c061241d565b81604051602001611b23929190612d59565b604051602081830303815290604052915050919050565b90565b60408501516000906060908015801590611b5b5750611b5b8461256d565b15611bcb5762015f905a1015611b84575050604080516020810190915260008082529150611443565b611b938762015f905a036125af565b96506000611ba58960200151836125c5565b905080611bc957600060405180602001604052806000815250935093505050611443565b505b60408051608081018252600e546001600160a01b039081168252600f541660208201526010549181019190915260115460ff1615156060820152611c0f818a612627565b6013546000611c1d8a612164565b6013819055905060006060611c31896126e8565b15611ce857306001600160a01b03168c63f573102160e01b8c8e604051602401611c5c929190612ea9565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051611c9a9190612d3d565b60006040518083038160008787f1925050503d8060008114611cd8576040519150601f19603f3d011682016040523d82523d6000602084013e611cdd565b606091505b509092509050611d4b565b8a6001600160a01b03168c8b604051611d019190612d3d565b60006040518083038160008787f1925050503d8060008114611d3f576040519150601f19603f3d011682016040523d82523d6000602084013e611d44565b606091505b5090925090505b600086118015611d5f5750611d5f8961256d565b8015611d69575081155b15611d91576000611d7e8660200151886125c5565b905080611d8f57611d8f6000611033565b505b611d9b8d86612627565b60135482611e8157600080600080611db2866126f1565b929650909450925090506003846007811115611dca57fe5b1415611dd957611dd984611033565b6001846007811115611de757fe5b1480611dfe57506004846007811115611dfc57fe5b145b80611e1457506006846007811115611e1257fe5b145b80611e2a57506007846007811115611e2857fe5b145b15611e355760128290555b6001846007811115611e4357fe5b1480611e5a57506004846007811115611e5857fe5b145b15611e6757809550611e7a565b6040518060200160405280600081525095505b5090925050505b909203909203601355909a909950975050505050505050565b611ea48282611837565b60025460405163af3dc01160e01b81526000916001600160a01b03169063af3dc01190611ed79086908690600401612dff565b602060405180830381600087803b158015611ef157600080fd5b505af1158015611f05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f299190612904565b90508061131257611f3983612055565b600260009054906101000a90046001600160a01b03166001600160a01b031663c3fd9b256040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611f8957600080fd5b505af1158015611f9d573d6000803e3d6000fd5b50505050611312614e206121a7565b60606000836007811115611fbc57fe5b1415611fd75750604080516020810190915260008152610632565b6003836007811115611fe557fe5b14156120235760408051602080820183526000808352925161200d9387939092839201612ee7565b6040516020818303038152906040529050610632565b60135460125460405161203e92869290918690602001612f23565b604051602081830303815290604052905092915050565b61205e81611972565b60025460405163011b1f7960e41b81526000916001600160a01b0316906311b1f7909061208f908590600401612dc7565b602060405180830381600087803b1580156120a957600080fd5b505af11580156120bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120e19190612904565b905080610a9b57600260009054906101000a90046001600160a01b03166001600160a01b03166333f943056040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561213857600080fd5b505af115801561214c573d6000803e3d6000fd5b50505050610a9b6175306064611ab2610aad86611317565b60005a8210612173575a610632565b5090565b60045460009083111561218c57506000610632565b60035483101561219e57506000610632565b50600192915050565b6013548111156121bb576121bb6002611033565b60138054919091039055565b606080825160011480156121ef57506080836000815181106121e557fe5b016020015160f81c105b156121fb575081610632565b6122078351608061241d565b8360405160200161203e929190612d59565b606060008260405160200161222e9190612dbe565b604051602081830303815290604052905060005b60208110156122785781818151811061225757fe5b01602001516001600160f81b0319161561227057612278565b600101612242565b6000816020036001600160401b038111801561229357600080fd5b506040519080825280601f01601f1916602001820160405280156122be576020820181803683370190505b50905060005b81518110156123145783516001840193859181106122de57fe5b602001015160f81c60f81b8282815181106122f557fe5b60200101906001600160f81b031916908160001a9053506001016122c4565b50949350505050565b606081516000141561233e5750604080516000815260208101909152610511565b6000805b83518110156123715783818151811061235757fe5b602002602001015151820191508080600101915050612342565b6000826001600160401b038111801561238957600080fd5b506040519080825280601f01601f1916602001820160405280156123b4576020820181803683370190505b50600092509050602081015b85518310156123145760008684815181106123d757fe5b6020026020010151905060006020820190506123f583828451612744565b87858151811061240157fe5b60200260200101515183019250505082806001019350506123c0565b6060806038841015612477576040805160018082528183019092529060208201818036833701905050905082840160f81b8160008151811061245b57fe5b60200101906001600160f81b031916908160001a905350610d53565b600060015b80868161248557fe5b041561249a576001909101906101000261247c565b816001016001600160401b03811180156124b357600080fd5b506040519080825280601f01601f1916602001820160405280156124de576020820181803683370190505b50925084820160370160f81b836000815181106124f757fe5b60200101906001600160f81b031916908160001a905350600190505b818111612563576101008183036101000a878161252c57fe5b048161253457fe5b0660f81b83828151811061254457fe5b60200101906001600160f81b031916908160001a905350600101612513565b5050905092915050565b60008082600481111561257c57fe5b1480612594575060035b82600481111561259257fe5b145b80610632575060048260048111156125a857fe5b1492915050565b60008183106125be5781610d53565b5090919050565b60008083836040516024016125db929190612dff565b60408051601f198184030181529190526020810180516001600160e01b031663a9059cbb60e01b1790529050600061261d5a6006602160991b01600085610737565b5095945050505050565b805182516001600160a01b0390811691161461265f578051600e80546001600160a01b0319166001600160a01b039092169190911790555b80602001516001600160a01b031682602001516001600160a01b0316146126a5576020810151600f80546001600160a01b0319166001600160a01b039092169190911790555b8060600151151582606001511515146126cf5760608101516011805460ff19169115159190911790555b8060400151826040015114610a9b576040015160105550565b60006003612586565b60008060006060845160001415612720575050604080516020810190915260008082529250829150819061273d565b848060200190518101906127349190612a79565b93509350935093505b9193509193565b8282825b60208110612767578151835260209283019290910190601f1901612748565b905182516020929092036101000a6000190180199091169116179052505050565b600061279b61279684612fde565b612fbb565b90508281528383830111156127af57600080fd5b828260208301376000602084830101529392505050565b80356105118161302b565b600082601f8301126127e1578081fd5b610d5383833560208501612788565b80356002811061051157600080fd5b600060e08284031215612810578081fd5b61281a60e0612fbb565b90508135815260208201356020820152612836604083016127f0565b6040820152612847606083016127c6565b6060820152612858608083016127c6565b608082015260a082013560a082015260c08201356001600160401b0381111561288057600080fd5b61288c848285016127d1565b60c08301525092915050565b6000602082840312156128a9578081fd5b8135610d538161302b565b6000602082840312156128c5578081fd5b8151610d538161302b565b6000806000606084860312156128e4578182fd5b83356128ef8161302b565b95602085013595506040909401359392505050565b600060208284031215612915578081fd5b81518015158114610d53578182fd5b600060208284031215612935578081fd5b5035919050565b60006020828403121561294d578081fd5b5051919050565b60008060408385031215612966578182fd5b50508035926020909101359150565b6000806000806080858703121561298a578081fd5b84359350602085013560ff811681146129a1578182fd5b93969395505050506040820135916060013590565b6000602082840312156129c7578081fd5b81356001600160401b038111156129dc578182fd5b610946848285016127d1565b600080604083850312156129fa578182fd5b82356001600160401b03811115612a0f578283fd5b612a1b858286016127d1565b9250506020830135612a2c8161302b565b809150509250929050565b60008060408385031215612a49578182fd5b82356001600160401b03811115612a5e578283fd5b612a6a858286016127d1565b95602094909401359450505050565b60008060008060808587031215612a8e578182fd5b845160088110612a9c578283fd5b80945050602085015192506040850151915060608501516001600160401b03811115612ac6578182fd5b8501601f81018713612ad6578182fd5b8051612ae461279682612fde565b818152886020838501011115612af8578384fd5b612b09826020830160208601612fff565b9598949750929550505050565b600060208284031215612b27578081fd5b81356001600160401b03811115612b3c578182fd5b8201601f81018413612b4c578182fd5b61094684823560208401612788565b60008060408385031215612b6d578182fd5b82356001600160401b03811115612b82578283fd5b612a1b858286016127ff565b60008060008060808587031215612ba3578182fd5b84356001600160401b03811115612bb8578283fd5b612bc4878288016127ff565b9450506020850135612bd58161302b565b9250604085013591506060850135612bec8161302b565b939692955090935050565b600080600060608486031215612c0b578081fd5b833592506020840135612c1d8161302b565b915060408401356001600160401b03811115612c37578182fd5b612c43868287016127d1565b9150509250925092565b60008060008060808587031215612c62578182fd5b843593506020850135612c748161302b565b92506040850135915060608501356001600160401b03811115612c95578182fd5b612ca1878288016127d1565b91505092959194509250565b60008151808452612cc5816020860160208601612fff565b601f01601f19169290920160200192915050565b60088110612ce357fe5b9052565b60609190911b6bffffffffffffffffffffffff1916815260140190565b6001600160f81b031994909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b60008251612d4f818460208701612fff565b9190910192915050565b60008351612d6b818460208801612fff565b835190830190612d7f818360208801612fff565b01949350505050565b6c600d380380600d6000396000f360981b81528151600090612db181600d850160208701612fff565b91909101600d0192915050565b90815260200190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b038316815260406020820181905260009061094690830184612cad565b60008315158252604060208301526109466040830184612cad565b93845260ff9290921660208401526040830152606082015260800190565b600060208252610d536020830184612cad565b600060408252612ebc6040830185612cad565b905060018060a01b03831660208301529392505050565b6020810160028310612ee157fe5b91905290565b6000612ef38287612cd9565b60ff8516602083015260ff8416604083015260806060830152612f196080830184612cad565b9695505050505050565b6000612f2f8287612cd9565b84602083015283604083015260806060830152612f196080830184612cad565b60208082526046908201527f4f6e6c792061757468656e746963617465642061646472657373657320696e2060408201527f6f766d53746174654d616e616765722063616e2063616c6c20746869732066756060820152653731ba34b7b760d11b608082015260a00190565b6040518181016001600160401b0381118282101715612fd657fe5b604052919050565b60006001600160401b03821115612ff157fe5b50601f01601f191660200190565b60005b8381101561301a578181015183820152602001613002565b8381111561092b5750506000910152565b6001600160a01b038116811461065257600080fdfe5369676e61747572652070726f766964656420666f7220454f4120636f6e7472616374206372656174696f6e20697320696e76616c69642e436f6e7472616374206372656174696f6e20636f646520636f6e7461696e7320756e73616665206f70636f6465732e2044696420796f75207573652074686520726967687420636f6d70696c6572206f72207061737320616e20756e7361666520636f6e7374727563746f7220617267756d656e743f436f6e7374727563746f7220617474656d7074656420746f206465706c6f7920756e736166652062797465636f64652ea2646970667358221220fe0b47506ec2f40df111ba865323ee43ffbd7ef91f30eae2dfc209de19a78c0a64736f6c63430007060033", "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", @@ -717,6 +814,14 @@ "_ADDRESS": "Active ADDRESS within the current message context." } }, + "ovmBALANCE(address)": { + "params": { + "_contract": "Address of the contract to query the OVM_ETH balance of." + }, + "returns": { + "_BALANCE": "OVM_ETH balance of the requested contract." + } + }, "ovmCALL(uint256,address,bytes)": { "params": { "_address": "Address of the contract to call.", @@ -728,11 +833,28 @@ "_success": "Whether or not the call returned (rather than reverted)." } }, + "ovmCALL(uint256,address,uint256,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.", + "_value": "ETH value to pass with the 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." } }, + "ovmCALLVALUE()": { + "returns": { + "_CALLVALUE": "Value sent along with the call according to the current message context." + } + }, "ovmCHAINID()": { "returns": { "_CHAINID": "Value of the chain's CHAINID within the global context." @@ -833,6 +955,11 @@ "_data": "Bytes data to pass along with the REVERT." } }, + "ovmSELFBALANCE()": { + "returns": { + "_BALANCE": "OVM_ETH balance of the requesting contract." + } + }, "ovmSLOAD(bytes32)": { "params": { "_key": "32 byte key of the storage slot to load." @@ -877,20 +1004,26 @@ "_transaction": "Transaction data to be executed." } }, - "safeCREATE(uint256,bytes,address)": { + "safeCREATE(bytes,address)": { "params": { "_address": "OVM address being deployed to.", - "_creationCode": "Code to pass into CREATE for deployment.", - "_gasLimit": "Amount of gas to be passed into this creation." + "_creationCode": "Code to pass into CREATE for deployment." } }, - "simulateMessage((uint256,uint256,uint8,address,address,uint256,bytes),address,address)": { + "simulateMessage((uint256,uint256,uint8,address,address,uint256,bytes),address,uint256,address)": { "params": { "_from": "the OVM account the simulated call should be from.", - "_transaction": "the message transaction to simulate." + "_ovmStateManager": "the address of the OVM_StateManager precompile in the L2 state.", + "_transaction": "the message transaction to simulate.", + "_value": "the amount of ETH value to send." } } }, + "stateVariables": { + "CONTAINER_CONTRACT_PREFIX": { + "details": "The Execution Manager and State Manager each have this 30 byte prefix, and are uncallable." + } + }, "title": "OVM_ExecutionManager", "version": 1 }, @@ -900,12 +1033,21 @@ "ovmADDRESS()": { "notice": "Overrides ADDRESS." }, + "ovmBALANCE(address)": { + "notice": "Overrides BALANCE. NOTE: In the future, this could be optimized to directly invoke EM._getContractStorage(...)." + }, "ovmCALL(uint256,address,bytes)": { + "notice": "Legacy ovmCALL function which did not support ETH value; this maintains backwards compatibility." + }, + "ovmCALL(uint256,address,uint256,bytes)": { "notice": "Overrides CALL." }, "ovmCALLER()": { "notice": "Overrides CALLER." }, + "ovmCALLVALUE()": { + "notice": "Overrides CALLVALUE." + }, "ovmCHAINID()": { "notice": "Overrides CHAINID." }, @@ -951,6 +1093,9 @@ "ovmREVERT(bytes)": { "notice": "Overrides REVERT." }, + "ovmSELFBALANCE()": { + "notice": "Overrides SELFBALANCE." + }, "ovmSLOAD(bytes32)": { "notice": "Overrides SLOAD." }, @@ -969,10 +1114,10 @@ "run((uint256,uint256,uint8,address,address,uint256,bytes),address)": { "notice": "Starts the execution of a transaction via the OVM_ExecutionManager." }, - "safeCREATE(uint256,bytes,address)": { + "safeCREATE(bytes,address)": { "notice": "Handles the creation-specific safety measures required for OVM contract deployment. This function sanitizes the return types for creation messages to match calls (bool, bytes), by being an external function which the EM can call, that mimics the success/fail case of the CREATE. This allows for consistent handling of both types of messages in _handleExternalMessage(). Having this step occur as a separate call frame also allows us to easily revert the contract deployment in the event that the code is unsafe." }, - "simulateMessage((uint256,uint256,uint8,address,address,uint256,bytes),address,address)": { + "simulateMessage((uint256,uint256,uint8,address,address,uint256,bytes),address,uint256,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." } }, @@ -981,76 +1126,76 @@ "storageLayout": { "storage": [ { - "astId": 12856, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12849" + "type": "t_contract(Lib_AddressManager)15296" }, { - "astId": 5228, + "astId": 6671, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmSafetyChecker", "offset": 0, "slot": "1", - "type": "t_contract(iOVM_SafetyChecker)11336" + "type": "t_contract(iOVM_SafetyChecker)13768" }, { - "astId": 5230, + "astId": 6673, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmStateManager", "offset": 0, "slot": "2", - "type": "t_contract(iOVM_StateManager)11568" + "type": "t_contract(iOVM_StateManager)14000" }, { - "astId": 5232, + "astId": 6675, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "gasMeterConfig", "offset": 0, "slot": "3", - "type": "t_struct(GasMeterConfig)11119_storage" + "type": "t_struct(GasMeterConfig)13517_storage" }, { - "astId": 5234, + "astId": 6677, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "globalContext", "offset": 0, "slot": "7", - "type": "t_struct(GlobalContext)11122_storage" + "type": "t_struct(GlobalContext)13520_storage" }, { - "astId": 5236, + "astId": 6679, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "transactionContext", "offset": 0, "slot": "8", - "type": "t_struct(TransactionContext)11135_storage" + "type": "t_struct(TransactionContext)13533_storage" }, { - "astId": 5238, + "astId": 6681, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "messageContext", "offset": 0, "slot": "14", - "type": "t_struct(MessageContext)11145_storage" + "type": "t_struct(MessageContext)13545_storage" }, { - "astId": 5240, + "astId": 6683, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "transactionRecord", "offset": 0, - "slot": "16", - "type": "t_struct(TransactionRecord)11138_storage" + "slot": "18", + "type": "t_struct(TransactionRecord)13536_storage" }, { - "astId": 5242, + "astId": 6685, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "messageRecord", "offset": 0, - "slot": "17", - "type": "t_struct(MessageRecord)11148_storage" + "slot": "19", + "type": "t_struct(MessageRecord)13548_storage" } ], "types": { @@ -1064,32 +1209,32 @@ "label": "bool", "numberOfBytes": "1" }, - "t_contract(Lib_AddressManager)12849": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" }, - "t_contract(iOVM_SafetyChecker)11336": { + "t_contract(iOVM_SafetyChecker)13768": { "encoding": "inplace", "label": "contract iOVM_SafetyChecker", "numberOfBytes": "20" }, - "t_contract(iOVM_StateManager)11568": { + "t_contract(iOVM_StateManager)14000": { "encoding": "inplace", "label": "contract iOVM_StateManager", "numberOfBytes": "20" }, - "t_enum(QueueOrigin)12489": { + "t_enum(QueueOrigin)14880": { "encoding": "inplace", "label": "enum Lib_OVMCodec.QueueOrigin", "numberOfBytes": "1" }, - "t_struct(GasMeterConfig)11119_storage": { + "t_struct(GasMeterConfig)13517_storage": { "encoding": "inplace", "label": "struct iOVM_ExecutionManager.GasMeterConfig", "members": [ { - "astId": 11112, + "astId": 13510, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "minTransactionGasLimit", "offset": 0, @@ -1097,7 +1242,7 @@ "type": "t_uint256" }, { - "astId": 11114, + "astId": 13512, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "maxTransactionGasLimit", "offset": 0, @@ -1105,7 +1250,7 @@ "type": "t_uint256" }, { - "astId": 11116, + "astId": 13514, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "maxGasPerQueuePerEpoch", "offset": 0, @@ -1113,7 +1258,7 @@ "type": "t_uint256" }, { - "astId": 11118, + "astId": 13516, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "secondsPerEpoch", "offset": 0, @@ -1123,12 +1268,12 @@ ], "numberOfBytes": "128" }, - "t_struct(GlobalContext)11122_storage": { + "t_struct(GlobalContext)13520_storage": { "encoding": "inplace", "label": "struct iOVM_ExecutionManager.GlobalContext", "members": [ { - "astId": 11121, + "astId": 13519, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmCHAINID", "offset": 0, @@ -1138,12 +1283,12 @@ ], "numberOfBytes": "32" }, - "t_struct(MessageContext)11145_storage": { + "t_struct(MessageContext)13545_storage": { "encoding": "inplace", "label": "struct iOVM_ExecutionManager.MessageContext", "members": [ { - "astId": 11140, + "astId": 13538, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmCALLER", "offset": 0, @@ -1151,7 +1296,7 @@ "type": "t_address" }, { - "astId": 11142, + "astId": 13540, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmADDRESS", "offset": 0, @@ -1159,22 +1304,30 @@ "type": "t_address" }, { - "astId": 11144, + "astId": 13542, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmCALLVALUE", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 13544, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "isStatic", - "offset": 20, - "slot": "1", + "offset": 0, + "slot": "3", "type": "t_bool" } ], - "numberOfBytes": "64" + "numberOfBytes": "128" }, - "t_struct(MessageRecord)11148_storage": { + "t_struct(MessageRecord)13548_storage": { "encoding": "inplace", "label": "struct iOVM_ExecutionManager.MessageRecord", "members": [ { - "astId": 11147, + "astId": 13547, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "nuisanceGasLeft", "offset": 0, @@ -1184,20 +1337,20 @@ ], "numberOfBytes": "32" }, - "t_struct(TransactionContext)11135_storage": { + "t_struct(TransactionContext)13533_storage": { "encoding": "inplace", "label": "struct iOVM_ExecutionManager.TransactionContext", "members": [ { - "astId": 11124, + "astId": 13522, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmL1QUEUEORIGIN", "offset": 0, "slot": "0", - "type": "t_enum(QueueOrigin)12489" + "type": "t_enum(QueueOrigin)14880" }, { - "astId": 11126, + "astId": 13524, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmTIMESTAMP", "offset": 0, @@ -1205,7 +1358,7 @@ "type": "t_uint256" }, { - "astId": 11128, + "astId": 13526, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmNUMBER", "offset": 0, @@ -1213,7 +1366,7 @@ "type": "t_uint256" }, { - "astId": 11130, + "astId": 13528, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmGASLIMIT", "offset": 0, @@ -1221,7 +1374,7 @@ "type": "t_uint256" }, { - "astId": 11132, + "astId": 13530, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmTXGASLIMIT", "offset": 0, @@ -1229,7 +1382,7 @@ "type": "t_uint256" }, { - "astId": 11134, + "astId": 13532, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmL1TXORIGIN", "offset": 0, @@ -1239,12 +1392,12 @@ ], "numberOfBytes": "192" }, - "t_struct(TransactionRecord)11138_storage": { + "t_struct(TransactionRecord)13536_storage": { "encoding": "inplace", "label": "struct iOVM_ExecutionManager.TransactionRecord", "members": [ { - "astId": 11137, + "astId": 13535, "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", "label": "ovmGasRefund", "offset": 0, diff --git a/packages/contracts/deployments/mainnet/OVM_FraudVerifier.json b/packages/contracts/deployments/mainnet/OVM_FraudVerifier.json index 6792581fd20e..8861f40fb543 100644 --- a/packages/contracts/deployments/mainnet/OVM_FraudVerifier.json +++ b/packages/contracts/deployments/mainnet/OVM_FraudVerifier.json @@ -1,5 +1,5 @@ { - "address": "0x169CC2f69Cc16da17B71Df2dce6161ef57991bB9", + "address": "0x042065416C5c665dc196076745326Af3Cd840D15", "abi": [ { "inputs": [ @@ -437,29 +437,29 @@ "type": "function" } ], - "transactionHash": "0xb24349bb6d8ea4817102c7c98e1f7656e761fa6817ed7a14a77c0a4bfd7a4215", + "transactionHash": "0xb342bc1baf22f8ff0264dc6b9bc6425d76d8798e9f811ce1dbd4830cbc1c1329", "receipt": { "to": null, - "from": "0xd033f09cB85621F98F7A84C64dB381ac16Eff818", - "contractAddress": "0x169CC2f69Cc16da17B71Df2dce6161ef57991bB9", - "transactionIndex": 154, - "gasUsed": "1386986", + "from": "0x9996571372066A1545D3435C6935e3F9593A7eF5", + "contractAddress": "0x042065416C5c665dc196076745326Af3Cd840D15", + "transactionIndex": 134, + "gasUsed": "1386998", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x7337e713943b7eeaef3e1fb048abc568735fedc9f81d2e1520179efdb4643a0c", - "transactionHash": "0xb24349bb6d8ea4817102c7c98e1f7656e761fa6817ed7a14a77c0a4bfd7a4215", + "blockHash": "0x81588e4753038f4b6f1ef49a19f520d45e6d294c0d12420ba3b06e358ec25578", + "transactionHash": "0xb342bc1baf22f8ff0264dc6b9bc6425d76d8798e9f811ce1dbd4830cbc1c1329", "logs": [], - "blockNumber": 12410842, - "cumulativeGasUsed": "7764301", + "blockNumber": 12686765, + "cumulativeGasUsed": "12675150", "status": 1, "byzantium": true }, "args": [ - "0x668E5b997b9aE88a56cd40409119d4Db9e6d752E" + "0xdE1FCfB0851916CA5101820A69b13a4E276bd81F" ], - "solcInputHash": "f2bdab652d5102f5f11e78dae866798d", - "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\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}}},\"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.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"}},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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 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\\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\":\"0x879cef57019254ad958a75db64f0b58eb0a6fcf74f386ed958f75384b860dd35\",\"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 * 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\":\"0x2d7973a0ad84c23ec62624d3f1e3aeb198cc72686ff1e6cfa17155556b320c94\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0xcc9fc5c64f1101a5c6c397594086b1608189a9edc5c9635e1ac38f70aeeeecbf\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b5060405161184138038061184183398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b6117b0806100916000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063299ca4781461005c578063461a44781461007a57806398d8867d1461008d578063a286ba1c146100a2578063b48ec820146100b5575b600080fd5b6100646100c8565b6040516100719190611306565b60405180910390f35b610064610088366004611101565b6100d7565b6100a061009b366004611029565b6101b5565b005b6100a06100b0366004610f64565b6104f4565b6100646100c3366004610f43565b6108bb565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561013757818101518382015260200161011f565b50505050905090810190601f1680156101645780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561018157600080fd5b505afa158015610195573d6000803e3d6000fd5b505050506040513d60208110156101ab57600080fd5b505190505b919050565b866101bf8561090a565b60005a905060006101cf8861090a565b90506101db8b82610923565b156101e65750610432565b60006102216040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b905060006102636040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e0000008152506100d7565b9050816001600160a01b0316634d69ee578e8e8e6040518463ffffffff1660e01b81526004016102959392919061135f565b60206040518083038186803b1580156102ad57600080fd5b505afa1580156102c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102e59190610f0f565b61030a5760405162461bcd60e51b8152600401610301906115e7565b60405180910390fd5b6040516326f2b4e760e11b81526001600160a01b03821690634de569ce9061033c908d908d908d908d90600401611641565b60206040518083038186803b15801561035457600080fd5b505afa158015610368573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038c9190610f0f565b6103a85760405162461bcd60e51b815260040161030190611499565b86600001518860600151018b600001518d6060015101600101146103de5760405162461bcd60e51b815260040161030190611525565b6103ed8d848d60000151610942565b7f41a48bde2468fac6f670f39b66d7b91f311053e1f28eab9d75056546e6eaac958d8c6000015185336040516104269493929190611394565b60405180910390a15050505b60005a820390506104696040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b1580156104cf57600080fd5b505af11580156104e3573d6000803e3d6000fd5b505050505050505050505050505050565b868460005a905060006105078b896108bb565b905060006105446040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b9050816001600160a01b031663b2fa1c9e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561057f57600080fd5b505afa158015610593573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b79190610f0f565b15156001146105d85760405162461bcd60e51b8152600401610301906113b8565b89600001518b606001510160010186600001518860600151011461060e5760405162461bcd60e51b81526004016103019061141f565b604051634d69ee5760e01b81526001600160a01b03821690634d69ee579061063e908f908f908f9060040161135f565b60206040518083038186803b15801561065657600080fd5b505afa15801561066a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068e9190610f0f565b6106aa5760405162461bcd60e51b8152600401610301906115e7565b604051634d69ee5760e01b81526001600160a01b03821690634d69ee57906106da908b908b908b9060040161135f565b60206040518083038186803b1580156106f257600080fd5b505afa158015610706573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072a9190610f0f565b6107465760405162461bcd60e51b8152600401610301906114dd565b816001600160a01b031663c1c618b86040518163ffffffff1660e01b815260040160206040518083038186803b15801561077f57600080fd5b505afa158015610793573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b79190610f2b565b8814156107d65760405162461bcd60e51b815260040161030190611597565b6107e0878d610a6d565b6000600160008e8c6040516020016107f9929190611289565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507f1e5fff3c23daf51ea67aaa3bbc738bcedaa98be5a5503f0e63a336a004b075b18c8b600001518b3360405161087a9493929190611394565b60405180910390a1505060005a820390506104696040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b60006001600084846040516020016108d4929190611289565b60408051808303601f19018152918152815160209283012083529082019290925201600020546001600160a01b03169392505050565b600061091582610bc7565b805190602001209050919050565b60008061093084846108bb565b6001600160a01b031614159392505050565b6109806040518060400160405280601c81526020017f4f564d5f53746174655472616e736974696f6e6572466163746f7279000000008152506100d7565b600054604051631168a38160e11b81526001600160a01b03928316926322d14702926109b79291169085908890889060040161131a565b602060405180830381600087803b1580156109d157600080fd5b505af11580156109e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0991906110e5565b600160008585604051602001610a20929190611289565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550505050565b6000610aa86040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b90506000610adc6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b604051632e38626b60e21b81529091506001600160a01b0383169063b8e189ac90610b0b90879060040161162e565b600060405180830381600087803b158015610b2557600080fd5b505af1158015610b39573d6000803e3d6000fd5b505050506000808560800151806020019051810190610b58919061114f565b60405163abfbbe1360e01b815291935091506001600160a01b0384169063abfbbe1390610b8d90889085908790600401611340565b600060405180830381600087803b158015610ba757600080fd5b505af1158015610bbb573d6000803e3d6000fd5b50505050505050505050565b6060816000015182602001518360400151846060015185608001518660a001518760c00151604051602001610c029796959493929190611297565b6040516020818303038152906040529050919050565b600067ffffffffffffffff831115610c2c57fe5b610c3f601f8401601f1916602001611700565b9050828152838383011115610c5357600080fd5b828260208301376000602084830101529392505050565b80356101b081611754565b600082601f830112610c85578081fd5b610c9483833560208501610c18565b9392505050565b8035600281106101b057600080fd5b600060a08284031215610cbb578081fd5b60405160a0810167ffffffffffffffff8282108183111715610cd957fe5b81604052829350843583526020850135602084015260408501356040840152606085013560608401526080850135915080821115610d1657600080fd5b50610d2385828601610c75565b6080830152505092915050565b600060408284031215610d41578081fd5b6040516040810167ffffffffffffffff8282108183111715610d5f57fe5b8160405282935084358352602091508185013581811115610d7f57600080fd5b8501601f81018713610d9057600080fd5b803582811115610d9c57fe5b8381029250610dac848401611700565b8181528481019083860185850187018b1015610dc757600080fd5b600095505b83861015610dea578035835260019590950194918601918601610dcc565b5080868801525050505050505092915050565b600060a08284031215610e0e578081fd5b60405160a0810167ffffffffffffffff8282108183111715610e2c57fe5b8160405282935084359150610e408261176c565b8183526020850135602084015260408501356040840152606085013560608401526080850135915080821115610d1657600080fd5b600060e08284031215610e86578081fd5b610e9060e0611700565b90508135815260208201356020820152610eac60408301610c9b565b6040820152610ebd60608301610c6a565b6060820152610ece60808301610c6a565b608082015260a082013560a082015260c082013567ffffffffffffffff811115610ef757600080fd5b610f0384828501610c75565b60c08301525092915050565b600060208284031215610f20578081fd5b8151610c948161176c565b600060208284031215610f3c578081fd5b5051919050565b60008060408385031215610f55578081fd5b50508035926020909101359150565b600080600080600080600060e0888a031215610f7e578283fd5b87359650602088013567ffffffffffffffff80821115610f9c578485fd5b610fa88b838c01610caa565b975060408a0135915080821115610fbd578485fd5b610fc98b838c01610d30565b965060608a0135955060808a0135945060a08a0135915080821115610fec578384fd5b610ff88b838c01610caa565b935060c08a013591508082111561100d578283fd5b5061101a8a828b01610d30565b91505092959891949750929550565b600080600080600080600060e0888a031215611043578081fd5b87359650602088013567ffffffffffffffff80821115611061578283fd5b61106d8b838c01610caa565b975060408a0135915080821115611082578283fd5b61108e8b838c01610d30565b965060608a01359150808211156110a3578283fd5b6110af8b838c01610e75565b955060808a01359150808211156110c4578283fd5b6110d08b838c01610dfd565b945060a08a0135915080821115610fec578283fd5b6000602082840312156110f6578081fd5b8151610c9481611754565b600060208284031215611112578081fd5b813567ffffffffffffffff811115611128578182fd5b8201601f81018413611138578182fd5b61114784823560208401610c18565b949350505050565b60008060408385031215611161578182fd5b82519150602083015161117381611754565b809150509250929050565b6001600160a01b03169052565b600081518084526111a3816020860160208601611724565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261114760a085018261118b565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b8083101561123f578451825293830193600192909201919083019061121f565b509695505050505050565b6000815115158352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261114760a085018261118b565b918252602082015260400190565b6000888252876020830152600287106112ac57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b1660558401525083606983015282516112f3816089850160208701611724565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b9283526001600160a01b03919091166020830152604082015260600190565b60008482526060602083015261137860608301856111b7565b828103604084015261138a81856111f4565b9695505050505050565b938452602084019290925260408301526001600160a01b0316606082015260800190565b60208082526041908201527f5374617465207472616e736974696f6e2070726f63657373206d75737420626560408201527f20636f6d706c65746564207072696f7220746f2066696e616c697a6174696f6e6060820152601760f91b608082015260a00190565b60208082526054908201527f506f73742d737461746520726f6f7420676c6f62616c20696e646578206d757360408201527f7420657175616c20746f207468652070726520737461746520726f6f7420676c60608201527337b130b61034b73232bc1038363ab99037b7329760611b608082015260a00190565b60208082526024908201527f496e76616c6964207472616e73616374696f6e20696e636c7573696f6e20707260408201526337b7b31760e11b606082015260800190565b60208082526028908201527f496e76616c696420706f73742d737461746520726f6f7420696e636c7573696f6040820152673710383937b7b31760c11b606082015260800190565b6020808252604c908201527f5072652d737461746520726f6f7420676c6f62616c20696e646578206d75737460408201527f20657175616c20746f20746865207472616e73616374696f6e20726f6f74206760608201526b3637b130b61034b73232bc1760a11b608082015260a00190565b60208082526030908201527f5374617465207472616e736974696f6e20686173206e6f74206265656e20707260408201526f37bb32b710333930bab23ab632b73a1760811b606082015260800190565b60208082526027908201527f496e76616c6964207072652d737461746520726f6f7420696e636c7573696f6e60408201526610383937b7b31760c91b606082015260800190565b600060208252610c9460208301846111b7565b60006080825285516080830152602086015160a083015260408601516002811061166757fe5b60c083015260608601516001600160a01b031660e0830152608086015161169261010084018261117e565b5060a086015161012083015260c086015160e06101408401526116b961016084018261118b565b905082810360208401526116cd818761124a565b905082810360408401526116e181866111b7565b905082810360608401526116f581856111f4565b979650505050505050565b60405181810167ffffffffffffffff8111828210171561171c57fe5b604052919050565b60005b8381101561173f578181015183820152602001611727565b8381111561174e576000848401525b50505050565b6001600160a01b038116811461176957600080fd5b50565b801515811461176957600080fdfea26469706673582212201bddb6e25a2ac8766d59ad23945a559f5d002a1c7940103e2fd0834ca70c019464736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c8063299ca4781461005c578063461a44781461007a57806398d8867d1461008d578063a286ba1c146100a2578063b48ec820146100b5575b600080fd5b6100646100c8565b6040516100719190611306565b60405180910390f35b610064610088366004611101565b6100d7565b6100a061009b366004611029565b6101b5565b005b6100a06100b0366004610f64565b6104f4565b6100646100c3366004610f43565b6108bb565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561013757818101518382015260200161011f565b50505050905090810190601f1680156101645780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561018157600080fd5b505afa158015610195573d6000803e3d6000fd5b505050506040513d60208110156101ab57600080fd5b505190505b919050565b866101bf8561090a565b60005a905060006101cf8861090a565b90506101db8b82610923565b156101e65750610432565b60006102216040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b905060006102636040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e0000008152506100d7565b9050816001600160a01b0316634d69ee578e8e8e6040518463ffffffff1660e01b81526004016102959392919061135f565b60206040518083038186803b1580156102ad57600080fd5b505afa1580156102c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102e59190610f0f565b61030a5760405162461bcd60e51b8152600401610301906115e7565b60405180910390fd5b6040516326f2b4e760e11b81526001600160a01b03821690634de569ce9061033c908d908d908d908d90600401611641565b60206040518083038186803b15801561035457600080fd5b505afa158015610368573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038c9190610f0f565b6103a85760405162461bcd60e51b815260040161030190611499565b86600001518860600151018b600001518d6060015101600101146103de5760405162461bcd60e51b815260040161030190611525565b6103ed8d848d60000151610942565b7f41a48bde2468fac6f670f39b66d7b91f311053e1f28eab9d75056546e6eaac958d8c6000015185336040516104269493929190611394565b60405180910390a15050505b60005a820390506104696040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b1580156104cf57600080fd5b505af11580156104e3573d6000803e3d6000fd5b505050505050505050505050505050565b868460005a905060006105078b896108bb565b905060006105446040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b9050816001600160a01b031663b2fa1c9e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561057f57600080fd5b505afa158015610593573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b79190610f0f565b15156001146105d85760405162461bcd60e51b8152600401610301906113b8565b89600001518b606001510160010186600001518860600151011461060e5760405162461bcd60e51b81526004016103019061141f565b604051634d69ee5760e01b81526001600160a01b03821690634d69ee579061063e908f908f908f9060040161135f565b60206040518083038186803b15801561065657600080fd5b505afa15801561066a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068e9190610f0f565b6106aa5760405162461bcd60e51b8152600401610301906115e7565b604051634d69ee5760e01b81526001600160a01b03821690634d69ee57906106da908b908b908b9060040161135f565b60206040518083038186803b1580156106f257600080fd5b505afa158015610706573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072a9190610f0f565b6107465760405162461bcd60e51b8152600401610301906114dd565b816001600160a01b031663c1c618b86040518163ffffffff1660e01b815260040160206040518083038186803b15801561077f57600080fd5b505afa158015610793573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b79190610f2b565b8814156107d65760405162461bcd60e51b815260040161030190611597565b6107e0878d610a6d565b6000600160008e8c6040516020016107f9929190611289565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507f1e5fff3c23daf51ea67aaa3bbc738bcedaa98be5a5503f0e63a336a004b075b18c8b600001518b3360405161087a9493929190611394565b60405180910390a1505060005a820390506104696040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b60006001600084846040516020016108d4929190611289565b60408051808303601f19018152918152815160209283012083529082019290925201600020546001600160a01b03169392505050565b600061091582610bc7565b805190602001209050919050565b60008061093084846108bb565b6001600160a01b031614159392505050565b6109806040518060400160405280601c81526020017f4f564d5f53746174655472616e736974696f6e6572466163746f7279000000008152506100d7565b600054604051631168a38160e11b81526001600160a01b03928316926322d14702926109b79291169085908890889060040161131a565b602060405180830381600087803b1580156109d157600080fd5b505af11580156109e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0991906110e5565b600160008585604051602001610a20929190611289565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550505050565b6000610aa86040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b90506000610adc6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b604051632e38626b60e21b81529091506001600160a01b0383169063b8e189ac90610b0b90879060040161162e565b600060405180830381600087803b158015610b2557600080fd5b505af1158015610b39573d6000803e3d6000fd5b505050506000808560800151806020019051810190610b58919061114f565b60405163abfbbe1360e01b815291935091506001600160a01b0384169063abfbbe1390610b8d90889085908790600401611340565b600060405180830381600087803b158015610ba757600080fd5b505af1158015610bbb573d6000803e3d6000fd5b50505050505050505050565b6060816000015182602001518360400151846060015185608001518660a001518760c00151604051602001610c029796959493929190611297565b6040516020818303038152906040529050919050565b600067ffffffffffffffff831115610c2c57fe5b610c3f601f8401601f1916602001611700565b9050828152838383011115610c5357600080fd5b828260208301376000602084830101529392505050565b80356101b081611754565b600082601f830112610c85578081fd5b610c9483833560208501610c18565b9392505050565b8035600281106101b057600080fd5b600060a08284031215610cbb578081fd5b60405160a0810167ffffffffffffffff8282108183111715610cd957fe5b81604052829350843583526020850135602084015260408501356040840152606085013560608401526080850135915080821115610d1657600080fd5b50610d2385828601610c75565b6080830152505092915050565b600060408284031215610d41578081fd5b6040516040810167ffffffffffffffff8282108183111715610d5f57fe5b8160405282935084358352602091508185013581811115610d7f57600080fd5b8501601f81018713610d9057600080fd5b803582811115610d9c57fe5b8381029250610dac848401611700565b8181528481019083860185850187018b1015610dc757600080fd5b600095505b83861015610dea578035835260019590950194918601918601610dcc565b5080868801525050505050505092915050565b600060a08284031215610e0e578081fd5b60405160a0810167ffffffffffffffff8282108183111715610e2c57fe5b8160405282935084359150610e408261176c565b8183526020850135602084015260408501356040840152606085013560608401526080850135915080821115610d1657600080fd5b600060e08284031215610e86578081fd5b610e9060e0611700565b90508135815260208201356020820152610eac60408301610c9b565b6040820152610ebd60608301610c6a565b6060820152610ece60808301610c6a565b608082015260a082013560a082015260c082013567ffffffffffffffff811115610ef757600080fd5b610f0384828501610c75565b60c08301525092915050565b600060208284031215610f20578081fd5b8151610c948161176c565b600060208284031215610f3c578081fd5b5051919050565b60008060408385031215610f55578081fd5b50508035926020909101359150565b600080600080600080600060e0888a031215610f7e578283fd5b87359650602088013567ffffffffffffffff80821115610f9c578485fd5b610fa88b838c01610caa565b975060408a0135915080821115610fbd578485fd5b610fc98b838c01610d30565b965060608a0135955060808a0135945060a08a0135915080821115610fec578384fd5b610ff88b838c01610caa565b935060c08a013591508082111561100d578283fd5b5061101a8a828b01610d30565b91505092959891949750929550565b600080600080600080600060e0888a031215611043578081fd5b87359650602088013567ffffffffffffffff80821115611061578283fd5b61106d8b838c01610caa565b975060408a0135915080821115611082578283fd5b61108e8b838c01610d30565b965060608a01359150808211156110a3578283fd5b6110af8b838c01610e75565b955060808a01359150808211156110c4578283fd5b6110d08b838c01610dfd565b945060a08a0135915080821115610fec578283fd5b6000602082840312156110f6578081fd5b8151610c9481611754565b600060208284031215611112578081fd5b813567ffffffffffffffff811115611128578182fd5b8201601f81018413611138578182fd5b61114784823560208401610c18565b949350505050565b60008060408385031215611161578182fd5b82519150602083015161117381611754565b809150509250929050565b6001600160a01b03169052565b600081518084526111a3816020860160208601611724565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261114760a085018261118b565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b8083101561123f578451825293830193600192909201919083019061121f565b509695505050505050565b6000815115158352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261114760a085018261118b565b918252602082015260400190565b6000888252876020830152600287106112ac57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b1660558401525083606983015282516112f3816089850160208701611724565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b9283526001600160a01b03919091166020830152604082015260600190565b60008482526060602083015261137860608301856111b7565b828103604084015261138a81856111f4565b9695505050505050565b938452602084019290925260408301526001600160a01b0316606082015260800190565b60208082526041908201527f5374617465207472616e736974696f6e2070726f63657373206d75737420626560408201527f20636f6d706c65746564207072696f7220746f2066696e616c697a6174696f6e6060820152601760f91b608082015260a00190565b60208082526054908201527f506f73742d737461746520726f6f7420676c6f62616c20696e646578206d757360408201527f7420657175616c20746f207468652070726520737461746520726f6f7420676c60608201527337b130b61034b73232bc1038363ab99037b7329760611b608082015260a00190565b60208082526024908201527f496e76616c6964207472616e73616374696f6e20696e636c7573696f6e20707260408201526337b7b31760e11b606082015260800190565b60208082526028908201527f496e76616c696420706f73742d737461746520726f6f7420696e636c7573696f6040820152673710383937b7b31760c11b606082015260800190565b6020808252604c908201527f5072652d737461746520726f6f7420676c6f62616c20696e646578206d75737460408201527f20657175616c20746f20746865207472616e73616374696f6e20726f6f74206760608201526b3637b130b61034b73232bc1760a11b608082015260a00190565b60208082526030908201527f5374617465207472616e736974696f6e20686173206e6f74206265656e20707260408201526f37bb32b710333930bab23ab632b73a1760811b606082015260800190565b60208082526027908201527f496e76616c6964207072652d737461746520726f6f7420696e636c7573696f6e60408201526610383937b7b31760c91b606082015260800190565b600060208252610c9460208301846111b7565b60006080825285516080830152602086015160a083015260408601516002811061166757fe5b60c083015260608601516001600160a01b031660e0830152608086015161169261010084018261117e565b5060a086015161012083015260c086015160e06101408401526116b961016084018261118b565b905082810360208401526116cd818761124a565b905082810360408401526116e181866111b7565b905082810360608401526116f581856111f4565b979650505050505050565b60405181810167ffffffffffffffff8111828210171561171c57fe5b604052919050565b60005b8381101561173f578181015183820152602001611727565b8381111561174e576000848401525b50505050565b6001600160a01b038116811461176957600080fd5b50565b801515811461176957600080fdfea26469706673582212201bddb6e25a2ac8766d59ad23945a559f5d002a1c7940103e2fd0834ca70c019464736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}}},\"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.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"}},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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 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\\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\":\"0x879cef57019254ad958a75db64f0b58eb0a6fcf74f386ed958f75384b860dd35\",\"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 * 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\",\"keccak256\":\"0x180b9c347e20f1a6efa553b0f2b9a59aebceda92a7484ae6fca4da2bf1d960c3\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405161184138038061184183398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b6117b0806100916000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063299ca4781461005c578063461a44781461007a57806398d8867d1461008d578063a286ba1c146100a2578063b48ec820146100b5575b600080fd5b6100646100c8565b6040516100719190611306565b60405180910390f35b610064610088366004611101565b6100d7565b6100a061009b366004611029565b6101b5565b005b6100a06100b0366004610f64565b6104f4565b6100646100c3366004610f43565b6108bb565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561013757818101518382015260200161011f565b50505050905090810190601f1680156101645780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561018157600080fd5b505afa158015610195573d6000803e3d6000fd5b505050506040513d60208110156101ab57600080fd5b505190505b919050565b866101bf8561090a565b60005a905060006101cf8861090a565b90506101db8b82610923565b156101e65750610432565b60006102216040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b905060006102636040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e0000008152506100d7565b9050816001600160a01b0316634d69ee578e8e8e6040518463ffffffff1660e01b81526004016102959392919061135f565b60206040518083038186803b1580156102ad57600080fd5b505afa1580156102c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102e59190610f0f565b61030a5760405162461bcd60e51b8152600401610301906115e7565b60405180910390fd5b6040516326f2b4e760e11b81526001600160a01b03821690634de569ce9061033c908d908d908d908d90600401611641565b60206040518083038186803b15801561035457600080fd5b505afa158015610368573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038c9190610f0f565b6103a85760405162461bcd60e51b815260040161030190611499565b86600001518860600151018b600001518d6060015101600101146103de5760405162461bcd60e51b815260040161030190611525565b6103ed8d848d60000151610942565b7f41a48bde2468fac6f670f39b66d7b91f311053e1f28eab9d75056546e6eaac958d8c6000015185336040516104269493929190611394565b60405180910390a15050505b60005a820390506104696040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b1580156104cf57600080fd5b505af11580156104e3573d6000803e3d6000fd5b505050505050505050505050505050565b868460005a905060006105078b896108bb565b905060006105446040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b9050816001600160a01b031663b2fa1c9e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561057f57600080fd5b505afa158015610593573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b79190610f0f565b15156001146105d85760405162461bcd60e51b8152600401610301906113b8565b89600001518b606001510160010186600001518860600151011461060e5760405162461bcd60e51b81526004016103019061141f565b604051634d69ee5760e01b81526001600160a01b03821690634d69ee579061063e908f908f908f9060040161135f565b60206040518083038186803b15801561065657600080fd5b505afa15801561066a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068e9190610f0f565b6106aa5760405162461bcd60e51b8152600401610301906115e7565b604051634d69ee5760e01b81526001600160a01b03821690634d69ee57906106da908b908b908b9060040161135f565b60206040518083038186803b1580156106f257600080fd5b505afa158015610706573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072a9190610f0f565b6107465760405162461bcd60e51b8152600401610301906114dd565b816001600160a01b031663c1c618b86040518163ffffffff1660e01b815260040160206040518083038186803b15801561077f57600080fd5b505afa158015610793573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b79190610f2b565b8814156107d65760405162461bcd60e51b815260040161030190611597565b6107e0878d610a6d565b6000600160008e8c6040516020016107f9929190611289565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507f1e5fff3c23daf51ea67aaa3bbc738bcedaa98be5a5503f0e63a336a004b075b18c8b600001518b3360405161087a9493929190611394565b60405180910390a1505060005a820390506104696040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b60006001600084846040516020016108d4929190611289565b60408051808303601f19018152918152815160209283012083529082019290925201600020546001600160a01b03169392505050565b600061091582610bc7565b805190602001209050919050565b60008061093084846108bb565b6001600160a01b031614159392505050565b6109806040518060400160405280601c81526020017f4f564d5f53746174655472616e736974696f6e6572466163746f7279000000008152506100d7565b600054604051631168a38160e11b81526001600160a01b03928316926322d14702926109b79291169085908890889060040161131a565b602060405180830381600087803b1580156109d157600080fd5b505af11580156109e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0991906110e5565b600160008585604051602001610a20929190611289565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550505050565b6000610aa86040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b90506000610adc6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b604051632e38626b60e21b81529091506001600160a01b0383169063b8e189ac90610b0b90879060040161162e565b600060405180830381600087803b158015610b2557600080fd5b505af1158015610b39573d6000803e3d6000fd5b505050506000808560800151806020019051810190610b58919061114f565b60405163abfbbe1360e01b815291935091506001600160a01b0384169063abfbbe1390610b8d90889085908790600401611340565b600060405180830381600087803b158015610ba757600080fd5b505af1158015610bbb573d6000803e3d6000fd5b50505050505050505050565b6060816000015182602001518360400151846060015185608001518660a001518760c00151604051602001610c029796959493929190611297565b6040516020818303038152906040529050919050565b600067ffffffffffffffff831115610c2c57fe5b610c3f601f8401601f1916602001611700565b9050828152838383011115610c5357600080fd5b828260208301376000602084830101529392505050565b80356101b081611754565b600082601f830112610c85578081fd5b610c9483833560208501610c18565b9392505050565b8035600281106101b057600080fd5b600060a08284031215610cbb578081fd5b60405160a0810167ffffffffffffffff8282108183111715610cd957fe5b81604052829350843583526020850135602084015260408501356040840152606085013560608401526080850135915080821115610d1657600080fd5b50610d2385828601610c75565b6080830152505092915050565b600060408284031215610d41578081fd5b6040516040810167ffffffffffffffff8282108183111715610d5f57fe5b8160405282935084358352602091508185013581811115610d7f57600080fd5b8501601f81018713610d9057600080fd5b803582811115610d9c57fe5b8381029250610dac848401611700565b8181528481019083860185850187018b1015610dc757600080fd5b600095505b83861015610dea578035835260019590950194918601918601610dcc565b5080868801525050505050505092915050565b600060a08284031215610e0e578081fd5b60405160a0810167ffffffffffffffff8282108183111715610e2c57fe5b8160405282935084359150610e408261176c565b8183526020850135602084015260408501356040840152606085013560608401526080850135915080821115610d1657600080fd5b600060e08284031215610e86578081fd5b610e9060e0611700565b90508135815260208201356020820152610eac60408301610c9b565b6040820152610ebd60608301610c6a565b6060820152610ece60808301610c6a565b608082015260a082013560a082015260c082013567ffffffffffffffff811115610ef757600080fd5b610f0384828501610c75565b60c08301525092915050565b600060208284031215610f20578081fd5b8151610c948161176c565b600060208284031215610f3c578081fd5b5051919050565b60008060408385031215610f55578081fd5b50508035926020909101359150565b600080600080600080600060e0888a031215610f7e578283fd5b87359650602088013567ffffffffffffffff80821115610f9c578485fd5b610fa88b838c01610caa565b975060408a0135915080821115610fbd578485fd5b610fc98b838c01610d30565b965060608a0135955060808a0135945060a08a0135915080821115610fec578384fd5b610ff88b838c01610caa565b935060c08a013591508082111561100d578283fd5b5061101a8a828b01610d30565b91505092959891949750929550565b600080600080600080600060e0888a031215611043578081fd5b87359650602088013567ffffffffffffffff80821115611061578283fd5b61106d8b838c01610caa565b975060408a0135915080821115611082578283fd5b61108e8b838c01610d30565b965060608a01359150808211156110a3578283fd5b6110af8b838c01610e75565b955060808a01359150808211156110c4578283fd5b6110d08b838c01610dfd565b945060a08a0135915080821115610fec578283fd5b6000602082840312156110f6578081fd5b8151610c9481611754565b600060208284031215611112578081fd5b813567ffffffffffffffff811115611128578182fd5b8201601f81018413611138578182fd5b61114784823560208401610c18565b949350505050565b60008060408385031215611161578182fd5b82519150602083015161117381611754565b809150509250929050565b6001600160a01b03169052565b600081518084526111a3816020860160208601611724565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261114760a085018261118b565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b8083101561123f578451825293830193600192909201919083019061121f565b509695505050505050565b6000815115158352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261114760a085018261118b565b918252602082015260400190565b6000888252876020830152600287106112ac57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b1660558401525083606983015282516112f3816089850160208701611724565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b9283526001600160a01b03919091166020830152604082015260600190565b60008482526060602083015261137860608301856111b7565b828103604084015261138a81856111f4565b9695505050505050565b938452602084019290925260408301526001600160a01b0316606082015260800190565b60208082526041908201527f5374617465207472616e736974696f6e2070726f63657373206d75737420626560408201527f20636f6d706c65746564207072696f7220746f2066696e616c697a6174696f6e6060820152601760f91b608082015260a00190565b60208082526054908201527f506f73742d737461746520726f6f7420676c6f62616c20696e646578206d757360408201527f7420657175616c20746f207468652070726520737461746520726f6f7420676c60608201527337b130b61034b73232bc1038363ab99037b7329760611b608082015260a00190565b60208082526024908201527f496e76616c6964207472616e73616374696f6e20696e636c7573696f6e20707260408201526337b7b31760e11b606082015260800190565b60208082526028908201527f496e76616c696420706f73742d737461746520726f6f7420696e636c7573696f6040820152673710383937b7b31760c11b606082015260800190565b6020808252604c908201527f5072652d737461746520726f6f7420676c6f62616c20696e646578206d75737460408201527f20657175616c20746f20746865207472616e73616374696f6e20726f6f74206760608201526b3637b130b61034b73232bc1760a11b608082015260a00190565b60208082526030908201527f5374617465207472616e736974696f6e20686173206e6f74206265656e20707260408201526f37bb32b710333930bab23ab632b73a1760811b606082015260800190565b60208082526027908201527f496e76616c6964207072652d737461746520726f6f7420696e636c7573696f6e60408201526610383937b7b31760c91b606082015260800190565b600060208252610c9460208301846111b7565b60006080825285516080830152602086015160a083015260408601516002811061166757fe5b60c083015260608601516001600160a01b031660e0830152608086015161169261010084018261117e565b5060a086015161012083015260c086015160e06101408401526116b961016084018261118b565b905082810360208401526116cd818761124a565b905082810360408401526116e181866111b7565b905082810360608401526116f581856111f4565b979650505050505050565b60405181810167ffffffffffffffff8111828210171561171c57fe5b604052919050565b60005b8381101561173f578181015183820152602001611727565b8381111561174e576000848401525b50505050565b6001600160a01b038116811461176957600080fd5b50565b801515811461176957600080fdfea264697066735822122090fa94f972b734dd4c794ce3c199f593acb07d65d0fea3b0025bd8132b68bc7a64736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c8063299ca4781461005c578063461a44781461007a57806398d8867d1461008d578063a286ba1c146100a2578063b48ec820146100b5575b600080fd5b6100646100c8565b6040516100719190611306565b60405180910390f35b610064610088366004611101565b6100d7565b6100a061009b366004611029565b6101b5565b005b6100a06100b0366004610f64565b6104f4565b6100646100c3366004610f43565b6108bb565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561013757818101518382015260200161011f565b50505050905090810190601f1680156101645780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561018157600080fd5b505afa158015610195573d6000803e3d6000fd5b505050506040513d60208110156101ab57600080fd5b505190505b919050565b866101bf8561090a565b60005a905060006101cf8861090a565b90506101db8b82610923565b156101e65750610432565b60006102216040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b905060006102636040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e0000008152506100d7565b9050816001600160a01b0316634d69ee578e8e8e6040518463ffffffff1660e01b81526004016102959392919061135f565b60206040518083038186803b1580156102ad57600080fd5b505afa1580156102c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102e59190610f0f565b61030a5760405162461bcd60e51b8152600401610301906115e7565b60405180910390fd5b6040516326f2b4e760e11b81526001600160a01b03821690634de569ce9061033c908d908d908d908d90600401611641565b60206040518083038186803b15801561035457600080fd5b505afa158015610368573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038c9190610f0f565b6103a85760405162461bcd60e51b815260040161030190611499565b86600001518860600151018b600001518d6060015101600101146103de5760405162461bcd60e51b815260040161030190611525565b6103ed8d848d60000151610942565b7f41a48bde2468fac6f670f39b66d7b91f311053e1f28eab9d75056546e6eaac958d8c6000015185336040516104269493929190611394565b60405180910390a15050505b60005a820390506104696040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b1580156104cf57600080fd5b505af11580156104e3573d6000803e3d6000fd5b505050505050505050505050505050565b868460005a905060006105078b896108bb565b905060006105446040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b9050816001600160a01b031663b2fa1c9e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561057f57600080fd5b505afa158015610593573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b79190610f0f565b15156001146105d85760405162461bcd60e51b8152600401610301906113b8565b89600001518b606001510160010186600001518860600151011461060e5760405162461bcd60e51b81526004016103019061141f565b604051634d69ee5760e01b81526001600160a01b03821690634d69ee579061063e908f908f908f9060040161135f565b60206040518083038186803b15801561065657600080fd5b505afa15801561066a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068e9190610f0f565b6106aa5760405162461bcd60e51b8152600401610301906115e7565b604051634d69ee5760e01b81526001600160a01b03821690634d69ee57906106da908b908b908b9060040161135f565b60206040518083038186803b1580156106f257600080fd5b505afa158015610706573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072a9190610f0f565b6107465760405162461bcd60e51b8152600401610301906114dd565b816001600160a01b031663c1c618b86040518163ffffffff1660e01b815260040160206040518083038186803b15801561077f57600080fd5b505afa158015610793573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b79190610f2b565b8814156107d65760405162461bcd60e51b815260040161030190611597565b6107e0878d610a6d565b6000600160008e8c6040516020016107f9929190611289565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507f1e5fff3c23daf51ea67aaa3bbc738bcedaa98be5a5503f0e63a336a004b075b18c8b600001518b3360405161087a9493929190611394565b60405180910390a1505060005a820390506104696040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b60006001600084846040516020016108d4929190611289565b60408051808303601f19018152918152815160209283012083529082019290925201600020546001600160a01b03169392505050565b600061091582610bc7565b805190602001209050919050565b60008061093084846108bb565b6001600160a01b031614159392505050565b6109806040518060400160405280601c81526020017f4f564d5f53746174655472616e736974696f6e6572466163746f7279000000008152506100d7565b600054604051631168a38160e11b81526001600160a01b03928316926322d14702926109b79291169085908890889060040161131a565b602060405180830381600087803b1580156109d157600080fd5b505af11580156109e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0991906110e5565b600160008585604051602001610a20929190611289565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550505050565b6000610aa86040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100d7565b90506000610adc6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100d7565b604051632e38626b60e21b81529091506001600160a01b0383169063b8e189ac90610b0b90879060040161162e565b600060405180830381600087803b158015610b2557600080fd5b505af1158015610b39573d6000803e3d6000fd5b505050506000808560800151806020019051810190610b58919061114f565b60405163abfbbe1360e01b815291935091506001600160a01b0384169063abfbbe1390610b8d90889085908790600401611340565b600060405180830381600087803b158015610ba757600080fd5b505af1158015610bbb573d6000803e3d6000fd5b50505050505050505050565b6060816000015182602001518360400151846060015185608001518660a001518760c00151604051602001610c029796959493929190611297565b6040516020818303038152906040529050919050565b600067ffffffffffffffff831115610c2c57fe5b610c3f601f8401601f1916602001611700565b9050828152838383011115610c5357600080fd5b828260208301376000602084830101529392505050565b80356101b081611754565b600082601f830112610c85578081fd5b610c9483833560208501610c18565b9392505050565b8035600281106101b057600080fd5b600060a08284031215610cbb578081fd5b60405160a0810167ffffffffffffffff8282108183111715610cd957fe5b81604052829350843583526020850135602084015260408501356040840152606085013560608401526080850135915080821115610d1657600080fd5b50610d2385828601610c75565b6080830152505092915050565b600060408284031215610d41578081fd5b6040516040810167ffffffffffffffff8282108183111715610d5f57fe5b8160405282935084358352602091508185013581811115610d7f57600080fd5b8501601f81018713610d9057600080fd5b803582811115610d9c57fe5b8381029250610dac848401611700565b8181528481019083860185850187018b1015610dc757600080fd5b600095505b83861015610dea578035835260019590950194918601918601610dcc565b5080868801525050505050505092915050565b600060a08284031215610e0e578081fd5b60405160a0810167ffffffffffffffff8282108183111715610e2c57fe5b8160405282935084359150610e408261176c565b8183526020850135602084015260408501356040840152606085013560608401526080850135915080821115610d1657600080fd5b600060e08284031215610e86578081fd5b610e9060e0611700565b90508135815260208201356020820152610eac60408301610c9b565b6040820152610ebd60608301610c6a565b6060820152610ece60808301610c6a565b608082015260a082013560a082015260c082013567ffffffffffffffff811115610ef757600080fd5b610f0384828501610c75565b60c08301525092915050565b600060208284031215610f20578081fd5b8151610c948161176c565b600060208284031215610f3c578081fd5b5051919050565b60008060408385031215610f55578081fd5b50508035926020909101359150565b600080600080600080600060e0888a031215610f7e578283fd5b87359650602088013567ffffffffffffffff80821115610f9c578485fd5b610fa88b838c01610caa565b975060408a0135915080821115610fbd578485fd5b610fc98b838c01610d30565b965060608a0135955060808a0135945060a08a0135915080821115610fec578384fd5b610ff88b838c01610caa565b935060c08a013591508082111561100d578283fd5b5061101a8a828b01610d30565b91505092959891949750929550565b600080600080600080600060e0888a031215611043578081fd5b87359650602088013567ffffffffffffffff80821115611061578283fd5b61106d8b838c01610caa565b975060408a0135915080821115611082578283fd5b61108e8b838c01610d30565b965060608a01359150808211156110a3578283fd5b6110af8b838c01610e75565b955060808a01359150808211156110c4578283fd5b6110d08b838c01610dfd565b945060a08a0135915080821115610fec578283fd5b6000602082840312156110f6578081fd5b8151610c9481611754565b600060208284031215611112578081fd5b813567ffffffffffffffff811115611128578182fd5b8201601f81018413611138578182fd5b61114784823560208401610c18565b949350505050565b60008060408385031215611161578182fd5b82519150602083015161117381611754565b809150509250929050565b6001600160a01b03169052565b600081518084526111a3816020860160208601611724565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261114760a085018261118b565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b8083101561123f578451825293830193600192909201919083019061121f565b509695505050505050565b6000815115158352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261114760a085018261118b565b918252602082015260400190565b6000888252876020830152600287106112ac57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b1660558401525083606983015282516112f3816089850160208701611724565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b9283526001600160a01b03919091166020830152604082015260600190565b60008482526060602083015261137860608301856111b7565b828103604084015261138a81856111f4565b9695505050505050565b938452602084019290925260408301526001600160a01b0316606082015260800190565b60208082526041908201527f5374617465207472616e736974696f6e2070726f63657373206d75737420626560408201527f20636f6d706c65746564207072696f7220746f2066696e616c697a6174696f6e6060820152601760f91b608082015260a00190565b60208082526054908201527f506f73742d737461746520726f6f7420676c6f62616c20696e646578206d757360408201527f7420657175616c20746f207468652070726520737461746520726f6f7420676c60608201527337b130b61034b73232bc1038363ab99037b7329760611b608082015260a00190565b60208082526024908201527f496e76616c6964207472616e73616374696f6e20696e636c7573696f6e20707260408201526337b7b31760e11b606082015260800190565b60208082526028908201527f496e76616c696420706f73742d737461746520726f6f7420696e636c7573696f6040820152673710383937b7b31760c11b606082015260800190565b6020808252604c908201527f5072652d737461746520726f6f7420676c6f62616c20696e646578206d75737460408201527f20657175616c20746f20746865207472616e73616374696f6e20726f6f74206760608201526b3637b130b61034b73232bc1760a11b608082015260a00190565b60208082526030908201527f5374617465207472616e736974696f6e20686173206e6f74206265656e20707260408201526f37bb32b710333930bab23ab632b73a1760811b606082015260800190565b60208082526027908201527f496e76616c6964207072652d737461746520726f6f7420696e636c7573696f6e60408201526610383937b7b31760c91b606082015260800190565b600060208252610c9460208301846111b7565b60006080825285516080830152602086015160a083015260408601516002811061166757fe5b60c083015260608601516001600160a01b031660e0830152608086015161169261010084018261117e565b5060a086015161012083015260c086015160e06101408401526116b961016084018261118b565b905082810360208401526116cd818761124a565b905082810360408401526116e181866111b7565b905082810360608401526116f581856111f4565b979650505050505050565b60405181810167ffffffffffffffff8111828210171561171c57fe5b604052919050565b60005b8381101561173f578181015183820152602001611727565b8381111561174e576000848401525b50505050565b6001600160a01b038116811461176957600080fd5b50565b801515811461176957600080fdfea264697066735822122090fa94f972b734dd4c794ce3c199f593acb07d65d0fea3b0025bd8132b68bc7a64736f6c63430007060033", "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", @@ -532,20 +532,20 @@ "storageLayout": { "storage": [ { - "astId": 12856, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_FraudVerifier.sol:OVM_FraudVerifier", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12849" + "type": "t_contract(Lib_AddressManager)15296" }, { - "astId": 9447, + "astId": 11750, "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)12018)" + "type": "t_mapping(t_bytes32,t_contract(iOVM_StateTransitioner)14378)" } ], "types": { @@ -554,22 +554,22 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(Lib_AddressManager)12849": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" }, - "t_contract(iOVM_StateTransitioner)12018": { + "t_contract(iOVM_StateTransitioner)14378": { "encoding": "inplace", "label": "contract iOVM_StateTransitioner", "numberOfBytes": "20" }, - "t_mapping(t_bytes32,t_contract(iOVM_StateTransitioner)12018)": { + "t_mapping(t_bytes32,t_contract(iOVM_StateTransitioner)14378)": { "encoding": "mapping", "key": "t_bytes32", "label": "mapping(bytes32 => contract iOVM_StateTransitioner)", "numberOfBytes": "32", - "value": "t_contract(iOVM_StateTransitioner)12018" + "value": "t_contract(iOVM_StateTransitioner)14378" } } } diff --git a/packages/contracts/deployments/mainnet/OVM_L1CrossDomainMessenger.json b/packages/contracts/deployments/mainnet/OVM_L1CrossDomainMessenger.json index db33aedb8462..aad7113732d3 100644 --- a/packages/contracts/deployments/mainnet/OVM_L1CrossDomainMessenger.json +++ b/packages/contracts/deployments/mainnet/OVM_L1CrossDomainMessenger.json @@ -1,5 +1,5 @@ { - "address": "0x598F2b19e983910529affAb7D219724a019339CC", + "address": "0x16393737D09d2722AD13DcA3cA8C3DB957699F1D", "abi": [ { "inputs": [], @@ -187,19 +187,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "messageNonce", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "owner", @@ -377,7 +364,7 @@ }, { "internalType": "uint256", - "name": "_messageNonce", + "name": "_queueIndex", "type": "uint256" }, { @@ -433,25 +420,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "sentMessages", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -498,27 +466,27 @@ "type": "function" } ], - "transactionHash": "0x47b0d51d9fe4e2e865817d3059ecfae9f4cf6d95ad3060ccd53e374ec2185fec", + "transactionHash": "0x4a72b205480e1d494b9d900c9888cf8f70b5faf9198f2dec1aface50d099ed5c", "receipt": { "to": null, - "from": "0xd033f09cB85621F98F7A84C64dB381ac16Eff818", - "contractAddress": "0x598F2b19e983910529affAb7D219724a019339CC", - "transactionIndex": 266, - "gasUsed": "2796916", + "from": "0x9996571372066A1545D3435C6935e3F9593A7eF5", + "contractAddress": "0x16393737D09d2722AD13DcA3cA8C3DB957699F1D", + "transactionIndex": 77, + "gasUsed": "2900721", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x86b6880928a67328d4b0d6db33534a245c0eb37f88f3eb72840f24e41bc9d0f5", - "transactionHash": "0x47b0d51d9fe4e2e865817d3059ecfae9f4cf6d95ad3060ccd53e374ec2185fec", + "blockHash": "0x5930661d6d35cf89ccad0d8b9682b46449d13ddf032db907f15c2d7aafc73ef8", + "transactionHash": "0x4a72b205480e1d494b9d900c9888cf8f70b5faf9198f2dec1aface50d099ed5c", "logs": [], - "blockNumber": 12410826, - "cumulativeGasUsed": "12515038", + "blockNumber": 12686754, + "cumulativeGasUsed": "10391834", "status": 1, "byzantium": true }, "args": [], - "solcInputHash": "f2bdab652d5102f5f11e78dae866798d", - "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\":\"FailedRelayedMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"_xDomainCalldataHash\",\"type\":\"bytes32\"}],\"name\":\"MessageAllowed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"_xDomainCalldataHash\",\"type\":\"bytes32\"}],\"name\":\"MessageBlocked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_xDomainCalldataHash\",\"type\":\"bytes32\"}],\"name\":\"allowMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_xDomainCalldataHash\",\"type\":\"bytes32\"}],\"name\":\"blockMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"blockedMessages\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"messageNonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"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\"},{\"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\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"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\":\"\",\"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\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"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\":{\"allowMessage(bytes32)\":{\"params\":{\"_xDomainCalldataHash\":\"Hash of the message to block.\"}},\"blockMessage(bytes32)\":{\"params\":{\"_xDomainCalldataHash\":\"Hash of the message to block.\"}},\"initialize(address)\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"paused()\":{\"details\":\"Returns true if the contract is paused, and false otherwise.\"},\"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.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"sendMessage(address,bytes,uint32)\":{\"params\":{\"_gasLimit\":\"Gas limit for the provided message.\",\"_message\":\"Message to send to the target.\",\"_target\":\"Target contract address.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"OVM_L1CrossDomainMessenger\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"allowMessage(bytes32)\":{\"notice\":\"Allow a message.\"},\"blockMessage(bytes32)\":{\"notice\":\"Block a message.\"},\"constructor\":{\"notice\":\"This contract is intended to be behind a delegate proxy. We pass the zero address to the address resolver just to satisfy the constructor. We still need to set this value in initialize().\"},\"pause()\":{\"notice\":\"Pause relaying.\"},\"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.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"sendMessage(address,bytes,uint32)\":{\"notice\":\"Sends a cross domain message to the target messenger.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol\":\"OVM_L1CrossDomainMessenger\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/Initializable.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal initializer {\\n __Context_init_unchained();\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal initializer {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xb419e68addcb82ecda3ad3974b0d2db76435ce9b08435a04d5b119a0c5d45ea5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n// solhint-disable-next-line compiler-version\\npragma solidity >=0.4.24 <0.8.0;\\n\\nimport \\\"../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n */\\nabstract contract Initializable {\\n\\n /**\\n * @dev Indicates that the contract has been initialized.\\n */\\n bool private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Modifier to protect an initializer function from being invoked twice.\\n */\\n modifier initializer() {\\n require(_initializing || _isConstructor() || !_initialized, \\\"Initializable: contract is already initialized\\\");\\n\\n bool isTopLevelCall = !_initializing;\\n if (isTopLevelCall) {\\n _initializing = true;\\n _initialized = true;\\n }\\n\\n _;\\n\\n if (isTopLevelCall) {\\n _initializing = false;\\n }\\n }\\n\\n /// @dev Returns true if and only if the function is running in the constructor\\n function _isConstructor() private view returns (bool) {\\n return !AddressUpgradeable.isContract(address(this));\\n }\\n}\\n\",\"keccak256\":\"0xd8e4eb08dcc1d1860fb347ba5ffd595242b9a1b66d49a47f2b4cb51c3f35017e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.2 <0.8.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { size := extcodesize(account) }\\n return size > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\n (bool success, ) = recipient.call{ value: amount }(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain`call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: value }(data);\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfc5ea91fa9ceb1961023b2a6c978b902888c52b90847ac7813fe3b79524165f6\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\nimport \\\"../proxy/Initializable.sol\\\";\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal initializer {\\n __Context_init_unchained();\\n }\\n\\n function __Context_init_unchained() internal initializer {\\n }\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0xbbf8a21b9a66c48d45ff771b8563c6df19ba451d63dfb8380a865c1e1f29d1a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"./ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which allows children to implement an emergency stop\\n * mechanism that can be triggered by an authorized account.\\n *\\n * This module is used through inheritance. It will make available the\\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\\n * the functions of your contract. Note that they will not be pausable by\\n * simply including this module, only once the modifiers are put in place.\\n */\\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\\n /**\\n * @dev Emitted when the pause is triggered by `account`.\\n */\\n event Paused(address account);\\n\\n /**\\n * @dev Emitted when the pause is lifted by `account`.\\n */\\n event Unpaused(address account);\\n\\n bool private _paused;\\n\\n /**\\n * @dev Initializes the contract in unpaused state.\\n */\\n function __Pausable_init() internal initializer {\\n __Context_init_unchained();\\n __Pausable_init_unchained();\\n }\\n\\n function __Pausable_init_unchained() internal initializer {\\n _paused = false;\\n }\\n\\n /**\\n * @dev Returns true if the contract is paused, and false otherwise.\\n */\\n function paused() public view virtual returns (bool) {\\n return _paused;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is not paused.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n modifier whenNotPaused() {\\n require(!paused(), \\\"Pausable: paused\\\");\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is paused.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n modifier whenPaused() {\\n require(paused(), \\\"Pausable: not paused\\\");\\n _;\\n }\\n\\n /**\\n * @dev Triggers stopped state.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n function _pause() internal virtual whenNotPaused {\\n _paused = true;\\n emit Paused(_msgSender());\\n }\\n\\n /**\\n * @dev Returns to normal state.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n function _unpause() internal virtual whenPaused {\\n _paused = false;\\n emit Unpaused(_msgSender());\\n }\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x73bef0a5dec3efde8183c4858d90f683ed2771656c4329647b4d5b0f89498fd5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\nimport \\\"../proxy/Initializable.sol\\\";\\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 ReentrancyGuardUpgradeable is Initializable {\\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 function __ReentrancyGuard_init() internal initializer {\\n __ReentrancyGuard_init_unchained();\\n }\\n\\n function __ReentrancyGuard_init_unchained() internal initializer {\\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 uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x46034cd5cca740f636345c8f7aebae0f78adfd4b70e31e6f888cccbe1086586e\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/bridge/messaging/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/messaging/iAbs_BaseCrossDomainMessenger.sol\\\";\\n\\n/**\\n * @title Abs_BaseCrossDomainMessenger\\n * @dev The Base Cross Domain Messenger is an abstract contract providing the interface and common\\n * functionality used in the L1 and L2 Cross Domain Messengers. It can also serve as a template for\\n * developers wishing to implement a custom bridge 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 {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n // The default x-domain message sender being set to a non-zero value makes\\n // deployment a bit more expensive, but in exchange the refund on every call to\\n // `relayMessage` by the L1 and L2 messengers will be higher.\\n address internal constant DEFAULT_XDOMAIN_SENDER = 0x000000000000000000000000000000000000dEaD;\\n\\n\\n /*************\\n * 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 internal xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() {}\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function xDomainMessageSender()\\n public\\n override\\n view\\n returns (\\n address\\n )\\n {\\n require(xDomainMsgSender != DEFAULT_XDOMAIN_SENDER, \\\"xDomainMessageSender is not set\\\");\\n return xDomainMsgSender;\\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 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 /**********************\\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 to send.\\n * param // 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\":\"0xed5dafa41fadfd461e33c042da3a721f2cce73e0d2418d170a44161f7714a439\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/bridge/messaging/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\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_L1CrossDomainMessenger } from \\\"../../../iOVM/bridge/messaging/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/* External Imports */\\nimport { OwnableUpgradeable } from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport { PausableUpgradeable } from \\\"@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol\\\";\\nimport { ReentrancyGuardUpgradeable } from \\\"@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol\\\";\\n\\n/**\\n * @title OVM_L1CrossDomainMessenger\\n * @dev The L1 Cross Domain Messenger contract sends messages from L1 to L2, and relays messages\\n * from L2 onto L1. In the event that a message sent from L1 to L2 is rejected for exceeding the L2\\n * epoch gas limit, it can be resubmitted via this contract's replay function.\\n *\\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_L1CrossDomainMessenger is\\n iOVM_L1CrossDomainMessenger,\\n Abs_BaseCrossDomainMessenger,\\n Lib_AddressResolver,\\n OwnableUpgradeable,\\n PausableUpgradeable,\\n ReentrancyGuardUpgradeable\\n{\\n\\n /**********\\n * Events *\\n **********/\\n\\n event MessageBlocked(\\n bytes32 indexed _xDomainCalldataHash\\n );\\n\\n event MessageAllowed(\\n bytes32 indexed _xDomainCalldataHash\\n );\\n\\n /**********************\\n * Contract Variables *\\n **********************/\\n\\n mapping (bytes32 => bool) public blockedMessages;\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * This contract is intended to be behind a delegate proxy.\\n * We pass the zero address to the address resolver just to satisfy the constructor.\\n * We still need to set this value in initialize().\\n */\\n constructor()\\n Lib_AddressResolver(address(0))\\n {}\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Modifier to enforce that, if configured, only the OVM_L2MessageRelayer contract may\\n * 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 * @param _libAddressManager Address of the Address Manager.\\n */\\n function initialize(\\n address _libAddressManager\\n )\\n public\\n initializer\\n {\\n require(\\n address(libAddressManager) == address(0),\\n \\\"L1CrossDomainMessenger already intialized.\\\"\\n );\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\\n\\n // Initialize upgradable OZ contracts\\n __Context_init_unchained(); // Context is a dependency for both Ownable and Pausable\\n __Ownable_init_unchained();\\n __Pausable_init_unchained();\\n __ReentrancyGuard_init_unchained();\\n }\\n\\n /**\\n * Pause relaying.\\n */\\n function pause()\\n external\\n onlyOwner\\n {\\n _pause();\\n }\\n\\n /**\\n * Block a message.\\n * @param _xDomainCalldataHash Hash of the message to block.\\n */\\n function blockMessage(\\n bytes32 _xDomainCalldataHash\\n )\\n external\\n onlyOwner\\n {\\n blockedMessages[_xDomainCalldataHash] = true;\\n emit MessageBlocked(_xDomainCalldataHash);\\n }\\n\\n /**\\n * Allow a message.\\n * @param _xDomainCalldataHash Hash of the message to block.\\n */\\n function allowMessage(\\n bytes32 _xDomainCalldataHash\\n )\\n external\\n onlyOwner\\n {\\n blockedMessages[_xDomainCalldataHash] = false;\\n emit MessageAllowed(_xDomainCalldataHash);\\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 whenNotPaused\\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 require(\\n blockedMessages[xDomainCalldataHash] == false,\\n \\\"Provided message has been blocked.\\\"\\n );\\n\\n xDomainMsgSender = _sender;\\n (bool success, ) = _target.call(_message);\\n xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\\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 } else {\\n emit FailedRelayedMessage(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(\\n resolve(\\\"OVM_StateCommitmentChain\\\")\\n );\\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 predeploy 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\":\"0xba49f550a93c91448340fdb85ad8e4d4dff523532eb1524add38ee2825cc0442\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/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\\n event SentMessage(bytes message);\\n event RelayedMessage(bytes32 msgHash);\\n event FailedRelayedMessage(bytes32 msgHash);\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n function xDomainMessageSender() external view returns (address);\\n\\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\":\"0x89981ed48e99d6939cc6cdef827d484fa3e2292d66c0ba5056c7050cb6282d7e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/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 * 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\":\"0x2d7973a0ad84c23ec62624d3f1e3aeb198cc72686ff1e6cfa17155556b320c94\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0xcc9fc5c64f1101a5c6c397594086b1608189a9edc5c9635e1ac38f70aeeeecbf\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 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, _key, 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 != pathRemainder.length) {\\n // Our extension node is not identical to the remainder.\\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 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 path may include\\n * additional nodes (e.g., it comes directly from a proof) and we can't resize in-memory\\n * arrays without costly duplication.\\n * @param _key Full original key.\\n * @param _keyRemainder Portion of the initial key that must be inserted 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 _key,\\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 // Reference: https://github.com/ethereumjs/merkle-patricia-tree/blob/c0a10395aab37d42c175a47114ebfcbd7efcf059/src/baseTrie.ts#L294-L313\\n bool matchLeaf = false;\\n if (lastNodeType == NodeType.LeafNode) {\\n uint256 l = 0;\\n if (_path.length > 0) {\\n for (uint256 i = 0; i < _path.length - 1; i++) {\\n if (_getNodeType(_path[i]) == NodeType.BranchNode) {\\n l++;\\n } else {\\n l += _getNodeKey(_path[i]).length;\\n }\\n }\\n }\\n\\n if (\\n _getSharedNibbleLength(\\n _getNodeKey(lastNode),\\n Lib_BytesUtils.slice(Lib_BytesUtils.toNibbles(_key), l)\\n ) == _getNodeKey(lastNode).length\\n && keyRemainder.length == 0\\n ) {\\n matchLeaf = true;\\n }\\n }\\n\\n if (matchLeaf) {\\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 = _editExtensionNodeValue(currentNode, 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 * Creates a new extension node with the same key but a different value.\\n * @param _node Extension node to copy and modify.\\n * @param _value New value for the extension node.\\n * @return New node with the same key and different value.\\n */\\n function _editExtensionNodeValue(\\n TrieNode memory _node,\\n bytes memory _value\\n )\\n private\\n pure\\n returns (\\n TrieNode memory\\n )\\n {\\n bytes[] memory raw = new bytes[](2);\\n bytes memory key = _addHexPrefix(_getNodeKey(_node), false);\\n raw[0] = Lib_RLPWriter.writeBytes(Lib_BytesUtils.fromNibbles(key));\\n if (_value.length < 32) {\\n raw[1] = _value;\\n } else {\\n raw[1] = Lib_RLPWriter.writeBytes(_value);\\n }\\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 abi.encodePacked(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\":\"0x4bb09d0b4f965b57cdc6b3ace49967bcfe7f2580fa0b7863dfe288081247d876\",\"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 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\":\"0xbbdd600165307d2131340599afa9dc0991f8f63727ba3a834bca5a3d7f501da8\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x6080604052600480546001600160a01b03191661dead17905534801561002457600080fd5b50600580546001600160a01b031916905561312e806100446000396000f3fe608060405234801561001057600080fd5b50600436106101215760003560e01c806381ada46c116100ad578063c4d66de811610071578063c4d66de814610213578063c6b94ab014610226578063d7fd19dd14610239578063ecc704281461024c578063f2fde38b1461026157610121565b806381ada46c146101ca57806382e3702d146101dd5780638456cb59146101f05780638da5cb5b146101f8578063b1b1b2091461020057610121565b8063461a4478116100f4578063461a44781461018c5780635c975abb1461019f5780636e296e45146101a7578063706ceab6146101af578063715018a6146101c257610121565b80630ecf2eea1461012657806321d800ec1461013b578063299ca478146101645780633dbb202b14610179575b600080fd5b610139610134366004612ab9565b610274565b005b61014e610149366004612ab9565b610319565b60405161015b9190612ccf565b60405180910390f35b61016c61032e565b60405161015b9190612c57565b610139610187366004612a3d565b61033d565b61016c61019a366004612ad1565b6103cc565b61014e6104a8565b61016c6104b1565b6101396101bd3660046129c6565b6104fa565b610139610561565b6101396101d8366004612ab9565b61060d565b61014e6101eb366004612ab9565b6106af565b6101396106c4565b61016c610730565b61014e61020e366004612ab9565b61073f565b61013961022136600461287d565b610754565b61014e610234366004612ab9565b610882565b610139610247366004612897565b610897565b610254610bd6565b60405161015b9190612ba0565b61013961026f36600461287d565b610bdc565b61027c610cdf565b6001600160a01b031661028d610730565b6001600160a01b0316146102d6576040805162461bcd60e51b815260206004820181905260248201526000805160206130d9833981519152604482015290519081900360640190fd5b600081815260ce6020526040808220805460ff191660011790555182917ff52508d5339edf0d7e5060a416df98db067af561bdc60872d29c0439eaa13a0291a250565b60006020819052908152604090205460ff1681565b6005546001600160a01b031681565b600061034d843385600354610ce3565b60038054600190810190915581516020808401919091206000908152600290915260409020805460ff19169091179055905061038f8163ffffffff8416610d30565b7f0ee9ffdb2334d78de97ffb066b23a352a4d35180cefb36589d663fbb1eb6f326816040516103be9190612d51565b60405180910390a150505050565b60055460405163bf40fac160e01b81526020600482018181528451602484015284516000946001600160a01b03169363bf40fac1938793928392604401918501908083838b5b8381101561042a578181015183820152602001610412565b50505050905090810190601f1680156104575780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561047457600080fd5b505afa158015610488573d6000803e3d6000fd5b505050506040513d602081101561049e57600080fd5b505190505b919050565b606a5460ff1690565b6004546000906001600160a01b031661dead14156104ea5760405162461bcd60e51b81526004016104e190612d64565b60405180910390fd5b506004546001600160a01b031690565b600061050886868686610ce3565b805160208083019190912060009081526002909152604090205490915060ff1615156001146105495760405162461bcd60e51b81526004016104e190612e59565b610559818363ffffffff16610d30565b505050505050565b610569610cdf565b6001600160a01b031661057a610730565b6001600160a01b0316146105c3576040805162461bcd60e51b815260206004820181905260248201526000805160206130d9833981519152604482015290519081900360640190fd5b6038546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3603880546001600160a01b0319169055565b610615610cdf565b6001600160a01b0316610626610730565b6001600160a01b03161461066f576040805162461bcd60e51b815260206004820181905260248201526000805160206130d9833981519152604482015290519081900360640190fd5b600081815260ce6020526040808220805460ff191690555182917f52c8a2680a9f4cc0ad0bf88f32096eadbebf0646ea611d93a0ce6a29a024040591a250565b60026020526000908152604090205460ff1681565b6106cc610cdf565b6001600160a01b03166106dd610730565b6001600160a01b031614610726576040805162461bcd60e51b815260206004820181905260248201526000805160206130d9833981519152604482015290519081900360640190fd5b61072e610e08565b565b6038546001600160a01b031690565b60016020526000908152604090205460ff1681565b600554600160a81b900460ff168061076f575061076f610ea8565b806107845750600554600160a01b900460ff16155b6107bf5760405162461bcd60e51b815260040180806020018281038252602e815260200180613085602e913960400191505060405180910390fd5b600554600160a81b900460ff161580156107f6576005805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b6005546001600160a01b03161561081f5760405162461bcd60e51b81526004016104e190612f83565b600580546001600160a01b0384166001600160a01b0319918216179091556004805490911661dead179055610852610eb9565b61085a610f72565b610862611082565b61086a611144565b801561087e576005805460ff60a81b191690555b5050565b60ce6020526000908152604090205460ff1681565b6002609c5414156108ef576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002609c5560408051808201909152601481527327ab26afa61926b2b9b9b0b3b2a932b630bcb2b960611b602082015260009061092b906103cc565b90506001600160a01b0381161561096457336001600160a01b038216146109645760405162461bcd60e51b81526004016104e190612ee6565b61096c6104a8565b156109b1576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b60006109bf87878787610ce3565b90506109cb8184611201565b15156001146109ec5760405162461bcd60e51b81526004016104e190612f3c565b80516020808301919091206000818152600190925260409091205460ff1615610a275760405162461bcd60e51b81526004016104e190612d9b565b600081815260ce602052604090205460ff1615610a565760405162461bcd60e51b81526004016104e190612ea4565b600480546001600160a01b0319166001600160a01b03898116919091179091556040516000918a1690610a8a908990612bb7565b6000604051808303816000865af19150503d8060008114610ac7576040519150601f19603f3d011682016040523d82523d6000602084013e610acc565b606091505b5050600480546001600160a01b03191661dead179055905080151560011415610b4757600082815260016020819052604091829020805460ff19169091179055517f4641df4a962071e12719d8c8c8e5ac7fc4d97b927346a3d7a335b1f7517e133c90610b3a908490612ba0565b60405180910390a1610b7f565b7f99d0e048484baa1b1540b1367cb128acd7ab2946d1ed91ec10e3c85e4bf51b8f82604051610b769190612ba0565b60405180910390a15b6000833343604051602001610b9693929190612c05565b60408051601f1981840301815291815281516020928301206000908152918290529020805460ff19166001908117909155609c5550505050505050505050565b60035481565b610be4610cdf565b6001600160a01b0316610bf5610730565b6001600160a01b031614610c3e576040805162461bcd60e51b815260206004820181905260248201526000805160206130d9833981519152604482015290519081900360640190fd5b6001600160a01b038116610c835760405162461bcd60e51b81526004018080602001828103825260268152602001806130356026913960400191505060405180910390fd5b6038546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3603880546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b606084848484604051602401610cfc9493929190612c6b565b60408051601f198184030181529190526020810180516001600160e01b031663cbd4ece960e01b1790529050949350505050565b610d6e6040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e0000008152506103cc565b6001600160a01b0316636fee07e0610dba6040518060400160405280601a81526020017f4f564d5f4c3243726f7373446f6d61696e4d657373656e6765720000000000008152506103cc565b83856040518463ffffffff1660e01b8152600401610dda93929190612ca8565b600060405180830381600087803b158015610df457600080fd5b505af1158015610559573d6000803e3d6000fd5b610e106104a8565b15610e55576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b606a805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610e8b610cdf565b604080516001600160a01b039092168252519081900360200190a1565b6000610eb330611226565b15905090565b600554600160a81b900460ff1680610ed45750610ed4610ea8565b80610ee95750600554600160a01b900460ff16155b610f245760405162461bcd60e51b815260040180806020018281038252602e815260200180613085602e913960400191505060405180910390fd5b600554600160a81b900460ff16158015610f5b576005805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b8015610f6f576005805460ff60a81b191690555b50565b600554600160a81b900460ff1680610f8d5750610f8d610ea8565b80610fa25750600554600160a01b900460ff16155b610fdd5760405162461bcd60e51b815260040180806020018281038252602e815260200180613085602e913960400191505060405180910390fd5b600554600160a81b900460ff16158015611014576005805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b600061101e610cdf565b603880546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3508015610f6f576005805460ff60a81b1916905550565b600554600160a81b900460ff168061109d575061109d610ea8565b806110b25750600554600160a01b900460ff16155b6110ed5760405162461bcd60e51b815260040180806020018281038252602e815260200180613085602e913960400191505060405180910390fd5b600554600160a81b900460ff16158015611124576005805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b606a805460ff191690558015610f6f576005805460ff60a81b1916905550565b600554600160a81b900460ff168061115f575061115f610ea8565b806111745750600554600160a01b900460ff16155b6111af5760405162461bcd60e51b815260040180806020018281038252602e815260200180613085602e913960400191505060405180910390fd5b600554600160a81b900460ff161580156111e6576005805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b6001609c558015610f6f576005805460ff60a81b1916905550565b600061120c8261122c565b801561121d575061121d8383611389565b90505b92915050565b3b151590565b60008061126d6040518060400160405280601881526020017f4f564d5f5374617465436f6d6d69746d656e74436861696e00000000000000008152506103cc565b6020840151604051639418bddd60e01b81529192506001600160a01b03831691639418bddd9161129f91600401612fcd565b60206040518083038186803b1580156112b757600080fd5b505afa1580156112cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ef9190612a99565b1580156113825750825160208401516040808601519051634d69ee5760e01b81526001600160a01b03851693634d69ee5793611332939192909190600401612cda565b60206040518083038186803b15801561134a57600080fd5b505afa15801561135e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113829190612a99565b9392505050565b600080836113cb6040518060400160405280601a81526020017f4f564d5f4c3243726f7373446f6d61696e4d657373656e6765720000000000008152506103cc565b6040516020016113dc929190612bd3565b604051602081830303815290604052805190602001206000604051602001611405929190612ba9565b604051602081830303815290604052805190602001209050600080611454602160991b6040516020016114389190612b88565b60408051601f19818403018152919052606087015187516114e6565b909250905060018215151461147b5760405162461bcd60e51b81526004016104e190612de6565b60006114868261150f565b90506114db8460405160200161149c9190612ba0565b60405160208183030381529060405260016040516020016114bd9190612c3f565b604051602081830303815290604052886080015184604001516115a1565b979650505050505050565b6000606060006114f5866115c5565b90506115028186866115f5565b9250925050935093915050565b611517612633565b6000611522836116c8565b9050604051806080016040528061154c8360008151811061153f57fe5b60200260200101516116db565b81526020016115618360018151811061153f57fe5b81526020016115838360028151811061157657fe5b60200260200101516116e2565b81526020016115988360038151811061157657fe5b90529392505050565b6000806115ad866115c5565b90506115bb818686866117db565b9695505050505050565b606081805190602001206040516020016115df9190612ba0565b6040516020818303038152906040529050919050565b60006060600061160485611801565b90506000806000611616848a896118d8565b8151929550909350915015808061162a5750815b61167b576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b60008161169757604051806020016040528060008152506116b6565b6116b68660018703815181106116a957fe5b6020026020010151611c7e565b919b919a509098505050505050505050565b60606112206116d683611c9a565b611cbf565b6000611220825b600060218260000151111561173e576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b600080600061174c85611e35565b91945092509050600081600181111561176157fe5b146117b3576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6020808601518401805190918410156115bb5760208490036101000a90049695505050505050565b60008060006117eb8786866115f5565b915091508180156114db57506114db868261215e565b6060600061180e836116c8565b90506000815167ffffffffffffffff8111801561182a57600080fd5b5060405190808252806020026020018201604052801561186457816020015b61185161265a565b8152602001906001900390816118495790505b50905060005b82518110156118d057600061189184838151811061188457fe5b6020026020010151612174565b905060405180604001604052808281526020016118ad836116c8565b8152508383815181106118bc57fe5b60209081029190910101525060010161186a565b509392505050565b600060608180806118e887612203565b9050856000806118f661265a565b60005b8c51811015611c56578c818151811061190e57fe5b60200260200101519150828401935060018701965083600014156119825781518051602090910120851461197d576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b611a49565b8151516020116119e95781518051602090910120851461197d576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b846119f78360000151612300565b14611a49576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b60208201515160111415611ab8578551841415611a6557611c56565b6000868581518110611a7357fe5b602001015160f81c60f81b60f81c9050600083602001518260ff1681518110611a9857fe5b60200260200101519050611aab8161232c565b9650600194505050611c4e565b60028260200151511415611c01576000611ad183612362565b9050600081600081518110611ae257fe5b016020015160f81c9050600181166002036000611b028460ff8416612380565b90506000611b108b8a612380565b90506000611b1e83836123ad565b905060ff851660021480611b35575060ff85166003145b15611b6757808351148015611b4a5750808251145b15611b5457988901985b50600160ff1b9950611c56945050505050565b60ff85161580611b7a575060ff85166001145b15611bca5782518114611b9a5750600160ff1b9950611c56945050505050565b611bbb8860200151600181518110611bae57fe5b602002602001015161232c565b9a509750611c4e945050505050565b60405162461bcd60e51b81526004018080602001828103825260268152602001806130b36026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b6001016118f9565b50600160ff1b841486611c698786612380565b909e909d50909b509950505050505050505050565b6020810151805160609161122091600019810190811061188457fe5b611ca2612674565b506040805180820190915281518152602082810190820152919050565b6060600080611ccd84611e35565b91935090915060019050816001811115611ce357fe5b14611d35576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b611d56612674565b815260200190600190039081611d4e5790505090506000835b8651811015611e2a5760208210611db75760405162461bcd60e51b815260040180806020018281038252602a81526020018061305b602a913960400191505060405180910390fd5b600080611de36040518060400160405280858c60000151038152602001858c6020015101815250611e35565b509150915060405180604001604052808383018152602001848b6020015101815250858581518110611e1157fe5b6020908102919091010152600193909301920101611d6f565b508152949350505050565b600080600080846000015111611e92576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f8111611eb7576000600160009450945094505050612157565b60b78111611f2c578551607f198201908110611f1a576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b60019550935060009250612157915050565b60bf811161201057855160b6198201908110611f8f576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111611ffb576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b60019091019550935060009250612157915050565b60f7811161208457855160bf198201908110612073576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b600195509350849250612157915050565b855160f61982019081106120df576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111612144576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b6001918201965094509250612157915050565b9193909250565b8051602091820120825192909101919091201490565b6060600080600061218485611e35565b91945092509050600081600181111561219957fe5b146121eb576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b6121fa85602001518484612413565b95945050505050565b60606000825160020267ffffffffffffffff8111801561222257600080fd5b506040519080825280601f01601f19166020018201604052801561224d576020820181803683370190505b50905060005b83518110156122f957600484828151811061226a57fe5b602001015160f81c60f81b6001600160f81b031916901c82826002028151811061229057fe5b60200101906001600160f81b031916908160001a90535060108482815181106122b557fe5b016020015160f81c816122c457fe5b0660f81b8282600202600101815181106122da57fe5b60200101906001600160f81b031916908160001a905350600101612253565b5092915050565b6000602082511015612317575060208101516104a3565b81806020019051602081101561049e57600080fd5b6000606060208360000151101561234d57612346836124c1565b9050612359565b61235683612174565b90505b61138281612300565b606061122061237b836020015160008151811061188457fe5b612203565b60608251821061239f5750604080516020810190915260008152611220565b61121d8383848651036124cc565b6000805b8084511180156123c15750808351115b801561240657508281815181106123d457fe5b602001015160f81c60f81b6001600160f81b0319168482815181106123f557fe5b01602001516001600160f81b031916145b1561121d576001016123b1565b606060008267ffffffffffffffff8111801561242e57600080fd5b506040519080825280601f01601f191660200182016040528015612459576020820181803683370190505b50905080516000141561246d579050611382565b8484016020820160005b60208604811015612498578251825260209283019290910190600101612477565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b60606112208261261d565b60608182601f011015612517576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b82828401101561255f576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b818301845110156125ab576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b6060821580156125ca5760405191506000825260208201604052612614565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156126035780518352602092830192016125eb565b5050858452601f01601f1916604052505b50949350505050565b6060611220826020015160008460000151612413565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060608152602001606081525090565b604051806040016040528060008152602001600081525090565b600067ffffffffffffffff8311156126a257fe5b6126b5601f8401601f1916602001612fe0565b90508281528383830111156126c957600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146104a357600080fd5b600082601f830112612707578081fd5b61121d8383356020850161268e565b600060a08284031215612727578081fd5b60405160a0810167ffffffffffffffff828210818311171561274557fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561278257600080fd5b5061278f858286016126f7565b6080830152505092915050565b6000604082840312156127ad578081fd5b6040516040810167ffffffffffffffff82821081831117156127cb57fe5b81604052829350843583526020915081850135818111156127eb57600080fd5b8501601f810187136127fc57600080fd5b80358281111561280857fe5b8381029250612818848401612fe0565b8181528481019083860185850187018b101561283357600080fd5b600095505b83861015612856578035835260019590950194918601918601612838565b5080868801525050505050505092915050565b803563ffffffff811681146104a357600080fd5b60006020828403121561288e578081fd5b61121d826126e0565b600080600080600060a086880312156128ae578081fd5b6128b7866126e0565b94506128c5602087016126e0565b9350604086013567ffffffffffffffff808211156128e1578283fd5b6128ed89838a016126f7565b9450606088013593506080880135915080821115612909578283fd5b9087019060a0828a03121561291c578283fd5b61292660a0612fe0565b8235815260208301358281111561293b578485fd5b6129478b828601612716565b60208301525060408301358281111561295e578485fd5b61296a8b82860161279c565b604083015250606083013582811115612981578485fd5b61298d8b8286016126f7565b6060830152506080830135828111156129a4578485fd5b6129b08b8286016126f7565b6080830152508093505050509295509295909350565b600080600080600060a086880312156129dd578081fd5b6129e6866126e0565b94506129f4602087016126e0565b9350604086013567ffffffffffffffff811115612a0f578182fd5b612a1b888289016126f7565b93505060608601359150612a3160808701612869565b90509295509295909350565b600080600060608486031215612a51578283fd5b612a5a846126e0565b9250602084013567ffffffffffffffff811115612a75578283fd5b612a81868287016126f7565b925050612a9060408501612869565b90509250925092565b600060208284031215612aaa578081fd5b8151801515811461121d578182fd5b600060208284031215612aca578081fd5b5035919050565b600060208284031215612ae2578081fd5b813567ffffffffffffffff811115612af8578182fd5b8201601f81018413612b08578182fd5b612b178482356020840161268e565b949350505050565b60008151808452612b37816020860160208601613004565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a06080850152612b1760a0850182612b1f565b60609190911b6001600160601b031916815260140190565b90815260200190565b918252602082015260400190565b60008251612bc9818460208701613004565b9190910192915050565b60008351612be5818460208801613004565b60609390931b6001600160601b0319169190920190815260140192915050565b60008451612c17818460208901613004565b60609490941b6001600160601b03191691909301908152601481019190915260340192915050565b60f89190911b6001600160f81b031916815260010190565b6001600160a01b0391909116815260200190565b6001600160a01b03858116825284166020820152608060408201819052600090612c9790830185612b1f565b905082606083015295945050505050565b600060018060a01b0385168252836020830152606060408301526121fa6060830184612b1f565b901515815260200190565b60008482526020606081840152612cf46060840186612b4b565b838103604085015260408101855182528286015160408484015281815180845260608501915085830194508693505b80841015612d435784518252938501936001939093019290850190612d23565b509998505050505050505050565b60006020825261121d6020830184612b1f565b6020808252601f908201527f78446f6d61696e4d65737361676553656e646572206973206e6f742073657400604082015260600190565b6020808252602b908201527f50726f7669646564206d6573736167652068617320616c72656164792062656560408201526a37103932b1b2b4bb32b21760a91b606082015260800190565b6020808252604d908201527f4d6573736167652070617373696e67207072656465706c6f7920686173206e6f60408201527f74206265656e20696e697469616c697a6564206f7220696e76616c696420707260608201526c37b7b310383937bb34b232b21760991b608082015260a00190565b6020808252602b908201527f50726f7669646564206d65737361676520686173206e6f7420616c726561647960408201526a103132b2b71039b2b73a1760a91b606082015260800190565b60208082526022908201527f50726f7669646564206d65737361676520686173206265656e20626c6f636b65604082015261321760f11b606082015260800190565b60208082526036908201527f4f6e6c79204f564d5f4c324d65737361676552656c617965722063616e2072656040820152753630bc90261916ba3796a6189036b2b9b9b0b3b2b99760511b606082015260800190565b60208082526027908201527f50726f7669646564206d65737361676520636f756c64206e6f742062652076656040820152663934b334b2b21760c91b606082015260800190565b6020808252602a908201527f4c3143726f7373446f6d61696e4d657373656e67657220616c72656164792069604082015269373a34b0b634bd32b21760b11b606082015260800190565b60006020825261121d6020830184612b4b565b60405181810167ffffffffffffffff81118282101715612ffc57fe5b604052919050565b60005b8381101561301f578181015183820152602001613007565b8381111561302e576000848401525b5050505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737350726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a656452656365697665642061206e6f6465207769746820616e20756e6b6e6f776e207072656669784f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a264697066735822122087bd533eeb6152e30fa62837ea031390739b59998c6635383a25ecccc63fce9e64736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101215760003560e01c806381ada46c116100ad578063c4d66de811610071578063c4d66de814610213578063c6b94ab014610226578063d7fd19dd14610239578063ecc704281461024c578063f2fde38b1461026157610121565b806381ada46c146101ca57806382e3702d146101dd5780638456cb59146101f05780638da5cb5b146101f8578063b1b1b2091461020057610121565b8063461a4478116100f4578063461a44781461018c5780635c975abb1461019f5780636e296e45146101a7578063706ceab6146101af578063715018a6146101c257610121565b80630ecf2eea1461012657806321d800ec1461013b578063299ca478146101645780633dbb202b14610179575b600080fd5b610139610134366004612ab9565b610274565b005b61014e610149366004612ab9565b610319565b60405161015b9190612ccf565b60405180910390f35b61016c61032e565b60405161015b9190612c57565b610139610187366004612a3d565b61033d565b61016c61019a366004612ad1565b6103cc565b61014e6104a8565b61016c6104b1565b6101396101bd3660046129c6565b6104fa565b610139610561565b6101396101d8366004612ab9565b61060d565b61014e6101eb366004612ab9565b6106af565b6101396106c4565b61016c610730565b61014e61020e366004612ab9565b61073f565b61013961022136600461287d565b610754565b61014e610234366004612ab9565b610882565b610139610247366004612897565b610897565b610254610bd6565b60405161015b9190612ba0565b61013961026f36600461287d565b610bdc565b61027c610cdf565b6001600160a01b031661028d610730565b6001600160a01b0316146102d6576040805162461bcd60e51b815260206004820181905260248201526000805160206130d9833981519152604482015290519081900360640190fd5b600081815260ce6020526040808220805460ff191660011790555182917ff52508d5339edf0d7e5060a416df98db067af561bdc60872d29c0439eaa13a0291a250565b60006020819052908152604090205460ff1681565b6005546001600160a01b031681565b600061034d843385600354610ce3565b60038054600190810190915581516020808401919091206000908152600290915260409020805460ff19169091179055905061038f8163ffffffff8416610d30565b7f0ee9ffdb2334d78de97ffb066b23a352a4d35180cefb36589d663fbb1eb6f326816040516103be9190612d51565b60405180910390a150505050565b60055460405163bf40fac160e01b81526020600482018181528451602484015284516000946001600160a01b03169363bf40fac1938793928392604401918501908083838b5b8381101561042a578181015183820152602001610412565b50505050905090810190601f1680156104575780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561047457600080fd5b505afa158015610488573d6000803e3d6000fd5b505050506040513d602081101561049e57600080fd5b505190505b919050565b606a5460ff1690565b6004546000906001600160a01b031661dead14156104ea5760405162461bcd60e51b81526004016104e190612d64565b60405180910390fd5b506004546001600160a01b031690565b600061050886868686610ce3565b805160208083019190912060009081526002909152604090205490915060ff1615156001146105495760405162461bcd60e51b81526004016104e190612e59565b610559818363ffffffff16610d30565b505050505050565b610569610cdf565b6001600160a01b031661057a610730565b6001600160a01b0316146105c3576040805162461bcd60e51b815260206004820181905260248201526000805160206130d9833981519152604482015290519081900360640190fd5b6038546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3603880546001600160a01b0319169055565b610615610cdf565b6001600160a01b0316610626610730565b6001600160a01b03161461066f576040805162461bcd60e51b815260206004820181905260248201526000805160206130d9833981519152604482015290519081900360640190fd5b600081815260ce6020526040808220805460ff191690555182917f52c8a2680a9f4cc0ad0bf88f32096eadbebf0646ea611d93a0ce6a29a024040591a250565b60026020526000908152604090205460ff1681565b6106cc610cdf565b6001600160a01b03166106dd610730565b6001600160a01b031614610726576040805162461bcd60e51b815260206004820181905260248201526000805160206130d9833981519152604482015290519081900360640190fd5b61072e610e08565b565b6038546001600160a01b031690565b60016020526000908152604090205460ff1681565b600554600160a81b900460ff168061076f575061076f610ea8565b806107845750600554600160a01b900460ff16155b6107bf5760405162461bcd60e51b815260040180806020018281038252602e815260200180613085602e913960400191505060405180910390fd5b600554600160a81b900460ff161580156107f6576005805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b6005546001600160a01b03161561081f5760405162461bcd60e51b81526004016104e190612f83565b600580546001600160a01b0384166001600160a01b0319918216179091556004805490911661dead179055610852610eb9565b61085a610f72565b610862611082565b61086a611144565b801561087e576005805460ff60a81b191690555b5050565b60ce6020526000908152604090205460ff1681565b6002609c5414156108ef576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002609c5560408051808201909152601481527327ab26afa61926b2b9b9b0b3b2a932b630bcb2b960611b602082015260009061092b906103cc565b90506001600160a01b0381161561096457336001600160a01b038216146109645760405162461bcd60e51b81526004016104e190612ee6565b61096c6104a8565b156109b1576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b60006109bf87878787610ce3565b90506109cb8184611201565b15156001146109ec5760405162461bcd60e51b81526004016104e190612f3c565b80516020808301919091206000818152600190925260409091205460ff1615610a275760405162461bcd60e51b81526004016104e190612d9b565b600081815260ce602052604090205460ff1615610a565760405162461bcd60e51b81526004016104e190612ea4565b600480546001600160a01b0319166001600160a01b03898116919091179091556040516000918a1690610a8a908990612bb7565b6000604051808303816000865af19150503d8060008114610ac7576040519150601f19603f3d011682016040523d82523d6000602084013e610acc565b606091505b5050600480546001600160a01b03191661dead179055905080151560011415610b4757600082815260016020819052604091829020805460ff19169091179055517f4641df4a962071e12719d8c8c8e5ac7fc4d97b927346a3d7a335b1f7517e133c90610b3a908490612ba0565b60405180910390a1610b7f565b7f99d0e048484baa1b1540b1367cb128acd7ab2946d1ed91ec10e3c85e4bf51b8f82604051610b769190612ba0565b60405180910390a15b6000833343604051602001610b9693929190612c05565b60408051601f1981840301815291815281516020928301206000908152918290529020805460ff19166001908117909155609c5550505050505050505050565b60035481565b610be4610cdf565b6001600160a01b0316610bf5610730565b6001600160a01b031614610c3e576040805162461bcd60e51b815260206004820181905260248201526000805160206130d9833981519152604482015290519081900360640190fd5b6001600160a01b038116610c835760405162461bcd60e51b81526004018080602001828103825260268152602001806130356026913960400191505060405180910390fd5b6038546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3603880546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b606084848484604051602401610cfc9493929190612c6b565b60408051601f198184030181529190526020810180516001600160e01b031663cbd4ece960e01b1790529050949350505050565b610d6e6040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e0000008152506103cc565b6001600160a01b0316636fee07e0610dba6040518060400160405280601a81526020017f4f564d5f4c3243726f7373446f6d61696e4d657373656e6765720000000000008152506103cc565b83856040518463ffffffff1660e01b8152600401610dda93929190612ca8565b600060405180830381600087803b158015610df457600080fd5b505af1158015610559573d6000803e3d6000fd5b610e106104a8565b15610e55576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b606a805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610e8b610cdf565b604080516001600160a01b039092168252519081900360200190a1565b6000610eb330611226565b15905090565b600554600160a81b900460ff1680610ed45750610ed4610ea8565b80610ee95750600554600160a01b900460ff16155b610f245760405162461bcd60e51b815260040180806020018281038252602e815260200180613085602e913960400191505060405180910390fd5b600554600160a81b900460ff16158015610f5b576005805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b8015610f6f576005805460ff60a81b191690555b50565b600554600160a81b900460ff1680610f8d5750610f8d610ea8565b80610fa25750600554600160a01b900460ff16155b610fdd5760405162461bcd60e51b815260040180806020018281038252602e815260200180613085602e913960400191505060405180910390fd5b600554600160a81b900460ff16158015611014576005805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b600061101e610cdf565b603880546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3508015610f6f576005805460ff60a81b1916905550565b600554600160a81b900460ff168061109d575061109d610ea8565b806110b25750600554600160a01b900460ff16155b6110ed5760405162461bcd60e51b815260040180806020018281038252602e815260200180613085602e913960400191505060405180910390fd5b600554600160a81b900460ff16158015611124576005805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b606a805460ff191690558015610f6f576005805460ff60a81b1916905550565b600554600160a81b900460ff168061115f575061115f610ea8565b806111745750600554600160a01b900460ff16155b6111af5760405162461bcd60e51b815260040180806020018281038252602e815260200180613085602e913960400191505060405180910390fd5b600554600160a81b900460ff161580156111e6576005805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b6001609c558015610f6f576005805460ff60a81b1916905550565b600061120c8261122c565b801561121d575061121d8383611389565b90505b92915050565b3b151590565b60008061126d6040518060400160405280601881526020017f4f564d5f5374617465436f6d6d69746d656e74436861696e00000000000000008152506103cc565b6020840151604051639418bddd60e01b81529192506001600160a01b03831691639418bddd9161129f91600401612fcd565b60206040518083038186803b1580156112b757600080fd5b505afa1580156112cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ef9190612a99565b1580156113825750825160208401516040808601519051634d69ee5760e01b81526001600160a01b03851693634d69ee5793611332939192909190600401612cda565b60206040518083038186803b15801561134a57600080fd5b505afa15801561135e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113829190612a99565b9392505050565b600080836113cb6040518060400160405280601a81526020017f4f564d5f4c3243726f7373446f6d61696e4d657373656e6765720000000000008152506103cc565b6040516020016113dc929190612bd3565b604051602081830303815290604052805190602001206000604051602001611405929190612ba9565b604051602081830303815290604052805190602001209050600080611454602160991b6040516020016114389190612b88565b60408051601f19818403018152919052606087015187516114e6565b909250905060018215151461147b5760405162461bcd60e51b81526004016104e190612de6565b60006114868261150f565b90506114db8460405160200161149c9190612ba0565b60405160208183030381529060405260016040516020016114bd9190612c3f565b604051602081830303815290604052886080015184604001516115a1565b979650505050505050565b6000606060006114f5866115c5565b90506115028186866115f5565b9250925050935093915050565b611517612633565b6000611522836116c8565b9050604051806080016040528061154c8360008151811061153f57fe5b60200260200101516116db565b81526020016115618360018151811061153f57fe5b81526020016115838360028151811061157657fe5b60200260200101516116e2565b81526020016115988360038151811061157657fe5b90529392505050565b6000806115ad866115c5565b90506115bb818686866117db565b9695505050505050565b606081805190602001206040516020016115df9190612ba0565b6040516020818303038152906040529050919050565b60006060600061160485611801565b90506000806000611616848a896118d8565b8151929550909350915015808061162a5750815b61167b576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b60008161169757604051806020016040528060008152506116b6565b6116b68660018703815181106116a957fe5b6020026020010151611c7e565b919b919a509098505050505050505050565b60606112206116d683611c9a565b611cbf565b6000611220825b600060218260000151111561173e576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b600080600061174c85611e35565b91945092509050600081600181111561176157fe5b146117b3576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6020808601518401805190918410156115bb5760208490036101000a90049695505050505050565b60008060006117eb8786866115f5565b915091508180156114db57506114db868261215e565b6060600061180e836116c8565b90506000815167ffffffffffffffff8111801561182a57600080fd5b5060405190808252806020026020018201604052801561186457816020015b61185161265a565b8152602001906001900390816118495790505b50905060005b82518110156118d057600061189184838151811061188457fe5b6020026020010151612174565b905060405180604001604052808281526020016118ad836116c8565b8152508383815181106118bc57fe5b60209081029190910101525060010161186a565b509392505050565b600060608180806118e887612203565b9050856000806118f661265a565b60005b8c51811015611c56578c818151811061190e57fe5b60200260200101519150828401935060018701965083600014156119825781518051602090910120851461197d576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b611a49565b8151516020116119e95781518051602090910120851461197d576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b846119f78360000151612300565b14611a49576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b60208201515160111415611ab8578551841415611a6557611c56565b6000868581518110611a7357fe5b602001015160f81c60f81b60f81c9050600083602001518260ff1681518110611a9857fe5b60200260200101519050611aab8161232c565b9650600194505050611c4e565b60028260200151511415611c01576000611ad183612362565b9050600081600081518110611ae257fe5b016020015160f81c9050600181166002036000611b028460ff8416612380565b90506000611b108b8a612380565b90506000611b1e83836123ad565b905060ff851660021480611b35575060ff85166003145b15611b6757808351148015611b4a5750808251145b15611b5457988901985b50600160ff1b9950611c56945050505050565b60ff85161580611b7a575060ff85166001145b15611bca5782518114611b9a5750600160ff1b9950611c56945050505050565b611bbb8860200151600181518110611bae57fe5b602002602001015161232c565b9a509750611c4e945050505050565b60405162461bcd60e51b81526004018080602001828103825260268152602001806130b36026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b6001016118f9565b50600160ff1b841486611c698786612380565b909e909d50909b509950505050505050505050565b6020810151805160609161122091600019810190811061188457fe5b611ca2612674565b506040805180820190915281518152602082810190820152919050565b6060600080611ccd84611e35565b91935090915060019050816001811115611ce357fe5b14611d35576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b611d56612674565b815260200190600190039081611d4e5790505090506000835b8651811015611e2a5760208210611db75760405162461bcd60e51b815260040180806020018281038252602a81526020018061305b602a913960400191505060405180910390fd5b600080611de36040518060400160405280858c60000151038152602001858c6020015101815250611e35565b509150915060405180604001604052808383018152602001848b6020015101815250858581518110611e1157fe5b6020908102919091010152600193909301920101611d6f565b508152949350505050565b600080600080846000015111611e92576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f8111611eb7576000600160009450945094505050612157565b60b78111611f2c578551607f198201908110611f1a576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b60019550935060009250612157915050565b60bf811161201057855160b6198201908110611f8f576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111611ffb576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b60019091019550935060009250612157915050565b60f7811161208457855160bf198201908110612073576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b600195509350849250612157915050565b855160f61982019081106120df576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111612144576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b6001918201965094509250612157915050565b9193909250565b8051602091820120825192909101919091201490565b6060600080600061218485611e35565b91945092509050600081600181111561219957fe5b146121eb576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b6121fa85602001518484612413565b95945050505050565b60606000825160020267ffffffffffffffff8111801561222257600080fd5b506040519080825280601f01601f19166020018201604052801561224d576020820181803683370190505b50905060005b83518110156122f957600484828151811061226a57fe5b602001015160f81c60f81b6001600160f81b031916901c82826002028151811061229057fe5b60200101906001600160f81b031916908160001a90535060108482815181106122b557fe5b016020015160f81c816122c457fe5b0660f81b8282600202600101815181106122da57fe5b60200101906001600160f81b031916908160001a905350600101612253565b5092915050565b6000602082511015612317575060208101516104a3565b81806020019051602081101561049e57600080fd5b6000606060208360000151101561234d57612346836124c1565b9050612359565b61235683612174565b90505b61138281612300565b606061122061237b836020015160008151811061188457fe5b612203565b60608251821061239f5750604080516020810190915260008152611220565b61121d8383848651036124cc565b6000805b8084511180156123c15750808351115b801561240657508281815181106123d457fe5b602001015160f81c60f81b6001600160f81b0319168482815181106123f557fe5b01602001516001600160f81b031916145b1561121d576001016123b1565b606060008267ffffffffffffffff8111801561242e57600080fd5b506040519080825280601f01601f191660200182016040528015612459576020820181803683370190505b50905080516000141561246d579050611382565b8484016020820160005b60208604811015612498578251825260209283019290910190600101612477565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b60606112208261261d565b60608182601f011015612517576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b82828401101561255f576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b818301845110156125ab576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b6060821580156125ca5760405191506000825260208201604052612614565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156126035780518352602092830192016125eb565b5050858452601f01601f1916604052505b50949350505050565b6060611220826020015160008460000151612413565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060608152602001606081525090565b604051806040016040528060008152602001600081525090565b600067ffffffffffffffff8311156126a257fe5b6126b5601f8401601f1916602001612fe0565b90508281528383830111156126c957600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146104a357600080fd5b600082601f830112612707578081fd5b61121d8383356020850161268e565b600060a08284031215612727578081fd5b60405160a0810167ffffffffffffffff828210818311171561274557fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561278257600080fd5b5061278f858286016126f7565b6080830152505092915050565b6000604082840312156127ad578081fd5b6040516040810167ffffffffffffffff82821081831117156127cb57fe5b81604052829350843583526020915081850135818111156127eb57600080fd5b8501601f810187136127fc57600080fd5b80358281111561280857fe5b8381029250612818848401612fe0565b8181528481019083860185850187018b101561283357600080fd5b600095505b83861015612856578035835260019590950194918601918601612838565b5080868801525050505050505092915050565b803563ffffffff811681146104a357600080fd5b60006020828403121561288e578081fd5b61121d826126e0565b600080600080600060a086880312156128ae578081fd5b6128b7866126e0565b94506128c5602087016126e0565b9350604086013567ffffffffffffffff808211156128e1578283fd5b6128ed89838a016126f7565b9450606088013593506080880135915080821115612909578283fd5b9087019060a0828a03121561291c578283fd5b61292660a0612fe0565b8235815260208301358281111561293b578485fd5b6129478b828601612716565b60208301525060408301358281111561295e578485fd5b61296a8b82860161279c565b604083015250606083013582811115612981578485fd5b61298d8b8286016126f7565b6060830152506080830135828111156129a4578485fd5b6129b08b8286016126f7565b6080830152508093505050509295509295909350565b600080600080600060a086880312156129dd578081fd5b6129e6866126e0565b94506129f4602087016126e0565b9350604086013567ffffffffffffffff811115612a0f578182fd5b612a1b888289016126f7565b93505060608601359150612a3160808701612869565b90509295509295909350565b600080600060608486031215612a51578283fd5b612a5a846126e0565b9250602084013567ffffffffffffffff811115612a75578283fd5b612a81868287016126f7565b925050612a9060408501612869565b90509250925092565b600060208284031215612aaa578081fd5b8151801515811461121d578182fd5b600060208284031215612aca578081fd5b5035919050565b600060208284031215612ae2578081fd5b813567ffffffffffffffff811115612af8578182fd5b8201601f81018413612b08578182fd5b612b178482356020840161268e565b949350505050565b60008151808452612b37816020860160208601613004565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a06080850152612b1760a0850182612b1f565b60609190911b6001600160601b031916815260140190565b90815260200190565b918252602082015260400190565b60008251612bc9818460208701613004565b9190910192915050565b60008351612be5818460208801613004565b60609390931b6001600160601b0319169190920190815260140192915050565b60008451612c17818460208901613004565b60609490941b6001600160601b03191691909301908152601481019190915260340192915050565b60f89190911b6001600160f81b031916815260010190565b6001600160a01b0391909116815260200190565b6001600160a01b03858116825284166020820152608060408201819052600090612c9790830185612b1f565b905082606083015295945050505050565b600060018060a01b0385168252836020830152606060408301526121fa6060830184612b1f565b901515815260200190565b60008482526020606081840152612cf46060840186612b4b565b838103604085015260408101855182528286015160408484015281815180845260608501915085830194508693505b80841015612d435784518252938501936001939093019290850190612d23565b509998505050505050505050565b60006020825261121d6020830184612b1f565b6020808252601f908201527f78446f6d61696e4d65737361676553656e646572206973206e6f742073657400604082015260600190565b6020808252602b908201527f50726f7669646564206d6573736167652068617320616c72656164792062656560408201526a37103932b1b2b4bb32b21760a91b606082015260800190565b6020808252604d908201527f4d6573736167652070617373696e67207072656465706c6f7920686173206e6f60408201527f74206265656e20696e697469616c697a6564206f7220696e76616c696420707260608201526c37b7b310383937bb34b232b21760991b608082015260a00190565b6020808252602b908201527f50726f7669646564206d65737361676520686173206e6f7420616c726561647960408201526a103132b2b71039b2b73a1760a91b606082015260800190565b60208082526022908201527f50726f7669646564206d65737361676520686173206265656e20626c6f636b65604082015261321760f11b606082015260800190565b60208082526036908201527f4f6e6c79204f564d5f4c324d65737361676552656c617965722063616e2072656040820152753630bc90261916ba3796a6189036b2b9b9b0b3b2b99760511b606082015260800190565b60208082526027908201527f50726f7669646564206d65737361676520636f756c64206e6f742062652076656040820152663934b334b2b21760c91b606082015260800190565b6020808252602a908201527f4c3143726f7373446f6d61696e4d657373656e67657220616c72656164792069604082015269373a34b0b634bd32b21760b11b606082015260800190565b60006020825261121d6020830184612b4b565b60405181810167ffffffffffffffff81118282101715612ffc57fe5b604052919050565b60005b8381101561301f578181015183820152602001613007565b8381111561302e576000848401525b5050505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737350726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a656452656365697665642061206e6f6465207769746820616e20756e6b6e6f776e207072656669784f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a264697066735822122087bd533eeb6152e30fa62837ea031390739b59998c6635383a25ecccc63fce9e64736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"FailedRelayedMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"_xDomainCalldataHash\",\"type\":\"bytes32\"}],\"name\":\"MessageAllowed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"_xDomainCalldataHash\",\"type\":\"bytes32\"}],\"name\":\"MessageBlocked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_xDomainCalldataHash\",\"type\":\"bytes32\"}],\"name\":\"allowMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_xDomainCalldataHash\",\"type\":\"bytes32\"}],\"name\":\"blockMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"blockedMessages\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"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\"},{\"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\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_target\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_message\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_queueIndex\",\"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\":\"\",\"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\":\"successfulMessages\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"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\":{\"allowMessage(bytes32)\":{\"params\":{\"_xDomainCalldataHash\":\"Hash of the message to block.\"}},\"blockMessage(bytes32)\":{\"params\":{\"_xDomainCalldataHash\":\"Hash of the message to block.\"}},\"initialize(address)\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"paused()\":{\"details\":\"Returns true if the contract is paused, and false otherwise.\"},\"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.\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"replayMessage(address,address,bytes,uint256,uint32)\":{\"params\":{\"_gasLimit\":\"Gas limit for the provided message.\",\"_message\":\"Message to send to the target.\",\"_queueIndex\":\"CTC Queue index for the message to replay.\",\"_sender\":\"Original sender address.\",\"_target\":\"Target contract address.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"sendMessage(address,bytes,uint32)\":{\"params\":{\"_gasLimit\":\"Gas limit for the provided message.\",\"_message\":\"Message to send to the target.\",\"_target\":\"Target contract address.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"OVM_L1CrossDomainMessenger\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"allowMessage(bytes32)\":{\"notice\":\"Allow a message.\"},\"blockMessage(bytes32)\":{\"notice\":\"Block a message.\"},\"constructor\":{\"notice\":\"This contract is intended to be behind a delegate proxy. We pass the zero address to the address resolver just to satisfy the constructor. We still need to set this value in initialize().\"},\"pause()\":{\"notice\":\"Pause relaying.\"},\"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.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"sendMessage(address,bytes,uint32)\":{\"notice\":\"Sends a cross domain message to the target messenger.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol\":\"OVM_L1CrossDomainMessenger\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/Initializable.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal initializer {\\n __Context_init_unchained();\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal initializer {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xb419e68addcb82ecda3ad3974b0d2db76435ce9b08435a04d5b119a0c5d45ea5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n// solhint-disable-next-line compiler-version\\npragma solidity >=0.4.24 <0.8.0;\\n\\nimport \\\"../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n */\\nabstract contract Initializable {\\n\\n /**\\n * @dev Indicates that the contract has been initialized.\\n */\\n bool private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Modifier to protect an initializer function from being invoked twice.\\n */\\n modifier initializer() {\\n require(_initializing || _isConstructor() || !_initialized, \\\"Initializable: contract is already initialized\\\");\\n\\n bool isTopLevelCall = !_initializing;\\n if (isTopLevelCall) {\\n _initializing = true;\\n _initialized = true;\\n }\\n\\n _;\\n\\n if (isTopLevelCall) {\\n _initializing = false;\\n }\\n }\\n\\n /// @dev Returns true if and only if the function is running in the constructor\\n function _isConstructor() private view returns (bool) {\\n return !AddressUpgradeable.isContract(address(this));\\n }\\n}\\n\",\"keccak256\":\"0xd8e4eb08dcc1d1860fb347ba5ffd595242b9a1b66d49a47f2b4cb51c3f35017e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.2 <0.8.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { size := extcodesize(account) }\\n return size > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\n (bool success, ) = recipient.call{ value: amount }(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain`call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: value }(data);\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfc5ea91fa9ceb1961023b2a6c978b902888c52b90847ac7813fe3b79524165f6\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\nimport \\\"../proxy/Initializable.sol\\\";\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal initializer {\\n __Context_init_unchained();\\n }\\n\\n function __Context_init_unchained() internal initializer {\\n }\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0xbbf8a21b9a66c48d45ff771b8563c6df19ba451d63dfb8380a865c1e1f29d1a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"./ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which allows children to implement an emergency stop\\n * mechanism that can be triggered by an authorized account.\\n *\\n * This module is used through inheritance. It will make available the\\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\\n * the functions of your contract. Note that they will not be pausable by\\n * simply including this module, only once the modifiers are put in place.\\n */\\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\\n /**\\n * @dev Emitted when the pause is triggered by `account`.\\n */\\n event Paused(address account);\\n\\n /**\\n * @dev Emitted when the pause is lifted by `account`.\\n */\\n event Unpaused(address account);\\n\\n bool private _paused;\\n\\n /**\\n * @dev Initializes the contract in unpaused state.\\n */\\n function __Pausable_init() internal initializer {\\n __Context_init_unchained();\\n __Pausable_init_unchained();\\n }\\n\\n function __Pausable_init_unchained() internal initializer {\\n _paused = false;\\n }\\n\\n /**\\n * @dev Returns true if the contract is paused, and false otherwise.\\n */\\n function paused() public view virtual returns (bool) {\\n return _paused;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is not paused.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n modifier whenNotPaused() {\\n require(!paused(), \\\"Pausable: paused\\\");\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is paused.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n modifier whenPaused() {\\n require(paused(), \\\"Pausable: not paused\\\");\\n _;\\n }\\n\\n /**\\n * @dev Triggers stopped state.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n function _pause() internal virtual whenNotPaused {\\n _paused = true;\\n emit Paused(_msgSender());\\n }\\n\\n /**\\n * @dev Returns to normal state.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n function _unpause() internal virtual whenPaused {\\n _paused = false;\\n emit Unpaused(_msgSender());\\n }\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x73bef0a5dec3efde8183c4858d90f683ed2771656c4329647b4d5b0f89498fd5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\nimport \\\"../proxy/Initializable.sol\\\";\\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 ReentrancyGuardUpgradeable is Initializable {\\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 function __ReentrancyGuard_init() internal initializer {\\n __ReentrancyGuard_init_unchained();\\n }\\n\\n function __ReentrancyGuard_init_unchained() internal initializer {\\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 uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x46034cd5cca740f636345c8f7aebae0f78adfd4b70e31e6f888cccbe1086586e\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/bridge/messaging/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_AddressResolver } from \\\"../../../libraries/resolver/Lib_AddressResolver.sol\\\";\\nimport { Lib_OVMCodec } from \\\"../../../libraries/codec/Lib_OVMCodec.sol\\\";\\nimport { Lib_AddressManager } from \\\"../../../libraries/resolver/Lib_AddressManager.sol\\\";\\nimport { Lib_SecureMerkleTrie } from \\\"../../../libraries/trie/Lib_SecureMerkleTrie.sol\\\";\\nimport { Lib_PredeployAddresses } from \\\"../../../libraries/constants/Lib_PredeployAddresses.sol\\\";\\nimport { Lib_CrossDomainUtils } from \\\"../../../libraries/bridge/Lib_CrossDomainUtils.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_L1CrossDomainMessenger } from \\\"../../../iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol\\\";\\nimport { iOVM_CanonicalTransactionChain } from \\\"../../../iOVM/chain/iOVM_CanonicalTransactionChain.sol\\\";\\nimport { iOVM_StateCommitmentChain } from \\\"../../../iOVM/chain/iOVM_StateCommitmentChain.sol\\\";\\n\\n/* External Imports */\\nimport { OwnableUpgradeable } from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport { PausableUpgradeable } from \\\"@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol\\\";\\nimport { ReentrancyGuardUpgradeable } from \\\"@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol\\\";\\n\\n/**\\n * @title OVM_L1CrossDomainMessenger\\n * @dev The L1 Cross Domain Messenger contract sends messages from L1 to L2, and relays messages\\n * from L2 onto L1. In the event that a message sent from L1 to L2 is rejected for exceeding the L2\\n * epoch gas limit, it can be resubmitted via this contract's replay function.\\n *\\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_L1CrossDomainMessenger is\\n iOVM_L1CrossDomainMessenger,\\n Lib_AddressResolver,\\n OwnableUpgradeable,\\n PausableUpgradeable,\\n ReentrancyGuardUpgradeable\\n{\\n\\n /**********\\n * Events *\\n **********/\\n\\n event MessageBlocked(\\n bytes32 indexed _xDomainCalldataHash\\n );\\n\\n event MessageAllowed(\\n bytes32 indexed _xDomainCalldataHash\\n );\\n\\n /*************\\n * Constants *\\n *************/\\n\\n // The default x-domain message sender being set to a non-zero value makes\\n // deployment a bit more expensive, but in exchange the refund on every call to\\n // `relayMessage` by the L1 and L2 messengers will be higher.\\n address internal constant DEFAULT_XDOMAIN_SENDER = 0x000000000000000000000000000000000000dEaD;\\n\\n /**********************\\n * Contract Variables *\\n **********************/\\n\\n mapping (bytes32 => bool) public blockedMessages;\\n mapping (bytes32 => bool) public relayedMessages;\\n mapping (bytes32 => bool) public successfulMessages;\\n\\n address internal xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * This contract is intended to be behind a delegate proxy.\\n * We pass the zero address to the address resolver just to satisfy the constructor.\\n * We still need to set this value in initialize().\\n */\\n constructor()\\n Lib_AddressResolver(address(0))\\n {}\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Modifier to enforce that, if configured, only the OVM_L2MessageRelayer contract may\\n * 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 * @param _libAddressManager Address of the Address Manager.\\n */\\n function initialize(\\n address _libAddressManager\\n )\\n public\\n initializer\\n {\\n require(\\n address(libAddressManager) == address(0),\\n \\\"L1CrossDomainMessenger already intialized.\\\"\\n );\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\\n\\n // Initialize upgradable OZ contracts\\n __Context_init_unchained(); // Context is a dependency for both Ownable and Pausable\\n __Ownable_init_unchained();\\n __Pausable_init_unchained();\\n __ReentrancyGuard_init_unchained();\\n }\\n\\n /**\\n * Pause relaying.\\n */\\n function pause()\\n external\\n onlyOwner\\n {\\n _pause();\\n }\\n\\n /**\\n * Block a message.\\n * @param _xDomainCalldataHash Hash of the message to block.\\n */\\n function blockMessage(\\n bytes32 _xDomainCalldataHash\\n )\\n external\\n onlyOwner\\n {\\n blockedMessages[_xDomainCalldataHash] = true;\\n emit MessageBlocked(_xDomainCalldataHash);\\n }\\n\\n /**\\n * Allow a message.\\n * @param _xDomainCalldataHash Hash of the message to block.\\n */\\n function allowMessage(\\n bytes32 _xDomainCalldataHash\\n )\\n external\\n onlyOwner\\n {\\n blockedMessages[_xDomainCalldataHash] = false;\\n emit MessageAllowed(_xDomainCalldataHash);\\n }\\n\\n function xDomainMessageSender()\\n public\\n override\\n view\\n returns (\\n address\\n )\\n {\\n require(xDomainMsgSender != DEFAULT_XDOMAIN_SENDER, \\\"xDomainMessageSender is not set\\\");\\n return xDomainMsgSender;\\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 memory _message,\\n uint32 _gasLimit\\n )\\n override\\n public\\n {\\n address ovmCanonicalTransactionChain = resolve(\\\"OVM_CanonicalTransactionChain\\\");\\n // Use the CTC queue length as nonce\\n uint40 nonce = iOVM_CanonicalTransactionChain(ovmCanonicalTransactionChain).getQueueLength();\\n\\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\\n _target,\\n msg.sender,\\n _message,\\n nonce\\n );\\n\\n address l2CrossDomainMessenger = resolve(\\\"OVM_L2CrossDomainMessenger\\\");\\n _sendXDomainMessage(ovmCanonicalTransactionChain, l2CrossDomainMessenger, xDomainCalldata, _gasLimit);\\n emit SentMessage(xDomainCalldata);\\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 whenNotPaused\\n {\\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\\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 require(\\n blockedMessages[xDomainCalldataHash] == false,\\n \\\"Provided message has been blocked.\\\"\\n );\\n\\n xDomainMsgSender = _sender;\\n (bool success, ) = _target.call(_message);\\n xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\\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 } else {\\n emit FailedRelayedMessage(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 _queueIndex,\\n uint32 _gasLimit\\n )\\n override\\n public\\n {\\n // Verify that the message is in the queue:\\n address canonicalTransactionChain = resolve(\\\"OVM_CanonicalTransactionChain\\\");\\n Lib_OVMCodec.QueueElement memory element = iOVM_CanonicalTransactionChain(canonicalTransactionChain).getQueueElement(_queueIndex);\\n\\n address l2CrossDomainMessenger = resolve(\\\"OVM_L2CrossDomainMessenger\\\");\\n // Compute the transactionHash\\n bytes32 transactionHash = keccak256(\\n abi.encode(\\n address(this),\\n l2CrossDomainMessenger,\\n _gasLimit,\\n _message\\n )\\n );\\n\\n require(\\n transactionHash == element.transactionHash,\\n \\\"Provided message has not been enqueued.\\\"\\n );\\n\\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\\n _target,\\n _sender,\\n _message,\\n _queueIndex\\n );\\n\\n _sendXDomainMessage(canonicalTransactionChain, l2CrossDomainMessenger, 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(\\n resolve(\\\"OVM_StateCommitmentChain\\\")\\n );\\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(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER),\\n _proof.stateTrieWitness,\\n _proof.stateRoot\\n );\\n\\n require(\\n exists == true,\\n \\\"Message passing predeploy 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 _canonicalTransactionChain Address of the OVM_CanonicalTransactionChain instance.\\n * @param _l2CrossDomainMessenger Address of the OVM_L2CrossDomainMessenger instance.\\n * @param _message Message to send.\\n * @param _gasLimit OVM gas limit for the message.\\n */\\n function _sendXDomainMessage(\\n address _canonicalTransactionChain,\\n address _l2CrossDomainMessenger,\\n bytes memory _message,\\n uint256 _gasLimit\\n )\\n internal\\n {\\n iOVM_CanonicalTransactionChain(_canonicalTransactionChain).enqueue(\\n _l2CrossDomainMessenger,\\n _gasLimit,\\n _message\\n );\\n }\\n}\\n\",\"keccak256\":\"0x627ab8efc23a85497fccbbf465890b88cadb12326299295ec4c567ddea9a7a7e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_CrossDomainMessenger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/**\\n * @title iOVM_CrossDomainMessenger\\n */\\ninterface iOVM_CrossDomainMessenger {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event SentMessage(bytes message);\\n event RelayedMessage(bytes32 msgHash);\\n event FailedRelayedMessage(bytes32 msgHash);\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n function xDomainMessageSender() external view returns (address);\\n\\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\":\"0x03dd576abe8e562cca646dd59b5c038291dffa9a5e43e4e3765d38cf1406fa62\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/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 { iOVM_CrossDomainMessenger } from \\\"./iOVM_CrossDomainMessenger.sol\\\";\\n\\n/**\\n * @title iOVM_L1CrossDomainMessenger\\n */\\ninterface iOVM_L1CrossDomainMessenger is iOVM_CrossDomainMessenger {\\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 _queueIndex CTC Queue index for the message to replay.\\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 _queueIndex,\\n uint32 _gasLimit\\n ) external;\\n}\\n\",\"keccak256\":\"0xd278237bb588a45208d8ed57c7766386cddd1dc1e4f31867c9cb356939dfd49a\",\"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 * 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\",\"keccak256\":\"0x180b9c347e20f1a6efa553b0f2b9a59aebceda92a7484ae6fca4da2bf1d960c3\",\"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/bridge/Lib_CrossDomainUtils.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\\\";\\n\\n/**\\n * @title Lib_CrossDomainUtils\\n */\\nlibrary Lib_CrossDomainUtils {\\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 encodeXDomainCalldata(\\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\",\"keccak256\":\"0x019940ce688f689f30ce43da1f58dc6d6742ad9bcb6cccaaf7c6bb0a16c48f9f\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_PredeployAddresses\\n */\\nlibrary Lib_PredeployAddresses {\\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\\n address internal constant ECDSA_CONTRACT_ACCOUNT = 0x4200000000000000000000000000000000000003;\\n address internal constant SEQUENCER_ENTRYPOINT = 0x4200000000000000000000000000000000000005;\\n address payable internal constant OVM_ETH = 0x4200000000000000000000000000000000000006;\\n address internal constant L2_CROSS_DOMAIN_MESSENGER = 0x4200000000000000000000000000000000000007;\\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\\n address internal constant EXECUTION_MANAGER_WRAPPER = 0x420000000000000000000000000000000000000B;\\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\\n address internal constant ERC1820_REGISTRY = 0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24;\\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\\n}\\n\",\"keccak256\":\"0x798dd3fe47c172880978c8e4d35573b25d5135be29a77584e9fac45845748695\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 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, _key, 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 != pathRemainder.length) {\\n // Our extension node is not identical to the remainder.\\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 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 path may include\\n * additional nodes (e.g., it comes directly from a proof) and we can't resize in-memory\\n * arrays without costly duplication.\\n * @param _key Full original key.\\n * @param _keyRemainder Portion of the initial key that must be inserted 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 _key,\\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 // Reference: https://github.com/ethereumjs/merkle-patricia-tree/blob/c0a10395aab37d42c175a47114ebfcbd7efcf059/src/baseTrie.ts#L294-L313\\n bool matchLeaf = false;\\n if (lastNodeType == NodeType.LeafNode) {\\n uint256 l = 0;\\n if (_path.length > 0) {\\n for (uint256 i = 0; i < _path.length - 1; i++) {\\n if (_getNodeType(_path[i]) == NodeType.BranchNode) {\\n l++;\\n } else {\\n l += _getNodeKey(_path[i]).length;\\n }\\n }\\n }\\n\\n if (\\n _getSharedNibbleLength(\\n _getNodeKey(lastNode),\\n Lib_BytesUtils.slice(Lib_BytesUtils.toNibbles(_key), l)\\n ) == _getNodeKey(lastNode).length\\n && keyRemainder.length == 0\\n ) {\\n matchLeaf = true;\\n }\\n }\\n\\n if (matchLeaf) {\\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 = _editExtensionNodeValue(currentNode, 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 * Creates a new extension node with the same key but a different value.\\n * @param _node Extension node to copy and modify.\\n * @param _value New value for the extension node.\\n * @return New node with the same key and different value.\\n */\\n function _editExtensionNodeValue(\\n TrieNode memory _node,\\n bytes memory _value\\n )\\n private\\n pure\\n returns (\\n TrieNode memory\\n )\\n {\\n bytes[] memory raw = new bytes[](2);\\n bytes memory key = _addHexPrefix(_getNodeKey(_node), false);\\n raw[0] = Lib_RLPWriter.writeBytes(Lib_BytesUtils.fromNibbles(key));\\n if (_value.length < 32) {\\n raw[1] = _value;\\n } else {\\n raw[1] = Lib_RLPWriter.writeBytes(_value);\\n }\\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 abi.encodePacked(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\":\"0x4bb09d0b4f965b57cdc6b3ace49967bcfe7f2580fa0b7863dfe288081247d876\",\"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 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\":\"0xbbdd600165307d2131340599afa9dc0991f8f63727ba3a834bca5a3d7f501da8\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405260cc80546001600160a01b03191661dead17905534801561002457600080fd5b50600080546001600160a01b0319169055613310806100446000396000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c8063715018a6116100a2578063b1b1b20911610071578063b1b1b209146101d7578063c4d66de8146101ea578063c6b94ab0146101fd578063d7fd19dd14610210578063f2fde38b146102235761010b565b8063715018a6146101ac57806381ada46c146101b45780638456cb59146101c75780638da5cb5b146101cf5761010b565b8063461a4478116100de578063461a4478146101765780635c975abb146101895780636e296e4514610191578063706ceab6146101995761010b565b80630ecf2eea1461011057806321d800ec14610125578063299ca4781461014e5780633dbb202b14610163575b600080fd5b61012361011e366004612bef565b610236565b005b610138610133366004612bef565b6102db565b6040516101459190612eb5565b60405180910390f35b6101566102f0565b6040516101459190612e05565b610123610171366004612b73565b6102ff565b610156610184366004612c07565b61045e565b61013861053c565b610156610545565b6101236101a7366004612afc565b61058e565b610123610711565b6101236101c2366004612bef565b6107bd565b61012361085f565b6101566108cb565b6101386101e5366004612bef565b6108da565b6101236101f83660046129b3565b6108ef565b61013861020b366004612bef565b610a1d565b61012361021e3660046129cd565b610a32565b6101236102313660046129b3565b610d70565b61023e610e73565b6001600160a01b031661024f6108cb565b6001600160a01b031614610298576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b600081815260c96020526040808220805460ff191660011790555182917ff52508d5339edf0d7e5060a416df98db067af561bdc60872d29c0439eaa13a0291a250565b60ca6020526000908152604090205460ff1681565b6000546001600160a01b031681565b600061033f6040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e00000081525061045e565b90506000816001600160a01b031663b8f770056040518163ffffffff1660e01b815260040160206040518083038186803b15801561037c57600080fd5b505afa158015610390573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103b49190612cb3565b905060006103cb8633878564ffffffffff16610e77565b9050600061040a6040518060400160405280601a81526020017927ab26afa61921b937b9b9a237b6b0b4b726b2b9b9b2b733b2b960311b81525061045e565b905061041e8482848863ffffffff16610ec4565b7f0ee9ffdb2334d78de97ffb066b23a352a4d35180cefb36589d663fbb1eb6f3268260405161044d9190612f37565b60405180910390a150505050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156104be5781810151838201526020016104a6565b50505050905090810190601f1680156104eb5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561050857600080fd5b505afa15801561051c573d6000803e3d6000fd5b505050506040513d602081101561053257600080fd5b505190505b919050565b60655460ff1690565b60cc546000906001600160a01b031661dead141561057e5760405162461bcd60e51b815260040161057590612f4a565b60405180910390fd5b5060cc546001600160a01b031690565b60006105ce6040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e00000081525061045e565b90506000816001600160a01b0316632a7f18be856040518263ffffffff1660e01b81526004016105fe9190612d4e565b60606040518083038186803b15801561061657600080fd5b505afa15801561062a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064e9190612c55565b9050600061068d6040518060400160405280601a81526020017927ab26afa61921b937b9b9a237b6b0b4b726b2b9b9b2b733b2b960311b81525061045e565b90506000308286896040516020016106a89493929190612e56565b604051602081830303815290604052805190602001209050826000015181146106e35760405162461bcd60e51b815260040161057590613168565b60006106f18a8a8a8a610e77565b90506107058584838963ffffffff16610ec4565b50505050505050505050565b610719610e73565b6001600160a01b031661072a6108cb565b6001600160a01b031614610773576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b6033546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3603380546001600160a01b0319169055565b6107c5610e73565b6001600160a01b03166107d66108cb565b6001600160a01b03161461081f576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b600081815260c96020526040808220805460ff191690555182917f52c8a2680a9f4cc0ad0bf88f32096eadbebf0646ea611d93a0ce6a29a024040591a250565b610867610e73565b6001600160a01b03166108786108cb565b6001600160a01b0316146108c1576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b6108c9610f2c565b565b6033546001600160a01b031690565b60cb6020526000908152604090205460ff1681565b600054600160a81b900460ff168061090a575061090a610fcc565b8061091f5750600054600160a01b900460ff16155b61095a5760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff16158015610991576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b6000546001600160a01b0316156109ba5760405162461bcd60e51b81526004016105759061311e565b600080546001600160a01b0384166001600160a01b03199182161790915560cc805490911661dead1790556109ed610fdd565b6109f5611096565b6109fd6111a6565b610a05611268565b8015610a19576000805460ff60a81b191690555b5050565b60c96020526000908152604090205460ff1681565b60026097541415610a8a576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260975560408051808201909152601481527327ab26afa61926b2b9b9b0b3b2a932b630bcb2b960611b6020820152600090610ac69061045e565b90506001600160a01b03811615610aff57336001600160a01b03821614610aff5760405162461bcd60e51b815260040161057590613081565b610b0761053c565b15610b4c576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6000610b5a87878787610e77565b9050610b668184611325565b1515600114610b875760405162461bcd60e51b8152600401610575906130d7565b8051602080830191909120600081815260cb90925260409091205460ff1615610bc25760405162461bcd60e51b815260040161057590612f81565b600081815260c9602052604090205460ff1615610bf15760405162461bcd60e51b81526004016105759061303f565b60cc80546001600160a01b0319166001600160a01b03898116919091179091556040516000918a1690610c25908990612d65565b6000604051808303816000865af19150503d8060008114610c62576040519150601f19603f3d011682016040523d82523d6000602084013e610c67565b606091505b505060cc80546001600160a01b03191661dead179055905080151560011415610ce057600082815260cb602052604090819020805460ff19166001179055517f4641df4a962071e12719d8c8c8e5ac7fc4d97b927346a3d7a335b1f7517e133c90610cd3908490612d4e565b60405180910390a1610d18565b7f99d0e048484baa1b1540b1367cb128acd7ab2946d1ed91ec10e3c85e4bf51b8f82604051610d0f9190612d4e565b60405180910390a15b6000833343604051602001610d2f93929190612db3565b60408051601f198184030181529181528151602092830120600090815260ca9092529020805460ff1916600190811790915560975550505050505050505050565b610d78610e73565b6001600160a01b0316610d896108cb565b6001600160a01b031614610dd2576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b6001600160a01b038116610e175760405162461bcd60e51b81526004018080602001828103825260268152602001806132176026913960400191505060405180910390fd5b6033546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3603380546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b606084848484604051602401610e909493929190612e19565b60408051601f198184030181529190526020810180516001600160e01b031663cbd4ece960e01b1790529050949350505050565b60405163037f703f60e51b81526001600160a01b03851690636fee07e090610ef490869085908790600401612e8e565b600060405180830381600087803b158015610f0e57600080fd5b505af1158015610f22573d6000803e3d6000fd5b5050505050505050565b610f3461053c565b15610f79576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610faf610e73565b604080516001600160a01b039092168252519081900360200190a1565b6000610fd73061134a565b15905090565b600054600160a81b900460ff1680610ff85750610ff8610fcc565b8061100d5750600054600160a01b900460ff16155b6110485760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff1615801561107f576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b8015611093576000805460ff60a81b191690555b50565b600054600160a81b900460ff16806110b157506110b1610fcc565b806110c65750600054600160a01b900460ff16155b6111015760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff16158015611138576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b6000611142610e73565b603380546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3508015611093576000805460ff60a81b1916905550565b600054600160a81b900460ff16806111c157506111c1610fcc565b806111d65750600054600160a01b900460ff16155b6112115760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff16158015611248576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b6065805460ff191690558015611093576000805460ff60a81b1916905550565b600054600160a81b900460ff16806112835750611283610fcc565b806112985750600054600160a01b900460ff16155b6112d35760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff1615801561130a576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b60016097558015611093576000805460ff60a81b1916905550565b600061133082611350565b8015611341575061134183836114ad565b90505b92915050565b3b151590565b6000806113916040518060400160405280601881526020017f4f564d5f5374617465436f6d6d69746d656e74436861696e000000000000000081525061045e565b6020840151604051639418bddd60e01b81529192506001600160a01b03831691639418bddd916113c3916004016131af565b60206040518083038186803b1580156113db57600080fd5b505afa1580156113ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114139190612bcf565b1580156114a65750825160208401516040808601519051634d69ee5760e01b81526001600160a01b03851693634d69ee5793611456939192909190600401612ec0565b60206040518083038186803b15801561146e57600080fd5b505afa158015611482573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a69190612bcf565b9392505050565b600080836114ec6040518060400160405280601a81526020017927ab26afa61921b937b9b9a237b6b0b4b726b2b9b9b2b733b2b960311b81525061045e565b6040516020016114fd929190612d81565b604051602081830303815290604052805190602001206000604051602001611526929190612d57565b604051602081830303815290604052805190602001209050600080611575602160991b6040516020016115599190612d36565b60408051601f1981840301815291905260608701518751611607565b909250905060018215151461159c5760405162461bcd60e51b815260040161057590612fcc565b60006115a782611630565b90506115fc846040516020016115bd9190612d4e565b60405160208183030381529060405260016040516020016115de9190612ded565b604051602081830303815290604052886080015184604001516116c2565b979650505050505050565b600060606000611616866116e6565b9050611623818686611716565b9250925050935093915050565b611638612754565b6000611643836117e9565b9050604051806080016040528061166d8360008151811061166057fe5b60200260200101516117fc565b81526020016116828360018151811061166057fe5b81526020016116a48360028151811061169757fe5b6020026020010151611803565b81526020016116b98360038151811061169757fe5b90529392505050565b6000806116ce866116e6565b90506116dc818686866118fc565b9695505050505050565b606081805190602001206040516020016117009190612d4e565b6040516020818303038152906040529050919050565b60006060600061172585611922565b90506000806000611737848a896119f9565b8151929550909350915015808061174b5750815b61179c576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b6000816117b857604051806020016040528060008152506117d7565b6117d78660018703815181106117ca57fe5b6020026020010151611d9f565b919b919a509098505050505050505050565b60606113446117f783611dbb565b611de0565b6000611344825b600060218260000151111561185f576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b600080600061186d85611f56565b91945092509050600081600181111561188257fe5b146118d4576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6020808601518401805190918410156116dc5760208490036101000a90049695505050505050565b600080600061190c878686611716565b915091508180156115fc57506115fc868261227f565b6060600061192f836117e9565b90506000815167ffffffffffffffff8111801561194b57600080fd5b5060405190808252806020026020018201604052801561198557816020015b61197261277b565b81526020019060019003908161196a5790505b50905060005b82518110156119f15760006119b28483815181106119a557fe5b6020026020010151612295565b905060405180604001604052808281526020016119ce836117e9565b8152508383815181106119dd57fe5b60209081029190910101525060010161198b565b509392505050565b60006060818080611a0987612324565b905085600080611a1761277b565b60005b8c51811015611d77578c8181518110611a2f57fe5b6020026020010151915082840193506001870196508360001415611aa357815180516020909101208514611a9e576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b611b6a565b815151602011611b0a57815180516020909101208514611a9e576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b84611b188360000151612421565b14611b6a576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b60208201515160111415611bd9578551841415611b8657611d77565b6000868581518110611b9457fe5b602001015160f81c60f81b60f81c9050600083602001518260ff1681518110611bb957fe5b60200260200101519050611bcc8161244d565b9650600194505050611d6f565b60028260200151511415611d22576000611bf283612483565b9050600081600081518110611c0357fe5b016020015160f81c9050600181166002036000611c238460ff84166124a1565b90506000611c318b8a6124a1565b90506000611c3f83836124ce565b905060ff851660021480611c56575060ff85166003145b15611c8857808351148015611c6b5750808251145b15611c7557988901985b50600160ff1b9950611d77945050505050565b60ff85161580611c9b575060ff85166001145b15611ceb5782518114611cbb5750600160ff1b9950611d77945050505050565b611cdc8860200151600181518110611ccf57fe5b602002602001015161244d565b9a509750611d6f945050505050565b60405162461bcd60e51b81526004018080602001828103825260268152602001806132956026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b600101611a1a565b50600160ff1b841486611d8a87866124a1565b909e909d50909b509950505050505050505050565b602081015180516060916113449160001981019081106119a557fe5b611dc3612795565b506040805180820190915281518152602082810190820152919050565b6060600080611dee84611f56565b91935090915060019050816001811115611e0457fe5b14611e56576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b611e77612795565b815260200190600190039081611e6f5790505090506000835b8651811015611f4b5760208210611ed85760405162461bcd60e51b815260040180806020018281038252602a81526020018061323d602a913960400191505060405180910390fd5b600080611f046040518060400160405280858c60000151038152602001858c6020015101815250611f56565b509150915060405180604001604052808383018152602001848b6020015101815250858581518110611f3257fe5b6020908102919091010152600193909301920101611e90565b508152949350505050565b600080600080846000015111611fb3576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f8111611fd8576000600160009450945094505050612278565b60b7811161204d578551607f19820190811061203b576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b60019550935060009250612278915050565b60bf811161213157855160b61982019081106120b0576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a600185015104905080820188600001511161211c576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b60019091019550935060009250612278915050565b60f781116121a557855160bf198201908110612194576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b600195509350849250612278915050565b855160f6198201908110612200576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111612265576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b6001918201965094509250612278915050565b9193909250565b8051602091820120825192909101919091201490565b606060008060006122a585611f56565b9194509250905060008160018111156122ba57fe5b1461230c576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b61231b85602001518484612534565b95945050505050565b60606000825160020267ffffffffffffffff8111801561234357600080fd5b506040519080825280601f01601f19166020018201604052801561236e576020820181803683370190505b50905060005b835181101561241a57600484828151811061238b57fe5b602001015160f81c60f81b6001600160f81b031916901c8282600202815181106123b157fe5b60200101906001600160f81b031916908160001a90535060108482815181106123d657fe5b016020015160f81c816123e557fe5b0660f81b8282600202600101815181106123fb57fe5b60200101906001600160f81b031916908160001a905350600101612374565b5092915050565b600060208251101561243857506020810151610537565b81806020019051602081101561053257600080fd5b6000606060208360000151101561246e57612467836125e2565b905061247a565b61247783612295565b90505b6114a681612421565b606061134461249c83602001516000815181106119a557fe5b612324565b6060825182106124c05750604080516020810190915260008152611344565b6113418383848651036125ed565b6000805b8084511180156124e25750808351115b801561252757508281815181106124f557fe5b602001015160f81c60f81b6001600160f81b03191684828151811061251657fe5b01602001516001600160f81b031916145b15611341576001016124d2565b606060008267ffffffffffffffff8111801561254f57600080fd5b506040519080825280601f01601f19166020018201604052801561257a576020820181803683370190505b50905080516000141561258e5790506114a6565b8484016020820160005b602086048110156125b9578251825260209283019290910190600101612598565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b60606113448261273e565b60608182601f011015612638576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b828284011015612680576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b818301845110156126cc576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b6060821580156126eb5760405191506000825260208201604052612735565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561272457805183526020928301920161270c565b5050858452601f01601f1916604052505b50949350505050565b6060611344826020015160008460000151612534565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060608152602001606081525090565b604051806040016040528060008152602001600081525090565b600067ffffffffffffffff8311156127c357fe5b6127d6601f8401601f19166020016131c2565b90508281528383830111156127ea57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b038116811461053757600080fd5b600082601f830112612828578081fd5b611341838335602085016127af565b600060a08284031215612848578081fd5b60405160a0810167ffffffffffffffff828210818311171561286657fe5b816040528293508435835260208501356020840152604085013560408401526060850135606084015260808501359150808211156128a357600080fd5b506128b085828601612818565b6080830152505092915050565b6000604082840312156128ce578081fd5b6040516040810167ffffffffffffffff82821081831117156128ec57fe5b816040528293508435835260209150818501358181111561290c57600080fd5b8501601f8101871361291d57600080fd5b80358281111561292957fe5b83810292506129398484016131c2565b8181528481019083860185850187018b101561295457600080fd5b600095505b83861015612977578035835260019590950194918601918601612959565b5080868801525050505050505092915050565b803563ffffffff8116811461053757600080fd5b805164ffffffffff8116811461053757600080fd5b6000602082840312156129c4578081fd5b61134182612801565b600080600080600060a086880312156129e4578081fd5b6129ed86612801565b94506129fb60208701612801565b9350604086013567ffffffffffffffff80821115612a17578283fd5b612a2389838a01612818565b9450606088013593506080880135915080821115612a3f578283fd5b9087019060a0828a031215612a52578283fd5b612a5c60a06131c2565b82358152602083013582811115612a71578485fd5b612a7d8b828601612837565b602083015250604083013582811115612a94578485fd5b612aa08b8286016128bd565b604083015250606083013582811115612ab7578485fd5b612ac38b828601612818565b606083015250608083013582811115612ada578485fd5b612ae68b828601612818565b6080830152508093505050509295509295909350565b600080600080600060a08688031215612b13578081fd5b612b1c86612801565b9450612b2a60208701612801565b9350604086013567ffffffffffffffff811115612b45578182fd5b612b5188828901612818565b93505060608601359150612b676080870161298a565b90509295509295909350565b600080600060608486031215612b87578283fd5b612b9084612801565b9250602084013567ffffffffffffffff811115612bab578283fd5b612bb786828701612818565b925050612bc66040850161298a565b90509250925092565b600060208284031215612be0578081fd5b81518015158114611341578182fd5b600060208284031215612c00578081fd5b5035919050565b600060208284031215612c18578081fd5b813567ffffffffffffffff811115612c2e578182fd5b8201601f81018413612c3e578182fd5b612c4d848235602084016127af565b949350505050565b600060608284031215612c66578081fd5b6040516060810181811067ffffffffffffffff82111715612c8357fe5b60405282518152612c966020840161299e565b6020820152612ca76040840161299e565b60408201529392505050565b600060208284031215612cc4578081fd5b6113418261299e565b60008151808452612ce58160208601602086016131e6565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a06080850152612c4d60a0850182612ccd565b60609190911b6001600160601b031916815260140190565b90815260200190565b918252602082015260400190565b60008251612d778184602087016131e6565b9190910192915050565b60008351612d938184602088016131e6565b60609390931b6001600160601b0319169190920190815260140192915050565b60008451612dc58184602089016131e6565b60609490941b6001600160601b03191691909301908152601481019190915260340192915050565b60f89190911b6001600160f81b031916815260010190565b6001600160a01b0391909116815260200190565b6001600160a01b03858116825284166020820152608060408201819052600090612e4590830185612ccd565b905082606083015295945050505050565b6001600160a01b0385811682528416602082015263ffffffff831660408201526080606082018190526000906116dc90830184612ccd565b600060018060a01b03851682528360208301526060604083015261231b6060830184612ccd565b901515815260200190565b60008482526020606081840152612eda6060840186612cf9565b838103604085015260408101855182528286015160408484015281815180845260608501915085830194508693505b80841015612f295784518252938501936001939093019290850190612f09565b509998505050505050505050565b6000602082526113416020830184612ccd565b6020808252601f908201527f78446f6d61696e4d65737361676553656e646572206973206e6f742073657400604082015260600190565b6020808252602b908201527f50726f7669646564206d6573736167652068617320616c72656164792062656560408201526a37103932b1b2b4bb32b21760a91b606082015260800190565b6020808252604d908201527f4d6573736167652070617373696e67207072656465706c6f7920686173206e6f60408201527f74206265656e20696e697469616c697a6564206f7220696e76616c696420707260608201526c37b7b310383937bb34b232b21760991b608082015260a00190565b60208082526022908201527f50726f7669646564206d65737361676520686173206265656e20626c6f636b65604082015261321760f11b606082015260800190565b60208082526036908201527f4f6e6c79204f564d5f4c324d65737361676552656c617965722063616e2072656040820152753630bc90261916ba3796a6189036b2b9b9b0b3b2b99760511b606082015260800190565b60208082526027908201527f50726f7669646564206d65737361676520636f756c64206e6f742062652076656040820152663934b334b2b21760c91b606082015260800190565b6020808252602a908201527f4c3143726f7373446f6d61696e4d657373656e67657220616c72656164792069604082015269373a34b0b634bd32b21760b11b606082015260800190565b60208082526027908201527f50726f7669646564206d65737361676520686173206e6f74206265656e20656e60408201526638bab2bab2b21760c91b606082015260800190565b6000602082526113416020830184612cf9565b60405181810167ffffffffffffffff811182821017156131de57fe5b604052919050565b60005b838110156132015781810151838201526020016131e9565b83811115613210576000848401525b5050505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737350726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a656452656365697665642061206e6f6465207769746820616e20756e6b6e6f776e207072656669784f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a26469706673582212203a1cd12f46684c95bb11e17fac1702e7dc0fea4c9f70f060e2b6070b1731d33764736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061010b5760003560e01c8063715018a6116100a2578063b1b1b20911610071578063b1b1b209146101d7578063c4d66de8146101ea578063c6b94ab0146101fd578063d7fd19dd14610210578063f2fde38b146102235761010b565b8063715018a6146101ac57806381ada46c146101b45780638456cb59146101c75780638da5cb5b146101cf5761010b565b8063461a4478116100de578063461a4478146101765780635c975abb146101895780636e296e4514610191578063706ceab6146101995761010b565b80630ecf2eea1461011057806321d800ec14610125578063299ca4781461014e5780633dbb202b14610163575b600080fd5b61012361011e366004612bef565b610236565b005b610138610133366004612bef565b6102db565b6040516101459190612eb5565b60405180910390f35b6101566102f0565b6040516101459190612e05565b610123610171366004612b73565b6102ff565b610156610184366004612c07565b61045e565b61013861053c565b610156610545565b6101236101a7366004612afc565b61058e565b610123610711565b6101236101c2366004612bef565b6107bd565b61012361085f565b6101566108cb565b6101386101e5366004612bef565b6108da565b6101236101f83660046129b3565b6108ef565b61013861020b366004612bef565b610a1d565b61012361021e3660046129cd565b610a32565b6101236102313660046129b3565b610d70565b61023e610e73565b6001600160a01b031661024f6108cb565b6001600160a01b031614610298576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b600081815260c96020526040808220805460ff191660011790555182917ff52508d5339edf0d7e5060a416df98db067af561bdc60872d29c0439eaa13a0291a250565b60ca6020526000908152604090205460ff1681565b6000546001600160a01b031681565b600061033f6040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e00000081525061045e565b90506000816001600160a01b031663b8f770056040518163ffffffff1660e01b815260040160206040518083038186803b15801561037c57600080fd5b505afa158015610390573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103b49190612cb3565b905060006103cb8633878564ffffffffff16610e77565b9050600061040a6040518060400160405280601a81526020017927ab26afa61921b937b9b9a237b6b0b4b726b2b9b9b2b733b2b960311b81525061045e565b905061041e8482848863ffffffff16610ec4565b7f0ee9ffdb2334d78de97ffb066b23a352a4d35180cefb36589d663fbb1eb6f3268260405161044d9190612f37565b60405180910390a150505050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156104be5781810151838201526020016104a6565b50505050905090810190601f1680156104eb5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561050857600080fd5b505afa15801561051c573d6000803e3d6000fd5b505050506040513d602081101561053257600080fd5b505190505b919050565b60655460ff1690565b60cc546000906001600160a01b031661dead141561057e5760405162461bcd60e51b815260040161057590612f4a565b60405180910390fd5b5060cc546001600160a01b031690565b60006105ce6040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e00000081525061045e565b90506000816001600160a01b0316632a7f18be856040518263ffffffff1660e01b81526004016105fe9190612d4e565b60606040518083038186803b15801561061657600080fd5b505afa15801561062a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064e9190612c55565b9050600061068d6040518060400160405280601a81526020017927ab26afa61921b937b9b9a237b6b0b4b726b2b9b9b2b733b2b960311b81525061045e565b90506000308286896040516020016106a89493929190612e56565b604051602081830303815290604052805190602001209050826000015181146106e35760405162461bcd60e51b815260040161057590613168565b60006106f18a8a8a8a610e77565b90506107058584838963ffffffff16610ec4565b50505050505050505050565b610719610e73565b6001600160a01b031661072a6108cb565b6001600160a01b031614610773576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b6033546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3603380546001600160a01b0319169055565b6107c5610e73565b6001600160a01b03166107d66108cb565b6001600160a01b03161461081f576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b600081815260c96020526040808220805460ff191690555182917f52c8a2680a9f4cc0ad0bf88f32096eadbebf0646ea611d93a0ce6a29a024040591a250565b610867610e73565b6001600160a01b03166108786108cb565b6001600160a01b0316146108c1576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b6108c9610f2c565b565b6033546001600160a01b031690565b60cb6020526000908152604090205460ff1681565b600054600160a81b900460ff168061090a575061090a610fcc565b8061091f5750600054600160a01b900460ff16155b61095a5760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff16158015610991576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b6000546001600160a01b0316156109ba5760405162461bcd60e51b81526004016105759061311e565b600080546001600160a01b0384166001600160a01b03199182161790915560cc805490911661dead1790556109ed610fdd565b6109f5611096565b6109fd6111a6565b610a05611268565b8015610a19576000805460ff60a81b191690555b5050565b60c96020526000908152604090205460ff1681565b60026097541415610a8a576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260975560408051808201909152601481527327ab26afa61926b2b9b9b0b3b2a932b630bcb2b960611b6020820152600090610ac69061045e565b90506001600160a01b03811615610aff57336001600160a01b03821614610aff5760405162461bcd60e51b815260040161057590613081565b610b0761053c565b15610b4c576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6000610b5a87878787610e77565b9050610b668184611325565b1515600114610b875760405162461bcd60e51b8152600401610575906130d7565b8051602080830191909120600081815260cb90925260409091205460ff1615610bc25760405162461bcd60e51b815260040161057590612f81565b600081815260c9602052604090205460ff1615610bf15760405162461bcd60e51b81526004016105759061303f565b60cc80546001600160a01b0319166001600160a01b03898116919091179091556040516000918a1690610c25908990612d65565b6000604051808303816000865af19150503d8060008114610c62576040519150601f19603f3d011682016040523d82523d6000602084013e610c67565b606091505b505060cc80546001600160a01b03191661dead179055905080151560011415610ce057600082815260cb602052604090819020805460ff19166001179055517f4641df4a962071e12719d8c8c8e5ac7fc4d97b927346a3d7a335b1f7517e133c90610cd3908490612d4e565b60405180910390a1610d18565b7f99d0e048484baa1b1540b1367cb128acd7ab2946d1ed91ec10e3c85e4bf51b8f82604051610d0f9190612d4e565b60405180910390a15b6000833343604051602001610d2f93929190612db3565b60408051601f198184030181529181528151602092830120600090815260ca9092529020805460ff1916600190811790915560975550505050505050505050565b610d78610e73565b6001600160a01b0316610d896108cb565b6001600160a01b031614610dd2576040805162461bcd60e51b815260206004820181905260248201526000805160206132bb833981519152604482015290519081900360640190fd5b6001600160a01b038116610e175760405162461bcd60e51b81526004018080602001828103825260268152602001806132176026913960400191505060405180910390fd5b6033546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3603380546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b606084848484604051602401610e909493929190612e19565b60408051601f198184030181529190526020810180516001600160e01b031663cbd4ece960e01b1790529050949350505050565b60405163037f703f60e51b81526001600160a01b03851690636fee07e090610ef490869085908790600401612e8e565b600060405180830381600087803b158015610f0e57600080fd5b505af1158015610f22573d6000803e3d6000fd5b5050505050505050565b610f3461053c565b15610f79576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610faf610e73565b604080516001600160a01b039092168252519081900360200190a1565b6000610fd73061134a565b15905090565b600054600160a81b900460ff1680610ff85750610ff8610fcc565b8061100d5750600054600160a01b900460ff16155b6110485760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff1615801561107f576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b8015611093576000805460ff60a81b191690555b50565b600054600160a81b900460ff16806110b157506110b1610fcc565b806110c65750600054600160a01b900460ff16155b6111015760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff16158015611138576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b6000611142610e73565b603380546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3508015611093576000805460ff60a81b1916905550565b600054600160a81b900460ff16806111c157506111c1610fcc565b806111d65750600054600160a01b900460ff16155b6112115760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff16158015611248576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b6065805460ff191690558015611093576000805460ff60a81b1916905550565b600054600160a81b900460ff16806112835750611283610fcc565b806112985750600054600160a01b900460ff16155b6112d35760405162461bcd60e51b815260040180806020018281038252602e815260200180613267602e913960400191505060405180910390fd5b600054600160a81b900460ff1615801561130a576000805460ff60a01b1960ff60a81b19909116600160a81b1716600160a01b1790555b60016097558015611093576000805460ff60a81b1916905550565b600061133082611350565b8015611341575061134183836114ad565b90505b92915050565b3b151590565b6000806113916040518060400160405280601881526020017f4f564d5f5374617465436f6d6d69746d656e74436861696e000000000000000081525061045e565b6020840151604051639418bddd60e01b81529192506001600160a01b03831691639418bddd916113c3916004016131af565b60206040518083038186803b1580156113db57600080fd5b505afa1580156113ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114139190612bcf565b1580156114a65750825160208401516040808601519051634d69ee5760e01b81526001600160a01b03851693634d69ee5793611456939192909190600401612ec0565b60206040518083038186803b15801561146e57600080fd5b505afa158015611482573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a69190612bcf565b9392505050565b600080836114ec6040518060400160405280601a81526020017927ab26afa61921b937b9b9a237b6b0b4b726b2b9b9b2b733b2b960311b81525061045e565b6040516020016114fd929190612d81565b604051602081830303815290604052805190602001206000604051602001611526929190612d57565b604051602081830303815290604052805190602001209050600080611575602160991b6040516020016115599190612d36565b60408051601f1981840301815291905260608701518751611607565b909250905060018215151461159c5760405162461bcd60e51b815260040161057590612fcc565b60006115a782611630565b90506115fc846040516020016115bd9190612d4e565b60405160208183030381529060405260016040516020016115de9190612ded565b604051602081830303815290604052886080015184604001516116c2565b979650505050505050565b600060606000611616866116e6565b9050611623818686611716565b9250925050935093915050565b611638612754565b6000611643836117e9565b9050604051806080016040528061166d8360008151811061166057fe5b60200260200101516117fc565b81526020016116828360018151811061166057fe5b81526020016116a48360028151811061169757fe5b6020026020010151611803565b81526020016116b98360038151811061169757fe5b90529392505050565b6000806116ce866116e6565b90506116dc818686866118fc565b9695505050505050565b606081805190602001206040516020016117009190612d4e565b6040516020818303038152906040529050919050565b60006060600061172585611922565b90506000806000611737848a896119f9565b8151929550909350915015808061174b5750815b61179c576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b6000816117b857604051806020016040528060008152506117d7565b6117d78660018703815181106117ca57fe5b6020026020010151611d9f565b919b919a509098505050505050505050565b60606113446117f783611dbb565b611de0565b6000611344825b600060218260000151111561185f576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b600080600061186d85611f56565b91945092509050600081600181111561188257fe5b146118d4576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6020808601518401805190918410156116dc5760208490036101000a90049695505050505050565b600080600061190c878686611716565b915091508180156115fc57506115fc868261227f565b6060600061192f836117e9565b90506000815167ffffffffffffffff8111801561194b57600080fd5b5060405190808252806020026020018201604052801561198557816020015b61197261277b565b81526020019060019003908161196a5790505b50905060005b82518110156119f15760006119b28483815181106119a557fe5b6020026020010151612295565b905060405180604001604052808281526020016119ce836117e9565b8152508383815181106119dd57fe5b60209081029190910101525060010161198b565b509392505050565b60006060818080611a0987612324565b905085600080611a1761277b565b60005b8c51811015611d77578c8181518110611a2f57fe5b6020026020010151915082840193506001870196508360001415611aa357815180516020909101208514611a9e576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b611b6a565b815151602011611b0a57815180516020909101208514611a9e576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b84611b188360000151612421565b14611b6a576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b60208201515160111415611bd9578551841415611b8657611d77565b6000868581518110611b9457fe5b602001015160f81c60f81b60f81c9050600083602001518260ff1681518110611bb957fe5b60200260200101519050611bcc8161244d565b9650600194505050611d6f565b60028260200151511415611d22576000611bf283612483565b9050600081600081518110611c0357fe5b016020015160f81c9050600181166002036000611c238460ff84166124a1565b90506000611c318b8a6124a1565b90506000611c3f83836124ce565b905060ff851660021480611c56575060ff85166003145b15611c8857808351148015611c6b5750808251145b15611c7557988901985b50600160ff1b9950611d77945050505050565b60ff85161580611c9b575060ff85166001145b15611ceb5782518114611cbb5750600160ff1b9950611d77945050505050565b611cdc8860200151600181518110611ccf57fe5b602002602001015161244d565b9a509750611d6f945050505050565b60405162461bcd60e51b81526004018080602001828103825260268152602001806132956026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b600101611a1a565b50600160ff1b841486611d8a87866124a1565b909e909d50909b509950505050505050505050565b602081015180516060916113449160001981019081106119a557fe5b611dc3612795565b506040805180820190915281518152602082810190820152919050565b6060600080611dee84611f56565b91935090915060019050816001811115611e0457fe5b14611e56576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b611e77612795565b815260200190600190039081611e6f5790505090506000835b8651811015611f4b5760208210611ed85760405162461bcd60e51b815260040180806020018281038252602a81526020018061323d602a913960400191505060405180910390fd5b600080611f046040518060400160405280858c60000151038152602001858c6020015101815250611f56565b509150915060405180604001604052808383018152602001848b6020015101815250858581518110611f3257fe5b6020908102919091010152600193909301920101611e90565b508152949350505050565b600080600080846000015111611fb3576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f8111611fd8576000600160009450945094505050612278565b60b7811161204d578551607f19820190811061203b576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b60019550935060009250612278915050565b60bf811161213157855160b61982019081106120b0576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a600185015104905080820188600001511161211c576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b60019091019550935060009250612278915050565b60f781116121a557855160bf198201908110612194576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b600195509350849250612278915050565b855160f6198201908110612200576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111612265576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b6001918201965094509250612278915050565b9193909250565b8051602091820120825192909101919091201490565b606060008060006122a585611f56565b9194509250905060008160018111156122ba57fe5b1461230c576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b61231b85602001518484612534565b95945050505050565b60606000825160020267ffffffffffffffff8111801561234357600080fd5b506040519080825280601f01601f19166020018201604052801561236e576020820181803683370190505b50905060005b835181101561241a57600484828151811061238b57fe5b602001015160f81c60f81b6001600160f81b031916901c8282600202815181106123b157fe5b60200101906001600160f81b031916908160001a90535060108482815181106123d657fe5b016020015160f81c816123e557fe5b0660f81b8282600202600101815181106123fb57fe5b60200101906001600160f81b031916908160001a905350600101612374565b5092915050565b600060208251101561243857506020810151610537565b81806020019051602081101561053257600080fd5b6000606060208360000151101561246e57612467836125e2565b905061247a565b61247783612295565b90505b6114a681612421565b606061134461249c83602001516000815181106119a557fe5b612324565b6060825182106124c05750604080516020810190915260008152611344565b6113418383848651036125ed565b6000805b8084511180156124e25750808351115b801561252757508281815181106124f557fe5b602001015160f81c60f81b6001600160f81b03191684828151811061251657fe5b01602001516001600160f81b031916145b15611341576001016124d2565b606060008267ffffffffffffffff8111801561254f57600080fd5b506040519080825280601f01601f19166020018201604052801561257a576020820181803683370190505b50905080516000141561258e5790506114a6565b8484016020820160005b602086048110156125b9578251825260209283019290910190600101612598565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b60606113448261273e565b60608182601f011015612638576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b828284011015612680576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b818301845110156126cc576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b6060821580156126eb5760405191506000825260208201604052612735565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561272457805183526020928301920161270c565b5050858452601f01601f1916604052505b50949350505050565b6060611344826020015160008460000151612534565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060608152602001606081525090565b604051806040016040528060008152602001600081525090565b600067ffffffffffffffff8311156127c357fe5b6127d6601f8401601f19166020016131c2565b90508281528383830111156127ea57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b038116811461053757600080fd5b600082601f830112612828578081fd5b611341838335602085016127af565b600060a08284031215612848578081fd5b60405160a0810167ffffffffffffffff828210818311171561286657fe5b816040528293508435835260208501356020840152604085013560408401526060850135606084015260808501359150808211156128a357600080fd5b506128b085828601612818565b6080830152505092915050565b6000604082840312156128ce578081fd5b6040516040810167ffffffffffffffff82821081831117156128ec57fe5b816040528293508435835260209150818501358181111561290c57600080fd5b8501601f8101871361291d57600080fd5b80358281111561292957fe5b83810292506129398484016131c2565b8181528481019083860185850187018b101561295457600080fd5b600095505b83861015612977578035835260019590950194918601918601612959565b5080868801525050505050505092915050565b803563ffffffff8116811461053757600080fd5b805164ffffffffff8116811461053757600080fd5b6000602082840312156129c4578081fd5b61134182612801565b600080600080600060a086880312156129e4578081fd5b6129ed86612801565b94506129fb60208701612801565b9350604086013567ffffffffffffffff80821115612a17578283fd5b612a2389838a01612818565b9450606088013593506080880135915080821115612a3f578283fd5b9087019060a0828a031215612a52578283fd5b612a5c60a06131c2565b82358152602083013582811115612a71578485fd5b612a7d8b828601612837565b602083015250604083013582811115612a94578485fd5b612aa08b8286016128bd565b604083015250606083013582811115612ab7578485fd5b612ac38b828601612818565b606083015250608083013582811115612ada578485fd5b612ae68b828601612818565b6080830152508093505050509295509295909350565b600080600080600060a08688031215612b13578081fd5b612b1c86612801565b9450612b2a60208701612801565b9350604086013567ffffffffffffffff811115612b45578182fd5b612b5188828901612818565b93505060608601359150612b676080870161298a565b90509295509295909350565b600080600060608486031215612b87578283fd5b612b9084612801565b9250602084013567ffffffffffffffff811115612bab578283fd5b612bb786828701612818565b925050612bc66040850161298a565b90509250925092565b600060208284031215612be0578081fd5b81518015158114611341578182fd5b600060208284031215612c00578081fd5b5035919050565b600060208284031215612c18578081fd5b813567ffffffffffffffff811115612c2e578182fd5b8201601f81018413612c3e578182fd5b612c4d848235602084016127af565b949350505050565b600060608284031215612c66578081fd5b6040516060810181811067ffffffffffffffff82111715612c8357fe5b60405282518152612c966020840161299e565b6020820152612ca76040840161299e565b60408201529392505050565b600060208284031215612cc4578081fd5b6113418261299e565b60008151808452612ce58160208601602086016131e6565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a06080850152612c4d60a0850182612ccd565b60609190911b6001600160601b031916815260140190565b90815260200190565b918252602082015260400190565b60008251612d778184602087016131e6565b9190910192915050565b60008351612d938184602088016131e6565b60609390931b6001600160601b0319169190920190815260140192915050565b60008451612dc58184602089016131e6565b60609490941b6001600160601b03191691909301908152601481019190915260340192915050565b60f89190911b6001600160f81b031916815260010190565b6001600160a01b0391909116815260200190565b6001600160a01b03858116825284166020820152608060408201819052600090612e4590830185612ccd565b905082606083015295945050505050565b6001600160a01b0385811682528416602082015263ffffffff831660408201526080606082018190526000906116dc90830184612ccd565b600060018060a01b03851682528360208301526060604083015261231b6060830184612ccd565b901515815260200190565b60008482526020606081840152612eda6060840186612cf9565b838103604085015260408101855182528286015160408484015281815180845260608501915085830194508693505b80841015612f295784518252938501936001939093019290850190612f09565b509998505050505050505050565b6000602082526113416020830184612ccd565b6020808252601f908201527f78446f6d61696e4d65737361676553656e646572206973206e6f742073657400604082015260600190565b6020808252602b908201527f50726f7669646564206d6573736167652068617320616c72656164792062656560408201526a37103932b1b2b4bb32b21760a91b606082015260800190565b6020808252604d908201527f4d6573736167652070617373696e67207072656465706c6f7920686173206e6f60408201527f74206265656e20696e697469616c697a6564206f7220696e76616c696420707260608201526c37b7b310383937bb34b232b21760991b608082015260a00190565b60208082526022908201527f50726f7669646564206d65737361676520686173206265656e20626c6f636b65604082015261321760f11b606082015260800190565b60208082526036908201527f4f6e6c79204f564d5f4c324d65737361676552656c617965722063616e2072656040820152753630bc90261916ba3796a6189036b2b9b9b0b3b2b99760511b606082015260800190565b60208082526027908201527f50726f7669646564206d65737361676520636f756c64206e6f742062652076656040820152663934b334b2b21760c91b606082015260800190565b6020808252602a908201527f4c3143726f7373446f6d61696e4d657373656e67657220616c72656164792069604082015269373a34b0b634bd32b21760b11b606082015260800190565b60208082526027908201527f50726f7669646564206d65737361676520686173206e6f74206265656e20656e60408201526638bab2bab2b21760c91b606082015260800190565b6000602082526113416020830184612cf9565b60405181810167ffffffffffffffff811182821017156131de57fe5b604052919050565b60005b838110156132015781810151838201526020016131e9565b83811115613210576000848401525b5050505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737350726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a656452656365697665642061206e6f6465207769746820616e20756e6b6e6f776e207072656669784f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a26469706673582212203a1cd12f46684c95bb11e17fac1702e7dc0fea4c9f70f060e2b6070b1731d33764736f6c63430007060033", "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", @@ -560,7 +528,7 @@ "params": { "_gasLimit": "Gas limit for the provided message.", "_message": "Message to send to the target.", - "_messageNonce": "Nonce for the provided message.", + "_queueIndex": "CTC Queue index for the message to replay.", "_sender": "Original sender address.", "_target": "Target contract address." } @@ -620,59 +588,19 @@ "storageLayout": { "storage": [ { - "astId": 1272, - "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", - "label": "relayedMessages", - "offset": 0, - "slot": "0", - "type": "t_mapping(t_bytes32,t_bool)" - }, - { - "astId": 1276, - "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", - "label": "successfulMessages", - "offset": 0, - "slot": "1", - "type": "t_mapping(t_bytes32,t_bool)" - }, - { - "astId": 1280, - "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", - "label": "sentMessages", - "offset": 0, - "slot": "2", - "type": "t_mapping(t_bytes32,t_bool)" - }, - { - "astId": 1282, - "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", - "label": "messageNonce", - "offset": 0, - "slot": "3", - "type": "t_uint256" - }, - { - "astId": 1285, - "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", - "label": "xDomainMsgSender", - "offset": 0, - "slot": "4", - "type": "t_address" - }, - { - "astId": 12856, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", "label": "libAddressManager", "offset": 0, - "slot": "5", - "type": "t_contract(Lib_AddressManager)12849" + "slot": "0", + "type": "t_contract(Lib_AddressManager)15296" }, { "astId": 137, "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", "label": "_initialized", "offset": 20, - "slot": "5", + "slot": "0", "type": "t_bool" }, { @@ -680,7 +608,7 @@ "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", "label": "_initializing", "offset": 21, - "slot": "5", + "slot": "0", "type": "t_bool" }, { @@ -688,7 +616,7 @@ "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", "label": "__gap", "offset": 0, - "slot": "6", + "slot": "1", "type": "t_array(t_uint256)50_storage" }, { @@ -696,7 +624,7 @@ "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", "label": "_owner", "offset": 0, - "slot": "56", + "slot": "51", "type": "t_address" }, { @@ -704,7 +632,7 @@ "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", "label": "__gap", "offset": 0, - "slot": "57", + "slot": "52", "type": "t_array(t_uint256)49_storage" }, { @@ -712,7 +640,7 @@ "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", "label": "_paused", "offset": 0, - "slot": "106", + "slot": "101", "type": "t_bool" }, { @@ -720,7 +648,7 @@ "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", "label": "__gap", "offset": 0, - "slot": "107", + "slot": "102", "type": "t_array(t_uint256)49_storage" }, { @@ -728,7 +656,7 @@ "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", "label": "_status", "offset": 0, - "slot": "156", + "slot": "151", "type": "t_uint256" }, { @@ -736,16 +664,40 @@ "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", "label": "__gap", "offset": 0, - "slot": "157", + "slot": "152", "type": "t_array(t_uint256)49_storage" }, { - "astId": 1436, + "astId": 2756, "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", "label": "blockedMessages", "offset": 0, - "slot": "206", + "slot": "201", "type": "t_mapping(t_bytes32,t_bool)" + }, + { + "astId": 2760, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "relayedMessages", + "offset": 0, + "slot": "202", + "type": "t_mapping(t_bytes32,t_bool)" + }, + { + "astId": 2764, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "successfulMessages", + "offset": 0, + "slot": "203", + "type": "t_mapping(t_bytes32,t_bool)" + }, + { + "astId": 2767, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "xDomainMsgSender", + "offset": 0, + "slot": "204", + "type": "t_address" } ], "types": { @@ -776,7 +728,7 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(Lib_AddressManager)12849": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" diff --git a/packages/contracts/deployments/mainnet/OVM_L1ETHGateway.json b/packages/contracts/deployments/mainnet/OVM_L1ETHGateway.json deleted file mode 100644 index a8f084ce78de..000000000000 --- a/packages/contracts/deployments/mainnet/OVM_L1ETHGateway.json +++ /dev/null @@ -1,322 +0,0 @@ -{ - "address": "0x40c9067ec8087EcF101FC10d2673636955b81A32", - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_from", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "_to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "DepositInitiated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "WithdrawalFinalized", - "type": "event" - }, - { - "inputs": [], - "name": "deposit", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_to", - "type": "address" - } - ], - "name": "depositTo", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "donateETH", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "finalizeWithdrawal", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "getFinalizeDepositL2Gas", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_libAddressManager", - "type": "address" - }, - { - "internalType": "address", - "name": "_ovmEth", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "libAddressManager", - "outputs": [ - { - "internalType": "contract Lib_AddressManager", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "messenger", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address payable", - "name": "_to", - "type": "address" - } - ], - "name": "migrateEth", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "ovmEth", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "_name", - "type": "string" - } - ], - "name": "resolve", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } - ], - "transactionHash": "0xac7e6ccfa141ea21c7b61df91f8fa959c3511a03620f9454eb30127db36d4728", - "receipt": { - "to": null, - "from": "0xd033f09cB85621F98F7A84C64dB381ac16Eff818", - "contractAddress": "0x40c9067ec8087EcF101FC10d2673636955b81A32", - "transactionIndex": 226, - "gasUsed": "698930", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x90752aa20b2cd9833bae07978ff62448296af979223745e985082ec1815dc60d", - "transactionHash": "0xac7e6ccfa141ea21c7b61df91f8fa959c3511a03620f9454eb30127db36d4728", - "logs": [], - "blockNumber": 12410915, - "cumulativeGasUsed": "12706291", - "status": 1, - "byzantium": true - }, - "args": [], - "solcInputHash": "f2bdab652d5102f5f11e78dae866798d", - "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"DepositInitiated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"WithdrawalFinalized\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"}],\"name\":\"depositTo\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"donateETH\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"finalizeWithdrawal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getFinalizeDepositL2Gas\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_ovmEth\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"messenger\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"_to\",\"type\":\"address\"}],\"name\":\"migrateEth\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ovmEth\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"The L1 ETH Gateway is a contract which stores deposited ETH that is in use on L2. Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{\"deposit()\":{\"details\":\"deposit an amount of the ETH to the caller's balance on L2\"},\"depositTo(address)\":{\"details\":\"deposit an amount of ETH to a recipients's balance on L2\",\"params\":{\"_to\":\"L2 address to credit the withdrawal to\"}},\"donateETH()\":{\"details\":\"Adds ETH balance to the account. This is meant to allow for ETH to be migrated from an old gateway to a new gateway\"},\"finalizeWithdrawal(address,uint256)\":{\"details\":\"Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the L1 ETH token. Since only the xDomainMessenger can call this function, it will never be called before the withdrawal is finalized.\",\"params\":{\"_amount\":\"Amount of the ETH to withdraw\",\"_to\":\"L1 address to credit the withdrawal to\"}},\"initialize(address,address)\":{\"params\":{\"_libAddressManager\":\"Address manager for this OE deployment\",\"_ovmEth\":\"L2 OVM_ETH implementation of iOVM_DepositedToken\"}},\"migrateEth(address)\":{\"details\":\"Migrates entire ETH balance to another gateway\",\"params\":{\"_to\":\"Gateway Proxy address to migrate ETH to\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}}},\"title\":\"OVM_L1ETHGateway\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ETHGateway.sol\":\"OVM_L1ETHGateway\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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_L2DepositedToken } from \\\"../../../iOVM/bridge/tokens/iOVM_L2DepositedToken.sol\\\";\\n\\n/* Library Imports */\\nimport { OVM_CrossDomainEnabled } from \\\"../../../libraries/bridge/OVM_CrossDomainEnabled.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../../libraries/resolver/Lib_AddressResolver.sol\\\";\\nimport { Lib_AddressManager } from \\\"../../../libraries/resolver/Lib_AddressManager.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 /********************\\n * Public Constants *\\n ********************/\\n\\n uint32 public constant override getFinalizeDepositL2Gas = 1200000;\\n\\n /********************************\\n * External Contract References *\\n ********************************/\\n\\n address public ovmEth;\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n // This contract lives behind a proxy, so the constructor parameters will go unused.\\n constructor()\\n OVM_CrossDomainEnabled(address(0))\\n Lib_AddressResolver(address(0))\\n public\\n {}\\n\\n /******************\\n * Initialization *\\n ******************/\\n\\n /**\\n * @param _libAddressManager Address manager for this OE deployment\\n * @param _ovmEth L2 OVM_ETH implementation of iOVM_DepositedToken\\n */\\n function initialize(\\n address _libAddressManager,\\n address _ovmEth\\n )\\n public\\n {\\n require(libAddressManager == Lib_AddressManager(0), \\\"Contract has already been initialized.\\\");\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n ovmEth = _ovmEth;\\n messenger = resolve(\\\"Proxy__OVM_L1CrossDomainMessenger\\\");\\n }\\n\\n /**************\\n * Depositing *\\n **************/\\n\\n receive()\\n external\\n payable\\n {\\n _initiateDeposit(msg.sender, msg.sender);\\n }\\n\\n /**\\n * @dev deposit an amount of the ETH 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 ETH 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 ETH and informing the L2 ETH 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 l2ETHGateway.finalizeDeposit(_to, _amount)\\n bytes memory data =\\n abi.encodeWithSelector(\\n iOVM_L2DepositedToken.finalizeDeposit.selector,\\n _to,\\n msg.value\\n );\\n\\n // Send calldata into L2\\n sendCrossDomainMessage(\\n ovmEth,\\n data,\\n getFinalizeDepositL2Gas\\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 ETH token.\\n * Since only the xDomainMessenger can call this function, it will never be called before the withdrawal is finalized.\\n *\\n * @param _to L1 address to credit the withdrawal to\\n * @param _amount Amount of the ETH to withdraw\\n */\\n function finalizeWithdrawal(\\n address _to,\\n uint256 _amount\\n )\\n external\\n override\\n onlyFromCrossDomainAccount(ovmEth)\\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 * Temporary - Migrating ETH *\\n *****************************/\\n\\n /**\\n * @dev Migrates entire ETH balance to another gateway\\n * @param _to Gateway Proxy address to migrate ETH to\\n */\\n function migrateEth(address payable _to) external {\\n address owner = Lib_AddressManager(libAddressManager).owner();\\n require(msg.sender == owner, \\\"Only the owner can migrate ETH\\\");\\n uint256 balance = address(this).balance;\\n OVM_L1ETHGateway(_to).donateETH{value:balance}();\\n }\\n\\n /**\\n * @dev Adds ETH balance to the account. This is meant to allow for ETH\\n * to be migrated from an old gateway to a new gateway\\n */\\n function donateETH() external payable {}\\n}\\n\",\"keccak256\":\"0x87dd8c00176be3bde93cb69d7a1af0b2e7cac0a6db72eb69353a1ac1e0c969be\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/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\\n event SentMessage(bytes message);\\n event RelayedMessage(bytes32 msgHash);\\n event FailedRelayedMessage(bytes32 msgHash);\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n function xDomainMessageSender() external view returns (address);\\n\\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\":\"0x89981ed48e99d6939cc6cdef827d484fa3e2292d66c0ba5056c7050cb6282d7e\",\"license\":\"MIT\"},\"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 * 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 function getFinalizeDepositL2Gas()\\n external\\n view\\n returns(\\n uint32\\n );\\n}\\n\",\"keccak256\":\"0x7e6805c5cacfd159410c7cd57a3d586e0fc5810bc46600bbd840a252e243e5ba\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L2DepositedToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0;\\npragma experimental ABIEncoderV2;\\n\\n/**\\n * @title iOVM_L2DepositedToken\\n */\\ninterface iOVM_L2DepositedToken {\\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\",\"keccak256\":\"0x59c807dfb01dbc00409431820457c350681af30d2f972a065231483a8ec926c4\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/bridge/OVM_CrossDomainEnabled.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Interface Imports */\\nimport { iAbs_BaseCrossDomainMessenger } from \\\"../../iOVM/bridge/messaging/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\\n /*************\\n * Variables *\\n *************/\\n\\n // Messenger contract used to send and recieve messages from the other domain.\\n address public messenger;\\n\\n\\n /***************\\n * Constructor *\\n ***************/ \\n\\n /**\\n * @param _messenger Address of the CrossDomainMessenger on the current layer.\\n */\\n constructor(\\n address _messenger\\n ) {\\n messenger = _messenger;\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * 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\\n * 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 /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Gets the messenger, usually from storage. This function is exposed in case a child contract\\n * 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 * 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\\n * `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 )\\n internal\\n {\\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _data, _gasLimit);\\n }\\n}\\n\",\"keccak256\":\"0x054c802a5c1318566b7727ff5327a1ad4dc0f18038a4586b7ada467cc6b08761\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0xcc9fc5c64f1101a5c6c397594086b1608189a9edc5c9635e1ac38f70aeeeecbf\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50600080546001600160a01b0319908116909155600180549091169055610b978061003c6000396000f3fe6080604052600436106100a05760003560e01c8063485cc95511610064578063485cc95514610158578063490b5b78146101785780638b4c40b01461018d578063b760faf914610195578063d0e30db0146101a8578063f4f7b41a146101b0576100b1565b80631273a090146100b6578063175dc507146100e1578063299ca478146101015780633cb747bf14610123578063461a447814610138576100b1565b366100b1576100af33336101d0565b005b600080fd5b3480156100c257600080fd5b506100cb610284565b6040516100d89190610abc565b60405180910390f35b3480156100ed57600080fd5b506100af6100fc366004610845565b61028b565b34801561010d57600080fd5b50610116610399565b6040516100d891906109b5565b34801561012f57600080fd5b506101166103a8565b34801561014457600080fd5b506101166101533660046108e7565b6103b7565b34801561016457600080fd5b506100af610173366004610884565b610491565b34801561018457600080fd5b50610116610530565b6100af61053f565b6100af6101a3366004610845565b610541565b6100af61054e565b3480156101bc57600080fd5b506100af6101cb3660046108bc565b610558565b6000638d6e9a5b60e01b82346040516024016101ed9291906109c9565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915260025490915061023c906001600160a01b03168262124f806106b9565b826001600160a01b03167ff531653a5819e21265de50358610d55dbe6594c61605b209dfa4280d277938c183346040516102779291906109c9565b60405180910390a2505050565b62124f8081565b60015460408051638da5cb5b60e01b815290516000926001600160a01b031691638da5cb5b916004808301926020929190829003018186803b1580156102d057600080fd5b505afa1580156102e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103089190610868565b9050336001600160a01b0382161461033b5760405162461bcd60e51b8152600401610332906109e2565b60405180910390fd5b6000479050826001600160a01b0316638b4c40b0826040518263ffffffff1660e01b81526004016000604051808303818588803b15801561037b57600080fd5b505af115801561038f573d6000803e3d6000fd5b5050505050505050565b6001546001600160a01b031681565b6000546001600160a01b031681565b60015460405163bf40fac160e01b81526020600482018181528451602484015284516000946001600160a01b03169363bf40fac1938793928392604401918501908083838b5b838110156104155781810151838201526020016103fd565b50505050905090810190601f1680156104425780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561045f57600080fd5b505afa158015610473573d6000803e3d6000fd5b505050506040513d602081101561048957600080fd5b505192915050565b6001546001600160a01b0316156104ba5760405162461bcd60e51b815260040161033290610a6d565b600180546001600160a01b038085166001600160a01b03199283161790925560028054928416929091169190911790556040805160608101909152602180825261050c9190610b4160208301396103b7565b600080546001600160a01b0319166001600160a01b03929092169190911790555050565b6002546001600160a01b031681565b565b61054b33826101d0565b50565b61053f33336101d0565b6002546001600160a01b031661056c6107a4565b6001600160a01b0316336001600160a01b0316146105bb5760405162461bcd60e51b815260040180806020018281038252602e815260200180610ae3602e913960400191505060405180910390fd5b806001600160a01b03166105cd6107a4565b6001600160a01b0316636e296e456040518163ffffffff1660e01b815260040160206040518083038186803b15801561060557600080fd5b505afa158015610619573d6000803e3d6000fd5b505050506040513d602081101561062f57600080fd5b50516001600160a01b0316146106765760405162461bcd60e51b8152600401808060200182810382526030815260200180610b116030913960400191505060405180910390fd5b61068083836107b3565b826001600160a01b03167f9e5c4f9f4e46b8629d3dda85f43a69194f50254404a72dc62b9e932d9c94eda8836040516102779190610ab3565b6106c16107a4565b6001600160a01b0316633dbb202b8484846040518463ffffffff1660e01b815260040180846001600160a01b03168152602001806020018363ffffffff168152602001828103825284818151815260200191508051906020019080838360005b83811015610739578181015183820152602001610721565b50505050905090810190601f1680156107665780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b15801561078757600080fd5b505af115801561079b573d6000803e3d6000fd5b50505050505050565b6000546001600160a01b031690565b604080516000808252602082019092526001600160a01b0384169083906040516107dd919061097c565b60006040518083038185875af1925050503d806000811461081a576040519150601f19603f3d011682016040523d82523d6000602084013e61081f565b606091505b50509050806108405760405162461bcd60e51b815260040161033290610a19565b505050565b600060208284031215610856578081fd5b813561086181610acd565b9392505050565b600060208284031215610879578081fd5b815161086181610acd565b60008060408385031215610896578081fd5b82356108a181610acd565b915060208301356108b181610acd565b809150509250929050565b600080604083850312156108ce578182fd5b82356108d981610acd565b946020939093013593505050565b600060208083850312156108f9578182fd5b823567ffffffffffffffff80821115610910578384fd5b818501915085601f830112610923578384fd5b81358181111561092f57fe5b604051601f8201601f191681018501838111828210171561094c57fe5b6040528181528382018501881015610962578586fd5b818585018683013790810190930193909352509392505050565b60008251815b8181101561099c5760208186018101518583015201610982565b818111156109aa5782828501525b509190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6020808252601e908201527f4f6e6c7920746865206f776e65722063616e206d696772617465204554480000604082015260600190565b60208082526034908201527f5472616e7366657248656c7065723a3a736166655472616e736665724554483a60408201527308115512081d1c985b9cd9995c8819985a5b195960621b606082015260800190565b60208082526026908201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616040820152653634bd32b21760d11b606082015260800190565b90815260200190565b63ffffffff91909116815260200190565b6001600160a01b038116811461054b57600080fdfe4f564d5f58434841494e3a206d657373656e67657220636f6e747261637420756e61757468656e746963617465644f564d5f58434841494e3a2077726f6e672073656e646572206f662063726f73732d646f6d61696e206d65737361676550726f78795f5f4f564d5f4c3143726f7373446f6d61696e4d657373656e676572a26469706673582212206941c23a3d320250801ba2fad4fc6bf0aa38a77f09cc5358b9733f6cce18c7a264736f6c63430007060033", - "deployedBytecode": "0x6080604052600436106100a05760003560e01c8063485cc95511610064578063485cc95514610158578063490b5b78146101785780638b4c40b01461018d578063b760faf914610195578063d0e30db0146101a8578063f4f7b41a146101b0576100b1565b80631273a090146100b6578063175dc507146100e1578063299ca478146101015780633cb747bf14610123578063461a447814610138576100b1565b366100b1576100af33336101d0565b005b600080fd5b3480156100c257600080fd5b506100cb610284565b6040516100d89190610abc565b60405180910390f35b3480156100ed57600080fd5b506100af6100fc366004610845565b61028b565b34801561010d57600080fd5b50610116610399565b6040516100d891906109b5565b34801561012f57600080fd5b506101166103a8565b34801561014457600080fd5b506101166101533660046108e7565b6103b7565b34801561016457600080fd5b506100af610173366004610884565b610491565b34801561018457600080fd5b50610116610530565b6100af61053f565b6100af6101a3366004610845565b610541565b6100af61054e565b3480156101bc57600080fd5b506100af6101cb3660046108bc565b610558565b6000638d6e9a5b60e01b82346040516024016101ed9291906109c9565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915260025490915061023c906001600160a01b03168262124f806106b9565b826001600160a01b03167ff531653a5819e21265de50358610d55dbe6594c61605b209dfa4280d277938c183346040516102779291906109c9565b60405180910390a2505050565b62124f8081565b60015460408051638da5cb5b60e01b815290516000926001600160a01b031691638da5cb5b916004808301926020929190829003018186803b1580156102d057600080fd5b505afa1580156102e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103089190610868565b9050336001600160a01b0382161461033b5760405162461bcd60e51b8152600401610332906109e2565b60405180910390fd5b6000479050826001600160a01b0316638b4c40b0826040518263ffffffff1660e01b81526004016000604051808303818588803b15801561037b57600080fd5b505af115801561038f573d6000803e3d6000fd5b5050505050505050565b6001546001600160a01b031681565b6000546001600160a01b031681565b60015460405163bf40fac160e01b81526020600482018181528451602484015284516000946001600160a01b03169363bf40fac1938793928392604401918501908083838b5b838110156104155781810151838201526020016103fd565b50505050905090810190601f1680156104425780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561045f57600080fd5b505afa158015610473573d6000803e3d6000fd5b505050506040513d602081101561048957600080fd5b505192915050565b6001546001600160a01b0316156104ba5760405162461bcd60e51b815260040161033290610a6d565b600180546001600160a01b038085166001600160a01b03199283161790925560028054928416929091169190911790556040805160608101909152602180825261050c9190610b4160208301396103b7565b600080546001600160a01b0319166001600160a01b03929092169190911790555050565b6002546001600160a01b031681565b565b61054b33826101d0565b50565b61053f33336101d0565b6002546001600160a01b031661056c6107a4565b6001600160a01b0316336001600160a01b0316146105bb5760405162461bcd60e51b815260040180806020018281038252602e815260200180610ae3602e913960400191505060405180910390fd5b806001600160a01b03166105cd6107a4565b6001600160a01b0316636e296e456040518163ffffffff1660e01b815260040160206040518083038186803b15801561060557600080fd5b505afa158015610619573d6000803e3d6000fd5b505050506040513d602081101561062f57600080fd5b50516001600160a01b0316146106765760405162461bcd60e51b8152600401808060200182810382526030815260200180610b116030913960400191505060405180910390fd5b61068083836107b3565b826001600160a01b03167f9e5c4f9f4e46b8629d3dda85f43a69194f50254404a72dc62b9e932d9c94eda8836040516102779190610ab3565b6106c16107a4565b6001600160a01b0316633dbb202b8484846040518463ffffffff1660e01b815260040180846001600160a01b03168152602001806020018363ffffffff168152602001828103825284818151815260200191508051906020019080838360005b83811015610739578181015183820152602001610721565b50505050905090810190601f1680156107665780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b15801561078757600080fd5b505af115801561079b573d6000803e3d6000fd5b50505050505050565b6000546001600160a01b031690565b604080516000808252602082019092526001600160a01b0384169083906040516107dd919061097c565b60006040518083038185875af1925050503d806000811461081a576040519150601f19603f3d011682016040523d82523d6000602084013e61081f565b606091505b50509050806108405760405162461bcd60e51b815260040161033290610a19565b505050565b600060208284031215610856578081fd5b813561086181610acd565b9392505050565b600060208284031215610879578081fd5b815161086181610acd565b60008060408385031215610896578081fd5b82356108a181610acd565b915060208301356108b181610acd565b809150509250929050565b600080604083850312156108ce578182fd5b82356108d981610acd565b946020939093013593505050565b600060208083850312156108f9578182fd5b823567ffffffffffffffff80821115610910578384fd5b818501915085601f830112610923578384fd5b81358181111561092f57fe5b604051601f8201601f191681018501838111828210171561094c57fe5b6040528181528382018501881015610962578586fd5b818585018683013790810190930193909352509392505050565b60008251815b8181101561099c5760208186018101518583015201610982565b818111156109aa5782828501525b509190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6020808252601e908201527f4f6e6c7920746865206f776e65722063616e206d696772617465204554480000604082015260600190565b60208082526034908201527f5472616e7366657248656c7065723a3a736166655472616e736665724554483a60408201527308115512081d1c985b9cd9995c8819985a5b195960621b606082015260800190565b60208082526026908201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616040820152653634bd32b21760d11b606082015260800190565b90815260200190565b63ffffffff91909116815260200190565b6001600160a01b038116811461054b57600080fdfe4f564d5f58434841494e3a206d657373656e67657220636f6e747261637420756e61757468656e746963617465644f564d5f58434841494e3a2077726f6e672073656e646572206f662063726f73732d646f6d61696e206d65737361676550726f78795f5f4f564d5f4c3143726f7373446f6d61696e4d657373656e676572a26469706673582212206941c23a3d320250801ba2fad4fc6bf0aa38a77f09cc5358b9733f6cce18c7a264736f6c63430007060033", - "devdoc": { - "details": "The L1 ETH Gateway is a contract which stores deposited ETH that is in use on L2. Compiler used: solc Runtime target: EVM", - "kind": "dev", - "methods": { - "deposit()": { - "details": "deposit an amount of the ETH to the caller's balance on L2" - }, - "depositTo(address)": { - "details": "deposit an amount of ETH to a recipients's balance on L2", - "params": { - "_to": "L2 address to credit the withdrawal to" - } - }, - "donateETH()": { - "details": "Adds ETH balance to the account. This is meant to allow for ETH to be migrated from an old gateway to a new gateway" - }, - "finalizeWithdrawal(address,uint256)": { - "details": "Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the L1 ETH token. Since only the xDomainMessenger can call this function, it will never be called before the withdrawal is finalized.", - "params": { - "_amount": "Amount of the ETH to withdraw", - "_to": "L1 address to credit the withdrawal to" - } - }, - "initialize(address,address)": { - "params": { - "_libAddressManager": "Address manager for this OE deployment", - "_ovmEth": "L2 OVM_ETH implementation of iOVM_DepositedToken" - } - }, - "migrateEth(address)": { - "details": "Migrates entire ETH balance to another gateway", - "params": { - "_to": "Gateway Proxy address to migrate ETH to" - } - }, - "resolve(string)": { - "params": { - "_name": "Name to resolve an address for." - }, - "returns": { - "_0": "Address associated with the given name." - } - } - }, - "title": "OVM_L1ETHGateway", - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "resolve(string)": { - "notice": "Resolves the address associated with a given name." - } - }, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 12044, - "contract": "contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ETHGateway.sol:OVM_L1ETHGateway", - "label": "messenger", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 12856, - "contract": "contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ETHGateway.sol:OVM_L1ETHGateway", - "label": "libAddressManager", - "offset": 0, - "slot": "1", - "type": "t_contract(Lib_AddressManager)12849" - }, - { - "astId": 2661, - "contract": "contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ETHGateway.sol:OVM_L1ETHGateway", - "label": "ovmEth", - "offset": 0, - "slot": "2", - "type": "t_address" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_contract(Lib_AddressManager)12849": { - "encoding": "inplace", - "label": "contract Lib_AddressManager", - "numberOfBytes": "20" - } - } - } -} \ No newline at end of file diff --git a/packages/contracts/deployments/mainnet/OVM_L1MultiMessageRelayer.json b/packages/contracts/deployments/mainnet/OVM_L1MultiMessageRelayer.json index f50158678fe9..dab02690f91f 100644 --- a/packages/contracts/deployments/mainnet/OVM_L1MultiMessageRelayer.json +++ b/packages/contracts/deployments/mainnet/OVM_L1MultiMessageRelayer.json @@ -1,5 +1,5 @@ { - "address": "0xc34F5B7279A9276A9D02491c59630fa725B7c36B", + "address": "0xF26391FBB1f77481f80a7d646AC08ba3817eA891", "abi": [ { "inputs": [ @@ -151,29 +151,29 @@ "type": "function" } ], - "transactionHash": "0x0ebd01c007713958d1b343f492ebcfc6296adf54e7b18b8682f17e262f32f5e9", + "transactionHash": "0x6ca2fea1b2653ec00b10b5537dbb9436b3e31418df4ce9fa424d377e0f7d9fc2", "receipt": { "to": null, - "from": "0xd033f09cB85621F98F7A84C64dB381ac16Eff818", - "contractAddress": "0xc34F5B7279A9276A9D02491c59630fa725B7c36B", - "transactionIndex": 159, - "gasUsed": "606489", + "from": "0x9996571372066A1545D3435C6935e3F9593A7eF5", + "contractAddress": "0xF26391FBB1f77481f80a7d646AC08ba3817eA891", + "transactionIndex": 120, + "gasUsed": "606477", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x6345aebe9ce7e9b618d0ae52783e8560b5a2e6810ba413e256033ca69c29d026", - "transactionHash": "0x0ebd01c007713958d1b343f492ebcfc6296adf54e7b18b8682f17e262f32f5e9", + "blockHash": "0x7b910c0721badc0259a470b5494483b0bd40300c4abf959a34f18709c1c91e68", + "transactionHash": "0x6ca2fea1b2653ec00b10b5537dbb9436b3e31418df4ce9fa424d377e0f7d9fc2", "logs": [], - "blockNumber": 12410908, - "cumulativeGasUsed": "10534115", + "blockNumber": 12686779, + "cumulativeGasUsed": "9401992", "status": 1, "byzantium": true }, "args": [ - "0x668E5b997b9aE88a56cd40409119d4Db9e6d752E" + "0xdE1FCfB0851916CA5101820A69b13a4E276bd81F" ], - "solcInputHash": "f2bdab652d5102f5f11e78dae866798d", - "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\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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\"}},\"constructor\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}}},\"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\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1MultiMessageRelayer.sol\":\"OVM_L1MultiMessageRelayer\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1MultiMessageRelayer.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_L1CrossDomainMessenger } from \\\"../../../iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol\\\";\\nimport { iOVM_L1MultiMessageRelayer } from \\\"../../../iOVM/bridge/messaging/iOVM_L1MultiMessageRelayer.sol\\\";\\n\\n/* Library Imports */\\nimport { Lib_AddressResolver } from \\\"../../../libraries/resolver/Lib_AddressResolver.sol\\\";\\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\\n /**\\n * @param _libAddressManager Address of the Address Manager.\\n */\\n constructor(\\n address _libAddressManager\\n )\\n Lib_AddressResolver(_libAddressManager)\\n {}\\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 /********************\\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(\\n L2ToL1Message[] calldata _messages\\n ) \\n override\\n external\\n onlyBatchRelayer\\n {\\n iOVM_L1CrossDomainMessenger messenger = iOVM_L1CrossDomainMessenger(\\n resolve(\\\"Proxy__OVM_L1CrossDomainMessenger\\\")\\n );\\n\\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\":\"0xe698b8dbdcecd055ee77cc553963f966faebcdefbed1e586f7fd603fa816d9c6\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/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\\n event SentMessage(bytes message);\\n event RelayedMessage(bytes32 msgHash);\\n event FailedRelayedMessage(bytes32 msgHash);\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n function xDomainMessageSender() external view returns (address);\\n\\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\":\"0x89981ed48e99d6939cc6cdef827d484fa3e2292d66c0ba5056c7050cb6282d7e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/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/messaging/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/messaging/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\":\"0x8bc1fb2a33dcac59ec307195f8b8358d1ae2ab021c70a1589038b366d1b949d7\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0xcc9fc5c64f1101a5c6c397594086b1608189a9edc5c9635e1ac38f70aeeeecbf\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50604051610a22380380610a2283398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b610991806100916000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806316e9cd9b14610046578063299ca4781461005b578063461a447814610079575b600080fd5b61005961005436600461057d565b61008c565b005b6100636101ea565b60405161007091906106db565b60405180910390f35b6100636100873660046105ec565b6101f9565b6100ca6040518060400160405280601981526020017f4f564d5f4c3242617463684d65737361676552656c61796572000000000000008152506101f9565b6001600160a01b0316336001600160a01b0316146101035760405162461bcd60e51b81526004016100fa906107d7565b60405180910390fd5b600061012660405180606001604052806021815260200161093b602191396101f9565b905060005b828110156101e457600084848381811061014157fe5b9050602002810190610153919061085a565b61015c9061089d565b8051602082015160408084015160608501516080860151925163d7fd19dd60e01b81529596506001600160a01b0389169563d7fd19dd956101a5959094909392916004016106ef565b600060405180830381600087803b1580156101bf57600080fd5b505af11580156101d3573d6000803e3d6000fd5b50506001909301925061012b915050565b50505050565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610259578181015183820152602001610241565b50505050905090810190601f1680156102865780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102a357600080fd5b505afa1580156102b7573d6000803e3d6000fd5b505050506040513d60208110156102cd57600080fd5b505190505b919050565b600067ffffffffffffffff8311156102eb57fe5b6102fe601f8401601f1916602001610879565b905082815283838301111561031257600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102d257600080fd5b600082601f830112610350578081fd5b61035f838335602085016102d7565b9392505050565b600060a08284031215610377578081fd5b60405160a0810167ffffffffffffffff828210818311171561039557fe5b816040528293508435835260208501356020840152604085013560408401526060850135606084015260808501359150808211156103d257600080fd5b506103df85828601610340565b6080830152505092915050565b6000604082840312156103fd578081fd5b6040516040810167ffffffffffffffff828210818311171561041b57fe5b816040528293508435835260209150818501358181111561043b57600080fd5b8501601f8101871361044c57600080fd5b80358281111561045857fe5b8381029250610468848401610879565b8181528481019083860185850187018b101561048357600080fd5b600095505b838610156104a6578035835260019590950194918601918601610488565b5080868801525050505050505092915050565b600060a082840312156104ca578081fd5b6104d460a0610879565b905081358152602082013567ffffffffffffffff808211156104f557600080fd5b61050185838601610366565b6020840152604084013591508082111561051a57600080fd5b610526858386016103ec565b6040840152606084013591508082111561053f57600080fd5b61054b85838601610340565b6060840152608084013591508082111561056457600080fd5b5061057184828501610340565b60808301525092915050565b6000806020838503121561058f578182fd5b823567ffffffffffffffff808211156105a6578384fd5b818501915085601f8301126105b9578384fd5b8135818111156105c7578485fd5b86602080830285010111156105da578485fd5b60209290920196919550909350505050565b6000602082840312156105fd578081fd5b813567ffffffffffffffff811115610613578182fd5b8201601f81018413610623578182fd5b610632848235602084016102d7565b949350505050565b60008151808452815b8181101561065f57602081850181015186830182015201610643565b818111156106705782602083870101525b50601f01601f19169290920160200192915050565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b808310156106d057845182529383019360019290920191908301906106b0565b509695505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0386811682528516602082015260a06040820181905260009061071b9083018661063a565b846060840152828103608084015283518152602084015160a06020830152805160a0830152602081015160c0830152604081015160e083015260608101516101008301526080810151905060a061012083015261077c61014083018261063a565b9050604085015182820360408401526107958282610685565b915050606085015182820360608401526107af828261063a565b915050608085015182820360808401526107c9828261063a565b9a9950505050505050505050565b60208082526057908201527f4f564d5f4c314d756c74694d65737361676552656c617965723a2046756e637460408201527f696f6e2063616e206f6e6c792062652063616c6c656420627920746865204f5660608201527f4d5f4c3242617463684d65737361676552656c61796572000000000000000000608082015260a00190565b60008235609e1983360301811261086f578182fd5b9190910192915050565b60405181810167ffffffffffffffff8111828210171561089557fe5b604052919050565b600060a082360312156108ae578081fd5b60405160a0810167ffffffffffffffff82821081831117156108cc57fe5b816040526108d985610329565b83526108e760208601610329565b602084015260408501359150808211156108ff578384fd5b61090b36838701610340565b604084015260608501356060840152608085013591508082111561092d578384fd5b50610571368286016104b956fe50726f78795f5f4f564d5f4c3143726f7373446f6d61696e4d657373656e676572a264697066735822122009eddc3ff04b76f7c0ac832d08a76adc227055f7bc6ab523f103ae9ee1d5c4fe64736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c806316e9cd9b14610046578063299ca4781461005b578063461a447814610079575b600080fd5b61005961005436600461057d565b61008c565b005b6100636101ea565b60405161007091906106db565b60405180910390f35b6100636100873660046105ec565b6101f9565b6100ca6040518060400160405280601981526020017f4f564d5f4c3242617463684d65737361676552656c61796572000000000000008152506101f9565b6001600160a01b0316336001600160a01b0316146101035760405162461bcd60e51b81526004016100fa906107d7565b60405180910390fd5b600061012660405180606001604052806021815260200161093b602191396101f9565b905060005b828110156101e457600084848381811061014157fe5b9050602002810190610153919061085a565b61015c9061089d565b8051602082015160408084015160608501516080860151925163d7fd19dd60e01b81529596506001600160a01b0389169563d7fd19dd956101a5959094909392916004016106ef565b600060405180830381600087803b1580156101bf57600080fd5b505af11580156101d3573d6000803e3d6000fd5b50506001909301925061012b915050565b50505050565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610259578181015183820152602001610241565b50505050905090810190601f1680156102865780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102a357600080fd5b505afa1580156102b7573d6000803e3d6000fd5b505050506040513d60208110156102cd57600080fd5b505190505b919050565b600067ffffffffffffffff8311156102eb57fe5b6102fe601f8401601f1916602001610879565b905082815283838301111561031257600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102d257600080fd5b600082601f830112610350578081fd5b61035f838335602085016102d7565b9392505050565b600060a08284031215610377578081fd5b60405160a0810167ffffffffffffffff828210818311171561039557fe5b816040528293508435835260208501356020840152604085013560408401526060850135606084015260808501359150808211156103d257600080fd5b506103df85828601610340565b6080830152505092915050565b6000604082840312156103fd578081fd5b6040516040810167ffffffffffffffff828210818311171561041b57fe5b816040528293508435835260209150818501358181111561043b57600080fd5b8501601f8101871361044c57600080fd5b80358281111561045857fe5b8381029250610468848401610879565b8181528481019083860185850187018b101561048357600080fd5b600095505b838610156104a6578035835260019590950194918601918601610488565b5080868801525050505050505092915050565b600060a082840312156104ca578081fd5b6104d460a0610879565b905081358152602082013567ffffffffffffffff808211156104f557600080fd5b61050185838601610366565b6020840152604084013591508082111561051a57600080fd5b610526858386016103ec565b6040840152606084013591508082111561053f57600080fd5b61054b85838601610340565b6060840152608084013591508082111561056457600080fd5b5061057184828501610340565b60808301525092915050565b6000806020838503121561058f578182fd5b823567ffffffffffffffff808211156105a6578384fd5b818501915085601f8301126105b9578384fd5b8135818111156105c7578485fd5b86602080830285010111156105da578485fd5b60209290920196919550909350505050565b6000602082840312156105fd578081fd5b813567ffffffffffffffff811115610613578182fd5b8201601f81018413610623578182fd5b610632848235602084016102d7565b949350505050565b60008151808452815b8181101561065f57602081850181015186830182015201610643565b818111156106705782602083870101525b50601f01601f19169290920160200192915050565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b808310156106d057845182529383019360019290920191908301906106b0565b509695505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0386811682528516602082015260a06040820181905260009061071b9083018661063a565b846060840152828103608084015283518152602084015160a06020830152805160a0830152602081015160c0830152604081015160e083015260608101516101008301526080810151905060a061012083015261077c61014083018261063a565b9050604085015182820360408401526107958282610685565b915050606085015182820360608401526107af828261063a565b915050608085015182820360808401526107c9828261063a565b9a9950505050505050505050565b60208082526057908201527f4f564d5f4c314d756c74694d65737361676552656c617965723a2046756e637460408201527f696f6e2063616e206f6e6c792062652063616c6c656420627920746865204f5660608201527f4d5f4c3242617463684d65737361676552656c61796572000000000000000000608082015260a00190565b60008235609e1983360301811261086f578182fd5b9190910192915050565b60405181810167ffffffffffffffff8111828210171561089557fe5b604052919050565b600060a082360312156108ae578081fd5b60405160a0810167ffffffffffffffff82821081831117156108cc57fe5b816040526108d985610329565b83526108e760208601610329565b602084015260408501359150808211156108ff578384fd5b61090b36838701610340565b604084015260608501356060840152608085013591508082111561092d578384fd5b50610571368286016104b956fe50726f78795f5f4f564d5f4c3143726f7373446f6d61696e4d657373656e676572a264697066735822122009eddc3ff04b76f7c0ac832d08a76adc227055f7bc6ab523f103ae9ee1d5c4fe64736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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\"}},\"constructor\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}}},\"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\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1MultiMessageRelayer.sol\":\"OVM_L1MultiMessageRelayer\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1MultiMessageRelayer.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_L1CrossDomainMessenger } from \\\"../../../iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol\\\";\\nimport { iOVM_L1MultiMessageRelayer } from \\\"../../../iOVM/bridge/messaging/iOVM_L1MultiMessageRelayer.sol\\\";\\n\\n/* Library Imports */\\nimport { Lib_AddressResolver } from \\\"../../../libraries/resolver/Lib_AddressResolver.sol\\\";\\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\\n /**\\n * @param _libAddressManager Address of the Address Manager.\\n */\\n constructor(\\n address _libAddressManager\\n )\\n Lib_AddressResolver(_libAddressManager)\\n {}\\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 /********************\\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(\\n L2ToL1Message[] calldata _messages\\n ) \\n override\\n external\\n onlyBatchRelayer\\n {\\n iOVM_L1CrossDomainMessenger messenger = iOVM_L1CrossDomainMessenger(\\n resolve(\\\"Proxy__OVM_L1CrossDomainMessenger\\\")\\n );\\n\\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\":\"0xe698b8dbdcecd055ee77cc553963f966faebcdefbed1e586f7fd603fa816d9c6\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_CrossDomainMessenger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/**\\n * @title iOVM_CrossDomainMessenger\\n */\\ninterface iOVM_CrossDomainMessenger {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event SentMessage(bytes message);\\n event RelayedMessage(bytes32 msgHash);\\n event FailedRelayedMessage(bytes32 msgHash);\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n function xDomainMessageSender() external view returns (address);\\n\\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\":\"0x03dd576abe8e562cca646dd59b5c038291dffa9a5e43e4e3765d38cf1406fa62\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/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 { iOVM_CrossDomainMessenger } from \\\"./iOVM_CrossDomainMessenger.sol\\\";\\n\\n/**\\n * @title iOVM_L1CrossDomainMessenger\\n */\\ninterface iOVM_L1CrossDomainMessenger is iOVM_CrossDomainMessenger {\\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 _queueIndex CTC Queue index for the message to replay.\\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 _queueIndex,\\n uint32 _gasLimit\\n ) external;\\n}\\n\",\"keccak256\":\"0xd278237bb588a45208d8ed57c7766386cddd1dc1e4f31867c9cb356939dfd49a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/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/messaging/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\":\"0x8bc1fb2a33dcac59ec307195f8b8358d1ae2ab021c70a1589038b366d1b949d7\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50604051610a22380380610a2283398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b610991806100916000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806316e9cd9b14610046578063299ca4781461005b578063461a447814610079575b600080fd5b61005961005436600461057d565b61008c565b005b6100636101ea565b60405161007091906106db565b60405180910390f35b6100636100873660046105ec565b6101f9565b6100ca6040518060400160405280601981526020017f4f564d5f4c3242617463684d65737361676552656c61796572000000000000008152506101f9565b6001600160a01b0316336001600160a01b0316146101035760405162461bcd60e51b81526004016100fa906107d7565b60405180910390fd5b600061012660405180606001604052806021815260200161093b602191396101f9565b905060005b828110156101e457600084848381811061014157fe5b9050602002810190610153919061085a565b61015c9061089d565b8051602082015160408084015160608501516080860151925163d7fd19dd60e01b81529596506001600160a01b0389169563d7fd19dd956101a5959094909392916004016106ef565b600060405180830381600087803b1580156101bf57600080fd5b505af11580156101d3573d6000803e3d6000fd5b50506001909301925061012b915050565b50505050565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610259578181015183820152602001610241565b50505050905090810190601f1680156102865780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102a357600080fd5b505afa1580156102b7573d6000803e3d6000fd5b505050506040513d60208110156102cd57600080fd5b505190505b919050565b600067ffffffffffffffff8311156102eb57fe5b6102fe601f8401601f1916602001610879565b905082815283838301111561031257600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102d257600080fd5b600082601f830112610350578081fd5b61035f838335602085016102d7565b9392505050565b600060a08284031215610377578081fd5b60405160a0810167ffffffffffffffff828210818311171561039557fe5b816040528293508435835260208501356020840152604085013560408401526060850135606084015260808501359150808211156103d257600080fd5b506103df85828601610340565b6080830152505092915050565b6000604082840312156103fd578081fd5b6040516040810167ffffffffffffffff828210818311171561041b57fe5b816040528293508435835260209150818501358181111561043b57600080fd5b8501601f8101871361044c57600080fd5b80358281111561045857fe5b8381029250610468848401610879565b8181528481019083860185850187018b101561048357600080fd5b600095505b838610156104a6578035835260019590950194918601918601610488565b5080868801525050505050505092915050565b600060a082840312156104ca578081fd5b6104d460a0610879565b905081358152602082013567ffffffffffffffff808211156104f557600080fd5b61050185838601610366565b6020840152604084013591508082111561051a57600080fd5b610526858386016103ec565b6040840152606084013591508082111561053f57600080fd5b61054b85838601610340565b6060840152608084013591508082111561056457600080fd5b5061057184828501610340565b60808301525092915050565b6000806020838503121561058f578182fd5b823567ffffffffffffffff808211156105a6578384fd5b818501915085601f8301126105b9578384fd5b8135818111156105c7578485fd5b86602080830285010111156105da578485fd5b60209290920196919550909350505050565b6000602082840312156105fd578081fd5b813567ffffffffffffffff811115610613578182fd5b8201601f81018413610623578182fd5b610632848235602084016102d7565b949350505050565b60008151808452815b8181101561065f57602081850181015186830182015201610643565b818111156106705782602083870101525b50601f01601f19169290920160200192915050565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b808310156106d057845182529383019360019290920191908301906106b0565b509695505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0386811682528516602082015260a06040820181905260009061071b9083018661063a565b846060840152828103608084015283518152602084015160a06020830152805160a0830152602081015160c0830152604081015160e083015260608101516101008301526080810151905060a061012083015261077c61014083018261063a565b9050604085015182820360408401526107958282610685565b915050606085015182820360608401526107af828261063a565b915050608085015182820360808401526107c9828261063a565b9a9950505050505050505050565b60208082526057908201527f4f564d5f4c314d756c74694d65737361676552656c617965723a2046756e637460408201527f696f6e2063616e206f6e6c792062652063616c6c656420627920746865204f5660608201527f4d5f4c3242617463684d65737361676552656c61796572000000000000000000608082015260a00190565b60008235609e1983360301811261086f578182fd5b9190910192915050565b60405181810167ffffffffffffffff8111828210171561089557fe5b604052919050565b600060a082360312156108ae578081fd5b60405160a0810167ffffffffffffffff82821081831117156108cc57fe5b816040526108d985610329565b83526108e760208601610329565b602084015260408501359150808211156108ff578384fd5b61090b36838701610340565b604084015260608501356060840152608085013591508082111561092d578384fd5b50610571368286016104b956fe50726f78795f5f4f564d5f4c3143726f7373446f6d61696e4d657373656e676572a2646970667358221220ca6bebf589e0e196a7eecc58e0f8a7270f00ec6d1a5d6a61d75748f6e061f36f64736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c806316e9cd9b14610046578063299ca4781461005b578063461a447814610079575b600080fd5b61005961005436600461057d565b61008c565b005b6100636101ea565b60405161007091906106db565b60405180910390f35b6100636100873660046105ec565b6101f9565b6100ca6040518060400160405280601981526020017f4f564d5f4c3242617463684d65737361676552656c61796572000000000000008152506101f9565b6001600160a01b0316336001600160a01b0316146101035760405162461bcd60e51b81526004016100fa906107d7565b60405180910390fd5b600061012660405180606001604052806021815260200161093b602191396101f9565b905060005b828110156101e457600084848381811061014157fe5b9050602002810190610153919061085a565b61015c9061089d565b8051602082015160408084015160608501516080860151925163d7fd19dd60e01b81529596506001600160a01b0389169563d7fd19dd956101a5959094909392916004016106ef565b600060405180830381600087803b1580156101bf57600080fd5b505af11580156101d3573d6000803e3d6000fd5b50506001909301925061012b915050565b50505050565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610259578181015183820152602001610241565b50505050905090810190601f1680156102865780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102a357600080fd5b505afa1580156102b7573d6000803e3d6000fd5b505050506040513d60208110156102cd57600080fd5b505190505b919050565b600067ffffffffffffffff8311156102eb57fe5b6102fe601f8401601f1916602001610879565b905082815283838301111561031257600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102d257600080fd5b600082601f830112610350578081fd5b61035f838335602085016102d7565b9392505050565b600060a08284031215610377578081fd5b60405160a0810167ffffffffffffffff828210818311171561039557fe5b816040528293508435835260208501356020840152604085013560408401526060850135606084015260808501359150808211156103d257600080fd5b506103df85828601610340565b6080830152505092915050565b6000604082840312156103fd578081fd5b6040516040810167ffffffffffffffff828210818311171561041b57fe5b816040528293508435835260209150818501358181111561043b57600080fd5b8501601f8101871361044c57600080fd5b80358281111561045857fe5b8381029250610468848401610879565b8181528481019083860185850187018b101561048357600080fd5b600095505b838610156104a6578035835260019590950194918601918601610488565b5080868801525050505050505092915050565b600060a082840312156104ca578081fd5b6104d460a0610879565b905081358152602082013567ffffffffffffffff808211156104f557600080fd5b61050185838601610366565b6020840152604084013591508082111561051a57600080fd5b610526858386016103ec565b6040840152606084013591508082111561053f57600080fd5b61054b85838601610340565b6060840152608084013591508082111561056457600080fd5b5061057184828501610340565b60808301525092915050565b6000806020838503121561058f578182fd5b823567ffffffffffffffff808211156105a6578384fd5b818501915085601f8301126105b9578384fd5b8135818111156105c7578485fd5b86602080830285010111156105da578485fd5b60209290920196919550909350505050565b6000602082840312156105fd578081fd5b813567ffffffffffffffff811115610613578182fd5b8201601f81018413610623578182fd5b610632848235602084016102d7565b949350505050565b60008151808452815b8181101561065f57602081850181015186830182015201610643565b818111156106705782602083870101525b50601f01601f19169290920160200192915050565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b808310156106d057845182529383019360019290920191908301906106b0565b509695505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0386811682528516602082015260a06040820181905260009061071b9083018661063a565b846060840152828103608084015283518152602084015160a06020830152805160a0830152602081015160c0830152604081015160e083015260608101516101008301526080810151905060a061012083015261077c61014083018261063a565b9050604085015182820360408401526107958282610685565b915050606085015182820360608401526107af828261063a565b915050608085015182820360808401526107c9828261063a565b9a9950505050505050505050565b60208082526057908201527f4f564d5f4c314d756c74694d65737361676552656c617965723a2046756e637460408201527f696f6e2063616e206f6e6c792062652063616c6c656420627920746865204f5660608201527f4d5f4c3242617463684d65737361676552656c61796572000000000000000000608082015260a00190565b60008235609e1983360301811261086f578182fd5b9190910192915050565b60405181810167ffffffffffffffff8111828210171561089557fe5b604052919050565b600060a082360312156108ae578081fd5b60405160a0810167ffffffffffffffff82821081831117156108cc57fe5b816040526108d985610329565b83526108e760208601610329565b602084015260408501359150808211156108ff578384fd5b61090b36838701610340565b604084015260608501356060840152608085013591508082111561092d578384fd5b50610571368286016104b956fe50726f78795f5f4f564d5f4c3143726f7373446f6d61696e4d657373656e676572a2646970667358221220ca6bebf589e0e196a7eecc58e0f8a7270f00ec6d1a5d6a61d75748f6e061f36f64736f6c63430007060033", "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", @@ -215,16 +215,16 @@ "storageLayout": { "storage": [ { - "astId": 12856, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1MultiMessageRelayer.sol:OVM_L1MultiMessageRelayer", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12849" + "type": "t_contract(Lib_AddressManager)15296" } ], "types": { - "t_contract(Lib_AddressManager)12849": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" diff --git a/packages/contracts/deployments/mainnet/OVM_SafetyChecker.json b/packages/contracts/deployments/mainnet/OVM_SafetyChecker.json index da2aa8a78b6b..04a3871c8db1 100644 --- a/packages/contracts/deployments/mainnet/OVM_SafetyChecker.json +++ b/packages/contracts/deployments/mainnet/OVM_SafetyChecker.json @@ -1,5 +1,5 @@ { - "address": "0xD87eFbBb82f1B7d25469641ee2E0E513f144394C", + "address": "0xfe1F9Cf28ecDb12110aa8086e6FD343EA06035cC", "abi": [ { "inputs": [ @@ -21,24 +21,24 @@ "type": "function" } ], - "transactionHash": "0x2968f1ad5acf532a8e41953e5d2feb06ee4c81ddf364453b2e31f018d83463ea", + "transactionHash": "0xc470369bd3f0b9544e40c2d859fa0345ffc8f1e87a242e8abf6a56eb5698c71f", "receipt": { "to": null, - "from": "0xd033f09cB85621F98F7A84C64dB381ac16Eff818", - "contractAddress": "0xD87eFbBb82f1B7d25469641ee2E0E513f144394C", - "transactionIndex": 53, + "from": "0x9996571372066A1545D3435C6935e3F9593A7eF5", + "contractAddress": "0xfe1F9Cf28ecDb12110aa8086e6FD343EA06035cC", + "transactionIndex": 106, "gasUsed": "243548", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x3916378de09329074abbb245a436330dfb8646cd9a1af7e5b7de1cd736f8aced", - "transactionHash": "0x2968f1ad5acf532a8e41953e5d2feb06ee4c81ddf364453b2e31f018d83463ea", + "blockHash": "0xc28664a0ac4aecc14cbfb3950126e7146416ee863c63c8120eaff726d89029fe", + "transactionHash": "0xc470369bd3f0b9544e40c2d859fa0345ffc8f1e87a242e8abf6a56eb5698c71f", "logs": [], - "blockNumber": 12410855, - "cumulativeGasUsed": "5205613", + "blockNumber": 12686776, + "cumulativeGasUsed": "5613711", "status": 1, "byzantium": true }, "args": [], - "solcInputHash": "f2bdab652d5102f5f11e78dae866798d", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", "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 /**\\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 (\\n bool\\n )\\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\":\"0x44cd4fcdcb25a233fa98da5ba66706ce2f9fbf13359cf7f2891793739687a86f\",\"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": "0x608060405234801561001057600080fd5b50610373806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063a44eb59a14610030575b600080fd5b6100d66004803603602081101561004657600080fd5b81019060208101813564010000000081111561006157600080fd5b82018360208201111561007357600080fd5b8035906020019184600183028401116401000000008311171561009557600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506100ea945050505050565b604080519115158252519081900360200190f35b60408051610100810182527e0101010101010101010101000000000101010101010101010101010101000081526b010101010101000000010100600160f81b016020808301919091526f0101010100000001010101010000000092820192909252630203040560e01b60608201527f0101010101010101010101010101010101010101010101010101010101010101608082015264010101010160d81b60a0820152600060c0820181905260e0820181905283519092741fffffffff000000000f8f000063f000013fff0ffe916a40000000000000000000026117ff60f31b039163ffffffff60601b1991870181019087015b8051600081811a880151811a82811a890151821a0182811a890151821a0182811a890151821a0182811a890151821a0182811a89015190911a01918201911a6001811b86811661032057808516610239575001605d1901610326565b80861661027e575b8280600101935050825160001a915081605b141561025e57610279565b6001821b851661027157918101605e1901915b838310610241575b610320565b816033141561030f578251602084015160d81c673350600060045af160c083901c14156102b057600885019450610306565b817f336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a0157601480156102e357508064016000f35b145b156102f357602585019450610306565b60009a5050505050505050505050610338565b50505050610326565b600098505050505050505050610338565b50506001015b8181106101dd57600196505050505050505b91905056fea26469706673582212209a836b268dcf58167a9f65bb872e3ddb5bd93b231f6b456f1c5e6d75b92a746364736f6c63430007060033", "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063a44eb59a14610030575b600080fd5b6100d66004803603602081101561004657600080fd5b81019060208101813564010000000081111561006157600080fd5b82018360208201111561007357600080fd5b8035906020019184600183028401116401000000008311171561009557600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506100ea945050505050565b604080519115158252519081900360200190f35b60408051610100810182527e0101010101010101010101000000000101010101010101010101010101000081526b010101010101000000010100600160f81b016020808301919091526f0101010100000001010101010000000092820192909252630203040560e01b60608201527f0101010101010101010101010101010101010101010101010101010101010101608082015264010101010160d81b60a0820152600060c0820181905260e0820181905283519092741fffffffff000000000f8f000063f000013fff0ffe916a40000000000000000000026117ff60f31b039163ffffffff60601b1991870181019087015b8051600081811a880151811a82811a890151821a0182811a890151821a0182811a890151821a0182811a890151821a0182811a89015190911a01918201911a6001811b86811661032057808516610239575001605d1901610326565b80861661027e575b8280600101935050825160001a915081605b141561025e57610279565b6001821b851661027157918101605e1901915b838310610241575b610320565b816033141561030f578251602084015160d81c673350600060045af160c083901c14156102b057600885019450610306565b817f336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a0157601480156102e357508064016000f35b145b156102f357602585019450610306565b60009a5050505050505050505050610338565b50505050610326565b600098505050505050505050610338565b50506001015b8181106101dd57600196505050505050505b91905056fea26469706673582212209a836b268dcf58167a9f65bb872e3ddb5bd93b231f6b456f1c5e6d75b92a746364736f6c63430007060033", diff --git a/packages/contracts/deployments/mainnet/OVM_StateCommitmentChain.json b/packages/contracts/deployments/mainnet/OVM_StateCommitmentChain.json index e8ee7024245f..df682332b6f8 100644 --- a/packages/contracts/deployments/mainnet/OVM_StateCommitmentChain.json +++ b/packages/contracts/deployments/mainnet/OVM_StateCommitmentChain.json @@ -1,5 +1,5 @@ { - "address": "0x6786EB419547a4902d285F70c6acDbC9AefAdB6F", + "address": "0xE969C2724d2448F1d1A6189d3e2aA1F37d5998c1", "abi": [ { "inputs": [ @@ -361,31 +361,31 @@ "type": "function" } ], - "transactionHash": "0x6835e7f23e2e75efc416767d52c468e23bb336602cc8f0e962ab5b2cb06f881c", + "transactionHash": "0x67c2ea9f14079f9b3c2b7b074401856f9837c99d55ec9191cc1eda1fbb2dcb9c", "receipt": { "to": null, - "from": "0xd033f09cB85621F98F7A84C64dB381ac16Eff818", - "contractAddress": "0x6786EB419547a4902d285F70c6acDbC9AefAdB6F", - "transactionIndex": 175, - "gasUsed": "1630165", + "from": "0x9996571372066A1545D3435C6935e3F9593A7eF5", + "contractAddress": "0xE969C2724d2448F1d1A6189d3e2aA1F37d5998c1", + "transactionIndex": 177, + "gasUsed": "1630177", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xfa4978a1df9e8790b1830bcbc4286faec9799b39dda0dd035ae59b8d54e8b6d4", - "transactionHash": "0x6835e7f23e2e75efc416767d52c468e23bb336602cc8f0e962ab5b2cb06f881c", + "blockHash": "0x9917443bb50022ebdac59d71a12d0d562522c3e8c8ade23d30eb39eeeadb72d2", + "transactionHash": "0x67c2ea9f14079f9b3c2b7b074401856f9837c99d55ec9191cc1eda1fbb2dcb9c", "logs": [], - "blockNumber": 12410815, - "cumulativeGasUsed": "9861812", + "blockNumber": 12686746, + "cumulativeGasUsed": "14820986", "status": 1, "byzantium": true }, "args": [ - "0x668E5b997b9aE88a56cd40409119d4Db9e6d752E", + "0xdE1FCfB0851916CA5101820A69b13a4E276bd81F", 604800, - 15770000 + 12592000 ], - "solcInputHash": "f2bdab652d5102f5f11e78dae866798d", - "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\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"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/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@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\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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 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_Proposer\\\");\\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 // For efficiency reasons getMerkleRoot modifies the `_batch` argument in place\\n // while calculating the root hash therefore any arguments passed to it must not\\n // be used again afterwards\\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\":\"0x5b72c845f856a06c978880d3cb2db40dafebaebf399df100c6ac832eaf41d7bd\",\"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 * 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\":\"0x2d7973a0ad84c23ec62624d3f1e3aeb198cc72686ff1e6cfa17155556b320c94\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0xcc9fc5c64f1101a5c6c397594086b1608189a9edc5c9635e1ac38f70aeeeecbf\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"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 * Note that the _elements argument is modified, therefore it must not be used again afterwards\\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 pure\\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 == 1) {\\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 (uint256 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\":\"0xa78edb9fbd34712771a1ebff05bc5e1abec7fc1e9a1bfb709d183099b44fa62a\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50604051611bee380380611bee83398101604081905261002f9161005b565b600080546001600160a01b0319166001600160a01b03949094169390931790925560015560025561009c565b60008060006060848603121561006f578283fd5b83516001600160a01b0381168114610085578384fd5b602085015160409095015190969495509392505050565b611b43806100ab6000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80638ca5cbb9116100715780638ca5cbb91461012f5780639418bddd14610144578063b8e189ac14610157578063c17b291b1461016a578063cfdf677e14610172578063e561dddc1461017a576100b4565b8063299ca478146100b9578063461a4478146100d75780634d69ee57146100ea5780637aa63a861461010a5780637ad168a01461011f57806381eb62ef14610127575b600080fd5b6100c1610182565b6040516100ce919061159f565b60405180910390f35b6100c16100e53660046114e3565b610191565b6100fd6100f8366004611431565b61026f565b6040516100ce91906115b3565b6101126102e2565b6040516100ce91906115be565b6101126102fb565b610112610314565b61014261013d366004611390565b61031a565b005b6100fd610152366004611531565b61052e565b610142610165366004611531565b61057e565b610112610636565b6100c161063c565b610112610664565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156101f15781810151838201526020016101d9565b50505050905090810190601f16801561021e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561023b57600080fd5b505afa15801561024f573d6000803e3d6000fd5b505050506040513d602081101561026557600080fd5b505190505b919050565b600061027a836106de565b61029f5760405162461bcd60e51b815260040161029690611749565b60405180910390fd5b6102bc836020015185846000015185602001518760400151610776565b6102d85760405162461bcd60e51b8152600401610296906116b5565b5060019392505050565b6000806102ed6108fb565b5064ffffffffff1691505090565b6000806103066108fb565b64ffffffffff169250505090565b60025481565b6103226102e2565b81146103405760405162461bcd60e51b8152600401610296906116ec565b6103706040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b815250610191565b6001600160a01b03166302ad4d2a336040518263ffffffff1660e01b815260040161039b919061159f565b60206040518083038186803b1580156103b357600080fd5b505afa1580156103c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103eb91906113d3565b6104075760405162461bcd60e51b8152600401610296906118bb565b60008251116104285760405162461bcd60e51b815260040161029690611878565b6104666040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e000000815250610191565b6001600160a01b0316637aa63a866040518163ffffffff1660e01b815260040160206040518083038186803b15801561049e57600080fd5b505afa1580156104b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d69190611419565b82516104e06102e2565b0111156104ff5760405162461bcd60e51b815260040161029690611646565b61052a8242336040516020016105169291906119a1565b604051602081830303815290604052610990565b5050565b60008082608001518060200190518101906105499190611564565b509050806105695760405162461bcd60e51b815260040161029690611833565b4261057682600154610b31565b119392505050565b6105b06040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b815250610191565b6001600160a01b0316336001600160a01b0316146105e05760405162461bcd60e51b8152600401610296906117d6565b6105e9816106de565b6106055760405162461bcd60e51b815260040161029690611749565b61060e8161052e565b61062a5760405162461bcd60e51b815260040161029690611778565b61063381610b92565b50565b60015481565b600061065f604051806060016040528060258152602001611ab560259139610191565b905090565b600061066e61063c565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156106a657600080fd5b505afa1580156106ba573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065f9190611419565b60006106e861063c565b8251604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a91610716916004016115be565b60206040518083038186803b15801561072e57600080fd5b505afa158015610742573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107669190611419565b61076f83610d0a565b1492915050565b60008082116107b65760405162461bcd60e51b8152600401808060200182810382526037815260200180611a316037913960400191505060405180910390fd5b8184106107f45760405162461bcd60e51b81526004018080602001828103825260248152602001806119dd6024913960400191505060405180910390fd5b6107fd82610d50565b83511461083b5760405162461bcd60e51b815260040180806020018281038252604d815260200180611a68604d913960600191505060405180910390fd5b8460005b84518110156108ee57856001166001141561089d5784818151811061086057fe5b60200260200101518260405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091506108e2565b818582815181106108aa57fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c950161083f565b5090951495945050505050565b600080600061090861063c565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b15801561094057600080fd5b505afa158015610954573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097891906113f3565b64ffffffffff602882901c16935060501c9150509091565b60006109bf6040518060400160405280600c81526020016b27ab26afa83937b837b9b2b960a11b815250610191565b90506000806109cc6108fb565b9092509050336001600160a01b03841614156109e9575042610a13565b426002548264ffffffffff160110610a135760405162461bcd60e51b81526004016102969061190a565b60006040518060a00160405280610a28610664565b8152602001610a3688610de6565b8152602001875181526020018464ffffffffff16815260200186815250905080600001517f16be4c5129a4e03cf3350262e181dc02ddfb4a6008d925368c0899fcd97ca9c58260200151836040015184606001518560800151604051610a9f94939291906115dd565b60405180910390a2610aaf61063c565b6001600160a01b0316632015276c610ac683610d0a565b610ada84604001518560600151018661121a565b6040518363ffffffff1660e01b8152600401610af79291906115c7565b600060405180830381600087803b158015610b1157600080fd5b505af1158015610b25573d6000803e3d6000fd5b50505050505050505050565b600082820183811015610b8b576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b610b9a61063c565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610bd257600080fd5b505afa158015610be6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0a9190611419565b815110610c295760405162461bcd60e51b815260040161029690611973565b610c32816106de565b610c4e5760405162461bcd60e51b815260040161029690611749565b610c5661063c565b6001600160a01b031663167fd6818260000151610c788460600151600061121a565b6040518363ffffffff1660e01b8152600401610c959291906115c7565b600060405180830381600087803b158015610caf57600080fd5b505af1158015610cc3573d6000803e3d6000fd5b5050505080600001517f8747b69ce8fdb31c3b9b0a67bd8049ad8c1a69ea417b69b12174068abd9cbd648260200151604051610cff91906115be565b60405180910390a250565b60008160200151826040015183606001518460800151604051602001610d3394939291906115dd565b604051602081830303815290604052805190602001209050919050565b6000808211610d905760405162461bcd60e51b8152600401808060200182810382526030815260200180611a016030913960400191505060405180910390fd5b8160011415610da15750600061026a565b81600060805b60018110610dd1576000196001821b01811b831615610dc95791821c91908101905b60011c610da7565b506001811b8414610b8b576001019392505050565b600080825111610e275760405162461bcd60e51b8152600401808060200182810382526034815260200180611ada6034913960400191505060405180910390fd5b815160011415610e4d5781600081518110610e3e57fe5b6020026020010151905061026a565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b60018411156111f65750506002820460018084161460005b82811015611172578a816002028151811061111957fe5b602002602001015196508a816002026001018151811061113557fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061115f57fe5b6020908102919091010152600101611102565b5080156111d55789600185038151811061118857fe5b6020026020010151955087836010811061119e57fe5b602002015160001b945085602088015284604088015286805190602001208a83815181106111c857fe5b6020026020010181815250505b806111e15760006111e4565b60015b60ff16820193506001909201916110ea565b8960008151811061120357fe5b602002602001015198505050505050505050919050565b602890811b91909117901b90565b600067ffffffffffffffff83111561123c57fe5b61124f601f8401601f19166020016119b8565b905082815283838301111561126357600080fd5b828260208301376000602084830101529392505050565b600082601f83011261128a578081fd5b8135602067ffffffffffffffff8211156112a057fe5b8082026112ae8282016119b8565b8381528281019086840183880185018910156112c8578687fd5b8693505b858410156112ea5780358352600193909301929184019184016112cc565b50979650505050505050565b600060a08284031215611307578081fd5b60405160a0810167ffffffffffffffff828210818311171561132557fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561136257600080fd5b508301601f8101851361137457600080fd5b61138385823560208401611228565b6080830152505092915050565b600080604083850312156113a2578182fd5b823567ffffffffffffffff8111156113b8578283fd5b6113c48582860161127a565b95602094909401359450505050565b6000602082840312156113e4578081fd5b81518015158114610b8b578182fd5b600060208284031215611404578081fd5b815164ffffffffff1981168114610b8b578182fd5b60006020828403121561142a578081fd5b5051919050565b600080600060608486031215611445578081fd5b83359250602084013567ffffffffffffffff80821115611463578283fd5b61146f878388016112f6565b93506040860135915080821115611484578283fd5b9085019060408288031215611497578283fd5b6040516040810181811083821117156114ac57fe5b604052823581526020830135828111156114c4578485fd5b6114d08982860161127a565b6020830152508093505050509250925092565b6000602082840312156114f4578081fd5b813567ffffffffffffffff81111561150a578182fd5b8201601f8101841361151a578182fd5b61152984823560208401611228565b949350505050565b600060208284031215611542578081fd5b813567ffffffffffffffff811115611558578182fd5b611529848285016112f6565b60008060408385031215611576578182fd5b825160208401519092506001600160a01b0381168114611594578182fd5b809150509250929050565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b91825264ffffffffff1916602082015260400190565b600085825260208581840152846040840152608060608401528351806080850152825b8181101561161c5785810183015185820160a001528201611600565b8181111561162d578360a083870101525b50601f01601f19169290920160a0019695505050505050565b60208082526049908201527f4e756d626572206f6620737461746520726f6f74732063616e6e6f742065786360408201527f65656420746865206e756d626572206f662063616e6f6e6963616c207472616e60608201526839b0b1ba34b7b7399760b91b608082015260a00190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b602080825260409082018190527f537461746520626174636865732063616e206f6e6c792062652064656c657465908201527f642077697468696e207468652066726175642070726f6f662077696e646f772e606082015260800190565b6020808252603b908201527f537461746520626174636865732063616e206f6e6c792062652064656c65746560408201527f6420627920746865204f564d5f467261756456657269666965722e0000000000606082015260800190565b60208082526025908201527f4261746368206865616465722074696d657374616d702063616e6e6f74206265604082015264207a65726f60d81b606082015260800190565b60208082526023908201527f43616e6e6f74207375626d697420616e20656d7074792073746174652062617460408201526231b41760e91b606082015260800190565b6020808252602f908201527f50726f706f73657220646f6573206e6f74206861766520656e6f75676820636f60408201526e1b1b185d195c985b081c1bdcdd1959608a1b606082015260800190565b60208082526043908201527f43616e6e6f74207075626c69736820737461746520726f6f747320776974686960408201527f6e207468652073657175656e636572207075626c69636174696f6e2077696e6460608201526237bb9760e91b608082015260a00190565b60208082526014908201527324b73b30b634b2103130ba31b41034b73232bc1760611b604082015260600190565b9182526001600160a01b0316602082015260400190565b60405181810167ffffffffffffffff811182821017156119d457fe5b60405291905056fe4c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4f564d5f436861696e53746f72616765436f6e7461696e65723a5343433a626174636865734c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea2646970667358221220506037c0b14007945d0021e871906eec23207a206b7ab0e885c015d836e1dcac64736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80638ca5cbb9116100715780638ca5cbb91461012f5780639418bddd14610144578063b8e189ac14610157578063c17b291b1461016a578063cfdf677e14610172578063e561dddc1461017a576100b4565b8063299ca478146100b9578063461a4478146100d75780634d69ee57146100ea5780637aa63a861461010a5780637ad168a01461011f57806381eb62ef14610127575b600080fd5b6100c1610182565b6040516100ce919061159f565b60405180910390f35b6100c16100e53660046114e3565b610191565b6100fd6100f8366004611431565b61026f565b6040516100ce91906115b3565b6101126102e2565b6040516100ce91906115be565b6101126102fb565b610112610314565b61014261013d366004611390565b61031a565b005b6100fd610152366004611531565b61052e565b610142610165366004611531565b61057e565b610112610636565b6100c161063c565b610112610664565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156101f15781810151838201526020016101d9565b50505050905090810190601f16801561021e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561023b57600080fd5b505afa15801561024f573d6000803e3d6000fd5b505050506040513d602081101561026557600080fd5b505190505b919050565b600061027a836106de565b61029f5760405162461bcd60e51b815260040161029690611749565b60405180910390fd5b6102bc836020015185846000015185602001518760400151610776565b6102d85760405162461bcd60e51b8152600401610296906116b5565b5060019392505050565b6000806102ed6108fb565b5064ffffffffff1691505090565b6000806103066108fb565b64ffffffffff169250505090565b60025481565b6103226102e2565b81146103405760405162461bcd60e51b8152600401610296906116ec565b6103706040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b815250610191565b6001600160a01b03166302ad4d2a336040518263ffffffff1660e01b815260040161039b919061159f565b60206040518083038186803b1580156103b357600080fd5b505afa1580156103c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103eb91906113d3565b6104075760405162461bcd60e51b8152600401610296906118bb565b60008251116104285760405162461bcd60e51b815260040161029690611878565b6104666040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e000000815250610191565b6001600160a01b0316637aa63a866040518163ffffffff1660e01b815260040160206040518083038186803b15801561049e57600080fd5b505afa1580156104b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d69190611419565b82516104e06102e2565b0111156104ff5760405162461bcd60e51b815260040161029690611646565b61052a8242336040516020016105169291906119a1565b604051602081830303815290604052610990565b5050565b60008082608001518060200190518101906105499190611564565b509050806105695760405162461bcd60e51b815260040161029690611833565b4261057682600154610b31565b119392505050565b6105b06040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b815250610191565b6001600160a01b0316336001600160a01b0316146105e05760405162461bcd60e51b8152600401610296906117d6565b6105e9816106de565b6106055760405162461bcd60e51b815260040161029690611749565b61060e8161052e565b61062a5760405162461bcd60e51b815260040161029690611778565b61063381610b92565b50565b60015481565b600061065f604051806060016040528060258152602001611ab560259139610191565b905090565b600061066e61063c565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156106a657600080fd5b505afa1580156106ba573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065f9190611419565b60006106e861063c565b8251604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a91610716916004016115be565b60206040518083038186803b15801561072e57600080fd5b505afa158015610742573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107669190611419565b61076f83610d0a565b1492915050565b60008082116107b65760405162461bcd60e51b8152600401808060200182810382526037815260200180611a316037913960400191505060405180910390fd5b8184106107f45760405162461bcd60e51b81526004018080602001828103825260248152602001806119dd6024913960400191505060405180910390fd5b6107fd82610d50565b83511461083b5760405162461bcd60e51b815260040180806020018281038252604d815260200180611a68604d913960600191505060405180910390fd5b8460005b84518110156108ee57856001166001141561089d5784818151811061086057fe5b60200260200101518260405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091506108e2565b818582815181106108aa57fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c950161083f565b5090951495945050505050565b600080600061090861063c565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b15801561094057600080fd5b505afa158015610954573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097891906113f3565b64ffffffffff602882901c16935060501c9150509091565b60006109bf6040518060400160405280600c81526020016b27ab26afa83937b837b9b2b960a11b815250610191565b90506000806109cc6108fb565b9092509050336001600160a01b03841614156109e9575042610a13565b426002548264ffffffffff160110610a135760405162461bcd60e51b81526004016102969061190a565b60006040518060a00160405280610a28610664565b8152602001610a3688610de6565b8152602001875181526020018464ffffffffff16815260200186815250905080600001517f16be4c5129a4e03cf3350262e181dc02ddfb4a6008d925368c0899fcd97ca9c58260200151836040015184606001518560800151604051610a9f94939291906115dd565b60405180910390a2610aaf61063c565b6001600160a01b0316632015276c610ac683610d0a565b610ada84604001518560600151018661121a565b6040518363ffffffff1660e01b8152600401610af79291906115c7565b600060405180830381600087803b158015610b1157600080fd5b505af1158015610b25573d6000803e3d6000fd5b50505050505050505050565b600082820183811015610b8b576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b610b9a61063c565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610bd257600080fd5b505afa158015610be6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0a9190611419565b815110610c295760405162461bcd60e51b815260040161029690611973565b610c32816106de565b610c4e5760405162461bcd60e51b815260040161029690611749565b610c5661063c565b6001600160a01b031663167fd6818260000151610c788460600151600061121a565b6040518363ffffffff1660e01b8152600401610c959291906115c7565b600060405180830381600087803b158015610caf57600080fd5b505af1158015610cc3573d6000803e3d6000fd5b5050505080600001517f8747b69ce8fdb31c3b9b0a67bd8049ad8c1a69ea417b69b12174068abd9cbd648260200151604051610cff91906115be565b60405180910390a250565b60008160200151826040015183606001518460800151604051602001610d3394939291906115dd565b604051602081830303815290604052805190602001209050919050565b6000808211610d905760405162461bcd60e51b8152600401808060200182810382526030815260200180611a016030913960400191505060405180910390fd5b8160011415610da15750600061026a565b81600060805b60018110610dd1576000196001821b01811b831615610dc95791821c91908101905b60011c610da7565b506001811b8414610b8b576001019392505050565b600080825111610e275760405162461bcd60e51b8152600401808060200182810382526034815260200180611ada6034913960400191505060405180910390fd5b815160011415610e4d5781600081518110610e3e57fe5b6020026020010151905061026a565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b60018411156111f65750506002820460018084161460005b82811015611172578a816002028151811061111957fe5b602002602001015196508a816002026001018151811061113557fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061115f57fe5b6020908102919091010152600101611102565b5080156111d55789600185038151811061118857fe5b6020026020010151955087836010811061119e57fe5b602002015160001b945085602088015284604088015286805190602001208a83815181106111c857fe5b6020026020010181815250505b806111e15760006111e4565b60015b60ff16820193506001909201916110ea565b8960008151811061120357fe5b602002602001015198505050505050505050919050565b602890811b91909117901b90565b600067ffffffffffffffff83111561123c57fe5b61124f601f8401601f19166020016119b8565b905082815283838301111561126357600080fd5b828260208301376000602084830101529392505050565b600082601f83011261128a578081fd5b8135602067ffffffffffffffff8211156112a057fe5b8082026112ae8282016119b8565b8381528281019086840183880185018910156112c8578687fd5b8693505b858410156112ea5780358352600193909301929184019184016112cc565b50979650505050505050565b600060a08284031215611307578081fd5b60405160a0810167ffffffffffffffff828210818311171561132557fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561136257600080fd5b508301601f8101851361137457600080fd5b61138385823560208401611228565b6080830152505092915050565b600080604083850312156113a2578182fd5b823567ffffffffffffffff8111156113b8578283fd5b6113c48582860161127a565b95602094909401359450505050565b6000602082840312156113e4578081fd5b81518015158114610b8b578182fd5b600060208284031215611404578081fd5b815164ffffffffff1981168114610b8b578182fd5b60006020828403121561142a578081fd5b5051919050565b600080600060608486031215611445578081fd5b83359250602084013567ffffffffffffffff80821115611463578283fd5b61146f878388016112f6565b93506040860135915080821115611484578283fd5b9085019060408288031215611497578283fd5b6040516040810181811083821117156114ac57fe5b604052823581526020830135828111156114c4578485fd5b6114d08982860161127a565b6020830152508093505050509250925092565b6000602082840312156114f4578081fd5b813567ffffffffffffffff81111561150a578182fd5b8201601f8101841361151a578182fd5b61152984823560208401611228565b949350505050565b600060208284031215611542578081fd5b813567ffffffffffffffff811115611558578182fd5b611529848285016112f6565b60008060408385031215611576578182fd5b825160208401519092506001600160a01b0381168114611594578182fd5b809150509250929050565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b91825264ffffffffff1916602082015260400190565b600085825260208581840152846040840152608060608401528351806080850152825b8181101561161c5785810183015185820160a001528201611600565b8181111561162d578360a083870101525b50601f01601f19169290920160a0019695505050505050565b60208082526049908201527f4e756d626572206f6620737461746520726f6f74732063616e6e6f742065786360408201527f65656420746865206e756d626572206f662063616e6f6e6963616c207472616e60608201526839b0b1ba34b7b7399760b91b608082015260a00190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b602080825260409082018190527f537461746520626174636865732063616e206f6e6c792062652064656c657465908201527f642077697468696e207468652066726175642070726f6f662077696e646f772e606082015260800190565b6020808252603b908201527f537461746520626174636865732063616e206f6e6c792062652064656c65746560408201527f6420627920746865204f564d5f467261756456657269666965722e0000000000606082015260800190565b60208082526025908201527f4261746368206865616465722074696d657374616d702063616e6e6f74206265604082015264207a65726f60d81b606082015260800190565b60208082526023908201527f43616e6e6f74207375626d697420616e20656d7074792073746174652062617460408201526231b41760e91b606082015260800190565b6020808252602f908201527f50726f706f73657220646f6573206e6f74206861766520656e6f75676820636f60408201526e1b1b185d195c985b081c1bdcdd1959608a1b606082015260800190565b60208082526043908201527f43616e6e6f74207075626c69736820737461746520726f6f747320776974686960408201527f6e207468652073657175656e636572207075626c69636174696f6e2077696e6460608201526237bb9760e91b608082015260a00190565b60208082526014908201527324b73b30b634b2103130ba31b41034b73232bc1760611b604082015260600190565b9182526001600160a01b0316602082015260400190565b60405181810167ffffffffffffffff811182821017156119d457fe5b60405291905056fe4c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4f564d5f436861696e53746f72616765436f6e7461696e65723a5343433a626174636865734c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea2646970667358221220506037c0b14007945d0021e871906eec23207a206b7ab0e885c015d836e1dcac64736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"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.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"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/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@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\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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 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_Proposer\\\");\\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 // For efficiency reasons getMerkleRoot modifies the `_batch` argument in place\\n // while calculating the root hash therefore any arguments passed to it must not\\n // be used again afterwards\\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\":\"0x12cc020811ca6a41cbad48c2e6b812c1eeaca1dde65e09b4b51a1891e0872d92\",\"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 * 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\",\"keccak256\":\"0x180b9c347e20f1a6efa553b0f2b9a59aebceda92a7484ae6fca4da2bf1d960c3\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"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 * Note that the _elements argument is modified, therefore it must not be used again afterwards\\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 pure\\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 == 1) {\\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 (uint256 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\":\"0xa78edb9fbd34712771a1ebff05bc5e1abec7fc1e9a1bfb709d183099b44fa62a\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50604051611bee380380611bee83398101604081905261002f9161005b565b600080546001600160a01b0319166001600160a01b03949094169390931790925560015560025561009c565b60008060006060848603121561006f578283fd5b83516001600160a01b0381168114610085578384fd5b602085015160409095015190969495509392505050565b611b43806100ab6000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80638ca5cbb9116100715780638ca5cbb91461012f5780639418bddd14610144578063b8e189ac14610157578063c17b291b1461016a578063cfdf677e14610172578063e561dddc1461017a576100b4565b8063299ca478146100b9578063461a4478146100d75780634d69ee57146100ea5780637aa63a861461010a5780637ad168a01461011f57806381eb62ef14610127575b600080fd5b6100c1610182565b6040516100ce919061159f565b60405180910390f35b6100c16100e53660046114e3565b610191565b6100fd6100f8366004611431565b61026f565b6040516100ce91906115b3565b6101126102e2565b6040516100ce91906115be565b6101126102fb565b610112610314565b61014261013d366004611390565b61031a565b005b6100fd610152366004611531565b61052e565b610142610165366004611531565b61057e565b610112610636565b6100c161063c565b610112610664565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156101f15781810151838201526020016101d9565b50505050905090810190601f16801561021e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561023b57600080fd5b505afa15801561024f573d6000803e3d6000fd5b505050506040513d602081101561026557600080fd5b505190505b919050565b600061027a836106de565b61029f5760405162461bcd60e51b815260040161029690611749565b60405180910390fd5b6102bc836020015185846000015185602001518760400151610776565b6102d85760405162461bcd60e51b8152600401610296906116b5565b5060019392505050565b6000806102ed6108fb565b5064ffffffffff1691505090565b6000806103066108fb565b64ffffffffff169250505090565b60025481565b6103226102e2565b81146103405760405162461bcd60e51b8152600401610296906116ec565b6103706040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b815250610191565b6001600160a01b03166302ad4d2a336040518263ffffffff1660e01b815260040161039b919061159f565b60206040518083038186803b1580156103b357600080fd5b505afa1580156103c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103eb91906113d3565b6104075760405162461bcd60e51b8152600401610296906118bb565b60008251116104285760405162461bcd60e51b815260040161029690611878565b6104666040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e000000815250610191565b6001600160a01b0316637aa63a866040518163ffffffff1660e01b815260040160206040518083038186803b15801561049e57600080fd5b505afa1580156104b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d69190611419565b82516104e06102e2565b0111156104ff5760405162461bcd60e51b815260040161029690611646565b61052a8242336040516020016105169291906119a1565b604051602081830303815290604052610990565b5050565b60008082608001518060200190518101906105499190611564565b509050806105695760405162461bcd60e51b815260040161029690611833565b4261057682600154610b31565b119392505050565b6105b06040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b815250610191565b6001600160a01b0316336001600160a01b0316146105e05760405162461bcd60e51b8152600401610296906117d6565b6105e9816106de565b6106055760405162461bcd60e51b815260040161029690611749565b61060e8161052e565b61062a5760405162461bcd60e51b815260040161029690611778565b61063381610b92565b50565b60015481565b600061065f604051806060016040528060258152602001611a6860259139610191565b905090565b600061066e61063c565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156106a657600080fd5b505afa1580156106ba573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065f9190611419565b60006106e861063c565b8251604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a91610716916004016115be565b60206040518083038186803b15801561072e57600080fd5b505afa158015610742573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107669190611419565b61076f83610d0a565b1492915050565b60008082116107b65760405162461bcd60e51b8152600401808060200182810382526037815260200180611a316037913960400191505060405180910390fd5b8184106107f45760405162461bcd60e51b81526004018080602001828103825260248152602001806119dd6024913960400191505060405180910390fd5b6107fd82610d50565b83511461083b5760405162461bcd60e51b815260040180806020018281038252604d815260200180611a8d604d913960600191505060405180910390fd5b8460005b84518110156108ee57856001166001141561089d5784818151811061086057fe5b60200260200101518260405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091506108e2565b818582815181106108aa57fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c950161083f565b5090951495945050505050565b600080600061090861063c565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b15801561094057600080fd5b505afa158015610954573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097891906113f3565b64ffffffffff602882901c16935060501c9150509091565b60006109bf6040518060400160405280600c81526020016b27ab26afa83937b837b9b2b960a11b815250610191565b90506000806109cc6108fb565b9092509050336001600160a01b03841614156109e9575042610a13565b426002548264ffffffffff160110610a135760405162461bcd60e51b81526004016102969061190a565b60006040518060a00160405280610a28610664565b8152602001610a3688610de6565b8152602001875181526020018464ffffffffff16815260200186815250905080600001517f16be4c5129a4e03cf3350262e181dc02ddfb4a6008d925368c0899fcd97ca9c58260200151836040015184606001518560800151604051610a9f94939291906115dd565b60405180910390a2610aaf61063c565b6001600160a01b0316632015276c610ac683610d0a565b610ada84604001518560600151018661121a565b6040518363ffffffff1660e01b8152600401610af79291906115c7565b600060405180830381600087803b158015610b1157600080fd5b505af1158015610b25573d6000803e3d6000fd5b50505050505050505050565b600082820183811015610b8b576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b610b9a61063c565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610bd257600080fd5b505afa158015610be6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0a9190611419565b815110610c295760405162461bcd60e51b815260040161029690611973565b610c32816106de565b610c4e5760405162461bcd60e51b815260040161029690611749565b610c5661063c565b6001600160a01b031663167fd6818260000151610c788460600151600061121a565b6040518363ffffffff1660e01b8152600401610c959291906115c7565b600060405180830381600087803b158015610caf57600080fd5b505af1158015610cc3573d6000803e3d6000fd5b5050505080600001517f8747b69ce8fdb31c3b9b0a67bd8049ad8c1a69ea417b69b12174068abd9cbd648260200151604051610cff91906115be565b60405180910390a250565b60008160200151826040015183606001518460800151604051602001610d3394939291906115dd565b604051602081830303815290604052805190602001209050919050565b6000808211610d905760405162461bcd60e51b8152600401808060200182810382526030815260200180611a016030913960400191505060405180910390fd5b8160011415610da15750600061026a565b81600060805b60018110610dd1576000196001821b01811b831615610dc95791821c91908101905b60011c610da7565b506001811b8414610b8b576001019392505050565b600080825111610e275760405162461bcd60e51b8152600401808060200182810382526034815260200180611ada6034913960400191505060405180910390fd5b815160011415610e4d5781600081518110610e3e57fe5b6020026020010151905061026a565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b60018411156111f65750506002820460018084161460005b82811015611172578a816002028151811061111957fe5b602002602001015196508a816002026001018151811061113557fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061115f57fe5b6020908102919091010152600101611102565b5080156111d55789600185038151811061118857fe5b6020026020010151955087836010811061119e57fe5b602002015160001b945085602088015284604088015286805190602001208a83815181106111c857fe5b6020026020010181815250505b806111e15760006111e4565b60015b60ff16820193506001909201916110ea565b8960008151811061120357fe5b602002602001015198505050505050505050919050565b602890811b91909117901b90565b600067ffffffffffffffff83111561123c57fe5b61124f601f8401601f19166020016119b8565b905082815283838301111561126357600080fd5b828260208301376000602084830101529392505050565b600082601f83011261128a578081fd5b8135602067ffffffffffffffff8211156112a057fe5b8082026112ae8282016119b8565b8381528281019086840183880185018910156112c8578687fd5b8693505b858410156112ea5780358352600193909301929184019184016112cc565b50979650505050505050565b600060a08284031215611307578081fd5b60405160a0810167ffffffffffffffff828210818311171561132557fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561136257600080fd5b508301601f8101851361137457600080fd5b61138385823560208401611228565b6080830152505092915050565b600080604083850312156113a2578182fd5b823567ffffffffffffffff8111156113b8578283fd5b6113c48582860161127a565b95602094909401359450505050565b6000602082840312156113e4578081fd5b81518015158114610b8b578182fd5b600060208284031215611404578081fd5b815164ffffffffff1981168114610b8b578182fd5b60006020828403121561142a578081fd5b5051919050565b600080600060608486031215611445578081fd5b83359250602084013567ffffffffffffffff80821115611463578283fd5b61146f878388016112f6565b93506040860135915080821115611484578283fd5b9085019060408288031215611497578283fd5b6040516040810181811083821117156114ac57fe5b604052823581526020830135828111156114c4578485fd5b6114d08982860161127a565b6020830152508093505050509250925092565b6000602082840312156114f4578081fd5b813567ffffffffffffffff81111561150a578182fd5b8201601f8101841361151a578182fd5b61152984823560208401611228565b949350505050565b600060208284031215611542578081fd5b813567ffffffffffffffff811115611558578182fd5b611529848285016112f6565b60008060408385031215611576578182fd5b825160208401519092506001600160a01b0381168114611594578182fd5b809150509250929050565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b91825264ffffffffff1916602082015260400190565b600085825260208581840152846040840152608060608401528351806080850152825b8181101561161c5785810183015185820160a001528201611600565b8181111561162d578360a083870101525b50601f01601f19169290920160a0019695505050505050565b60208082526049908201527f4e756d626572206f6620737461746520726f6f74732063616e6e6f742065786360408201527f65656420746865206e756d626572206f662063616e6f6e6963616c207472616e60608201526839b0b1ba34b7b7399760b91b608082015260a00190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b602080825260409082018190527f537461746520626174636865732063616e206f6e6c792062652064656c657465908201527f642077697468696e207468652066726175642070726f6f662077696e646f772e606082015260800190565b6020808252603b908201527f537461746520626174636865732063616e206f6e6c792062652064656c65746560408201527f6420627920746865204f564d5f467261756456657269666965722e0000000000606082015260800190565b60208082526025908201527f4261746368206865616465722074696d657374616d702063616e6e6f74206265604082015264207a65726f60d81b606082015260800190565b60208082526023908201527f43616e6e6f74207375626d697420616e20656d7074792073746174652062617460408201526231b41760e91b606082015260800190565b6020808252602f908201527f50726f706f73657220646f6573206e6f74206861766520656e6f75676820636f60408201526e1b1b185d195c985b081c1bdcdd1959608a1b606082015260800190565b60208082526043908201527f43616e6e6f74207075626c69736820737461746520726f6f747320776974686960408201527f6e207468652073657175656e636572207075626c69636174696f6e2077696e6460608201526237bb9760e91b608082015260a00190565b60208082526014908201527324b73b30b634b2103130ba31b41034b73232bc1760611b604082015260600190565b9182526001600160a01b0316602082015260400190565b60405181810167ffffffffffffffff811182821017156119d457fe5b60405291905056fe4c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4f564d5f436861696e53746f72616765436f6e7461696e65722d5343432d626174636865734c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea2646970667358221220fe58eec60e1130e9f94565e6ea97ae3f590e96eeda1a972687d27ab93f7f7df464736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80638ca5cbb9116100715780638ca5cbb91461012f5780639418bddd14610144578063b8e189ac14610157578063c17b291b1461016a578063cfdf677e14610172578063e561dddc1461017a576100b4565b8063299ca478146100b9578063461a4478146100d75780634d69ee57146100ea5780637aa63a861461010a5780637ad168a01461011f57806381eb62ef14610127575b600080fd5b6100c1610182565b6040516100ce919061159f565b60405180910390f35b6100c16100e53660046114e3565b610191565b6100fd6100f8366004611431565b61026f565b6040516100ce91906115b3565b6101126102e2565b6040516100ce91906115be565b6101126102fb565b610112610314565b61014261013d366004611390565b61031a565b005b6100fd610152366004611531565b61052e565b610142610165366004611531565b61057e565b610112610636565b6100c161063c565b610112610664565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156101f15781810151838201526020016101d9565b50505050905090810190601f16801561021e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561023b57600080fd5b505afa15801561024f573d6000803e3d6000fd5b505050506040513d602081101561026557600080fd5b505190505b919050565b600061027a836106de565b61029f5760405162461bcd60e51b815260040161029690611749565b60405180910390fd5b6102bc836020015185846000015185602001518760400151610776565b6102d85760405162461bcd60e51b8152600401610296906116b5565b5060019392505050565b6000806102ed6108fb565b5064ffffffffff1691505090565b6000806103066108fb565b64ffffffffff169250505090565b60025481565b6103226102e2565b81146103405760405162461bcd60e51b8152600401610296906116ec565b6103706040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b815250610191565b6001600160a01b03166302ad4d2a336040518263ffffffff1660e01b815260040161039b919061159f565b60206040518083038186803b1580156103b357600080fd5b505afa1580156103c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103eb91906113d3565b6104075760405162461bcd60e51b8152600401610296906118bb565b60008251116104285760405162461bcd60e51b815260040161029690611878565b6104666040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e000000815250610191565b6001600160a01b0316637aa63a866040518163ffffffff1660e01b815260040160206040518083038186803b15801561049e57600080fd5b505afa1580156104b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d69190611419565b82516104e06102e2565b0111156104ff5760405162461bcd60e51b815260040161029690611646565b61052a8242336040516020016105169291906119a1565b604051602081830303815290604052610990565b5050565b60008082608001518060200190518101906105499190611564565b509050806105695760405162461bcd60e51b815260040161029690611833565b4261057682600154610b31565b119392505050565b6105b06040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b815250610191565b6001600160a01b0316336001600160a01b0316146105e05760405162461bcd60e51b8152600401610296906117d6565b6105e9816106de565b6106055760405162461bcd60e51b815260040161029690611749565b61060e8161052e565b61062a5760405162461bcd60e51b815260040161029690611778565b61063381610b92565b50565b60015481565b600061065f604051806060016040528060258152602001611a6860259139610191565b905090565b600061066e61063c565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156106a657600080fd5b505afa1580156106ba573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065f9190611419565b60006106e861063c565b8251604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a91610716916004016115be565b60206040518083038186803b15801561072e57600080fd5b505afa158015610742573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107669190611419565b61076f83610d0a565b1492915050565b60008082116107b65760405162461bcd60e51b8152600401808060200182810382526037815260200180611a316037913960400191505060405180910390fd5b8184106107f45760405162461bcd60e51b81526004018080602001828103825260248152602001806119dd6024913960400191505060405180910390fd5b6107fd82610d50565b83511461083b5760405162461bcd60e51b815260040180806020018281038252604d815260200180611a8d604d913960600191505060405180910390fd5b8460005b84518110156108ee57856001166001141561089d5784818151811061086057fe5b60200260200101518260405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091506108e2565b818582815181106108aa57fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c950161083f565b5090951495945050505050565b600080600061090861063c565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b15801561094057600080fd5b505afa158015610954573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097891906113f3565b64ffffffffff602882901c16935060501c9150509091565b60006109bf6040518060400160405280600c81526020016b27ab26afa83937b837b9b2b960a11b815250610191565b90506000806109cc6108fb565b9092509050336001600160a01b03841614156109e9575042610a13565b426002548264ffffffffff160110610a135760405162461bcd60e51b81526004016102969061190a565b60006040518060a00160405280610a28610664565b8152602001610a3688610de6565b8152602001875181526020018464ffffffffff16815260200186815250905080600001517f16be4c5129a4e03cf3350262e181dc02ddfb4a6008d925368c0899fcd97ca9c58260200151836040015184606001518560800151604051610a9f94939291906115dd565b60405180910390a2610aaf61063c565b6001600160a01b0316632015276c610ac683610d0a565b610ada84604001518560600151018661121a565b6040518363ffffffff1660e01b8152600401610af79291906115c7565b600060405180830381600087803b158015610b1157600080fd5b505af1158015610b25573d6000803e3d6000fd5b50505050505050505050565b600082820183811015610b8b576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b610b9a61063c565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610bd257600080fd5b505afa158015610be6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0a9190611419565b815110610c295760405162461bcd60e51b815260040161029690611973565b610c32816106de565b610c4e5760405162461bcd60e51b815260040161029690611749565b610c5661063c565b6001600160a01b031663167fd6818260000151610c788460600151600061121a565b6040518363ffffffff1660e01b8152600401610c959291906115c7565b600060405180830381600087803b158015610caf57600080fd5b505af1158015610cc3573d6000803e3d6000fd5b5050505080600001517f8747b69ce8fdb31c3b9b0a67bd8049ad8c1a69ea417b69b12174068abd9cbd648260200151604051610cff91906115be565b60405180910390a250565b60008160200151826040015183606001518460800151604051602001610d3394939291906115dd565b604051602081830303815290604052805190602001209050919050565b6000808211610d905760405162461bcd60e51b8152600401808060200182810382526030815260200180611a016030913960400191505060405180910390fd5b8160011415610da15750600061026a565b81600060805b60018110610dd1576000196001821b01811b831615610dc95791821c91908101905b60011c610da7565b506001811b8414610b8b576001019392505050565b600080825111610e275760405162461bcd60e51b8152600401808060200182810382526034815260200180611ada6034913960400191505060405180910390fd5b815160011415610e4d5781600081518110610e3e57fe5b6020026020010151905061026a565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b60018411156111f65750506002820460018084161460005b82811015611172578a816002028151811061111957fe5b602002602001015196508a816002026001018151811061113557fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061115f57fe5b6020908102919091010152600101611102565b5080156111d55789600185038151811061118857fe5b6020026020010151955087836010811061119e57fe5b602002015160001b945085602088015284604088015286805190602001208a83815181106111c857fe5b6020026020010181815250505b806111e15760006111e4565b60015b60ff16820193506001909201916110ea565b8960008151811061120357fe5b602002602001015198505050505050505050919050565b602890811b91909117901b90565b600067ffffffffffffffff83111561123c57fe5b61124f601f8401601f19166020016119b8565b905082815283838301111561126357600080fd5b828260208301376000602084830101529392505050565b600082601f83011261128a578081fd5b8135602067ffffffffffffffff8211156112a057fe5b8082026112ae8282016119b8565b8381528281019086840183880185018910156112c8578687fd5b8693505b858410156112ea5780358352600193909301929184019184016112cc565b50979650505050505050565b600060a08284031215611307578081fd5b60405160a0810167ffffffffffffffff828210818311171561132557fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561136257600080fd5b508301601f8101851361137457600080fd5b61138385823560208401611228565b6080830152505092915050565b600080604083850312156113a2578182fd5b823567ffffffffffffffff8111156113b8578283fd5b6113c48582860161127a565b95602094909401359450505050565b6000602082840312156113e4578081fd5b81518015158114610b8b578182fd5b600060208284031215611404578081fd5b815164ffffffffff1981168114610b8b578182fd5b60006020828403121561142a578081fd5b5051919050565b600080600060608486031215611445578081fd5b83359250602084013567ffffffffffffffff80821115611463578283fd5b61146f878388016112f6565b93506040860135915080821115611484578283fd5b9085019060408288031215611497578283fd5b6040516040810181811083821117156114ac57fe5b604052823581526020830135828111156114c4578485fd5b6114d08982860161127a565b6020830152508093505050509250925092565b6000602082840312156114f4578081fd5b813567ffffffffffffffff81111561150a578182fd5b8201601f8101841361151a578182fd5b61152984823560208401611228565b949350505050565b600060208284031215611542578081fd5b813567ffffffffffffffff811115611558578182fd5b611529848285016112f6565b60008060408385031215611576578182fd5b825160208401519092506001600160a01b0381168114611594578182fd5b809150509250929050565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b91825264ffffffffff1916602082015260400190565b600085825260208581840152846040840152608060608401528351806080850152825b8181101561161c5785810183015185820160a001528201611600565b8181111561162d578360a083870101525b50601f01601f19169290920160a0019695505050505050565b60208082526049908201527f4e756d626572206f6620737461746520726f6f74732063616e6e6f742065786360408201527f65656420746865206e756d626572206f662063616e6f6e6963616c207472616e60608201526839b0b1ba34b7b7399760b91b608082015260a00190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b602080825260409082018190527f537461746520626174636865732063616e206f6e6c792062652064656c657465908201527f642077697468696e207468652066726175642070726f6f662077696e646f772e606082015260800190565b6020808252603b908201527f537461746520626174636865732063616e206f6e6c792062652064656c65746560408201527f6420627920746865204f564d5f467261756456657269666965722e0000000000606082015260800190565b60208082526025908201527f4261746368206865616465722074696d657374616d702063616e6e6f74206265604082015264207a65726f60d81b606082015260800190565b60208082526023908201527f43616e6e6f74207375626d697420616e20656d7074792073746174652062617460408201526231b41760e91b606082015260800190565b6020808252602f908201527f50726f706f73657220646f6573206e6f74206861766520656e6f75676820636f60408201526e1b1b185d195c985b081c1bdcdd1959608a1b606082015260800190565b60208082526043908201527f43616e6e6f74207075626c69736820737461746520726f6f747320776974686960408201527f6e207468652073657175656e636572207075626c69636174696f6e2077696e6460608201526237bb9760e91b608082015260a00190565b60208082526014908201527324b73b30b634b2103130ba31b41034b73232bc1760611b604082015260600190565b9182526001600160a01b0316602082015260400190565b60405181810167ffffffffffffffff811182821017156119d457fe5b60405291905056fe4c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4f564d5f436861696e53746f72616765436f6e7461696e65722d5343432d626174636865734c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea2646970667358221220fe58eec60e1130e9f94565e6ea97ae3f590e96eeda1a972687d27ab93f7f7df464736f6c63430007060033", "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", @@ -489,15 +489,15 @@ "storageLayout": { "storage": [ { - "astId": 12856, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol:OVM_StateCommitmentChain", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12849" + "type": "t_contract(Lib_AddressManager)15296" }, { - "astId": 4722, + "astId": 6159, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol:OVM_StateCommitmentChain", "label": "FRAUD_PROOF_WINDOW", "offset": 0, @@ -505,7 +505,7 @@ "type": "t_uint256" }, { - "astId": 4724, + "astId": 6161, "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol:OVM_StateCommitmentChain", "label": "SEQUENCER_PUBLISH_WINDOW", "offset": 0, @@ -514,7 +514,7 @@ } ], "types": { - "t_contract(Lib_AddressManager)12849": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" diff --git a/packages/contracts/deployments/mainnet/OVM_StateManagerFactory.json b/packages/contracts/deployments/mainnet/OVM_StateManagerFactory.json index 21c4d1f254d3..8c7496a9a80d 100644 --- a/packages/contracts/deployments/mainnet/OVM_StateManagerFactory.json +++ b/packages/contracts/deployments/mainnet/OVM_StateManagerFactory.json @@ -1,5 +1,5 @@ { - "address": "0xA4C213C1E2bF5594baB0BCdF071ed5B0E946b19e", + "address": "0xd0e3e318154716BD9d007E1E6B021Eab246ff98d", "abi": [ { "inputs": [ @@ -21,24 +21,24 @@ "type": "function" } ], - "transactionHash": "0x3eb51c18e23caff11a345482b4f5ba332d783cd2937218e8f03cb92fc112ba14", + "transactionHash": "0xb836668863e589c68dfa78eaf02f42a94595643b12c7b77de767dc572e073b17", "receipt": { "to": null, - "from": "0xd033f09cB85621F98F7A84C64dB381ac16Eff818", - "contractAddress": "0xA4C213C1E2bF5594baB0BCdF071ed5B0E946b19e", - "transactionIndex": 185, + "from": "0x9996571372066A1545D3435C6935e3F9593A7eF5", + "contractAddress": "0xd0e3e318154716BD9d007E1E6B021Eab246ff98d", + "transactionIndex": 52, "gasUsed": "1170970", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x81540961200bc28f697df473ce437473ce7b9e4bdba345530d81da098497e568", - "transactionHash": "0x3eb51c18e23caff11a345482b4f5ba332d783cd2937218e8f03cb92fc112ba14", + "blockHash": "0xbd242fd7b8461a41f603bfa1cf76a2942c634f0eefafe66349c0807a4057ebc8", + "transactionHash": "0xb836668863e589c68dfa78eaf02f42a94595643b12c7b77de767dc572e073b17", "logs": [], - "blockNumber": 12410846, - "cumulativeGasUsed": "8261242", + "blockNumber": 12686769, + "cumulativeGasUsed": "4910141", "status": 1, "byzantium": true }, "args": [], - "solcInputHash": "f2bdab652d5102f5f11e78dae866798d", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", "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\":\"\",\"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\":{\"_0\":\"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 * 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 * Variables *\\n *************/\\n\\n address override public owner;\\n address override public ovmExecutionManager;\\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 {\\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 *\\n ********************/\\n\\n /**\\n * Checks whether a given address is allowed to modify this contract.\\n * @param _address Address to check.\\n * @return Whether or not the address can modify this contract.\\n */\\n function isAuthenticated(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n bool\\n )\\n {\\n return (_address == owner || _address == ovmExecutionManager);\\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 * 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 for the given address.\\n */\\n function getAccount(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n Lib_OVMCodec.Account memory\\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 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\\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 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\\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 of the account.\\n */\\n function getAccountNonce(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n uint256\\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 Corresponding Ethereum address.\\n */\\n function getAccountEthAddress(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n address\\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 Corresponding storage root.\\n */\\n function getAccountStorageRoot(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n bytes32\\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 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\\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 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\\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 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\\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 uncommitted accounts.\\n */\\n function getTotalUncommittedAccounts()\\n override\\n public\\n view\\n returns (\\n uint256\\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 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\\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 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\\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 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\\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 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\\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 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\\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 uncommitted storage slots.\\n */\\n function getTotalUncommittedContractStorage()\\n override\\n public\\n view\\n returns (\\n uint256\\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 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\\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\":\"0x0df9654f9f958038435c2b2a2c7793b20fa16afe866a69cbed32a371aaa4c78b\",\"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 *\\n ********************/\\n\\n /**\\n * Creates a new OVM_StateManager\\n * @param _owner Owner of the created contract.\\n * @return New OVM_StateManager instance.\\n */\\n function create(\\n address _owner\\n )\\n override\\n public\\n returns (\\n iOVM_StateManager\\n )\\n {\\n return new OVM_StateManager(_owner);\\n }\\n}\\n\",\"keccak256\":\"0xc557f05b8a82eee7b36a389795fe4acc0803bcf5ae33e15e9cba8226e9ab49fc\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"license\":\"MIT\"}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b50611437806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80639ed9331814610030575b600080fd5b6100566004803603602081101561004657600080fd5b50356001600160a01b0316610072565b604080516001600160a01b039092168252519081900360200190f35b600081604051610081906100b5565b6001600160a01b03909116815260405190819003602001906000f0801580156100ae573d6000803e3d6000fd5b5092915050565b61133f806100c38339019056fe608060405234801561001057600080fd5b5060405161133f38038061133f83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b6112ae806100916000396000f3fe608060405234801561001057600080fd5b50600436106101f05760003560e01c80638f3b96471161010f578063d126199f116100a2578063e90abb8611610071578063e90abb86146103f9578063fb37b31c1461040c578063fbcbc0f11461041f578063fcf149a21461043f576101f0565b8063d126199f146103b8578063d15d4150146103cb578063d54414c8146103de578063d7bd4a2a146103f1576101f0565b8063c3fd9b25116100de578063c3fd9b2514610377578063c7650bf21461037f578063c8e40fbf14610392578063d0a215f2146103a5576101f0565b80638f3b96471461033657806399056ba914610349578063af37b86414610351578063af3dc01114610364576101f0565b806333f94305116101875780636f3c75af116101565780636f3c75af146102f55780637c8ee703146103085780637e86faa81461031b5780638da5cb5b1461032e576101f0565b806333f94305146102b25780635c17d629146102ba5780636b18e4e8146102cd5780636c87ad20146102e0576101f0565b8063167020d2116101c3578063167020d2146102595780631aaf392f1461026c5780631b208a5a1461028c57806326dc5b121461029f576101f0565b806307a12945146101f55780630ad226791461021e57806311b1f790146102315780631381ba4d14610244575b600080fd5b61020861020336600461101d565b610452565b60405161021591906111c4565b60405180910390f35b61020861022c366004611072565b6104ba565b61020861023f36600461101d565b610517565b61025761025236600461101d565b610573565b005b61020861026736600461101d565b6105d4565b61027f61027a366004611072565b610679565b60405161021591906111cf565b61020861029a36600461101d565b610727565b61027f6102ad36600461101d565b61075e565b61025761077d565b6102576102c836600461109b565b6107c7565b6102576102db36600461101d565b61089a565b6102e8610944565b60405161021591906111b0565b610208610303366004611072565b610953565b6102e861031636600461101d565b61098c565b610208610329366004611072565b6109ad565b6102e86109c3565b6102576103443660046110cd565b6109d2565b61027f610a88565b61020861035f366004611072565b610a8e565b610208610372366004611072565b610ae2565b610257610b2f565b61020861038d366004611072565b610b79565b6102086103a036600461101d565b610c20565b6102576103b3366004611037565b610c40565b61027f6103c636600461101d565b610cb9565b6102086103d936600461101d565b610cd4565b6102086103ec36600461101d565b610d01565b61027f610d16565b610257610407366004611072565b610d1c565b61020861041a36600461101d565b610d77565b61043261042d36600461101d565b610dc3565b604051610215919061122e565b61025761044d36600461101d565b610e37565b6001600160a01b0381166000908152600260205260408120600301547fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4701480156104b257506001600160a01b038216600090815260026020526040902054155b90505b919050565b6001600160a01b038216600090815260046020908152604080832084845290915281205460ff168061050e57506001600160a01b038316600090815260026020526040902060040154600160a01b900460ff165b90505b92915050565b600080546001600160a01b031633148061053b57506001546001600160a01b031633145b6105605760405162461bcd60e51b8152600401610557906111d8565b60405180910390fd5b6104b261056c83610ef8565b6002610f28565b6000546001600160a01b031633148061059657506001546001600160a01b031633145b6105b25760405162461bcd60e51b8152600401610557906111d8565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b03163314806105f857506001546001600160a01b031633145b6106145760405162461bcd60e51b8152600401610557906111d8565b600061061f83610ef8565b9050600260008281526005602052604090205460ff16600381111561064057fe5b1461064f5760009150506104b5565b6000908152600560205260409020805460ff19166003179055505060068054600019019055600190565b6001600160a01b038216600090815260046020908152604080832084845290915281205460ff161580156106cf57506001600160a01b038316600090815260026020526040902060040154600160a01b900460ff165b156106dc57506000610511565b506001600160a01b0391909116600090815260036020908152604080832093835292905220547ffeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef1890565b60008061073383610ef8565b905060025b60008281526005602052604090205460ff16600381111561075557fe5b10159392505050565b6001600160a01b03166000908152600260208190526040909120015490565b6000546001600160a01b03163314806107a057506001546001600160a01b031633145b6107bc5760405162461bcd60e51b8152600401610557906111d8565b600680546001019055565b6000546001600160a01b03163314806107ea57506001546001600160a01b031633145b6108065760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b038316600081815260036020908152604080832086845282528083207ffeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef86189055928252600481528282208583529052205460ff16610895576001600160a01b03831660009081526004602090815260408083208584529091529020805460ff191660011790555b505050565b6000546001600160a01b03163314806108bd57506001546001600160a01b031633145b6108d95760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b031660009081526002602081905260409091207f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421918101919091557fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470600390910155565b6001546001600160a01b031681565b6000806109608484610f8e565b905060025b60008281526005602052604090205460ff16600381111561098257fe5b1015949350505050565b6001600160a01b039081166000908152600260205260409020600401541690565b6000806109ba8484610f8e565b90506003610965565b6000546001600160a01b031681565b6000546001600160a01b03163314806109f557506001546001600160a01b031633145b610a115760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b039182166000908152600260208181526040928390208451815590840151600182015591830151908201556060820151600382015560808201516004909101805460a0909301516001600160a01b0319909316919093161760ff60a01b1916600160a01b91151591909102179055565b60075490565b600080546001600160a01b0316331480610ab257506001546001600160a01b031633145b610ace5760405162461bcd60e51b8152600401610557906111d8565b61050e610adb8484610f8e565b6001610f28565b600080546001600160a01b0316331480610b0657506001546001600160a01b031633145b610b225760405162461bcd60e51b8152600401610557906111d8565b61050e61056c8484610f8e565b6000546001600160a01b0316331480610b5257506001546001600160a01b031633145b610b6e5760405162461bcd60e51b8152600401610557906111d8565b600780546001019055565b600080546001600160a01b0316331480610b9d57506001546001600160a01b031633145b610bb95760405162461bcd60e51b8152600401610557906111d8565b6000610bc58484610f8e565b9050600260008281526005602052604090205460ff166003811115610be657fe5b14610bf5576000915050610511565b6000908152600560205260409020805460ff1916600317905550506007805460001901905550600190565b6001600160a01b0316600090815260026020526040902060030154151590565b6000546001600160a01b0316331480610c6357506001546001600160a01b031633145b610c7f5760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b0392831660009081526002602052604090206004810180546001600160a01b031916939094169290921790925560030155565b6001600160a01b031660009081526002602052604090205490565b600080546001600160a01b03838116911614806104b25750506001546001600160a01b0390811691161490565b600080610d0d83610ef8565b90506003610738565b60065490565b6000546001600160a01b0316331480610d3f57506001546001600160a01b031633145b610d5b5760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b03909116600090815260026020526040902055565b600080546001600160a01b0316331480610d9b57506001546001600160a01b031633145b610db75760405162461bcd60e51b8152600401610557906111d8565b6104b2610adb83610ef8565b610dcb610fc1565b506001600160a01b03908116600090815260026020818152604092839020835160c08101855281548152600182015492810192909252918201549281019290925260038101546060830152600401549182166080820152600160a01b90910460ff16151560a082015290565b6000546001600160a01b0316331480610e5a57506001546001600160a01b031633145b610e765760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b03166000908152600260208190526040909120600181557f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421918101919091557fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4706003820155600401805460ff60a01b1916600160a01b179055565b600081604051602001610f0b9190611171565b604051602081830303815290604052805190602001209050919050565b600080826003811115610f3757fe5b60008581526005602052604090205460ff166003811115610f5457fe5b101590508061050e576000848152600560205260409020805484919060ff19166001836003811115610f8257fe5b02179055509392505050565b60008282604051602001610fa392919061118e565b60405160208183030381529060405280519060200120905092915050565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a081019190915290565b80356001600160a01b03811681146104b557600080fd5b803580151581146104b557600080fd5b60006020828403121561102e578081fd5b61050e82610ff6565b60008060006060848603121561104b578182fd5b61105484610ff6565b925061106260208501610ff6565b9150604084013590509250925092565b60008060408385031215611084578182fd5b61108d83610ff6565b946020939093013593505050565b6000806000606084860312156110af578283fd5b6110b884610ff6565b95602085013595506040909401359392505050565b60008082840360e08112156110e0578283fd5b6110e984610ff6565b925060c0601f19820112156110fc578182fd5b5060405160c0810181811067ffffffffffffffff8211171561111a57fe5b80604052506020840135815260408401356020820152606084013560408201526080840135606082015261115060a08501610ff6565b608082015261116160c0850161100d565b60a0820152809150509250929050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b60609290921b6bffffffffffffffffffffffff19168252601482015260340190565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b60208082526036908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c65642062792061604082015275757468656e746963617465642061646472657373657360501b606082015260800190565b815181526020808301519082015260408083015190820152606080830151908201526080808301516001600160a01b03169082015260a09182015115159181019190915260c0019056fea2646970667358221220831108797bd578e5207b0f7717657875894fce501cf25b4109f65121461461ca64736f6c63430007060033a2646970667358221220c3b6fe114c6da51f019d7729cc2ec959a0decd1375f627f7e6327030359bac6264736f6c63430007060033", "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80639ed9331814610030575b600080fd5b6100566004803603602081101561004657600080fd5b50356001600160a01b0316610072565b604080516001600160a01b039092168252519081900360200190f35b600081604051610081906100b5565b6001600160a01b03909116815260405190819003602001906000f0801580156100ae573d6000803e3d6000fd5b5092915050565b61133f806100c38339019056fe608060405234801561001057600080fd5b5060405161133f38038061133f83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b6112ae806100916000396000f3fe608060405234801561001057600080fd5b50600436106101f05760003560e01c80638f3b96471161010f578063d126199f116100a2578063e90abb8611610071578063e90abb86146103f9578063fb37b31c1461040c578063fbcbc0f11461041f578063fcf149a21461043f576101f0565b8063d126199f146103b8578063d15d4150146103cb578063d54414c8146103de578063d7bd4a2a146103f1576101f0565b8063c3fd9b25116100de578063c3fd9b2514610377578063c7650bf21461037f578063c8e40fbf14610392578063d0a215f2146103a5576101f0565b80638f3b96471461033657806399056ba914610349578063af37b86414610351578063af3dc01114610364576101f0565b806333f94305116101875780636f3c75af116101565780636f3c75af146102f55780637c8ee703146103085780637e86faa81461031b5780638da5cb5b1461032e576101f0565b806333f94305146102b25780635c17d629146102ba5780636b18e4e8146102cd5780636c87ad20146102e0576101f0565b8063167020d2116101c3578063167020d2146102595780631aaf392f1461026c5780631b208a5a1461028c57806326dc5b121461029f576101f0565b806307a12945146101f55780630ad226791461021e57806311b1f790146102315780631381ba4d14610244575b600080fd5b61020861020336600461101d565b610452565b60405161021591906111c4565b60405180910390f35b61020861022c366004611072565b6104ba565b61020861023f36600461101d565b610517565b61025761025236600461101d565b610573565b005b61020861026736600461101d565b6105d4565b61027f61027a366004611072565b610679565b60405161021591906111cf565b61020861029a36600461101d565b610727565b61027f6102ad36600461101d565b61075e565b61025761077d565b6102576102c836600461109b565b6107c7565b6102576102db36600461101d565b61089a565b6102e8610944565b60405161021591906111b0565b610208610303366004611072565b610953565b6102e861031636600461101d565b61098c565b610208610329366004611072565b6109ad565b6102e86109c3565b6102576103443660046110cd565b6109d2565b61027f610a88565b61020861035f366004611072565b610a8e565b610208610372366004611072565b610ae2565b610257610b2f565b61020861038d366004611072565b610b79565b6102086103a036600461101d565b610c20565b6102576103b3366004611037565b610c40565b61027f6103c636600461101d565b610cb9565b6102086103d936600461101d565b610cd4565b6102086103ec36600461101d565b610d01565b61027f610d16565b610257610407366004611072565b610d1c565b61020861041a36600461101d565b610d77565b61043261042d36600461101d565b610dc3565b604051610215919061122e565b61025761044d36600461101d565b610e37565b6001600160a01b0381166000908152600260205260408120600301547fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4701480156104b257506001600160a01b038216600090815260026020526040902054155b90505b919050565b6001600160a01b038216600090815260046020908152604080832084845290915281205460ff168061050e57506001600160a01b038316600090815260026020526040902060040154600160a01b900460ff165b90505b92915050565b600080546001600160a01b031633148061053b57506001546001600160a01b031633145b6105605760405162461bcd60e51b8152600401610557906111d8565b60405180910390fd5b6104b261056c83610ef8565b6002610f28565b6000546001600160a01b031633148061059657506001546001600160a01b031633145b6105b25760405162461bcd60e51b8152600401610557906111d8565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b03163314806105f857506001546001600160a01b031633145b6106145760405162461bcd60e51b8152600401610557906111d8565b600061061f83610ef8565b9050600260008281526005602052604090205460ff16600381111561064057fe5b1461064f5760009150506104b5565b6000908152600560205260409020805460ff19166003179055505060068054600019019055600190565b6001600160a01b038216600090815260046020908152604080832084845290915281205460ff161580156106cf57506001600160a01b038316600090815260026020526040902060040154600160a01b900460ff165b156106dc57506000610511565b506001600160a01b0391909116600090815260036020908152604080832093835292905220547ffeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef1890565b60008061073383610ef8565b905060025b60008281526005602052604090205460ff16600381111561075557fe5b10159392505050565b6001600160a01b03166000908152600260208190526040909120015490565b6000546001600160a01b03163314806107a057506001546001600160a01b031633145b6107bc5760405162461bcd60e51b8152600401610557906111d8565b600680546001019055565b6000546001600160a01b03163314806107ea57506001546001600160a01b031633145b6108065760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b038316600081815260036020908152604080832086845282528083207ffeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef86189055928252600481528282208583529052205460ff16610895576001600160a01b03831660009081526004602090815260408083208584529091529020805460ff191660011790555b505050565b6000546001600160a01b03163314806108bd57506001546001600160a01b031633145b6108d95760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b031660009081526002602081905260409091207f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421918101919091557fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470600390910155565b6001546001600160a01b031681565b6000806109608484610f8e565b905060025b60008281526005602052604090205460ff16600381111561098257fe5b1015949350505050565b6001600160a01b039081166000908152600260205260409020600401541690565b6000806109ba8484610f8e565b90506003610965565b6000546001600160a01b031681565b6000546001600160a01b03163314806109f557506001546001600160a01b031633145b610a115760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b039182166000908152600260208181526040928390208451815590840151600182015591830151908201556060820151600382015560808201516004909101805460a0909301516001600160a01b0319909316919093161760ff60a01b1916600160a01b91151591909102179055565b60075490565b600080546001600160a01b0316331480610ab257506001546001600160a01b031633145b610ace5760405162461bcd60e51b8152600401610557906111d8565b61050e610adb8484610f8e565b6001610f28565b600080546001600160a01b0316331480610b0657506001546001600160a01b031633145b610b225760405162461bcd60e51b8152600401610557906111d8565b61050e61056c8484610f8e565b6000546001600160a01b0316331480610b5257506001546001600160a01b031633145b610b6e5760405162461bcd60e51b8152600401610557906111d8565b600780546001019055565b600080546001600160a01b0316331480610b9d57506001546001600160a01b031633145b610bb95760405162461bcd60e51b8152600401610557906111d8565b6000610bc58484610f8e565b9050600260008281526005602052604090205460ff166003811115610be657fe5b14610bf5576000915050610511565b6000908152600560205260409020805460ff1916600317905550506007805460001901905550600190565b6001600160a01b0316600090815260026020526040902060030154151590565b6000546001600160a01b0316331480610c6357506001546001600160a01b031633145b610c7f5760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b0392831660009081526002602052604090206004810180546001600160a01b031916939094169290921790925560030155565b6001600160a01b031660009081526002602052604090205490565b600080546001600160a01b03838116911614806104b25750506001546001600160a01b0390811691161490565b600080610d0d83610ef8565b90506003610738565b60065490565b6000546001600160a01b0316331480610d3f57506001546001600160a01b031633145b610d5b5760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b03909116600090815260026020526040902055565b600080546001600160a01b0316331480610d9b57506001546001600160a01b031633145b610db75760405162461bcd60e51b8152600401610557906111d8565b6104b2610adb83610ef8565b610dcb610fc1565b506001600160a01b03908116600090815260026020818152604092839020835160c08101855281548152600182015492810192909252918201549281019290925260038101546060830152600401549182166080820152600160a01b90910460ff16151560a082015290565b6000546001600160a01b0316331480610e5a57506001546001600160a01b031633145b610e765760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b03166000908152600260208190526040909120600181557f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421918101919091557fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4706003820155600401805460ff60a01b1916600160a01b179055565b600081604051602001610f0b9190611171565b604051602081830303815290604052805190602001209050919050565b600080826003811115610f3757fe5b60008581526005602052604090205460ff166003811115610f5457fe5b101590508061050e576000848152600560205260409020805484919060ff19166001836003811115610f8257fe5b02179055509392505050565b60008282604051602001610fa392919061118e565b60405160208183030381529060405280519060200120905092915050565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a081019190915290565b80356001600160a01b03811681146104b557600080fd5b803580151581146104b557600080fd5b60006020828403121561102e578081fd5b61050e82610ff6565b60008060006060848603121561104b578182fd5b61105484610ff6565b925061106260208501610ff6565b9150604084013590509250925092565b60008060408385031215611084578182fd5b61108d83610ff6565b946020939093013593505050565b6000806000606084860312156110af578283fd5b6110b884610ff6565b95602085013595506040909401359392505050565b60008082840360e08112156110e0578283fd5b6110e984610ff6565b925060c0601f19820112156110fc578182fd5b5060405160c0810181811067ffffffffffffffff8211171561111a57fe5b80604052506020840135815260408401356020820152606084013560408201526080840135606082015261115060a08501610ff6565b608082015261116160c0850161100d565b60a0820152809150509250929050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b60609290921b6bffffffffffffffffffffffff19168252601482015260340190565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b60208082526036908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c65642062792061604082015275757468656e746963617465642061646472657373657360501b606082015260800190565b815181526020808301519082015260408083015190820152606080830151908201526080808301516001600160a01b03169082015260a09182015115159181019190915260c0019056fea2646970667358221220831108797bd578e5207b0f7717657875894fce501cf25b4109f65121461461ca64736f6c63430007060033a2646970667358221220c3b6fe114c6da51f019d7729cc2ec959a0decd1375f627f7e6327030359bac6264736f6c63430007060033", diff --git a/packages/contracts/deployments/mainnet/OVM_StateTransitionerFactory.json b/packages/contracts/deployments/mainnet/OVM_StateTransitionerFactory.json index fac598a9a3c5..72ba23ac0637 100644 --- a/packages/contracts/deployments/mainnet/OVM_StateTransitionerFactory.json +++ b/packages/contracts/deployments/mainnet/OVM_StateTransitionerFactory.json @@ -1,5 +1,5 @@ { - "address": "0xAe4ef5e45C42dA513d2B48E184B64A05c18d8154", + "address": "0x38A6ed6fd76035684caDef38cF49a2FffA782B67", "abi": [ { "inputs": [ @@ -79,29 +79,29 @@ "type": "function" } ], - "transactionHash": "0x48ded21f964908ff5fd32f2b5b6dd820218680d145577e87789ee6c4f4823e92", + "transactionHash": "0xccad165e14d16a839e19f77b81be34d3c7b2138d1b9e256447e8a30ae5dfb59d", "receipt": { "to": null, - "from": "0xd033f09cB85621F98F7A84C64dB381ac16Eff818", - "contractAddress": "0xAe4ef5e45C42dA513d2B48E184B64A05c18d8154", - "transactionIndex": 101, + "from": "0x9996571372066A1545D3435C6935e3F9593A7eF5", + "contractAddress": "0x38A6ed6fd76035684caDef38cF49a2FffA782B67", + "transactionIndex": 141, "gasUsed": "4209012", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xbc5cd27fe7a430f5560b1eded2d0f4aaf6f7098bd3a96fd809546ed514b71c4f", - "transactionHash": "0x48ded21f964908ff5fd32f2b5b6dd820218680d145577e87789ee6c4f4823e92", + "blockHash": "0xa714317a982d5b02a89d09360f459eff63478a084d1fc3b267a50f9e1d8dc264", + "transactionHash": "0xccad165e14d16a839e19f77b81be34d3c7b2138d1b9e256447e8a30ae5dfb59d", "logs": [], - "blockNumber": 12410849, - "cumulativeGasUsed": "8881804", + "blockNumber": 12686773, + "cumulativeGasUsed": "12610571", "status": 1, "byzantium": true }, "args": [ - "0x668E5b997b9aE88a56cd40409119d4Db9e6d752E" + "0xdE1FCfB0851916CA5101820A69b13a4E276bd81F" ], - "solcInputHash": "f2bdab652d5102f5f11e78dae866798d", - "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\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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\":{\"_0\":\"New OVM_StateTransitioner instance.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}}},\"title\":\"OVM_StateTransitionerFactory\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"create(address,uint256,bytes32,bytes32)\":{\"notice\":\"Creates a new OVM_StateTransitioner\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"}},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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 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 external\\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 external\\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 external\\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 external\\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 external\\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 external\\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 // Prevent the Execution Manager from calling this SM again.\\n ovmStateManager.setExecutionManager(address(0));\\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 external\\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 external\\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 external\\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\":\"0x53231f64d413623b2b8c4ba1b596c9cbbe4712c9b406a42198aeaa8387a293d9\",\"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 /***************\\n * Constructor *\\n ***************/\\n\\n constructor(\\n address _libAddressManager\\n )\\n Lib_AddressResolver(_libAddressManager)\\n {}\\n\\n\\n /********************\\n * Public Functions *\\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 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\\n )\\n {\\n require(\\n msg.sender == resolve(\\\"OVM_FraudVerifier\\\"),\\n \\\"Create can only be done by the OVM_FraudVerifier.\\\"\\n );\\n\\n return new OVM_StateTransitioner(\\n _libAddressManager,\\n _stateTransitionIndex,\\n _preStateRoot,\\n _transactionHash\\n );\\n }\\n}\\n\",\"keccak256\":\"0x65ef11334a2d6931b6d3a85e7b29c39c774d19443e7040e132a58be505e3b52c\",\"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 OUT_OF_GAS,\\n INTENTIONAL_REVERT,\\n EXCEEDS_NUISANCE_GAS,\\n INVALID_STATE_ACCESS,\\n UNSAFE_BYTECODE,\\n CREATE_COLLISION,\\n STATIC_VIOLATION,\\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 }\\n\\n\\n /************************************\\n * Transaction Execution Entrypoint *\\n ************************************/\\n\\n function run(\\n Lib_OVMCodec.Transaction calldata _transaction,\\n address _txStateManager\\n ) external returns (bytes memory);\\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, bytes memory _revertdata);\\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract, bytes memory _revertdata);\\n\\n\\n /*******************************\\n * Account Abstraction Opcodes *\\n ******************************/\\n\\n function ovmGETNONCE() external returns (uint256 _nonce);\\n function ovmINCREMENTNONCE() 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 Context *\\n ***************************************/\\n\\n function getMaxTransactionGasLimit() external view returns (uint _maxTransactionGasLimit);\\n}\\n\",\"keccak256\":\"0xf023d5d6fc6a03bd52f7a57af6e21076de77e8925d065bb79db062e73e43b684\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0xcc9fc5c64f1101a5c6c397594086b1608189a9edc5c9635e1ac38f70aeeeecbf\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 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, _key, 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 != pathRemainder.length) {\\n // Our extension node is not identical to the remainder.\\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 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 path may include\\n * additional nodes (e.g., it comes directly from a proof) and we can't resize in-memory\\n * arrays without costly duplication.\\n * @param _key Full original key.\\n * @param _keyRemainder Portion of the initial key that must be inserted 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 _key,\\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 // Reference: https://github.com/ethereumjs/merkle-patricia-tree/blob/c0a10395aab37d42c175a47114ebfcbd7efcf059/src/baseTrie.ts#L294-L313\\n bool matchLeaf = false;\\n if (lastNodeType == NodeType.LeafNode) {\\n uint256 l = 0;\\n if (_path.length > 0) {\\n for (uint256 i = 0; i < _path.length - 1; i++) {\\n if (_getNodeType(_path[i]) == NodeType.BranchNode) {\\n l++;\\n } else {\\n l += _getNodeKey(_path[i]).length;\\n }\\n }\\n }\\n\\n if (\\n _getSharedNibbleLength(\\n _getNodeKey(lastNode),\\n Lib_BytesUtils.slice(Lib_BytesUtils.toNibbles(_key), l)\\n ) == _getNodeKey(lastNode).length\\n && keyRemainder.length == 0\\n ) {\\n matchLeaf = true;\\n }\\n }\\n\\n if (matchLeaf) {\\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 = _editExtensionNodeValue(currentNode, 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 * Creates a new extension node with the same key but a different value.\\n * @param _node Extension node to copy and modify.\\n * @param _value New value for the extension node.\\n * @return New node with the same key and different value.\\n */\\n function _editExtensionNodeValue(\\n TrieNode memory _node,\\n bytes memory _value\\n )\\n private\\n pure\\n returns (\\n TrieNode memory\\n )\\n {\\n bytes[] memory raw = new bytes[](2);\\n bytes memory key = _addHexPrefix(_getNodeKey(_node), false);\\n raw[0] = Lib_RLPWriter.writeBytes(Lib_BytesUtils.fromNibbles(key));\\n if (_value.length < 32) {\\n raw[1] = _value;\\n } else {\\n raw[1] = Lib_RLPWriter.writeBytes(_value);\\n }\\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 abi.encodePacked(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\":\"0x4bb09d0b4f965b57cdc6b3ace49967bcfe7f2580fa0b7863dfe288081247d876\",\"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 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\":\"0xbbdd600165307d2131340599afa9dc0991f8f63727ba3a834bca5a3d7f501da8\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"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 *\\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 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\\n )\\n {\\n bytes memory code;\\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 Full code of the contract.\\n */\\n function getCode(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes memory\\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 Size of the contract's code in bytes.\\n */\\n function getCodeSize(\\n address _address\\n )\\n internal\\n view\\n returns (\\n uint256\\n )\\n {\\n uint256 codeSize;\\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 Hash of the contract's code.\\n */\\n function getCodeHash(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n bytes32 codeHash;\\n assembly {\\n codeHash := extcodehash(_address)\\n }\\n\\n return codeHash;\\n }\\n\\n /**\\n * Creates a contract with some given initialization code.\\n * @param _code Contract initialization code.\\n * @return Address of the created contract.\\n */\\n function createContract(\\n bytes memory _code\\n )\\n internal\\n returns (\\n address\\n )\\n {\\n address created;\\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 to be generated by CREATE.\\n */\\n function getAddressForCREATE(\\n address _creator,\\n uint256 _nonce\\n )\\n internal\\n pure\\n returns (\\n 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 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 (\\n address\\n )\\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\":\"0xf29a67d78e61cb472d524b779b32cfcb39a587f4096500d5419e6425ed367d49\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50604051614b2b380380614b2b8339818101604052602081101561003357600080fd5b5051600080546001600160a01b039092166001600160a01b0319909216919091179055614ac6806100656000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806322d1470214610046578063299ca4781461009a578063461a4478146100a2575b600080fd5b61007e6004803603608081101561005c57600080fd5b506001600160a01b038135169060208101359060408101359060600135610148565b604080516001600160a01b039092168252519081900360200190f35b61007e610229565b61007e600480360360208110156100b857600080fd5b8101906020810181356401000000008111156100d357600080fd5b8201836020820111156100e557600080fd5b8035906020019184600183028401116401000000008311171561010757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610238945050505050565b600061017c6040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b815250610238565b6001600160a01b0316336001600160a01b0316146101cb5760405162461bcd60e51b8152600401808060200182810382526031815260200180614a606031913960400191505060405180910390fd5b848484846040516101db90610314565b80856001600160a01b03168152602001848152602001838152602001828152602001945050505050604051809103906000f08015801561021f573d6000803e3d6000fd5b5095945050505050565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610298578181015183820152602001610280565b50505050905090810190601f1680156102c55780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102e257600080fd5b505afa1580156102f6573d6000803e3d6000fd5b505050506040513d602081101561030c57600080fd5b505192915050565b61473e806103228339019056fe60806040523480156200001157600080fd5b506040516200473e3803806200473e833981016040819052620000349162000232565b600080546001600160a01b0319166001600160a01b038616179055600583905560028290556003829055600681905560408051808201909152601781527f4f564d5f53746174654d616e61676572466163746f72790000000000000000006020820152620000a29062000150565b6001600160a01b0316639ed93318306040518263ffffffff1660e01b8152600401620000cf919062000299565b602060405180830381600087803b158015620000ea57600080fd5b505af1158015620000ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000125919062000273565b600180546001600160a01b0319166001600160a01b039290921691909117905550620002c692505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015620001b257818101518382015260200162000198565b50505050905090810190601f168015620001e05780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b158015620001fe57600080fd5b505afa15801562000213573d6000803e3d6000fd5b505050506040513d60208110156200022a57600080fd5b505192915050565b6000806000806080858703121562000248578384fd5b84516200025581620002ad565b60208601516040870151606090970151919890975090945092505050565b60006020828403121562000285578081fd5b81516200029281620002ad565b9392505050565b6001600160a01b0391909116815260200190565b6001600160a01b0381168114620002c357600080fd5b50565b61446880620002d66000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063845fe7a31161008c578063b2fa1c9e11610066578063b2fa1c9e14610185578063b52805711461019a578063b9194310146101a2578063c1c618b8146101b5576100cf565b8063845fe7a314610155578063a244316a14610168578063b1c9fe6e14610170576100cf565b8063299ca478146100d45780632e1ac36c146100f25780632eb1375814610107578063461a44781461011a578063732f960b1461012d578063805e9d3014610140575b600080fd5b6100dc6101bd565b6040516100e99190613de6565b60405180910390f35b610105610100366004613a42565b6101cc565b005b610105610115366004613a82565b610565565b6100dc610128366004613b6a565b6108a1565b61010561013b366004613c2e565b61097f565b610148610c6f565b6040516100e99190613d3f565b610105610163366004613a42565b610c75565b610105610fa1565b610178611128565b6040516100e99190613e98565b61018d611131565b6040516100e99190613e8d565b6100dc61114c565b6101056101b03660046139e3565b61115b565b610148611475565b6000546001600160a01b031681565b60018060045460ff1660028111156101e057fe5b146102065760405162461bcd60e51b81526004016101fd906141e9565b60405180910390fd5b60025460065460005a6001546040516363b285f960e11b81529192506001600160a01b03169063c7650bf290610242908a908a90600401613dfa565b602060405180830381600087803b15801561025c57600080fd5b505af1158015610270573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102949190613acf565b15156001146102b55760405162461bcd60e51b81526004016101fd90613f94565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f1906102e6908b90600401613de6565b60c06040518083038186803b1580156102fe57600080fd5b505afa158015610312573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103369190613baf565b600154604051631aaf392f60e01b81529192506000916001600160a01b0390911690631aaf392f9061036e908c908c90600401613dfa565b60206040518083038186803b15801561038657600080fd5b505afa15801561039a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103be9190613ae9565b90506103ff886040516020016103d49190613d3f565b6040516020818303038152906040526103f46103ef8461147b565b6114c4565b89856040015161152e565b6040808401919091526001549051638f3b964760e01b81526001600160a01b0390911690638f3b964790610439908c908690600401613e34565b600060405180830381600087803b15801561045357600080fd5b505af1158015610467573d6000803e3d6000fd5b505050507f3e3ed1a676a2754a041b49bf752e0f167c8753495e36c320fe01d1ef7476253c898960405161049c929190613dfa565b60405180910390a1505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561054357600080fd5b505af1158015610557573d6000803e3d6000fd5b505050505050505050505050565b60018060045460ff16600281111561057957fe5b146105965760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a9050600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156105ef57600080fd5b505afa158015610603573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106279190613ae9565b156106445760405162461bcd60e51b81526004016101fd90614075565b600154604051630b38106960e11b81526001600160a01b039091169063167020d290610674908990600401613de6565b602060405180830381600087803b15801561068e57600080fd5b505af11580156106a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c69190613acf565b15156001146106e75760405162461bcd60e51b81526004016101fd9061412f565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f190610718908a90600401613de6565b60c06040518083038186803b15801561073057600080fd5b505afa158015610744573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107689190613baf565b90506107a78760405160200161077e9190613d22565b60405160208183030381529060405261079e61079984611554565b611594565b8860035461152e565b6003556040517fcec9ef675d775706a02b43afe48af52c5019bc50f99582e3208c6ff55d59c008906107da908990613de6565b60405180910390a15060005a8203905061081a6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561088057600080fd5b505af1158015610894573d6000803e3d6000fd5b5050505050505050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156109015781810151838201526020016108e9565b50505050905090810190601f16801561092e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561094b57600080fd5b505afa15801561095f573d6000803e3d6000fd5b505050506040513d602081101561097557600080fd5b505190505b919050565b60008060045460ff16600281111561099357fe5b146109b05760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a90506006546109c78661169d565b146109e45760405162461bcd60e51b81526004016101fd9061423a565b6103e88560a0015161040802816109f757fe5b04620186a0015a1015610a1c5760405162461bcd60e51b81526004016101fd906140d2565b6000610a536040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b8152506108a1565b600154604051631381ba4d60e01b81529192506001600160a01b031690631381ba4d90610a84908490600401613de6565b600060405180830381600087803b158015610a9e57600080fd5b505af1158015610ab2573d6000803e3d6000fd5b5050600154604051639be3ad6760e01b81526001600160a01b038086169450639be3ad679350610ae9928b929116906004016142ce565b600060405180830381600087803b158015610b0357600080fd5b505af1158015610b17573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b3f9190810190613b01565b50600154604051631381ba4d60e01b81526001600160a01b0390911690631381ba4d90610b7190600090600401613de6565b600060405180830381600087803b158015610b8b57600080fd5b505af1158015610b9f573d6000803e3d6000fd5b50506004805460ff191660011790555060009150505a82039050610be96040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b158015610c4f57600080fd5b505af1158015610c63573d6000803e3d6000fd5b50505050505050505050565b60025490565b60008060045460ff166002811115610c8957fe5b14610ca65760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a600154604051630ad2267960e01b81529192506001600160a01b031690630ad2267990610ce2908a908a90600401613dfa565b60206040518083038186803b158015610cfa57600080fd5b505afa158015610d0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d329190613acf565b15610d4f5760405162461bcd60e51b81526004016101fd90613eac565b60015460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf90610d7f908a90600401613de6565b60206040518083038186803b158015610d9757600080fd5b505afa158015610dab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcf9190613acf565b1515600114610df05760405162461bcd60e51b81526004016101fd90614271565b60015460405163136e2d8960e11b81526000916001600160a01b0316906326dc5b1290610e21908b90600401613de6565b60206040518083038186803b158015610e3957600080fd5b505afa158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e719190613ae9565b905060007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421821415610ea557506000610f02565b600080610ed28a604051602001610ebc9190613d3f565b6040516020818303038152906040528a866116b6565b909250905060018215151415610efa57610ef3610eee826116df565b6116f2565b9250610eff565b600092505b50505b600154604051635c17d62960e01b81526001600160a01b0390911690635c17d62990610f36908c908c908690600401613e13565b600060405180830381600087803b158015610f5057600080fd5b505af1158015610f64573d6000803e3d6000fd5b50505050505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b60018060045460ff166002811115610fb557fe5b14610fd25760405162461bcd60e51b81526004016101fd906141e9565b600160009054906101000a90046001600160a01b03166001600160a01b031663d7bd4a2a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561102057600080fd5b505afa158015611034573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110589190613ae9565b156110755760405162461bcd60e51b81526004016101fd90613f37565b600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156110c357600080fd5b505afa1580156110d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110fb9190613ae9565b156111185760405162461bcd60e51b81526004016101fd9061418c565b506004805460ff19166002179055565b60045460ff1681565b6000600260045460ff16600281111561114657fe5b14905090565b6001546001600160a01b031681565b60008060045460ff16600281111561116f57fe5b1461118c5760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a60015460405163c8e40fbf60e01b81529192506001600160a01b03169063c8e40fbf906111c6908a90600401613de6565b60206040518083038186803b1580156111de57600080fd5b505afa1580156111f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112169190613acf565b1580156112a057506001546040516307a1294560e01b81526001600160a01b03909116906307a129459061124e908a90600401613de6565b60206040518083038186803b15801561126657600080fd5b505afa15801561127a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129e9190613acf565b155b6112bc5760405162461bcd60e51b81526004016101fd90613ef1565b6000806112eb896040516020016112d39190613d22565b604051602081830303815290604052886002546116b6565b90925090506001821515141561140c57600061130682611721565b606081015190915089907fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470141561133f5750600061136a565b816060015161134d826117b3565b1461136a5760405162461bcd60e51b81526004016101fd90613ff2565b6001546040805160c08101825284518152602080860151908201528482015181830152606080860151908201526001600160a01b038481166080830152600060a08301529151638f3b964760e01b81529190921691638f3b9647916113d3918f91600401613e34565b600060405180830381600087803b1580156113ed57600080fd5b505af1158015611401573d6000803e3d6000fd5b50505050505061143c565b600154604051630d631c9d60e31b81526001600160a01b0390911690636b18e4e890610f36908c90600401613de6565b505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b60035490565b6060806000805b6020811085821a15161561149c5760019182019101611482565b5060405191506040820160405283600882021b60208301528060200382525080915050919050565b606080825160011480156114ec57506080836000815181106114e257fe5b016020015160f81c105b156114f8575081611528565b611504835160806117b7565b83604051602001611516929190613d48565b60405160208183030381529060405290505b92915050565b60008061153a86611906565b905061154881868686611936565b9150505b949350505050565b61155c613901565b604051806080016040528083600001518152602001836020015181526020018360400151815260200183606001518152509050919050565b60408051600480825260a0820190925260609160009190816020015b60608152602001906001900390816115b057505083519091506115d6906103ef9061147b565b816000815181106115e357fe5b60200260200101819052506116016103ef846020015160001b61147b565b8160018151811061160e57fe5b602002602001018190525061164583604001516040516020016116319190613d3f565b6040516020818303038152906040526114c4565b8160028151811061165257fe5b602002602001018190525061167583606001516040516020016116319190613d3f565b8160038151811061168257fe5b6020026020010181905250611696816119d2565b9392505050565b60006116a882611a16565b805190602001209050919050565b6000606060006116c586611906565b90506116d2818686611a51565b9250925050935093915050565b60606115286116ed83611b24565b611b49565b600080600060208451111561170857602061170b565b83515b6020858101519190036008021c92505050919050565b611729613901565b600061173483611bd8565b9050604051806080016040528061175e8360008151811061175157fe5b6020026020010151611beb565b81526020016117738360018151811061175157fe5b81526020016117958360028151811061178857fe5b6020026020010151611bf2565b81526020016117aa8360038151811061178857fe5b90529392505050565b3f90565b6060806038841015611811576040805160018082528183019092529060208201818036833701905050905082840160f81b816000815181106117f557fe5b60200101906001600160f81b031916908160001a905350611696565b600060015b80868161181f57fe5b04156118345760019091019061010002611816565b816001016001600160401b038111801561184d57600080fd5b506040519080825280601f01601f191660200182016040528015611878576020820181803683370190505b50925084820160370160f81b8360008151811061189157fe5b60200101906001600160f81b031916908160001a905350600190505b8181116118fd576101008183036101000a87816118c657fe5b04816118ce57fe5b0660f81b8382815181106118de57fe5b60200101906001600160f81b031916908160001a9053506001016118ad565b50509392505050565b606081805190602001206040516020016119209190613d3f565b6040516020818303038152906040529050919050565b6040805180820190915260018152600160ff1b60209091015260007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42182141561198a576119838585611cec565b905061154c565b600061199584611d10565b90506000806119a5838987611de6565b509150915060006119b984848b858c61218c565b90506119c5818a61256a565b9998505050505050505050565b606060006119df836126c3565b90506119ed815160c06117b7565b816040516020016119ff929190613d48565b604051602081830303815290604052915050919050565b6060816000015182602001518360400151846060015185608001518660a001518760c001516040516020016119209796959493929190613d77565b600060606000611a6085611d10565b90506000806000611a72848a89611de6565b81519295509093509150158080611a865750815b611ad7576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b600081611af35760405180602001604052806000815250611b12565b611b12866001870381518110611b0557fe5b60200260200101516127cc565b919b919a509098505050505050505050565b611b2c613928565b506040805180820190915281518152602082810190820152919050565b60606000806000611b59856127e8565b919450925090506000816001811115611b6e57fe5b14611bc0576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b611bcf85602001518484612b11565b95945050505050565b6060611528611be683611b24565b612bbe565b6000611528825b6000602182600001511115611c4e576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6000806000611c5c856127e8565b919450925090506000816001811115611c7157fe5b14611cc3576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b602080860151840180519091841015611ce25760208490036101000a90045b9695505050505050565b6000611d00611cfa84612d34565b83612e30565b5180516020909101209392505050565b60606000611d1d83611bd8565b9050600081516001600160401b0381118015611d3857600080fd5b50604051908082528060200260200182016040528015611d7257816020015b611d5f613942565b815260200190600190039081611d575790505b50905060005b8251811015611dde576000611d9f848381518110611d9257fe5b6020026020010151611b49565b90506040518060400160405280828152602001611dbb83611bd8565b815250838381518110611dca57fe5b602090810291909101015250600101611d78565b509392505050565b60006060818080611df687612d34565b905085600080611e04613942565b60005b8c51811015612164578c8181518110611e1c57fe5b6020026020010151915082840193506001870196508360001415611e9057815180516020909101208514611e8b576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b611f57565b815151602011611ef757815180516020909101208514611e8b576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b84611f058360000151612ec4565b14611f57576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b60208201515160111415611fc6578551841415611f7357612164565b6000868581518110611f8157fe5b602001015160f81c60f81b60f81c9050600083602001518260ff1681518110611fa657fe5b60200260200101519050611fb981612ef0565b965060019450505061215c565b6002826020015151141561210f576000611fdf83612f26565b9050600081600081518110611ff057fe5b016020015160f81c90506001811660020360006120108460ff8416612f44565b9050600061201e8b8a612f44565b9050600061202c8383612f71565b905060ff851660021480612043575060ff85166003145b15612075578083511480156120585750808251145b1561206257988901985b50600160ff1b9950612164945050505050565b60ff85161580612088575060ff85166001145b156120d857825181146120a85750600160ff1b9950612164945050505050565b6120c988602001516001815181106120bc57fe5b6020026020010151612ef0565b9a50975061215c945050505050565b60405162461bcd60e51b815260040180806020018281038252602681526020018061440d6026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b600101611e07565b50600160ff1b8414866121778786612f44565b909e909d50909b509950505050505050505050565b6060600083905060008760018803815181106121a457fe5b6020026020010151905060006121b982612fd7565b6040805160038082526080820190925291925060009190816020015b6121dd613942565b8152602001906001900390816121d5579050509050600080600284600281111561220357fe5b14156122cd578b51600090156122885760005b60018e51038110156122865760006122408f838151811061223357fe5b6020026020010151612fd7565b600281111561224b57fe5b141561225c5760019091019061227e565b6122788e828151811061226b57fe5b60200260200101516130ad565b51820191505b600101612216565b505b612291866130ad565b516122b561229e886130ad565b6122b06122aa8f612d34565b85612f44565b612f71565b1480156122c157508651155b156122cb57600191505b505b8015612307576122e56122df866130ad565b89612e30565b8383815181106122f157fe5b602002602001018190525060018201915061254b565b600084600281111561231557fe5b141561237e57855161234d5761232b85896130c0565b83838151811061233757fe5b6020026020010181905250600182019150612379565b8483838151811061235a57fe5b60200260200101819052506001820191506122e56122df876001612f44565b61254b565b6000612389866130ad565b905060006123978289612f71565b905080156123f85760006123ad8360008461310b565b90506123c1816123bc8d61325b565b61329c565b8686815181106123cd57fe5b60200260200101819052506001850194506123e88383612f44565b92506123f48983612f44565b9850505b60006124026132e0565b9050825160001415612427576124208161241b8a6127cc565b6130c0565b90506124bf565b60008360008151811061243657fe5b016020015160f81c905061244b846001612f44565b9350600288600281111561245b57fe5b1415612496576000612475856124708c6127cc565b612e30565b905061248e8383612489846000015161325b565b61336d565b9250506124bd565b8351156124ac576000612475856123bc8c6127cc565b6124ba82826124898c6127cc565b91505b505b88516124f4576124cf818c6130c0565b9050808686815181106124de57fe5b6020026020010181905250600185019450612547565b6124ff896001612f44565b98508086868151811061250e57fe5b6020026020010181905250600185019450612529898c612e30565b86868151811061253557fe5b60200260200101819052506001850194505b5050505b61255a8c60018d0385856133c6565b9c9b505050505050505050505050565b60008061257683612d34565b9050612580613942565b84516000906060905b80156126ae5787600182038151811061259e57fe5b602002602001015193506125b184612fd7565b925060028360028111156125c157fe5b14156125ec5760006125d2856130ad565b90506125e4866000835189510361310b565b955050612698565b60018360028111156125fa57fe5b141561263a57600061260b856130ad565b905061261d866000835189510361310b565b8351909650156126345761263185846134a8565b94505b50612698565b600083600281111561264857fe5b1415612698578151156126985760008560018751038151811061266757fe5b602001015160f81c60f81b60f81c9050612687866000600189510361310b565b955061269485828561336d565b9450505b83516126a39061325b565b915060001901612589565b50509051805160209091012095945050505050565b60608151600014156126e4575060408051600081526020810190915261097a565b6000805b8351811015612717578381815181106126fd57fe5b6020026020010151518201915080806001019150506126e8565b6000826001600160401b038111801561272f57600080fd5b506040519080825280601f01601f19166020018201604052801561275a576020820181803683370190505b50600092509050602081015b85518310156127c357600086848151811061277d57fe5b60200260200101519050600060208201905061279b83828451613554565b8785815181106127a757fe5b6020026020010151518301925050508280600101935050612766565b50949350505050565b60208101518051606091611528916000198101908110611d9257fe5b600080600080846000015111612845576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f811161286a576000600160009450945094505050612b0a565b60b781116128df578551607f1982019081106128cd576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b60019550935060009250612b0a915050565b60bf81116129c357855160b6198201908110612942576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a60018501510490508082018860000151116129ae576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b60019091019550935060009250612b0a915050565b60f78111612a3757855160bf198201908110612a26576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b600195509350849250612b0a915050565b855160f6198201908110612a92576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111612af7576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b6001918201965094509250612b0a915050565b9193909250565b60606000826001600160401b0381118015612b2b57600080fd5b506040519080825280601f01601f191660200182016040528015612b56576020820181803683370190505b509050805160001415612b6a579050611696565b8484016020820160005b60208604811015612b95578251825260209283019290910190600101612b74565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b6060600080612bcc846127e8565b91935090915060019050816001811115612be257fe5b14612c34576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b612c55613928565b815260200190600190039081612c4d5790505090506000835b8651811015612d295760208210612cb65760405162461bcd60e51b815260040180806020018281038252602a8152602001806143e3602a913960400191505060405180910390fd5b600080612ce26040518060400160405280858c60000151038152602001858c60200151018152506127e8565b509150915060405180604001604052808383018152602001848b6020015101815250858581518110612d1057fe5b6020908102919091010152600193909301920101612c6e565b508152949350505050565b6060600082516002026001600160401b0381118015612d5257600080fd5b506040519080825280601f01601f191660200182016040528015612d7d576020820181803683370190505b50905060005b8351811015612e29576004848281518110612d9a57fe5b602001015160f81c60f81b6001600160f81b031916901c828260020281518110612dc057fe5b60200101906001600160f81b031916908160001a9053506010848281518110612de557fe5b016020015160f81c81612df457fe5b0660f81b828260020260010181518110612e0a57fe5b60200101906001600160f81b031916908160001a905350600101612d83565b5092915050565b612e38613942565b60408051600280825260608201909252600091816020015b6060815260200190600190039081612e505790505090506000612e74856001613598565b9050612e826103ef826136ef565b82600081518110612e8f57fe5b6020026020010181905250612ea3846114c4565b82600181518110612eb057fe5b6020026020010181905250611bcf826137bf565b6000602082511015612edb5750602081015161097a565b81806020019051602081101561097557600080fd5b60006060602083600001511015612f1157612f0a836137ee565b9050612f1d565b612f1a83611b49565b90505b61169681612ec4565b6060611528612f3f8360200151600081518110611d9257fe5b612d34565b606082518210612f635750604080516020810190915260008152611528565b61169683838486510361310b565b6000805b808451118015612f855750808351115b8015612fca5750828181518110612f9857fe5b602001015160f81c60f81b6001600160f81b031916848281518110612fb957fe5b01602001516001600160f81b031916145b1561169657600101612f75565b60208101515160009060111415612ff05750600061097a565b6002826020015151141561306c57600061300983612f26565b905060008160008151811061301a57fe5b016020015160f81c90506002811480613036575060ff81166003145b156130465760029250505061097a565b60ff81161580613059575060ff81166001145b156130695760019250505061097a565b50505b6040805162461bcd60e51b8152602060048201526011602482015270496e76616c6964206e6f6465207479706560781b604482015290519081900360640190fd5b60606115286130bb83612f26565b6137f9565b6130c8613942565b60006130d3836114c4565b90506130de81611b24565b6020850151805160001981019081106130f357fe5b602002602001018190525061154c8460200151613842565b60608182601f011015613156576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b82828401101561319e576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b818301845110156131ea576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b60608215801561320957604051915060008252602082016040526127c3565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561324257805183526020928301920161322a565b5050858452601f01601f19166040525050949350505050565b606060208251101561326e57508061097a565b818051906020012060405160200180828152602001915050604051602081830303815290604052905061097a565b6132a4613942565b60408051600280825260608201909252600091816020015b60608152602001906001900390816132bc5790505090506000612e74856000613598565b6132e8613942565b6040805160118082526102408201909252600091816020015b606081526020019060019003908161330157905050905060005b815181101561335d57604051806040016040528060018152602001600160ff1b81525082828151811061334a57fe5b602090810291909101015260010161331b565b50613367816137bf565b91505090565b613375613942565b6000602083511061338e57613389836114c4565b613390565b825b905061339b81611b24565b85602001518560ff16815181106133ae57fe5b6020026020010181905250611bcf8560200151613842565b606060008285016001600160401b03811180156133e257600080fd5b5060405190808252806020026020018201604052801561341c57816020015b613409613942565b8152602001906001900390816134015790505b50905060005b8581101561345d5786818151811061343657fe5b602002602001015182828151811061344a57fe5b6020908102919091010152600101613422565b5060005b8381101561349e5784818151811061347557fe5b6020026020010151828783018151811061348b57fe5b6020908102919091010152600101613461565b5095945050505050565b6134b0613942565b60408051600280825260608201909252600091816020015b60608152602001906001900390816134c857905050905060006134f46134ed866130ad565b6000613598565b90506135026103ef826136ef565b8260008151811061350f57fe5b602002602001018190525060208451101561354257838260018151811061353257fe5b602002602001018190525061354b565b612ea3846114c4565b611bcf826137bf565b8282825b60208110613577578151835260209283019290910190601f1901613558565b905182516020929092036101000a6000190180199091169116179052505050565b60606000826135a85760006135ab565b60025b9050600060028551816135ba57fe5b06905060008160020360ff166001600160401b03811180156135db57600080fd5b506040519080825280601f01601f191660200182016040528015613606576020820181803683370190505b50905081830160f81b8160008151811061361c57fe5b60200101906001600160f81b031916908160001a90535080866040516020018083805190602001908083835b602083106136675780518252601f199092019160209182019101613648565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106136af5780518252601f199092019160209182019101613690565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052935050505092915050565b6060600060028351816136fe57fe5b046001600160401b038111801561371457600080fd5b506040519080825280601f01601f19166020018201604052801561373f576020820181803683370190505b50905060005b8151811015612e295783816002026001018151811061376057fe5b602001015160f81c60f81b600485836002028151811061377c57fe5b602001015160f81c60f81b6001600160f81b031916901b178282815181106137a057fe5b60200101906001600160f81b031916908160001a905350600101613745565b6137c7613942565b60006137d2836119d2565b905060405180604001604052808281526020016117aa83611bd8565b6060611528826138eb565b606060028260008151811061380a57fe5b016020015160f81c8161381957fe5b0660ff166000141561383757613830826002612f44565b905061097a565b613830826001612f44565b61384a613942565b600082516001600160401b038111801561386357600080fd5b5060405190808252806020026020018201604052801561389757816020015b60608152602001906001900390816138825790505b50905060005b83518110156138e1576138c28482815181106138b557fe5b60200260200101516137ee565b8282815181106138ce57fe5b602090810291909101015260010161389d565b50611696816137bf565b6060611528826020015160008460000151612b11565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060008152602001600081525090565b604051806040016040528060608152602001606081525090565b600061396f61396a84614379565b614356565b905082815283838301111561398357600080fd5b828260208301376000602084830101529392505050565b803561097a816143ca565b8051801515811461097a57600080fd5b600082601f8301126139c5578081fd5b6116968383356020850161395c565b80356002811061097a57600080fd5b6000806000606084860312156139f7578283fd5b8335613a02816143ca565b92506020840135613a12816143ca565b915060408401356001600160401b03811115613a2c578182fd5b613a38868287016139b5565b9150509250925092565b600080600060608486031215613a56578283fd5b8335613a61816143ca565b92506020840135915060408401356001600160401b03811115613a2c578182fd5b60008060408385031215613a94578182fd5b8235613a9f816143ca565b915060208301356001600160401b03811115613ab9578182fd5b613ac5858286016139b5565b9150509250929050565b600060208284031215613ae0578081fd5b611696826139a5565b600060208284031215613afa578081fd5b5051919050565b600060208284031215613b12578081fd5b81516001600160401b03811115613b27578182fd5b8201601f81018413613b37578182fd5b8051613b4561396a82614379565b818152856020838501011115613b59578384fd5b611bcf82602083016020860161439a565b600060208284031215613b7b578081fd5b81356001600160401b03811115613b90578182fd5b8201601f81018413613ba0578182fd5b61154c8482356020840161395c565b600060c08284031215613bc0578081fd5b60405160c081018181106001600160401b0382111715613bdc57fe5b8060405250825181526020830151602082015260408301516040820152606083015160608201526080830151613c11816143ca565b6080820152613c2260a084016139a5565b60a08201529392505050565b600060208284031215613c3f578081fd5b81356001600160401b0380821115613c55578283fd5b9083019060e08286031215613c68578283fd5b613c7260e0614356565b8235815260208301356020820152613c8c604084016139d4565b6040820152613c9d6060840161399a565b6060820152613cae6080840161399a565b608082015260a083013560a082015260c083013582811115613cce578485fd5b613cda878286016139b5565b60c08301525095945050505050565b6001600160a01b03169052565b60008151808452613d0e81602086016020860161439a565b601f01601f19169290920160200192915050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b90815260200190565b60008351613d5a81846020880161439a565b835190830190613d6e81836020880161439a565b01949350505050565b600088825287602083015260028710613d8c57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b166055840152508360698301528251613dd381608985016020870161439a565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b600060e08201905060018060a01b038085168352835160208401526020840151604084015260408401516060840152606084015160808401528060808501511660a08401525060a0830151151560c08301529392505050565b901515815260200190565b6020810160038310613ea657fe5b91905290565b60208082526025908201527f53746f7261676520736c6f742068617320616c7265616479206265656e20707260408201526437bb32b71760d91b606082015260800190565b60208082526026908201527f4163636f756e742073746174652068617320616c7265616479206265656e20706040820152653937bb32b71760d11b606082015260800190565b6020808252603e908201527f416c6c206163636f756e7473206d75737420626520636f6d6d6974746564206260408201527f65666f726520636f6d706c6574696e672061207472616e736974696f6e2e0000606082015260800190565b602080825260409082018190527f53746f7261676520736c6f742076616c7565207761736e2774206368616e6765908201527f64206f722068617320616c7265616479206265656e20636f6d6d69747465642e606082015260800190565b6020808252605b908201527f4f564d5f53746174655472616e736974696f6e65723a2050726f76696465642060408201527f4c3120636f6e747261637420636f6465206861736820646f6573206e6f74206d60608201527f61746368204c3220636f6e747261637420636f646520686173682e0000000000608082015260a00190565b6020808252603f908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d6d697474696e67206163636f756e74207374617465732e00606082015260800190565b60208082526038908201527f4e6f7420656e6f7567682067617320746f2065786563757465207472616e736160408201527f6374696f6e2064657465726d696e6973746963616c6c792e0000000000000000606082015260800190565b6020808252603b908201527f4163636f756e74207374617465207761736e2774206368616e676564206f722060408201527f68617320616c7265616479206265656e20636f6d6d69747465642e0000000000606082015260800190565b6020808252603d908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d706c6574696e672061207472616e736974696f6e2e000000606082015260800190565b60208082526031908201527f46756e6374696f6e206d7573742062652063616c6c656420647572696e67207460408201527034329031b7b93932b1ba10383430b9b29760791b606082015260800190565b6020808252601d908201527f496e76616c6964207472616e73616374696f6e2070726f76696465642e000000604082015260600190565b60208082526038908201527f436f6e7472616374206d757374206265207665726966696564206265666f726560408201527f2070726f76696e6720612073746f7261676520736c6f742e0000000000000000606082015260800190565b60006040825283516040830152602084015160608301526040840151600281106142f457fe5b60808381019190915260608501516001600160a01b031660a084015284015161432060c0840182613ce9565b5060a084015160e083015260c084015160e0610100840152614346610120840182613cf6565b9150506116966020830184613ce9565b6040518181016001600160401b038111828210171561437157fe5b604052919050565b60006001600160401b0382111561438c57fe5b50601f01601f191660200190565b60005b838110156143b557818101518382015260200161439d565b838111156143c4576000848401525b50505050565b6001600160a01b03811681146143df57600080fd5b5056fe50726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e52656365697665642061206e6f6465207769746820616e20756e6b6e6f776e20707265666978a2646970667358221220e1e4d3b66fdb29cc31b98f8b28be1f1ae5444146eb6157e8e4757ceec746aba764736f6c634300070600334372656174652063616e206f6e6c7920626520646f6e6520627920746865204f564d5f467261756456657269666965722ea264697066735822122055726a03c626eda10428d6a8adff2cef3ee762aaa0d2c446eee2a007c7036add64736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c806322d1470214610046578063299ca4781461009a578063461a4478146100a2575b600080fd5b61007e6004803603608081101561005c57600080fd5b506001600160a01b038135169060208101359060408101359060600135610148565b604080516001600160a01b039092168252519081900360200190f35b61007e610229565b61007e600480360360208110156100b857600080fd5b8101906020810181356401000000008111156100d357600080fd5b8201836020820111156100e557600080fd5b8035906020019184600183028401116401000000008311171561010757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610238945050505050565b600061017c6040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b815250610238565b6001600160a01b0316336001600160a01b0316146101cb5760405162461bcd60e51b8152600401808060200182810382526031815260200180614a606031913960400191505060405180910390fd5b848484846040516101db90610314565b80856001600160a01b03168152602001848152602001838152602001828152602001945050505050604051809103906000f08015801561021f573d6000803e3d6000fd5b5095945050505050565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610298578181015183820152602001610280565b50505050905090810190601f1680156102c55780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102e257600080fd5b505afa1580156102f6573d6000803e3d6000fd5b505050506040513d602081101561030c57600080fd5b505192915050565b61473e806103228339019056fe60806040523480156200001157600080fd5b506040516200473e3803806200473e833981016040819052620000349162000232565b600080546001600160a01b0319166001600160a01b038616179055600583905560028290556003829055600681905560408051808201909152601781527f4f564d5f53746174654d616e61676572466163746f72790000000000000000006020820152620000a29062000150565b6001600160a01b0316639ed93318306040518263ffffffff1660e01b8152600401620000cf919062000299565b602060405180830381600087803b158015620000ea57600080fd5b505af1158015620000ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000125919062000273565b600180546001600160a01b0319166001600160a01b039290921691909117905550620002c692505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015620001b257818101518382015260200162000198565b50505050905090810190601f168015620001e05780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b158015620001fe57600080fd5b505afa15801562000213573d6000803e3d6000fd5b505050506040513d60208110156200022a57600080fd5b505192915050565b6000806000806080858703121562000248578384fd5b84516200025581620002ad565b60208601516040870151606090970151919890975090945092505050565b60006020828403121562000285578081fd5b81516200029281620002ad565b9392505050565b6001600160a01b0391909116815260200190565b6001600160a01b0381168114620002c357600080fd5b50565b61446880620002d66000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063845fe7a31161008c578063b2fa1c9e11610066578063b2fa1c9e14610185578063b52805711461019a578063b9194310146101a2578063c1c618b8146101b5576100cf565b8063845fe7a314610155578063a244316a14610168578063b1c9fe6e14610170576100cf565b8063299ca478146100d45780632e1ac36c146100f25780632eb1375814610107578063461a44781461011a578063732f960b1461012d578063805e9d3014610140575b600080fd5b6100dc6101bd565b6040516100e99190613de6565b60405180910390f35b610105610100366004613a42565b6101cc565b005b610105610115366004613a82565b610565565b6100dc610128366004613b6a565b6108a1565b61010561013b366004613c2e565b61097f565b610148610c6f565b6040516100e99190613d3f565b610105610163366004613a42565b610c75565b610105610fa1565b610178611128565b6040516100e99190613e98565b61018d611131565b6040516100e99190613e8d565b6100dc61114c565b6101056101b03660046139e3565b61115b565b610148611475565b6000546001600160a01b031681565b60018060045460ff1660028111156101e057fe5b146102065760405162461bcd60e51b81526004016101fd906141e9565b60405180910390fd5b60025460065460005a6001546040516363b285f960e11b81529192506001600160a01b03169063c7650bf290610242908a908a90600401613dfa565b602060405180830381600087803b15801561025c57600080fd5b505af1158015610270573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102949190613acf565b15156001146102b55760405162461bcd60e51b81526004016101fd90613f94565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f1906102e6908b90600401613de6565b60c06040518083038186803b1580156102fe57600080fd5b505afa158015610312573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103369190613baf565b600154604051631aaf392f60e01b81529192506000916001600160a01b0390911690631aaf392f9061036e908c908c90600401613dfa565b60206040518083038186803b15801561038657600080fd5b505afa15801561039a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103be9190613ae9565b90506103ff886040516020016103d49190613d3f565b6040516020818303038152906040526103f46103ef8461147b565b6114c4565b89856040015161152e565b6040808401919091526001549051638f3b964760e01b81526001600160a01b0390911690638f3b964790610439908c908690600401613e34565b600060405180830381600087803b15801561045357600080fd5b505af1158015610467573d6000803e3d6000fd5b505050507f3e3ed1a676a2754a041b49bf752e0f167c8753495e36c320fe01d1ef7476253c898960405161049c929190613dfa565b60405180910390a1505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561054357600080fd5b505af1158015610557573d6000803e3d6000fd5b505050505050505050505050565b60018060045460ff16600281111561057957fe5b146105965760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a9050600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156105ef57600080fd5b505afa158015610603573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106279190613ae9565b156106445760405162461bcd60e51b81526004016101fd90614075565b600154604051630b38106960e11b81526001600160a01b039091169063167020d290610674908990600401613de6565b602060405180830381600087803b15801561068e57600080fd5b505af11580156106a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c69190613acf565b15156001146106e75760405162461bcd60e51b81526004016101fd9061412f565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f190610718908a90600401613de6565b60c06040518083038186803b15801561073057600080fd5b505afa158015610744573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107689190613baf565b90506107a78760405160200161077e9190613d22565b60405160208183030381529060405261079e61079984611554565b611594565b8860035461152e565b6003556040517fcec9ef675d775706a02b43afe48af52c5019bc50f99582e3208c6ff55d59c008906107da908990613de6565b60405180910390a15060005a8203905061081a6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561088057600080fd5b505af1158015610894573d6000803e3d6000fd5b5050505050505050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156109015781810151838201526020016108e9565b50505050905090810190601f16801561092e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561094b57600080fd5b505afa15801561095f573d6000803e3d6000fd5b505050506040513d602081101561097557600080fd5b505190505b919050565b60008060045460ff16600281111561099357fe5b146109b05760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a90506006546109c78661169d565b146109e45760405162461bcd60e51b81526004016101fd9061423a565b6103e88560a0015161040802816109f757fe5b04620186a0015a1015610a1c5760405162461bcd60e51b81526004016101fd906140d2565b6000610a536040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b8152506108a1565b600154604051631381ba4d60e01b81529192506001600160a01b031690631381ba4d90610a84908490600401613de6565b600060405180830381600087803b158015610a9e57600080fd5b505af1158015610ab2573d6000803e3d6000fd5b5050600154604051639be3ad6760e01b81526001600160a01b038086169450639be3ad679350610ae9928b929116906004016142ce565b600060405180830381600087803b158015610b0357600080fd5b505af1158015610b17573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b3f9190810190613b01565b50600154604051631381ba4d60e01b81526001600160a01b0390911690631381ba4d90610b7190600090600401613de6565b600060405180830381600087803b158015610b8b57600080fd5b505af1158015610b9f573d6000803e3d6000fd5b50506004805460ff191660011790555060009150505a82039050610be96040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b158015610c4f57600080fd5b505af1158015610c63573d6000803e3d6000fd5b50505050505050505050565b60025490565b60008060045460ff166002811115610c8957fe5b14610ca65760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a600154604051630ad2267960e01b81529192506001600160a01b031690630ad2267990610ce2908a908a90600401613dfa565b60206040518083038186803b158015610cfa57600080fd5b505afa158015610d0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d329190613acf565b15610d4f5760405162461bcd60e51b81526004016101fd90613eac565b60015460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf90610d7f908a90600401613de6565b60206040518083038186803b158015610d9757600080fd5b505afa158015610dab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcf9190613acf565b1515600114610df05760405162461bcd60e51b81526004016101fd90614271565b60015460405163136e2d8960e11b81526000916001600160a01b0316906326dc5b1290610e21908b90600401613de6565b60206040518083038186803b158015610e3957600080fd5b505afa158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e719190613ae9565b905060007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421821415610ea557506000610f02565b600080610ed28a604051602001610ebc9190613d3f565b6040516020818303038152906040528a866116b6565b909250905060018215151415610efa57610ef3610eee826116df565b6116f2565b9250610eff565b600092505b50505b600154604051635c17d62960e01b81526001600160a01b0390911690635c17d62990610f36908c908c908690600401613e13565b600060405180830381600087803b158015610f5057600080fd5b505af1158015610f64573d6000803e3d6000fd5b50505050505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b60018060045460ff166002811115610fb557fe5b14610fd25760405162461bcd60e51b81526004016101fd906141e9565b600160009054906101000a90046001600160a01b03166001600160a01b031663d7bd4a2a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561102057600080fd5b505afa158015611034573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110589190613ae9565b156110755760405162461bcd60e51b81526004016101fd90613f37565b600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156110c357600080fd5b505afa1580156110d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110fb9190613ae9565b156111185760405162461bcd60e51b81526004016101fd9061418c565b506004805460ff19166002179055565b60045460ff1681565b6000600260045460ff16600281111561114657fe5b14905090565b6001546001600160a01b031681565b60008060045460ff16600281111561116f57fe5b1461118c5760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a60015460405163c8e40fbf60e01b81529192506001600160a01b03169063c8e40fbf906111c6908a90600401613de6565b60206040518083038186803b1580156111de57600080fd5b505afa1580156111f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112169190613acf565b1580156112a057506001546040516307a1294560e01b81526001600160a01b03909116906307a129459061124e908a90600401613de6565b60206040518083038186803b15801561126657600080fd5b505afa15801561127a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129e9190613acf565b155b6112bc5760405162461bcd60e51b81526004016101fd90613ef1565b6000806112eb896040516020016112d39190613d22565b604051602081830303815290604052886002546116b6565b90925090506001821515141561140c57600061130682611721565b606081015190915089907fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470141561133f5750600061136a565b816060015161134d826117b3565b1461136a5760405162461bcd60e51b81526004016101fd90613ff2565b6001546040805160c08101825284518152602080860151908201528482015181830152606080860151908201526001600160a01b038481166080830152600060a08301529151638f3b964760e01b81529190921691638f3b9647916113d3918f91600401613e34565b600060405180830381600087803b1580156113ed57600080fd5b505af1158015611401573d6000803e3d6000fd5b50505050505061143c565b600154604051630d631c9d60e31b81526001600160a01b0390911690636b18e4e890610f36908c90600401613de6565b505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b60035490565b6060806000805b6020811085821a15161561149c5760019182019101611482565b5060405191506040820160405283600882021b60208301528060200382525080915050919050565b606080825160011480156114ec57506080836000815181106114e257fe5b016020015160f81c105b156114f8575081611528565b611504835160806117b7565b83604051602001611516929190613d48565b60405160208183030381529060405290505b92915050565b60008061153a86611906565b905061154881868686611936565b9150505b949350505050565b61155c613901565b604051806080016040528083600001518152602001836020015181526020018360400151815260200183606001518152509050919050565b60408051600480825260a0820190925260609160009190816020015b60608152602001906001900390816115b057505083519091506115d6906103ef9061147b565b816000815181106115e357fe5b60200260200101819052506116016103ef846020015160001b61147b565b8160018151811061160e57fe5b602002602001018190525061164583604001516040516020016116319190613d3f565b6040516020818303038152906040526114c4565b8160028151811061165257fe5b602002602001018190525061167583606001516040516020016116319190613d3f565b8160038151811061168257fe5b6020026020010181905250611696816119d2565b9392505050565b60006116a882611a16565b805190602001209050919050565b6000606060006116c586611906565b90506116d2818686611a51565b9250925050935093915050565b60606115286116ed83611b24565b611b49565b600080600060208451111561170857602061170b565b83515b6020858101519190036008021c92505050919050565b611729613901565b600061173483611bd8565b9050604051806080016040528061175e8360008151811061175157fe5b6020026020010151611beb565b81526020016117738360018151811061175157fe5b81526020016117958360028151811061178857fe5b6020026020010151611bf2565b81526020016117aa8360038151811061178857fe5b90529392505050565b3f90565b6060806038841015611811576040805160018082528183019092529060208201818036833701905050905082840160f81b816000815181106117f557fe5b60200101906001600160f81b031916908160001a905350611696565b600060015b80868161181f57fe5b04156118345760019091019061010002611816565b816001016001600160401b038111801561184d57600080fd5b506040519080825280601f01601f191660200182016040528015611878576020820181803683370190505b50925084820160370160f81b8360008151811061189157fe5b60200101906001600160f81b031916908160001a905350600190505b8181116118fd576101008183036101000a87816118c657fe5b04816118ce57fe5b0660f81b8382815181106118de57fe5b60200101906001600160f81b031916908160001a9053506001016118ad565b50509392505050565b606081805190602001206040516020016119209190613d3f565b6040516020818303038152906040529050919050565b6040805180820190915260018152600160ff1b60209091015260007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42182141561198a576119838585611cec565b905061154c565b600061199584611d10565b90506000806119a5838987611de6565b509150915060006119b984848b858c61218c565b90506119c5818a61256a565b9998505050505050505050565b606060006119df836126c3565b90506119ed815160c06117b7565b816040516020016119ff929190613d48565b604051602081830303815290604052915050919050565b6060816000015182602001518360400151846060015185608001518660a001518760c001516040516020016119209796959493929190613d77565b600060606000611a6085611d10565b90506000806000611a72848a89611de6565b81519295509093509150158080611a865750815b611ad7576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b600081611af35760405180602001604052806000815250611b12565b611b12866001870381518110611b0557fe5b60200260200101516127cc565b919b919a509098505050505050505050565b611b2c613928565b506040805180820190915281518152602082810190820152919050565b60606000806000611b59856127e8565b919450925090506000816001811115611b6e57fe5b14611bc0576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b611bcf85602001518484612b11565b95945050505050565b6060611528611be683611b24565b612bbe565b6000611528825b6000602182600001511115611c4e576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6000806000611c5c856127e8565b919450925090506000816001811115611c7157fe5b14611cc3576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b602080860151840180519091841015611ce25760208490036101000a90045b9695505050505050565b6000611d00611cfa84612d34565b83612e30565b5180516020909101209392505050565b60606000611d1d83611bd8565b9050600081516001600160401b0381118015611d3857600080fd5b50604051908082528060200260200182016040528015611d7257816020015b611d5f613942565b815260200190600190039081611d575790505b50905060005b8251811015611dde576000611d9f848381518110611d9257fe5b6020026020010151611b49565b90506040518060400160405280828152602001611dbb83611bd8565b815250838381518110611dca57fe5b602090810291909101015250600101611d78565b509392505050565b60006060818080611df687612d34565b905085600080611e04613942565b60005b8c51811015612164578c8181518110611e1c57fe5b6020026020010151915082840193506001870196508360001415611e9057815180516020909101208514611e8b576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b611f57565b815151602011611ef757815180516020909101208514611e8b576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b84611f058360000151612ec4565b14611f57576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b60208201515160111415611fc6578551841415611f7357612164565b6000868581518110611f8157fe5b602001015160f81c60f81b60f81c9050600083602001518260ff1681518110611fa657fe5b60200260200101519050611fb981612ef0565b965060019450505061215c565b6002826020015151141561210f576000611fdf83612f26565b9050600081600081518110611ff057fe5b016020015160f81c90506001811660020360006120108460ff8416612f44565b9050600061201e8b8a612f44565b9050600061202c8383612f71565b905060ff851660021480612043575060ff85166003145b15612075578083511480156120585750808251145b1561206257988901985b50600160ff1b9950612164945050505050565b60ff85161580612088575060ff85166001145b156120d857825181146120a85750600160ff1b9950612164945050505050565b6120c988602001516001815181106120bc57fe5b6020026020010151612ef0565b9a50975061215c945050505050565b60405162461bcd60e51b815260040180806020018281038252602681526020018061440d6026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b600101611e07565b50600160ff1b8414866121778786612f44565b909e909d50909b509950505050505050505050565b6060600083905060008760018803815181106121a457fe5b6020026020010151905060006121b982612fd7565b6040805160038082526080820190925291925060009190816020015b6121dd613942565b8152602001906001900390816121d5579050509050600080600284600281111561220357fe5b14156122cd578b51600090156122885760005b60018e51038110156122865760006122408f838151811061223357fe5b6020026020010151612fd7565b600281111561224b57fe5b141561225c5760019091019061227e565b6122788e828151811061226b57fe5b60200260200101516130ad565b51820191505b600101612216565b505b612291866130ad565b516122b561229e886130ad565b6122b06122aa8f612d34565b85612f44565b612f71565b1480156122c157508651155b156122cb57600191505b505b8015612307576122e56122df866130ad565b89612e30565b8383815181106122f157fe5b602002602001018190525060018201915061254b565b600084600281111561231557fe5b141561237e57855161234d5761232b85896130c0565b83838151811061233757fe5b6020026020010181905250600182019150612379565b8483838151811061235a57fe5b60200260200101819052506001820191506122e56122df876001612f44565b61254b565b6000612389866130ad565b905060006123978289612f71565b905080156123f85760006123ad8360008461310b565b90506123c1816123bc8d61325b565b61329c565b8686815181106123cd57fe5b60200260200101819052506001850194506123e88383612f44565b92506123f48983612f44565b9850505b60006124026132e0565b9050825160001415612427576124208161241b8a6127cc565b6130c0565b90506124bf565b60008360008151811061243657fe5b016020015160f81c905061244b846001612f44565b9350600288600281111561245b57fe5b1415612496576000612475856124708c6127cc565b612e30565b905061248e8383612489846000015161325b565b61336d565b9250506124bd565b8351156124ac576000612475856123bc8c6127cc565b6124ba82826124898c6127cc565b91505b505b88516124f4576124cf818c6130c0565b9050808686815181106124de57fe5b6020026020010181905250600185019450612547565b6124ff896001612f44565b98508086868151811061250e57fe5b6020026020010181905250600185019450612529898c612e30565b86868151811061253557fe5b60200260200101819052506001850194505b5050505b61255a8c60018d0385856133c6565b9c9b505050505050505050505050565b60008061257683612d34565b9050612580613942565b84516000906060905b80156126ae5787600182038151811061259e57fe5b602002602001015193506125b184612fd7565b925060028360028111156125c157fe5b14156125ec5760006125d2856130ad565b90506125e4866000835189510361310b565b955050612698565b60018360028111156125fa57fe5b141561263a57600061260b856130ad565b905061261d866000835189510361310b565b8351909650156126345761263185846134a8565b94505b50612698565b600083600281111561264857fe5b1415612698578151156126985760008560018751038151811061266757fe5b602001015160f81c60f81b60f81c9050612687866000600189510361310b565b955061269485828561336d565b9450505b83516126a39061325b565b915060001901612589565b50509051805160209091012095945050505050565b60608151600014156126e4575060408051600081526020810190915261097a565b6000805b8351811015612717578381815181106126fd57fe5b6020026020010151518201915080806001019150506126e8565b6000826001600160401b038111801561272f57600080fd5b506040519080825280601f01601f19166020018201604052801561275a576020820181803683370190505b50600092509050602081015b85518310156127c357600086848151811061277d57fe5b60200260200101519050600060208201905061279b83828451613554565b8785815181106127a757fe5b6020026020010151518301925050508280600101935050612766565b50949350505050565b60208101518051606091611528916000198101908110611d9257fe5b600080600080846000015111612845576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f811161286a576000600160009450945094505050612b0a565b60b781116128df578551607f1982019081106128cd576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b60019550935060009250612b0a915050565b60bf81116129c357855160b6198201908110612942576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a60018501510490508082018860000151116129ae576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b60019091019550935060009250612b0a915050565b60f78111612a3757855160bf198201908110612a26576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b600195509350849250612b0a915050565b855160f6198201908110612a92576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111612af7576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b6001918201965094509250612b0a915050565b9193909250565b60606000826001600160401b0381118015612b2b57600080fd5b506040519080825280601f01601f191660200182016040528015612b56576020820181803683370190505b509050805160001415612b6a579050611696565b8484016020820160005b60208604811015612b95578251825260209283019290910190600101612b74565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b6060600080612bcc846127e8565b91935090915060019050816001811115612be257fe5b14612c34576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b612c55613928565b815260200190600190039081612c4d5790505090506000835b8651811015612d295760208210612cb65760405162461bcd60e51b815260040180806020018281038252602a8152602001806143e3602a913960400191505060405180910390fd5b600080612ce26040518060400160405280858c60000151038152602001858c60200151018152506127e8565b509150915060405180604001604052808383018152602001848b6020015101815250858581518110612d1057fe5b6020908102919091010152600193909301920101612c6e565b508152949350505050565b6060600082516002026001600160401b0381118015612d5257600080fd5b506040519080825280601f01601f191660200182016040528015612d7d576020820181803683370190505b50905060005b8351811015612e29576004848281518110612d9a57fe5b602001015160f81c60f81b6001600160f81b031916901c828260020281518110612dc057fe5b60200101906001600160f81b031916908160001a9053506010848281518110612de557fe5b016020015160f81c81612df457fe5b0660f81b828260020260010181518110612e0a57fe5b60200101906001600160f81b031916908160001a905350600101612d83565b5092915050565b612e38613942565b60408051600280825260608201909252600091816020015b6060815260200190600190039081612e505790505090506000612e74856001613598565b9050612e826103ef826136ef565b82600081518110612e8f57fe5b6020026020010181905250612ea3846114c4565b82600181518110612eb057fe5b6020026020010181905250611bcf826137bf565b6000602082511015612edb5750602081015161097a565b81806020019051602081101561097557600080fd5b60006060602083600001511015612f1157612f0a836137ee565b9050612f1d565b612f1a83611b49565b90505b61169681612ec4565b6060611528612f3f8360200151600081518110611d9257fe5b612d34565b606082518210612f635750604080516020810190915260008152611528565b61169683838486510361310b565b6000805b808451118015612f855750808351115b8015612fca5750828181518110612f9857fe5b602001015160f81c60f81b6001600160f81b031916848281518110612fb957fe5b01602001516001600160f81b031916145b1561169657600101612f75565b60208101515160009060111415612ff05750600061097a565b6002826020015151141561306c57600061300983612f26565b905060008160008151811061301a57fe5b016020015160f81c90506002811480613036575060ff81166003145b156130465760029250505061097a565b60ff81161580613059575060ff81166001145b156130695760019250505061097a565b50505b6040805162461bcd60e51b8152602060048201526011602482015270496e76616c6964206e6f6465207479706560781b604482015290519081900360640190fd5b60606115286130bb83612f26565b6137f9565b6130c8613942565b60006130d3836114c4565b90506130de81611b24565b6020850151805160001981019081106130f357fe5b602002602001018190525061154c8460200151613842565b60608182601f011015613156576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b82828401101561319e576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b818301845110156131ea576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b60608215801561320957604051915060008252602082016040526127c3565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561324257805183526020928301920161322a565b5050858452601f01601f19166040525050949350505050565b606060208251101561326e57508061097a565b818051906020012060405160200180828152602001915050604051602081830303815290604052905061097a565b6132a4613942565b60408051600280825260608201909252600091816020015b60608152602001906001900390816132bc5790505090506000612e74856000613598565b6132e8613942565b6040805160118082526102408201909252600091816020015b606081526020019060019003908161330157905050905060005b815181101561335d57604051806040016040528060018152602001600160ff1b81525082828151811061334a57fe5b602090810291909101015260010161331b565b50613367816137bf565b91505090565b613375613942565b6000602083511061338e57613389836114c4565b613390565b825b905061339b81611b24565b85602001518560ff16815181106133ae57fe5b6020026020010181905250611bcf8560200151613842565b606060008285016001600160401b03811180156133e257600080fd5b5060405190808252806020026020018201604052801561341c57816020015b613409613942565b8152602001906001900390816134015790505b50905060005b8581101561345d5786818151811061343657fe5b602002602001015182828151811061344a57fe5b6020908102919091010152600101613422565b5060005b8381101561349e5784818151811061347557fe5b6020026020010151828783018151811061348b57fe5b6020908102919091010152600101613461565b5095945050505050565b6134b0613942565b60408051600280825260608201909252600091816020015b60608152602001906001900390816134c857905050905060006134f46134ed866130ad565b6000613598565b90506135026103ef826136ef565b8260008151811061350f57fe5b602002602001018190525060208451101561354257838260018151811061353257fe5b602002602001018190525061354b565b612ea3846114c4565b611bcf826137bf565b8282825b60208110613577578151835260209283019290910190601f1901613558565b905182516020929092036101000a6000190180199091169116179052505050565b60606000826135a85760006135ab565b60025b9050600060028551816135ba57fe5b06905060008160020360ff166001600160401b03811180156135db57600080fd5b506040519080825280601f01601f191660200182016040528015613606576020820181803683370190505b50905081830160f81b8160008151811061361c57fe5b60200101906001600160f81b031916908160001a90535080866040516020018083805190602001908083835b602083106136675780518252601f199092019160209182019101613648565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106136af5780518252601f199092019160209182019101613690565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052935050505092915050565b6060600060028351816136fe57fe5b046001600160401b038111801561371457600080fd5b506040519080825280601f01601f19166020018201604052801561373f576020820181803683370190505b50905060005b8151811015612e295783816002026001018151811061376057fe5b602001015160f81c60f81b600485836002028151811061377c57fe5b602001015160f81c60f81b6001600160f81b031916901b178282815181106137a057fe5b60200101906001600160f81b031916908160001a905350600101613745565b6137c7613942565b60006137d2836119d2565b905060405180604001604052808281526020016117aa83611bd8565b6060611528826138eb565b606060028260008151811061380a57fe5b016020015160f81c8161381957fe5b0660ff166000141561383757613830826002612f44565b905061097a565b613830826001612f44565b61384a613942565b600082516001600160401b038111801561386357600080fd5b5060405190808252806020026020018201604052801561389757816020015b60608152602001906001900390816138825790505b50905060005b83518110156138e1576138c28482815181106138b557fe5b60200260200101516137ee565b8282815181106138ce57fe5b602090810291909101015260010161389d565b50611696816137bf565b6060611528826020015160008460000151612b11565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060008152602001600081525090565b604051806040016040528060608152602001606081525090565b600061396f61396a84614379565b614356565b905082815283838301111561398357600080fd5b828260208301376000602084830101529392505050565b803561097a816143ca565b8051801515811461097a57600080fd5b600082601f8301126139c5578081fd5b6116968383356020850161395c565b80356002811061097a57600080fd5b6000806000606084860312156139f7578283fd5b8335613a02816143ca565b92506020840135613a12816143ca565b915060408401356001600160401b03811115613a2c578182fd5b613a38868287016139b5565b9150509250925092565b600080600060608486031215613a56578283fd5b8335613a61816143ca565b92506020840135915060408401356001600160401b03811115613a2c578182fd5b60008060408385031215613a94578182fd5b8235613a9f816143ca565b915060208301356001600160401b03811115613ab9578182fd5b613ac5858286016139b5565b9150509250929050565b600060208284031215613ae0578081fd5b611696826139a5565b600060208284031215613afa578081fd5b5051919050565b600060208284031215613b12578081fd5b81516001600160401b03811115613b27578182fd5b8201601f81018413613b37578182fd5b8051613b4561396a82614379565b818152856020838501011115613b59578384fd5b611bcf82602083016020860161439a565b600060208284031215613b7b578081fd5b81356001600160401b03811115613b90578182fd5b8201601f81018413613ba0578182fd5b61154c8482356020840161395c565b600060c08284031215613bc0578081fd5b60405160c081018181106001600160401b0382111715613bdc57fe5b8060405250825181526020830151602082015260408301516040820152606083015160608201526080830151613c11816143ca565b6080820152613c2260a084016139a5565b60a08201529392505050565b600060208284031215613c3f578081fd5b81356001600160401b0380821115613c55578283fd5b9083019060e08286031215613c68578283fd5b613c7260e0614356565b8235815260208301356020820152613c8c604084016139d4565b6040820152613c9d6060840161399a565b6060820152613cae6080840161399a565b608082015260a083013560a082015260c083013582811115613cce578485fd5b613cda878286016139b5565b60c08301525095945050505050565b6001600160a01b03169052565b60008151808452613d0e81602086016020860161439a565b601f01601f19169290920160200192915050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b90815260200190565b60008351613d5a81846020880161439a565b835190830190613d6e81836020880161439a565b01949350505050565b600088825287602083015260028710613d8c57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b166055840152508360698301528251613dd381608985016020870161439a565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b600060e08201905060018060a01b038085168352835160208401526020840151604084015260408401516060840152606084015160808401528060808501511660a08401525060a0830151151560c08301529392505050565b901515815260200190565b6020810160038310613ea657fe5b91905290565b60208082526025908201527f53746f7261676520736c6f742068617320616c7265616479206265656e20707260408201526437bb32b71760d91b606082015260800190565b60208082526026908201527f4163636f756e742073746174652068617320616c7265616479206265656e20706040820152653937bb32b71760d11b606082015260800190565b6020808252603e908201527f416c6c206163636f756e7473206d75737420626520636f6d6d6974746564206260408201527f65666f726520636f6d706c6574696e672061207472616e736974696f6e2e0000606082015260800190565b602080825260409082018190527f53746f7261676520736c6f742076616c7565207761736e2774206368616e6765908201527f64206f722068617320616c7265616479206265656e20636f6d6d69747465642e606082015260800190565b6020808252605b908201527f4f564d5f53746174655472616e736974696f6e65723a2050726f76696465642060408201527f4c3120636f6e747261637420636f6465206861736820646f6573206e6f74206d60608201527f61746368204c3220636f6e747261637420636f646520686173682e0000000000608082015260a00190565b6020808252603f908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d6d697474696e67206163636f756e74207374617465732e00606082015260800190565b60208082526038908201527f4e6f7420656e6f7567682067617320746f2065786563757465207472616e736160408201527f6374696f6e2064657465726d696e6973746963616c6c792e0000000000000000606082015260800190565b6020808252603b908201527f4163636f756e74207374617465207761736e2774206368616e676564206f722060408201527f68617320616c7265616479206265656e20636f6d6d69747465642e0000000000606082015260800190565b6020808252603d908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d706c6574696e672061207472616e736974696f6e2e000000606082015260800190565b60208082526031908201527f46756e6374696f6e206d7573742062652063616c6c656420647572696e67207460408201527034329031b7b93932b1ba10383430b9b29760791b606082015260800190565b6020808252601d908201527f496e76616c6964207472616e73616374696f6e2070726f76696465642e000000604082015260600190565b60208082526038908201527f436f6e7472616374206d757374206265207665726966696564206265666f726560408201527f2070726f76696e6720612073746f7261676520736c6f742e0000000000000000606082015260800190565b60006040825283516040830152602084015160608301526040840151600281106142f457fe5b60808381019190915260608501516001600160a01b031660a084015284015161432060c0840182613ce9565b5060a084015160e083015260c084015160e0610100840152614346610120840182613cf6565b9150506116966020830184613ce9565b6040518181016001600160401b038111828210171561437157fe5b604052919050565b60006001600160401b0382111561438c57fe5b50601f01601f191660200190565b60005b838110156143b557818101518382015260200161439d565b838111156143c4576000848401525b50505050565b6001600160a01b03811681146143df57600080fd5b5056fe50726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e52656365697665642061206e6f6465207769746820616e20756e6b6e6f776e20707265666978a2646970667358221220e1e4d3b66fdb29cc31b98f8b28be1f1ae5444146eb6157e8e4757ceec746aba764736f6c634300070600334372656174652063616e206f6e6c7920626520646f6e6520627920746865204f564d5f467261756456657269666965722ea264697066735822122055726a03c626eda10428d6a8adff2cef3ee762aaa0d2c446eee2a007c7036add64736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"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\":{\"_0\":\"New OVM_StateTransitioner instance.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}}},\"title\":\"OVM_StateTransitionerFactory\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"create(address,uint256,bytes32,bytes32)\":{\"notice\":\"Creates a new OVM_StateTransitioner\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"}},\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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 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 external\\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 external\\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 external\\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 external\\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 external\\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 external\\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 // Prevent the Execution Manager from calling this SM again.\\n ovmStateManager.setExecutionManager(address(0));\\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 external\\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 external\\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 external\\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\":\"0x53231f64d413623b2b8c4ba1b596c9cbbe4712c9b406a42198aeaa8387a293d9\",\"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 /***************\\n * Constructor *\\n ***************/\\n\\n constructor(\\n address _libAddressManager\\n )\\n Lib_AddressResolver(_libAddressManager)\\n {}\\n\\n\\n /********************\\n * Public Functions *\\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 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\\n )\\n {\\n require(\\n msg.sender == resolve(\\\"OVM_FraudVerifier\\\"),\\n \\\"Create can only be done by the OVM_FraudVerifier.\\\"\\n );\\n\\n return new OVM_StateTransitioner(\\n _libAddressManager,\\n _stateTransitionIndex,\\n _preStateRoot,\\n _transactionHash\\n );\\n }\\n}\\n\",\"keccak256\":\"0x65ef11334a2d6931b6d3a85e7b29c39c774d19443e7040e132a58be505e3b52c\",\"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 OUT_OF_GAS,\\n INTENTIONAL_REVERT,\\n EXCEEDS_NUISANCE_GAS,\\n INVALID_STATE_ACCESS,\\n UNSAFE_BYTECODE,\\n CREATE_COLLISION,\\n STATIC_VIOLATION,\\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 enum MessageType {\\n ovmCALL,\\n ovmSTATICCALL,\\n ovmDELEGATECALL,\\n ovmCREATE,\\n ovmCREATE2\\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 uint256 ovmCALLVALUE;\\n bool isStatic;\\n }\\n\\n struct MessageRecord {\\n uint256 nuisanceGasLeft;\\n }\\n\\n\\n /************************************\\n * Transaction Execution Entrypoint *\\n ************************************/\\n\\n function run(\\n Lib_OVMCodec.Transaction calldata _transaction,\\n address _txStateManager\\n ) external returns (bytes memory);\\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 ovmCALLVALUE() external view returns (uint _callValue);\\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, bytes memory _revertdata);\\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract, bytes memory _revertdata);\\n\\n\\n /*******************************\\n * Account Abstraction Opcodes *\\n ******************************/\\n\\n function ovmGETNONCE() external returns (uint256 _nonce);\\n function ovmINCREMENTNONCE() external;\\n function ovmCREATEEOA(bytes32 _messageHash, uint8 _v, bytes32 _r, bytes32 _s) external;\\n\\n\\n /****************************\\n * Contract Calling Opcodes *\\n ****************************/\\n\\n // Valueless ovmCALL for maintaining backwards compatibility with legacy OVM bytecode.\\n function ovmCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\\n function ovmCALL(uint256 _gasLimit, address _address, uint256 _value, 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 * ETH Value Opcodes *\\n *********************/\\n\\n function ovmBALANCE(address _contract) external returns (uint256 _balance);\\n function ovmSELFBALANCE() external returns (uint256 _balance);\\n\\n\\n /***************************************\\n * Public Functions: Execution Context *\\n ***************************************/\\n\\n function getMaxTransactionGasLimit() external view returns (uint _maxTransactionGasLimit);\\n}\\n\",\"keccak256\":\"0x87a056425696719488dbd06adbbf89280d86651e75e1f77d9e96b0632c8634cc\",\"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\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*********\\n * Enums *\\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 transactionHash;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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 Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory\\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 of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32\\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\":\"0xd85ba2066057a2677926f484b938c7c2ef33ff3853f3b71cda252f4a54f30e05\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"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 require(\\n out == 0 || out == 1,\\n \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\"\\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\":\"0x829174c61216dce35fdb888383b6022e0365eb7fbdc71ad79d98b108091969fe\",\"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/**\\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 The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = abi.encodePacked(_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 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\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return abi.encodePacked(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a bytes32 value.\\n * @param _in The bytes32 to encode.\\n * @return _out The RLP encoded bytes32 in bytes.\\n */\\n function writeBytes32(\\n bytes32 _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 The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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 The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory\\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}\\n\",\"keccak256\":\"0xb60ee4b03ad372c3deff21d454ab714dd0c18ee3e6f9d45532e209fc59d5a54d\",\"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 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, _key, 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 != pathRemainder.length) {\\n // Our extension node is not identical to the remainder.\\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 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 path may include\\n * additional nodes (e.g., it comes directly from a proof) and we can't resize in-memory\\n * arrays without costly duplication.\\n * @param _key Full original key.\\n * @param _keyRemainder Portion of the initial key that must be inserted 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 _key,\\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 // Reference: https://github.com/ethereumjs/merkle-patricia-tree/blob/c0a10395aab37d42c175a47114ebfcbd7efcf059/src/baseTrie.ts#L294-L313\\n bool matchLeaf = false;\\n if (lastNodeType == NodeType.LeafNode) {\\n uint256 l = 0;\\n if (_path.length > 0) {\\n for (uint256 i = 0; i < _path.length - 1; i++) {\\n if (_getNodeType(_path[i]) == NodeType.BranchNode) {\\n l++;\\n } else {\\n l += _getNodeKey(_path[i]).length;\\n }\\n }\\n }\\n\\n if (\\n _getSharedNibbleLength(\\n _getNodeKey(lastNode),\\n Lib_BytesUtils.slice(Lib_BytesUtils.toNibbles(_key), l)\\n ) == _getNodeKey(lastNode).length\\n && keyRemainder.length == 0\\n ) {\\n matchLeaf = true;\\n }\\n }\\n\\n if (matchLeaf) {\\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 = _editExtensionNodeValue(currentNode, 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 * Creates a new extension node with the same key but a different value.\\n * @param _node Extension node to copy and modify.\\n * @param _value New value for the extension node.\\n * @return New node with the same key and different value.\\n */\\n function _editExtensionNodeValue(\\n TrieNode memory _node,\\n bytes memory _value\\n )\\n private\\n pure\\n returns (\\n TrieNode memory\\n )\\n {\\n bytes[] memory raw = new bytes[](2);\\n bytes memory key = _addHexPrefix(_getNodeKey(_node), false);\\n raw[0] = Lib_RLPWriter.writeBytes(Lib_BytesUtils.fromNibbles(key));\\n if (_value.length < 32) {\\n raw[1] = _value;\\n } else {\\n raw[1] = Lib_RLPWriter.writeBytes(_value);\\n }\\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 abi.encodePacked(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\":\"0x4bb09d0b4f965b57cdc6b3ace49967bcfe7f2580fa0b7863dfe288081247d876\",\"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 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\":\"0xbbdd600165307d2131340599afa9dc0991f8f63727ba3a834bca5a3d7f501da8\",\"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 /**\\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \\\"true.\\\"\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as a boolean.\\n */\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return _in != 0;\\n }\\n\\n /**\\n * Converts a boolean to a bytes32 value.\\n * @param _in Input boolean value.\\n * @return Boolean as a bytes32.\\n */\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n /**\\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 as an address.\\n */\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n /**\\n * Converts an address to a bytes32.\\n * @param _in Input address value.\\n * @return Address as a bytes32.\\n */\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n /**\\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\\n * @param _in Input bytes32 value.\\n * @return Bytes32 without any leading zeros.\\n */\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\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\":\"0xfa2def593e3fc56a31852c3744aefdaa93cec74e721bfcfeb1e5d166c7c60b64\",\"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 slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\n {\\n if (_start >= _bytes.length) {\\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 (\\n bytes32\\n )\\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 (\\n bytes32\\n )\\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 (\\n uint256\\n )\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint24\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n uint8\\n )\\n {\\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(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\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 (\\n bytes memory\\n )\\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 (\\n bytes memory\\n )\\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 (\\n bool\\n )\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xd27e37973f1e0f64798725b7a0de12989dac992fba0d72970249d7e1f70e17c5\",\"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 *\\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 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\\n )\\n {\\n bytes memory code;\\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 Full code of the contract.\\n */\\n function getCode(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes memory\\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 Size of the contract's code in bytes.\\n */\\n function getCodeSize(\\n address _address\\n )\\n internal\\n view\\n returns (\\n uint256\\n )\\n {\\n uint256 codeSize;\\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 Hash of the contract's code.\\n */\\n function getCodeHash(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n bytes32 codeHash;\\n assembly {\\n codeHash := extcodehash(_address)\\n }\\n\\n return codeHash;\\n }\\n\\n /**\\n * Creates a contract with some given initialization code.\\n * @param _code Contract initialization code.\\n * @return Address of the created contract.\\n */\\n function createContract(\\n bytes memory _code\\n )\\n internal\\n returns (\\n address\\n )\\n {\\n address created;\\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 to be generated by CREATE.\\n */\\n function getAddressForCREATE(\\n address _creator,\\n uint256 _nonce\\n )\\n internal\\n pure\\n returns (\\n 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 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 (\\n address\\n )\\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\":\"0xf29a67d78e61cb472d524b779b32cfcb39a587f4096500d5419e6425ed367d49\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50604051614b2b380380614b2b8339818101604052602081101561003357600080fd5b5051600080546001600160a01b039092166001600160a01b0319909216919091179055614ac6806100656000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806322d1470214610046578063299ca4781461009a578063461a4478146100a2575b600080fd5b61007e6004803603608081101561005c57600080fd5b506001600160a01b038135169060208101359060408101359060600135610148565b604080516001600160a01b039092168252519081900360200190f35b61007e610229565b61007e600480360360208110156100b857600080fd5b8101906020810181356401000000008111156100d357600080fd5b8201836020820111156100e557600080fd5b8035906020019184600183028401116401000000008311171561010757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610238945050505050565b600061017c6040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b815250610238565b6001600160a01b0316336001600160a01b0316146101cb5760405162461bcd60e51b8152600401808060200182810382526031815260200180614a606031913960400191505060405180910390fd5b848484846040516101db90610314565b80856001600160a01b03168152602001848152602001838152602001828152602001945050505050604051809103906000f08015801561021f573d6000803e3d6000fd5b5095945050505050565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610298578181015183820152602001610280565b50505050905090810190601f1680156102c55780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102e257600080fd5b505afa1580156102f6573d6000803e3d6000fd5b505050506040513d602081101561030c57600080fd5b505192915050565b61473e806103228339019056fe60806040523480156200001157600080fd5b506040516200473e3803806200473e833981016040819052620000349162000232565b600080546001600160a01b0319166001600160a01b038616179055600583905560028290556003829055600681905560408051808201909152601781527f4f564d5f53746174654d616e61676572466163746f72790000000000000000006020820152620000a29062000150565b6001600160a01b0316639ed93318306040518263ffffffff1660e01b8152600401620000cf919062000299565b602060405180830381600087803b158015620000ea57600080fd5b505af1158015620000ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000125919062000273565b600180546001600160a01b0319166001600160a01b039290921691909117905550620002c692505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015620001b257818101518382015260200162000198565b50505050905090810190601f168015620001e05780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b158015620001fe57600080fd5b505afa15801562000213573d6000803e3d6000fd5b505050506040513d60208110156200022a57600080fd5b505192915050565b6000806000806080858703121562000248578384fd5b84516200025581620002ad565b60208601516040870151606090970151919890975090945092505050565b60006020828403121562000285578081fd5b81516200029281620002ad565b9392505050565b6001600160a01b0391909116815260200190565b6001600160a01b0381168114620002c357600080fd5b50565b61446880620002d66000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063845fe7a31161008c578063b2fa1c9e11610066578063b2fa1c9e14610185578063b52805711461019a578063b9194310146101a2578063c1c618b8146101b5576100cf565b8063845fe7a314610155578063a244316a14610168578063b1c9fe6e14610170576100cf565b8063299ca478146100d45780632e1ac36c146100f25780632eb1375814610107578063461a44781461011a578063732f960b1461012d578063805e9d3014610140575b600080fd5b6100dc6101bd565b6040516100e99190613de6565b60405180910390f35b610105610100366004613a42565b6101cc565b005b610105610115366004613a82565b610565565b6100dc610128366004613b6a565b6108a1565b61010561013b366004613c2e565b61097f565b610148610c6f565b6040516100e99190613d3f565b610105610163366004613a42565b610c75565b610105610fa1565b610178611128565b6040516100e99190613e98565b61018d611131565b6040516100e99190613e8d565b6100dc61114c565b6101056101b03660046139e3565b61115b565b610148611475565b6000546001600160a01b031681565b60018060045460ff1660028111156101e057fe5b146102065760405162461bcd60e51b81526004016101fd906141e9565b60405180910390fd5b60025460065460005a6001546040516363b285f960e11b81529192506001600160a01b03169063c7650bf290610242908a908a90600401613dfa565b602060405180830381600087803b15801561025c57600080fd5b505af1158015610270573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102949190613acf565b15156001146102b55760405162461bcd60e51b81526004016101fd90613f94565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f1906102e6908b90600401613de6565b60c06040518083038186803b1580156102fe57600080fd5b505afa158015610312573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103369190613baf565b600154604051631aaf392f60e01b81529192506000916001600160a01b0390911690631aaf392f9061036e908c908c90600401613dfa565b60206040518083038186803b15801561038657600080fd5b505afa15801561039a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103be9190613ae9565b90506103ff886040516020016103d49190613d3f565b6040516020818303038152906040526103f46103ef8461147b565b6114c4565b89856040015161152e565b6040808401919091526001549051638f3b964760e01b81526001600160a01b0390911690638f3b964790610439908c908690600401613e34565b600060405180830381600087803b15801561045357600080fd5b505af1158015610467573d6000803e3d6000fd5b505050507f3e3ed1a676a2754a041b49bf752e0f167c8753495e36c320fe01d1ef7476253c898960405161049c929190613dfa565b60405180910390a1505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561054357600080fd5b505af1158015610557573d6000803e3d6000fd5b505050505050505050505050565b60018060045460ff16600281111561057957fe5b146105965760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a9050600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156105ef57600080fd5b505afa158015610603573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106279190613ae9565b156106445760405162461bcd60e51b81526004016101fd90614075565b600154604051630b38106960e11b81526001600160a01b039091169063167020d290610674908990600401613de6565b602060405180830381600087803b15801561068e57600080fd5b505af11580156106a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c69190613acf565b15156001146106e75760405162461bcd60e51b81526004016101fd9061412f565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f190610718908a90600401613de6565b60c06040518083038186803b15801561073057600080fd5b505afa158015610744573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107689190613baf565b90506107a78760405160200161077e9190613d22565b60405160208183030381529060405261079e61079984611554565b611594565b8860035461152e565b6003556040517fcec9ef675d775706a02b43afe48af52c5019bc50f99582e3208c6ff55d59c008906107da908990613de6565b60405180910390a15060005a8203905061081a6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561088057600080fd5b505af1158015610894573d6000803e3d6000fd5b5050505050505050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156109015781810151838201526020016108e9565b50505050905090810190601f16801561092e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561094b57600080fd5b505afa15801561095f573d6000803e3d6000fd5b505050506040513d602081101561097557600080fd5b505190505b919050565b60008060045460ff16600281111561099357fe5b146109b05760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a90506006546109c78661169d565b146109e45760405162461bcd60e51b81526004016101fd9061423a565b6103e88560a0015161040802816109f757fe5b04620186a0015a1015610a1c5760405162461bcd60e51b81526004016101fd906140d2565b6000610a536040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b8152506108a1565b600154604051631381ba4d60e01b81529192506001600160a01b031690631381ba4d90610a84908490600401613de6565b600060405180830381600087803b158015610a9e57600080fd5b505af1158015610ab2573d6000803e3d6000fd5b5050600154604051639be3ad6760e01b81526001600160a01b038086169450639be3ad679350610ae9928b929116906004016142ce565b600060405180830381600087803b158015610b0357600080fd5b505af1158015610b17573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b3f9190810190613b01565b50600154604051631381ba4d60e01b81526001600160a01b0390911690631381ba4d90610b7190600090600401613de6565b600060405180830381600087803b158015610b8b57600080fd5b505af1158015610b9f573d6000803e3d6000fd5b50506004805460ff191660011790555060009150505a82039050610be96040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b158015610c4f57600080fd5b505af1158015610c63573d6000803e3d6000fd5b50505050505050505050565b60025490565b60008060045460ff166002811115610c8957fe5b14610ca65760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a600154604051630ad2267960e01b81529192506001600160a01b031690630ad2267990610ce2908a908a90600401613dfa565b60206040518083038186803b158015610cfa57600080fd5b505afa158015610d0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d329190613acf565b15610d4f5760405162461bcd60e51b81526004016101fd90613eac565b60015460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf90610d7f908a90600401613de6565b60206040518083038186803b158015610d9757600080fd5b505afa158015610dab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcf9190613acf565b1515600114610df05760405162461bcd60e51b81526004016101fd90614271565b60015460405163136e2d8960e11b81526000916001600160a01b0316906326dc5b1290610e21908b90600401613de6565b60206040518083038186803b158015610e3957600080fd5b505afa158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e719190613ae9565b905060007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421821415610ea557506000610f02565b600080610ed28a604051602001610ebc9190613d3f565b6040516020818303038152906040528a866116b6565b909250905060018215151415610efa57610ef3610eee826116df565b6116f2565b9250610eff565b600092505b50505b600154604051635c17d62960e01b81526001600160a01b0390911690635c17d62990610f36908c908c908690600401613e13565b600060405180830381600087803b158015610f5057600080fd5b505af1158015610f64573d6000803e3d6000fd5b50505050505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b60018060045460ff166002811115610fb557fe5b14610fd25760405162461bcd60e51b81526004016101fd906141e9565b600160009054906101000a90046001600160a01b03166001600160a01b031663d7bd4a2a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561102057600080fd5b505afa158015611034573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110589190613ae9565b156110755760405162461bcd60e51b81526004016101fd90613f37565b600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156110c357600080fd5b505afa1580156110d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110fb9190613ae9565b156111185760405162461bcd60e51b81526004016101fd9061418c565b506004805460ff19166002179055565b60045460ff1681565b6000600260045460ff16600281111561114657fe5b14905090565b6001546001600160a01b031681565b60008060045460ff16600281111561116f57fe5b1461118c5760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a60015460405163c8e40fbf60e01b81529192506001600160a01b03169063c8e40fbf906111c6908a90600401613de6565b60206040518083038186803b1580156111de57600080fd5b505afa1580156111f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112169190613acf565b1580156112a057506001546040516307a1294560e01b81526001600160a01b03909116906307a129459061124e908a90600401613de6565b60206040518083038186803b15801561126657600080fd5b505afa15801561127a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129e9190613acf565b155b6112bc5760405162461bcd60e51b81526004016101fd90613ef1565b6000806112eb896040516020016112d39190613d22565b604051602081830303815290604052886002546116b6565b90925090506001821515141561140c57600061130682611721565b606081015190915089907fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470141561133f5750600061136a565b816060015161134d826117b3565b1461136a5760405162461bcd60e51b81526004016101fd90613ff2565b6001546040805160c08101825284518152602080860151908201528482015181830152606080860151908201526001600160a01b038481166080830152600060a08301529151638f3b964760e01b81529190921691638f3b9647916113d3918f91600401613e34565b600060405180830381600087803b1580156113ed57600080fd5b505af1158015611401573d6000803e3d6000fd5b50505050505061143c565b600154604051630d631c9d60e31b81526001600160a01b0390911690636b18e4e890610f36908c90600401613de6565b505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b60035490565b6060806000805b6020811085821a15161561149c5760019182019101611482565b5060405191506040820160405283600882021b60208301528060200382525080915050919050565b606080825160011480156114ec57506080836000815181106114e257fe5b016020015160f81c105b156114f8575081611528565b611504835160806117b7565b83604051602001611516929190613d48565b60405160208183030381529060405290505b92915050565b60008061153a86611906565b905061154881868686611936565b9150505b949350505050565b61155c613901565b604051806080016040528083600001518152602001836020015181526020018360400151815260200183606001518152509050919050565b60408051600480825260a0820190925260609160009190816020015b60608152602001906001900390816115b057505083519091506115d6906103ef9061147b565b816000815181106115e357fe5b60200260200101819052506116016103ef846020015160001b61147b565b8160018151811061160e57fe5b602002602001018190525061164583604001516040516020016116319190613d3f565b6040516020818303038152906040526114c4565b8160028151811061165257fe5b602002602001018190525061167583606001516040516020016116319190613d3f565b8160038151811061168257fe5b6020026020010181905250611696816119d2565b9392505050565b60006116a882611a16565b805190602001209050919050565b6000606060006116c586611906565b90506116d2818686611a51565b9250925050935093915050565b60606115286116ed83611b24565b611b49565b600080600060208451111561170857602061170b565b83515b6020858101519190036008021c92505050919050565b611729613901565b600061173483611bd8565b9050604051806080016040528061175e8360008151811061175157fe5b6020026020010151611beb565b81526020016117738360018151811061175157fe5b81526020016117958360028151811061178857fe5b6020026020010151611bf2565b81526020016117aa8360038151811061178857fe5b90529392505050565b3f90565b6060806038841015611811576040805160018082528183019092529060208201818036833701905050905082840160f81b816000815181106117f557fe5b60200101906001600160f81b031916908160001a905350611696565b600060015b80868161181f57fe5b04156118345760019091019061010002611816565b816001016001600160401b038111801561184d57600080fd5b506040519080825280601f01601f191660200182016040528015611878576020820181803683370190505b50925084820160370160f81b8360008151811061189157fe5b60200101906001600160f81b031916908160001a905350600190505b8181116118fd576101008183036101000a87816118c657fe5b04816118ce57fe5b0660f81b8382815181106118de57fe5b60200101906001600160f81b031916908160001a9053506001016118ad565b50509392505050565b606081805190602001206040516020016119209190613d3f565b6040516020818303038152906040529050919050565b6040805180820190915260018152600160ff1b60209091015260007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42182141561198a576119838585611cec565b905061154c565b600061199584611d10565b90506000806119a5838987611de6565b509150915060006119b984848b858c61218c565b90506119c5818a61256a565b9998505050505050505050565b606060006119df836126c3565b90506119ed815160c06117b7565b816040516020016119ff929190613d48565b604051602081830303815290604052915050919050565b6060816000015182602001518360400151846060015185608001518660a001518760c001516040516020016119209796959493929190613d77565b600060606000611a6085611d10565b90506000806000611a72848a89611de6565b81519295509093509150158080611a865750815b611ad7576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b600081611af35760405180602001604052806000815250611b12565b611b12866001870381518110611b0557fe5b60200260200101516127cc565b919b919a509098505050505050505050565b611b2c613928565b506040805180820190915281518152602082810190820152919050565b60606000806000611b59856127e8565b919450925090506000816001811115611b6e57fe5b14611bc0576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b611bcf85602001518484612b11565b95945050505050565b6060611528611be683611b24565b612bbe565b6000611528825b6000602182600001511115611c4e576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6000806000611c5c856127e8565b919450925090506000816001811115611c7157fe5b14611cc3576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b602080860151840180519091841015611ce25760208490036101000a90045b9695505050505050565b6000611d00611cfa84612d34565b83612e30565b5180516020909101209392505050565b60606000611d1d83611bd8565b9050600081516001600160401b0381118015611d3857600080fd5b50604051908082528060200260200182016040528015611d7257816020015b611d5f613942565b815260200190600190039081611d575790505b50905060005b8251811015611dde576000611d9f848381518110611d9257fe5b6020026020010151611b49565b90506040518060400160405280828152602001611dbb83611bd8565b815250838381518110611dca57fe5b602090810291909101015250600101611d78565b509392505050565b60006060818080611df687612d34565b905085600080611e04613942565b60005b8c51811015612164578c8181518110611e1c57fe5b6020026020010151915082840193506001870196508360001415611e9057815180516020909101208514611e8b576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b611f57565b815151602011611ef757815180516020909101208514611e8b576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b84611f058360000151612ec4565b14611f57576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b60208201515160111415611fc6578551841415611f7357612164565b6000868581518110611f8157fe5b602001015160f81c60f81b60f81c9050600083602001518260ff1681518110611fa657fe5b60200260200101519050611fb981612ef0565b965060019450505061215c565b6002826020015151141561210f576000611fdf83612f26565b9050600081600081518110611ff057fe5b016020015160f81c90506001811660020360006120108460ff8416612f44565b9050600061201e8b8a612f44565b9050600061202c8383612f71565b905060ff851660021480612043575060ff85166003145b15612075578083511480156120585750808251145b1561206257988901985b50600160ff1b9950612164945050505050565b60ff85161580612088575060ff85166001145b156120d857825181146120a85750600160ff1b9950612164945050505050565b6120c988602001516001815181106120bc57fe5b6020026020010151612ef0565b9a50975061215c945050505050565b60405162461bcd60e51b815260040180806020018281038252602681526020018061440d6026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b600101611e07565b50600160ff1b8414866121778786612f44565b909e909d50909b509950505050505050505050565b6060600083905060008760018803815181106121a457fe5b6020026020010151905060006121b982612fd7565b6040805160038082526080820190925291925060009190816020015b6121dd613942565b8152602001906001900390816121d5579050509050600080600284600281111561220357fe5b14156122cd578b51600090156122885760005b60018e51038110156122865760006122408f838151811061223357fe5b6020026020010151612fd7565b600281111561224b57fe5b141561225c5760019091019061227e565b6122788e828151811061226b57fe5b60200260200101516130ad565b51820191505b600101612216565b505b612291866130ad565b516122b561229e886130ad565b6122b06122aa8f612d34565b85612f44565b612f71565b1480156122c157508651155b156122cb57600191505b505b8015612307576122e56122df866130ad565b89612e30565b8383815181106122f157fe5b602002602001018190525060018201915061254b565b600084600281111561231557fe5b141561237e57855161234d5761232b85896130c0565b83838151811061233757fe5b6020026020010181905250600182019150612379565b8483838151811061235a57fe5b60200260200101819052506001820191506122e56122df876001612f44565b61254b565b6000612389866130ad565b905060006123978289612f71565b905080156123f85760006123ad8360008461310b565b90506123c1816123bc8d61325b565b61329c565b8686815181106123cd57fe5b60200260200101819052506001850194506123e88383612f44565b92506123f48983612f44565b9850505b60006124026132e0565b9050825160001415612427576124208161241b8a6127cc565b6130c0565b90506124bf565b60008360008151811061243657fe5b016020015160f81c905061244b846001612f44565b9350600288600281111561245b57fe5b1415612496576000612475856124708c6127cc565b612e30565b905061248e8383612489846000015161325b565b61336d565b9250506124bd565b8351156124ac576000612475856123bc8c6127cc565b6124ba82826124898c6127cc565b91505b505b88516124f4576124cf818c6130c0565b9050808686815181106124de57fe5b6020026020010181905250600185019450612547565b6124ff896001612f44565b98508086868151811061250e57fe5b6020026020010181905250600185019450612529898c612e30565b86868151811061253557fe5b60200260200101819052506001850194505b5050505b61255a8c60018d0385856133c6565b9c9b505050505050505050505050565b60008061257683612d34565b9050612580613942565b84516000906060905b80156126ae5787600182038151811061259e57fe5b602002602001015193506125b184612fd7565b925060028360028111156125c157fe5b14156125ec5760006125d2856130ad565b90506125e4866000835189510361310b565b955050612698565b60018360028111156125fa57fe5b141561263a57600061260b856130ad565b905061261d866000835189510361310b565b8351909650156126345761263185846134a8565b94505b50612698565b600083600281111561264857fe5b1415612698578151156126985760008560018751038151811061266757fe5b602001015160f81c60f81b60f81c9050612687866000600189510361310b565b955061269485828561336d565b9450505b83516126a39061325b565b915060001901612589565b50509051805160209091012095945050505050565b60608151600014156126e4575060408051600081526020810190915261097a565b6000805b8351811015612717578381815181106126fd57fe5b6020026020010151518201915080806001019150506126e8565b6000826001600160401b038111801561272f57600080fd5b506040519080825280601f01601f19166020018201604052801561275a576020820181803683370190505b50600092509050602081015b85518310156127c357600086848151811061277d57fe5b60200260200101519050600060208201905061279b83828451613554565b8785815181106127a757fe5b6020026020010151518301925050508280600101935050612766565b50949350505050565b60208101518051606091611528916000198101908110611d9257fe5b600080600080846000015111612845576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f811161286a576000600160009450945094505050612b0a565b60b781116128df578551607f1982019081106128cd576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b60019550935060009250612b0a915050565b60bf81116129c357855160b6198201908110612942576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a60018501510490508082018860000151116129ae576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b60019091019550935060009250612b0a915050565b60f78111612a3757855160bf198201908110612a26576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b600195509350849250612b0a915050565b855160f6198201908110612a92576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111612af7576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b6001918201965094509250612b0a915050565b9193909250565b60606000826001600160401b0381118015612b2b57600080fd5b506040519080825280601f01601f191660200182016040528015612b56576020820181803683370190505b509050805160001415612b6a579050611696565b8484016020820160005b60208604811015612b95578251825260209283019290910190600101612b74565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b6060600080612bcc846127e8565b91935090915060019050816001811115612be257fe5b14612c34576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b612c55613928565b815260200190600190039081612c4d5790505090506000835b8651811015612d295760208210612cb65760405162461bcd60e51b815260040180806020018281038252602a8152602001806143e3602a913960400191505060405180910390fd5b600080612ce26040518060400160405280858c60000151038152602001858c60200151018152506127e8565b509150915060405180604001604052808383018152602001848b6020015101815250858581518110612d1057fe5b6020908102919091010152600193909301920101612c6e565b508152949350505050565b6060600082516002026001600160401b0381118015612d5257600080fd5b506040519080825280601f01601f191660200182016040528015612d7d576020820181803683370190505b50905060005b8351811015612e29576004848281518110612d9a57fe5b602001015160f81c60f81b6001600160f81b031916901c828260020281518110612dc057fe5b60200101906001600160f81b031916908160001a9053506010848281518110612de557fe5b016020015160f81c81612df457fe5b0660f81b828260020260010181518110612e0a57fe5b60200101906001600160f81b031916908160001a905350600101612d83565b5092915050565b612e38613942565b60408051600280825260608201909252600091816020015b6060815260200190600190039081612e505790505090506000612e74856001613598565b9050612e826103ef826136ef565b82600081518110612e8f57fe5b6020026020010181905250612ea3846114c4565b82600181518110612eb057fe5b6020026020010181905250611bcf826137bf565b6000602082511015612edb5750602081015161097a565b81806020019051602081101561097557600080fd5b60006060602083600001511015612f1157612f0a836137ee565b9050612f1d565b612f1a83611b49565b90505b61169681612ec4565b6060611528612f3f8360200151600081518110611d9257fe5b612d34565b606082518210612f635750604080516020810190915260008152611528565b61169683838486510361310b565b6000805b808451118015612f855750808351115b8015612fca5750828181518110612f9857fe5b602001015160f81c60f81b6001600160f81b031916848281518110612fb957fe5b01602001516001600160f81b031916145b1561169657600101612f75565b60208101515160009060111415612ff05750600061097a565b6002826020015151141561306c57600061300983612f26565b905060008160008151811061301a57fe5b016020015160f81c90506002811480613036575060ff81166003145b156130465760029250505061097a565b60ff81161580613059575060ff81166001145b156130695760019250505061097a565b50505b6040805162461bcd60e51b8152602060048201526011602482015270496e76616c6964206e6f6465207479706560781b604482015290519081900360640190fd5b60606115286130bb83612f26565b6137f9565b6130c8613942565b60006130d3836114c4565b90506130de81611b24565b6020850151805160001981019081106130f357fe5b602002602001018190525061154c8460200151613842565b60608182601f011015613156576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b82828401101561319e576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b818301845110156131ea576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b60608215801561320957604051915060008252602082016040526127c3565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561324257805183526020928301920161322a565b5050858452601f01601f19166040525050949350505050565b606060208251101561326e57508061097a565b818051906020012060405160200180828152602001915050604051602081830303815290604052905061097a565b6132a4613942565b60408051600280825260608201909252600091816020015b60608152602001906001900390816132bc5790505090506000612e74856000613598565b6132e8613942565b6040805160118082526102408201909252600091816020015b606081526020019060019003908161330157905050905060005b815181101561335d57604051806040016040528060018152602001600160ff1b81525082828151811061334a57fe5b602090810291909101015260010161331b565b50613367816137bf565b91505090565b613375613942565b6000602083511061338e57613389836114c4565b613390565b825b905061339b81611b24565b85602001518560ff16815181106133ae57fe5b6020026020010181905250611bcf8560200151613842565b606060008285016001600160401b03811180156133e257600080fd5b5060405190808252806020026020018201604052801561341c57816020015b613409613942565b8152602001906001900390816134015790505b50905060005b8581101561345d5786818151811061343657fe5b602002602001015182828151811061344a57fe5b6020908102919091010152600101613422565b5060005b8381101561349e5784818151811061347557fe5b6020026020010151828783018151811061348b57fe5b6020908102919091010152600101613461565b5095945050505050565b6134b0613942565b60408051600280825260608201909252600091816020015b60608152602001906001900390816134c857905050905060006134f46134ed866130ad565b6000613598565b90506135026103ef826136ef565b8260008151811061350f57fe5b602002602001018190525060208451101561354257838260018151811061353257fe5b602002602001018190525061354b565b612ea3846114c4565b611bcf826137bf565b8282825b60208110613577578151835260209283019290910190601f1901613558565b905182516020929092036101000a6000190180199091169116179052505050565b60606000826135a85760006135ab565b60025b9050600060028551816135ba57fe5b06905060008160020360ff166001600160401b03811180156135db57600080fd5b506040519080825280601f01601f191660200182016040528015613606576020820181803683370190505b50905081830160f81b8160008151811061361c57fe5b60200101906001600160f81b031916908160001a90535080866040516020018083805190602001908083835b602083106136675780518252601f199092019160209182019101613648565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106136af5780518252601f199092019160209182019101613690565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052935050505092915050565b6060600060028351816136fe57fe5b046001600160401b038111801561371457600080fd5b506040519080825280601f01601f19166020018201604052801561373f576020820181803683370190505b50905060005b8151811015612e295783816002026001018151811061376057fe5b602001015160f81c60f81b600485836002028151811061377c57fe5b602001015160f81c60f81b6001600160f81b031916901b178282815181106137a057fe5b60200101906001600160f81b031916908160001a905350600101613745565b6137c7613942565b60006137d2836119d2565b905060405180604001604052808281526020016117aa83611bd8565b6060611528826138eb565b606060028260008151811061380a57fe5b016020015160f81c8161381957fe5b0660ff166000141561383757613830826002612f44565b905061097a565b613830826001612f44565b61384a613942565b600082516001600160401b038111801561386357600080fd5b5060405190808252806020026020018201604052801561389757816020015b60608152602001906001900390816138825790505b50905060005b83518110156138e1576138c28482815181106138b557fe5b60200260200101516137ee565b8282815181106138ce57fe5b602090810291909101015260010161389d565b50611696816137bf565b6060611528826020015160008460000151612b11565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060008152602001600081525090565b604051806040016040528060608152602001606081525090565b600061396f61396a84614379565b614356565b905082815283838301111561398357600080fd5b828260208301376000602084830101529392505050565b803561097a816143ca565b8051801515811461097a57600080fd5b600082601f8301126139c5578081fd5b6116968383356020850161395c565b80356002811061097a57600080fd5b6000806000606084860312156139f7578283fd5b8335613a02816143ca565b92506020840135613a12816143ca565b915060408401356001600160401b03811115613a2c578182fd5b613a38868287016139b5565b9150509250925092565b600080600060608486031215613a56578283fd5b8335613a61816143ca565b92506020840135915060408401356001600160401b03811115613a2c578182fd5b60008060408385031215613a94578182fd5b8235613a9f816143ca565b915060208301356001600160401b03811115613ab9578182fd5b613ac5858286016139b5565b9150509250929050565b600060208284031215613ae0578081fd5b611696826139a5565b600060208284031215613afa578081fd5b5051919050565b600060208284031215613b12578081fd5b81516001600160401b03811115613b27578182fd5b8201601f81018413613b37578182fd5b8051613b4561396a82614379565b818152856020838501011115613b59578384fd5b611bcf82602083016020860161439a565b600060208284031215613b7b578081fd5b81356001600160401b03811115613b90578182fd5b8201601f81018413613ba0578182fd5b61154c8482356020840161395c565b600060c08284031215613bc0578081fd5b60405160c081018181106001600160401b0382111715613bdc57fe5b8060405250825181526020830151602082015260408301516040820152606083015160608201526080830151613c11816143ca565b6080820152613c2260a084016139a5565b60a08201529392505050565b600060208284031215613c3f578081fd5b81356001600160401b0380821115613c55578283fd5b9083019060e08286031215613c68578283fd5b613c7260e0614356565b8235815260208301356020820152613c8c604084016139d4565b6040820152613c9d6060840161399a565b6060820152613cae6080840161399a565b608082015260a083013560a082015260c083013582811115613cce578485fd5b613cda878286016139b5565b60c08301525095945050505050565b6001600160a01b03169052565b60008151808452613d0e81602086016020860161439a565b601f01601f19169290920160200192915050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b90815260200190565b60008351613d5a81846020880161439a565b835190830190613d6e81836020880161439a565b01949350505050565b600088825287602083015260028710613d8c57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b166055840152508360698301528251613dd381608985016020870161439a565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b600060e08201905060018060a01b038085168352835160208401526020840151604084015260408401516060840152606084015160808401528060808501511660a08401525060a0830151151560c08301529392505050565b901515815260200190565b6020810160038310613ea657fe5b91905290565b60208082526025908201527f53746f7261676520736c6f742068617320616c7265616479206265656e20707260408201526437bb32b71760d91b606082015260800190565b60208082526026908201527f4163636f756e742073746174652068617320616c7265616479206265656e20706040820152653937bb32b71760d11b606082015260800190565b6020808252603e908201527f416c6c206163636f756e7473206d75737420626520636f6d6d6974746564206260408201527f65666f726520636f6d706c6574696e672061207472616e736974696f6e2e0000606082015260800190565b602080825260409082018190527f53746f7261676520736c6f742076616c7565207761736e2774206368616e6765908201527f64206f722068617320616c7265616479206265656e20636f6d6d69747465642e606082015260800190565b6020808252605b908201527f4f564d5f53746174655472616e736974696f6e65723a2050726f76696465642060408201527f4c3120636f6e747261637420636f6465206861736820646f6573206e6f74206d60608201527f61746368204c3220636f6e747261637420636f646520686173682e0000000000608082015260a00190565b6020808252603f908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d6d697474696e67206163636f756e74207374617465732e00606082015260800190565b60208082526038908201527f4e6f7420656e6f7567682067617320746f2065786563757465207472616e736160408201527f6374696f6e2064657465726d696e6973746963616c6c792e0000000000000000606082015260800190565b6020808252603b908201527f4163636f756e74207374617465207761736e2774206368616e676564206f722060408201527f68617320616c7265616479206265656e20636f6d6d69747465642e0000000000606082015260800190565b6020808252603d908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d706c6574696e672061207472616e736974696f6e2e000000606082015260800190565b60208082526031908201527f46756e6374696f6e206d7573742062652063616c6c656420647572696e67207460408201527034329031b7b93932b1ba10383430b9b29760791b606082015260800190565b6020808252601d908201527f496e76616c6964207472616e73616374696f6e2070726f76696465642e000000604082015260600190565b60208082526038908201527f436f6e7472616374206d757374206265207665726966696564206265666f726560408201527f2070726f76696e6720612073746f7261676520736c6f742e0000000000000000606082015260800190565b60006040825283516040830152602084015160608301526040840151600281106142f457fe5b60808381019190915260608501516001600160a01b031660a084015284015161432060c0840182613ce9565b5060a084015160e083015260c084015160e0610100840152614346610120840182613cf6565b9150506116966020830184613ce9565b6040518181016001600160401b038111828210171561437157fe5b604052919050565b60006001600160401b0382111561438c57fe5b50601f01601f191660200190565b60005b838110156143b557818101518382015260200161439d565b838111156143c4576000848401525b50505050565b6001600160a01b03811681146143df57600080fd5b5056fe50726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e52656365697665642061206e6f6465207769746820616e20756e6b6e6f776e20707265666978a264697066735822122098623b5d8a4c0fcdf15bfb72801372ca7a0d19e2a81bde8c6eed2b833d19284964736f6c634300070600334372656174652063616e206f6e6c7920626520646f6e6520627920746865204f564d5f467261756456657269666965722ea2646970667358221220dd4b9e8035653bfb395d28bfa466d3d87570bcf75ea8d58973b1d53f4783560f64736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c806322d1470214610046578063299ca4781461009a578063461a4478146100a2575b600080fd5b61007e6004803603608081101561005c57600080fd5b506001600160a01b038135169060208101359060408101359060600135610148565b604080516001600160a01b039092168252519081900360200190f35b61007e610229565b61007e600480360360208110156100b857600080fd5b8101906020810181356401000000008111156100d357600080fd5b8201836020820111156100e557600080fd5b8035906020019184600183028401116401000000008311171561010757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610238945050505050565b600061017c6040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b815250610238565b6001600160a01b0316336001600160a01b0316146101cb5760405162461bcd60e51b8152600401808060200182810382526031815260200180614a606031913960400191505060405180910390fd5b848484846040516101db90610314565b80856001600160a01b03168152602001848152602001838152602001828152602001945050505050604051809103906000f08015801561021f573d6000803e3d6000fd5b5095945050505050565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610298578181015183820152602001610280565b50505050905090810190601f1680156102c55780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102e257600080fd5b505afa1580156102f6573d6000803e3d6000fd5b505050506040513d602081101561030c57600080fd5b505192915050565b61473e806103228339019056fe60806040523480156200001157600080fd5b506040516200473e3803806200473e833981016040819052620000349162000232565b600080546001600160a01b0319166001600160a01b038616179055600583905560028290556003829055600681905560408051808201909152601781527f4f564d5f53746174654d616e61676572466163746f72790000000000000000006020820152620000a29062000150565b6001600160a01b0316639ed93318306040518263ffffffff1660e01b8152600401620000cf919062000299565b602060405180830381600087803b158015620000ea57600080fd5b505af1158015620000ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000125919062000273565b600180546001600160a01b0319166001600160a01b039290921691909117905550620002c692505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015620001b257818101518382015260200162000198565b50505050905090810190601f168015620001e05780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b158015620001fe57600080fd5b505afa15801562000213573d6000803e3d6000fd5b505050506040513d60208110156200022a57600080fd5b505192915050565b6000806000806080858703121562000248578384fd5b84516200025581620002ad565b60208601516040870151606090970151919890975090945092505050565b60006020828403121562000285578081fd5b81516200029281620002ad565b9392505050565b6001600160a01b0391909116815260200190565b6001600160a01b0381168114620002c357600080fd5b50565b61446880620002d66000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063845fe7a31161008c578063b2fa1c9e11610066578063b2fa1c9e14610185578063b52805711461019a578063b9194310146101a2578063c1c618b8146101b5576100cf565b8063845fe7a314610155578063a244316a14610168578063b1c9fe6e14610170576100cf565b8063299ca478146100d45780632e1ac36c146100f25780632eb1375814610107578063461a44781461011a578063732f960b1461012d578063805e9d3014610140575b600080fd5b6100dc6101bd565b6040516100e99190613de6565b60405180910390f35b610105610100366004613a42565b6101cc565b005b610105610115366004613a82565b610565565b6100dc610128366004613b6a565b6108a1565b61010561013b366004613c2e565b61097f565b610148610c6f565b6040516100e99190613d3f565b610105610163366004613a42565b610c75565b610105610fa1565b610178611128565b6040516100e99190613e98565b61018d611131565b6040516100e99190613e8d565b6100dc61114c565b6101056101b03660046139e3565b61115b565b610148611475565b6000546001600160a01b031681565b60018060045460ff1660028111156101e057fe5b146102065760405162461bcd60e51b81526004016101fd906141e9565b60405180910390fd5b60025460065460005a6001546040516363b285f960e11b81529192506001600160a01b03169063c7650bf290610242908a908a90600401613dfa565b602060405180830381600087803b15801561025c57600080fd5b505af1158015610270573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102949190613acf565b15156001146102b55760405162461bcd60e51b81526004016101fd90613f94565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f1906102e6908b90600401613de6565b60c06040518083038186803b1580156102fe57600080fd5b505afa158015610312573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103369190613baf565b600154604051631aaf392f60e01b81529192506000916001600160a01b0390911690631aaf392f9061036e908c908c90600401613dfa565b60206040518083038186803b15801561038657600080fd5b505afa15801561039a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103be9190613ae9565b90506103ff886040516020016103d49190613d3f565b6040516020818303038152906040526103f46103ef8461147b565b6114c4565b89856040015161152e565b6040808401919091526001549051638f3b964760e01b81526001600160a01b0390911690638f3b964790610439908c908690600401613e34565b600060405180830381600087803b15801561045357600080fd5b505af1158015610467573d6000803e3d6000fd5b505050507f3e3ed1a676a2754a041b49bf752e0f167c8753495e36c320fe01d1ef7476253c898960405161049c929190613dfa565b60405180910390a1505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561054357600080fd5b505af1158015610557573d6000803e3d6000fd5b505050505050505050505050565b60018060045460ff16600281111561057957fe5b146105965760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a9050600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156105ef57600080fd5b505afa158015610603573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106279190613ae9565b156106445760405162461bcd60e51b81526004016101fd90614075565b600154604051630b38106960e11b81526001600160a01b039091169063167020d290610674908990600401613de6565b602060405180830381600087803b15801561068e57600080fd5b505af11580156106a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c69190613acf565b15156001146106e75760405162461bcd60e51b81526004016101fd9061412f565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f190610718908a90600401613de6565b60c06040518083038186803b15801561073057600080fd5b505afa158015610744573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107689190613baf565b90506107a78760405160200161077e9190613d22565b60405160208183030381529060405261079e61079984611554565b611594565b8860035461152e565b6003556040517fcec9ef675d775706a02b43afe48af52c5019bc50f99582e3208c6ff55d59c008906107da908990613de6565b60405180910390a15060005a8203905061081a6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561088057600080fd5b505af1158015610894573d6000803e3d6000fd5b5050505050505050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156109015781810151838201526020016108e9565b50505050905090810190601f16801561092e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561094b57600080fd5b505afa15801561095f573d6000803e3d6000fd5b505050506040513d602081101561097557600080fd5b505190505b919050565b60008060045460ff16600281111561099357fe5b146109b05760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a90506006546109c78661169d565b146109e45760405162461bcd60e51b81526004016101fd9061423a565b6103e88560a0015161040802816109f757fe5b04620186a0015a1015610a1c5760405162461bcd60e51b81526004016101fd906140d2565b6000610a536040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b8152506108a1565b600154604051631381ba4d60e01b81529192506001600160a01b031690631381ba4d90610a84908490600401613de6565b600060405180830381600087803b158015610a9e57600080fd5b505af1158015610ab2573d6000803e3d6000fd5b5050600154604051639be3ad6760e01b81526001600160a01b038086169450639be3ad679350610ae9928b929116906004016142ce565b600060405180830381600087803b158015610b0357600080fd5b505af1158015610b17573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b3f9190810190613b01565b50600154604051631381ba4d60e01b81526001600160a01b0390911690631381ba4d90610b7190600090600401613de6565b600060405180830381600087803b158015610b8b57600080fd5b505af1158015610b9f573d6000803e3d6000fd5b50506004805460ff191660011790555060009150505a82039050610be96040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b158015610c4f57600080fd5b505af1158015610c63573d6000803e3d6000fd5b50505050505050505050565b60025490565b60008060045460ff166002811115610c8957fe5b14610ca65760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a600154604051630ad2267960e01b81529192506001600160a01b031690630ad2267990610ce2908a908a90600401613dfa565b60206040518083038186803b158015610cfa57600080fd5b505afa158015610d0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d329190613acf565b15610d4f5760405162461bcd60e51b81526004016101fd90613eac565b60015460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf90610d7f908a90600401613de6565b60206040518083038186803b158015610d9757600080fd5b505afa158015610dab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcf9190613acf565b1515600114610df05760405162461bcd60e51b81526004016101fd90614271565b60015460405163136e2d8960e11b81526000916001600160a01b0316906326dc5b1290610e21908b90600401613de6565b60206040518083038186803b158015610e3957600080fd5b505afa158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e719190613ae9565b905060007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421821415610ea557506000610f02565b600080610ed28a604051602001610ebc9190613d3f565b6040516020818303038152906040528a866116b6565b909250905060018215151415610efa57610ef3610eee826116df565b6116f2565b9250610eff565b600092505b50505b600154604051635c17d62960e01b81526001600160a01b0390911690635c17d62990610f36908c908c908690600401613e13565b600060405180830381600087803b158015610f5057600080fd5b505af1158015610f64573d6000803e3d6000fd5b50505050505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b60018060045460ff166002811115610fb557fe5b14610fd25760405162461bcd60e51b81526004016101fd906141e9565b600160009054906101000a90046001600160a01b03166001600160a01b031663d7bd4a2a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561102057600080fd5b505afa158015611034573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110589190613ae9565b156110755760405162461bcd60e51b81526004016101fd90613f37565b600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156110c357600080fd5b505afa1580156110d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110fb9190613ae9565b156111185760405162461bcd60e51b81526004016101fd9061418c565b506004805460ff19166002179055565b60045460ff1681565b6000600260045460ff16600281111561114657fe5b14905090565b6001546001600160a01b031681565b60008060045460ff16600281111561116f57fe5b1461118c5760405162461bcd60e51b81526004016101fd906141e9565b60025460065460005a60015460405163c8e40fbf60e01b81529192506001600160a01b03169063c8e40fbf906111c6908a90600401613de6565b60206040518083038186803b1580156111de57600080fd5b505afa1580156111f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112169190613acf565b1580156112a057506001546040516307a1294560e01b81526001600160a01b03909116906307a129459061124e908a90600401613de6565b60206040518083038186803b15801561126657600080fd5b505afa15801561127a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129e9190613acf565b155b6112bc5760405162461bcd60e51b81526004016101fd90613ef1565b6000806112eb896040516020016112d39190613d22565b604051602081830303815290604052886002546116b6565b90925090506001821515141561140c57600061130682611721565b606081015190915089907fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470141561133f5750600061136a565b816060015161134d826117b3565b1461136a5760405162461bcd60e51b81526004016101fd90613ff2565b6001546040805160c08101825284518152602080860151908201528482015181830152606080860151908201526001600160a01b038481166080830152600060a08301529151638f3b964760e01b81529190921691638f3b9647916113d3918f91600401613e34565b600060405180830381600087803b1580156113ed57600080fd5b505af1158015611401573d6000803e3d6000fd5b50505050505061143c565b600154604051630d631c9d60e31b81526001600160a01b0390911690636b18e4e890610f36908c90600401613de6565b505060005a820390506104dd6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506108a1565b60035490565b6060806000805b6020811085821a15161561149c5760019182019101611482565b5060405191506040820160405283600882021b60208301528060200382525080915050919050565b606080825160011480156114ec57506080836000815181106114e257fe5b016020015160f81c105b156114f8575081611528565b611504835160806117b7565b83604051602001611516929190613d48565b60405160208183030381529060405290505b92915050565b60008061153a86611906565b905061154881868686611936565b9150505b949350505050565b61155c613901565b604051806080016040528083600001518152602001836020015181526020018360400151815260200183606001518152509050919050565b60408051600480825260a0820190925260609160009190816020015b60608152602001906001900390816115b057505083519091506115d6906103ef9061147b565b816000815181106115e357fe5b60200260200101819052506116016103ef846020015160001b61147b565b8160018151811061160e57fe5b602002602001018190525061164583604001516040516020016116319190613d3f565b6040516020818303038152906040526114c4565b8160028151811061165257fe5b602002602001018190525061167583606001516040516020016116319190613d3f565b8160038151811061168257fe5b6020026020010181905250611696816119d2565b9392505050565b60006116a882611a16565b805190602001209050919050565b6000606060006116c586611906565b90506116d2818686611a51565b9250925050935093915050565b60606115286116ed83611b24565b611b49565b600080600060208451111561170857602061170b565b83515b6020858101519190036008021c92505050919050565b611729613901565b600061173483611bd8565b9050604051806080016040528061175e8360008151811061175157fe5b6020026020010151611beb565b81526020016117738360018151811061175157fe5b81526020016117958360028151811061178857fe5b6020026020010151611bf2565b81526020016117aa8360038151811061178857fe5b90529392505050565b3f90565b6060806038841015611811576040805160018082528183019092529060208201818036833701905050905082840160f81b816000815181106117f557fe5b60200101906001600160f81b031916908160001a905350611696565b600060015b80868161181f57fe5b04156118345760019091019061010002611816565b816001016001600160401b038111801561184d57600080fd5b506040519080825280601f01601f191660200182016040528015611878576020820181803683370190505b50925084820160370160f81b8360008151811061189157fe5b60200101906001600160f81b031916908160001a905350600190505b8181116118fd576101008183036101000a87816118c657fe5b04816118ce57fe5b0660f81b8382815181106118de57fe5b60200101906001600160f81b031916908160001a9053506001016118ad565b50509392505050565b606081805190602001206040516020016119209190613d3f565b6040516020818303038152906040529050919050565b6040805180820190915260018152600160ff1b60209091015260007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42182141561198a576119838585611cec565b905061154c565b600061199584611d10565b90506000806119a5838987611de6565b509150915060006119b984848b858c61218c565b90506119c5818a61256a565b9998505050505050505050565b606060006119df836126c3565b90506119ed815160c06117b7565b816040516020016119ff929190613d48565b604051602081830303815290604052915050919050565b6060816000015182602001518360400151846060015185608001518660a001518760c001516040516020016119209796959493929190613d77565b600060606000611a6085611d10565b90506000806000611a72848a89611de6565b81519295509093509150158080611a865750815b611ad7576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b600081611af35760405180602001604052806000815250611b12565b611b12866001870381518110611b0557fe5b60200260200101516127cc565b919b919a509098505050505050505050565b611b2c613928565b506040805180820190915281518152602082810190820152919050565b60606000806000611b59856127e8565b919450925090506000816001811115611b6e57fe5b14611bc0576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b611bcf85602001518484612b11565b95945050505050565b6060611528611be683611b24565b612bbe565b6000611528825b6000602182600001511115611c4e576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6000806000611c5c856127e8565b919450925090506000816001811115611c7157fe5b14611cc3576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b602080860151840180519091841015611ce25760208490036101000a90045b9695505050505050565b6000611d00611cfa84612d34565b83612e30565b5180516020909101209392505050565b60606000611d1d83611bd8565b9050600081516001600160401b0381118015611d3857600080fd5b50604051908082528060200260200182016040528015611d7257816020015b611d5f613942565b815260200190600190039081611d575790505b50905060005b8251811015611dde576000611d9f848381518110611d9257fe5b6020026020010151611b49565b90506040518060400160405280828152602001611dbb83611bd8565b815250838381518110611dca57fe5b602090810291909101015250600101611d78565b509392505050565b60006060818080611df687612d34565b905085600080611e04613942565b60005b8c51811015612164578c8181518110611e1c57fe5b6020026020010151915082840193506001870196508360001415611e9057815180516020909101208514611e8b576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b611f57565b815151602011611ef757815180516020909101208514611e8b576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b84611f058360000151612ec4565b14611f57576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b60208201515160111415611fc6578551841415611f7357612164565b6000868581518110611f8157fe5b602001015160f81c60f81b60f81c9050600083602001518260ff1681518110611fa657fe5b60200260200101519050611fb981612ef0565b965060019450505061215c565b6002826020015151141561210f576000611fdf83612f26565b9050600081600081518110611ff057fe5b016020015160f81c90506001811660020360006120108460ff8416612f44565b9050600061201e8b8a612f44565b9050600061202c8383612f71565b905060ff851660021480612043575060ff85166003145b15612075578083511480156120585750808251145b1561206257988901985b50600160ff1b9950612164945050505050565b60ff85161580612088575060ff85166001145b156120d857825181146120a85750600160ff1b9950612164945050505050565b6120c988602001516001815181106120bc57fe5b6020026020010151612ef0565b9a50975061215c945050505050565b60405162461bcd60e51b815260040180806020018281038252602681526020018061440d6026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b600101611e07565b50600160ff1b8414866121778786612f44565b909e909d50909b509950505050505050505050565b6060600083905060008760018803815181106121a457fe5b6020026020010151905060006121b982612fd7565b6040805160038082526080820190925291925060009190816020015b6121dd613942565b8152602001906001900390816121d5579050509050600080600284600281111561220357fe5b14156122cd578b51600090156122885760005b60018e51038110156122865760006122408f838151811061223357fe5b6020026020010151612fd7565b600281111561224b57fe5b141561225c5760019091019061227e565b6122788e828151811061226b57fe5b60200260200101516130ad565b51820191505b600101612216565b505b612291866130ad565b516122b561229e886130ad565b6122b06122aa8f612d34565b85612f44565b612f71565b1480156122c157508651155b156122cb57600191505b505b8015612307576122e56122df866130ad565b89612e30565b8383815181106122f157fe5b602002602001018190525060018201915061254b565b600084600281111561231557fe5b141561237e57855161234d5761232b85896130c0565b83838151811061233757fe5b6020026020010181905250600182019150612379565b8483838151811061235a57fe5b60200260200101819052506001820191506122e56122df876001612f44565b61254b565b6000612389866130ad565b905060006123978289612f71565b905080156123f85760006123ad8360008461310b565b90506123c1816123bc8d61325b565b61329c565b8686815181106123cd57fe5b60200260200101819052506001850194506123e88383612f44565b92506123f48983612f44565b9850505b60006124026132e0565b9050825160001415612427576124208161241b8a6127cc565b6130c0565b90506124bf565b60008360008151811061243657fe5b016020015160f81c905061244b846001612f44565b9350600288600281111561245b57fe5b1415612496576000612475856124708c6127cc565b612e30565b905061248e8383612489846000015161325b565b61336d565b9250506124bd565b8351156124ac576000612475856123bc8c6127cc565b6124ba82826124898c6127cc565b91505b505b88516124f4576124cf818c6130c0565b9050808686815181106124de57fe5b6020026020010181905250600185019450612547565b6124ff896001612f44565b98508086868151811061250e57fe5b6020026020010181905250600185019450612529898c612e30565b86868151811061253557fe5b60200260200101819052506001850194505b5050505b61255a8c60018d0385856133c6565b9c9b505050505050505050505050565b60008061257683612d34565b9050612580613942565b84516000906060905b80156126ae5787600182038151811061259e57fe5b602002602001015193506125b184612fd7565b925060028360028111156125c157fe5b14156125ec5760006125d2856130ad565b90506125e4866000835189510361310b565b955050612698565b60018360028111156125fa57fe5b141561263a57600061260b856130ad565b905061261d866000835189510361310b565b8351909650156126345761263185846134a8565b94505b50612698565b600083600281111561264857fe5b1415612698578151156126985760008560018751038151811061266757fe5b602001015160f81c60f81b60f81c9050612687866000600189510361310b565b955061269485828561336d565b9450505b83516126a39061325b565b915060001901612589565b50509051805160209091012095945050505050565b60608151600014156126e4575060408051600081526020810190915261097a565b6000805b8351811015612717578381815181106126fd57fe5b6020026020010151518201915080806001019150506126e8565b6000826001600160401b038111801561272f57600080fd5b506040519080825280601f01601f19166020018201604052801561275a576020820181803683370190505b50600092509050602081015b85518310156127c357600086848151811061277d57fe5b60200260200101519050600060208201905061279b83828451613554565b8785815181106127a757fe5b6020026020010151518301925050508280600101935050612766565b50949350505050565b60208101518051606091611528916000198101908110611d9257fe5b600080600080846000015111612845576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f811161286a576000600160009450945094505050612b0a565b60b781116128df578551607f1982019081106128cd576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b60019550935060009250612b0a915050565b60bf81116129c357855160b6198201908110612942576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a60018501510490508082018860000151116129ae576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b60019091019550935060009250612b0a915050565b60f78111612a3757855160bf198201908110612a26576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b600195509350849250612b0a915050565b855160f6198201908110612a92576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111612af7576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b6001918201965094509250612b0a915050565b9193909250565b60606000826001600160401b0381118015612b2b57600080fd5b506040519080825280601f01601f191660200182016040528015612b56576020820181803683370190505b509050805160001415612b6a579050611696565b8484016020820160005b60208604811015612b95578251825260209283019290910190600101612b74565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b6060600080612bcc846127e8565b91935090915060019050816001811115612be257fe5b14612c34576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b612c55613928565b815260200190600190039081612c4d5790505090506000835b8651811015612d295760208210612cb65760405162461bcd60e51b815260040180806020018281038252602a8152602001806143e3602a913960400191505060405180910390fd5b600080612ce26040518060400160405280858c60000151038152602001858c60200151018152506127e8565b509150915060405180604001604052808383018152602001848b6020015101815250858581518110612d1057fe5b6020908102919091010152600193909301920101612c6e565b508152949350505050565b6060600082516002026001600160401b0381118015612d5257600080fd5b506040519080825280601f01601f191660200182016040528015612d7d576020820181803683370190505b50905060005b8351811015612e29576004848281518110612d9a57fe5b602001015160f81c60f81b6001600160f81b031916901c828260020281518110612dc057fe5b60200101906001600160f81b031916908160001a9053506010848281518110612de557fe5b016020015160f81c81612df457fe5b0660f81b828260020260010181518110612e0a57fe5b60200101906001600160f81b031916908160001a905350600101612d83565b5092915050565b612e38613942565b60408051600280825260608201909252600091816020015b6060815260200190600190039081612e505790505090506000612e74856001613598565b9050612e826103ef826136ef565b82600081518110612e8f57fe5b6020026020010181905250612ea3846114c4565b82600181518110612eb057fe5b6020026020010181905250611bcf826137bf565b6000602082511015612edb5750602081015161097a565b81806020019051602081101561097557600080fd5b60006060602083600001511015612f1157612f0a836137ee565b9050612f1d565b612f1a83611b49565b90505b61169681612ec4565b6060611528612f3f8360200151600081518110611d9257fe5b612d34565b606082518210612f635750604080516020810190915260008152611528565b61169683838486510361310b565b6000805b808451118015612f855750808351115b8015612fca5750828181518110612f9857fe5b602001015160f81c60f81b6001600160f81b031916848281518110612fb957fe5b01602001516001600160f81b031916145b1561169657600101612f75565b60208101515160009060111415612ff05750600061097a565b6002826020015151141561306c57600061300983612f26565b905060008160008151811061301a57fe5b016020015160f81c90506002811480613036575060ff81166003145b156130465760029250505061097a565b60ff81161580613059575060ff81166001145b156130695760019250505061097a565b50505b6040805162461bcd60e51b8152602060048201526011602482015270496e76616c6964206e6f6465207479706560781b604482015290519081900360640190fd5b60606115286130bb83612f26565b6137f9565b6130c8613942565b60006130d3836114c4565b90506130de81611b24565b6020850151805160001981019081106130f357fe5b602002602001018190525061154c8460200151613842565b60608182601f011015613156576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b82828401101561319e576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b818301845110156131ea576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b60608215801561320957604051915060008252602082016040526127c3565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561324257805183526020928301920161322a565b5050858452601f01601f19166040525050949350505050565b606060208251101561326e57508061097a565b818051906020012060405160200180828152602001915050604051602081830303815290604052905061097a565b6132a4613942565b60408051600280825260608201909252600091816020015b60608152602001906001900390816132bc5790505090506000612e74856000613598565b6132e8613942565b6040805160118082526102408201909252600091816020015b606081526020019060019003908161330157905050905060005b815181101561335d57604051806040016040528060018152602001600160ff1b81525082828151811061334a57fe5b602090810291909101015260010161331b565b50613367816137bf565b91505090565b613375613942565b6000602083511061338e57613389836114c4565b613390565b825b905061339b81611b24565b85602001518560ff16815181106133ae57fe5b6020026020010181905250611bcf8560200151613842565b606060008285016001600160401b03811180156133e257600080fd5b5060405190808252806020026020018201604052801561341c57816020015b613409613942565b8152602001906001900390816134015790505b50905060005b8581101561345d5786818151811061343657fe5b602002602001015182828151811061344a57fe5b6020908102919091010152600101613422565b5060005b8381101561349e5784818151811061347557fe5b6020026020010151828783018151811061348b57fe5b6020908102919091010152600101613461565b5095945050505050565b6134b0613942565b60408051600280825260608201909252600091816020015b60608152602001906001900390816134c857905050905060006134f46134ed866130ad565b6000613598565b90506135026103ef826136ef565b8260008151811061350f57fe5b602002602001018190525060208451101561354257838260018151811061353257fe5b602002602001018190525061354b565b612ea3846114c4565b611bcf826137bf565b8282825b60208110613577578151835260209283019290910190601f1901613558565b905182516020929092036101000a6000190180199091169116179052505050565b60606000826135a85760006135ab565b60025b9050600060028551816135ba57fe5b06905060008160020360ff166001600160401b03811180156135db57600080fd5b506040519080825280601f01601f191660200182016040528015613606576020820181803683370190505b50905081830160f81b8160008151811061361c57fe5b60200101906001600160f81b031916908160001a90535080866040516020018083805190602001908083835b602083106136675780518252601f199092019160209182019101613648565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106136af5780518252601f199092019160209182019101613690565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052935050505092915050565b6060600060028351816136fe57fe5b046001600160401b038111801561371457600080fd5b506040519080825280601f01601f19166020018201604052801561373f576020820181803683370190505b50905060005b8151811015612e295783816002026001018151811061376057fe5b602001015160f81c60f81b600485836002028151811061377c57fe5b602001015160f81c60f81b6001600160f81b031916901b178282815181106137a057fe5b60200101906001600160f81b031916908160001a905350600101613745565b6137c7613942565b60006137d2836119d2565b905060405180604001604052808281526020016117aa83611bd8565b6060611528826138eb565b606060028260008151811061380a57fe5b016020015160f81c8161381957fe5b0660ff166000141561383757613830826002612f44565b905061097a565b613830826001612f44565b61384a613942565b600082516001600160401b038111801561386357600080fd5b5060405190808252806020026020018201604052801561389757816020015b60608152602001906001900390816138825790505b50905060005b83518110156138e1576138c28482815181106138b557fe5b60200260200101516137ee565b8282815181106138ce57fe5b602090810291909101015260010161389d565b50611696816137bf565b6060611528826020015160008460000151612b11565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060008152602001600081525090565b604051806040016040528060608152602001606081525090565b600061396f61396a84614379565b614356565b905082815283838301111561398357600080fd5b828260208301376000602084830101529392505050565b803561097a816143ca565b8051801515811461097a57600080fd5b600082601f8301126139c5578081fd5b6116968383356020850161395c565b80356002811061097a57600080fd5b6000806000606084860312156139f7578283fd5b8335613a02816143ca565b92506020840135613a12816143ca565b915060408401356001600160401b03811115613a2c578182fd5b613a38868287016139b5565b9150509250925092565b600080600060608486031215613a56578283fd5b8335613a61816143ca565b92506020840135915060408401356001600160401b03811115613a2c578182fd5b60008060408385031215613a94578182fd5b8235613a9f816143ca565b915060208301356001600160401b03811115613ab9578182fd5b613ac5858286016139b5565b9150509250929050565b600060208284031215613ae0578081fd5b611696826139a5565b600060208284031215613afa578081fd5b5051919050565b600060208284031215613b12578081fd5b81516001600160401b03811115613b27578182fd5b8201601f81018413613b37578182fd5b8051613b4561396a82614379565b818152856020838501011115613b59578384fd5b611bcf82602083016020860161439a565b600060208284031215613b7b578081fd5b81356001600160401b03811115613b90578182fd5b8201601f81018413613ba0578182fd5b61154c8482356020840161395c565b600060c08284031215613bc0578081fd5b60405160c081018181106001600160401b0382111715613bdc57fe5b8060405250825181526020830151602082015260408301516040820152606083015160608201526080830151613c11816143ca565b6080820152613c2260a084016139a5565b60a08201529392505050565b600060208284031215613c3f578081fd5b81356001600160401b0380821115613c55578283fd5b9083019060e08286031215613c68578283fd5b613c7260e0614356565b8235815260208301356020820152613c8c604084016139d4565b6040820152613c9d6060840161399a565b6060820152613cae6080840161399a565b608082015260a083013560a082015260c083013582811115613cce578485fd5b613cda878286016139b5565b60c08301525095945050505050565b6001600160a01b03169052565b60008151808452613d0e81602086016020860161439a565b601f01601f19169290920160200192915050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b90815260200190565b60008351613d5a81846020880161439a565b835190830190613d6e81836020880161439a565b01949350505050565b600088825287602083015260028710613d8c57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b166055840152508360698301528251613dd381608985016020870161439a565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b600060e08201905060018060a01b038085168352835160208401526020840151604084015260408401516060840152606084015160808401528060808501511660a08401525060a0830151151560c08301529392505050565b901515815260200190565b6020810160038310613ea657fe5b91905290565b60208082526025908201527f53746f7261676520736c6f742068617320616c7265616479206265656e20707260408201526437bb32b71760d91b606082015260800190565b60208082526026908201527f4163636f756e742073746174652068617320616c7265616479206265656e20706040820152653937bb32b71760d11b606082015260800190565b6020808252603e908201527f416c6c206163636f756e7473206d75737420626520636f6d6d6974746564206260408201527f65666f726520636f6d706c6574696e672061207472616e736974696f6e2e0000606082015260800190565b602080825260409082018190527f53746f7261676520736c6f742076616c7565207761736e2774206368616e6765908201527f64206f722068617320616c7265616479206265656e20636f6d6d69747465642e606082015260800190565b6020808252605b908201527f4f564d5f53746174655472616e736974696f6e65723a2050726f76696465642060408201527f4c3120636f6e747261637420636f6465206861736820646f6573206e6f74206d60608201527f61746368204c3220636f6e747261637420636f646520686173682e0000000000608082015260a00190565b6020808252603f908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d6d697474696e67206163636f756e74207374617465732e00606082015260800190565b60208082526038908201527f4e6f7420656e6f7567682067617320746f2065786563757465207472616e736160408201527f6374696f6e2064657465726d696e6973746963616c6c792e0000000000000000606082015260800190565b6020808252603b908201527f4163636f756e74207374617465207761736e2774206368616e676564206f722060408201527f68617320616c7265616479206265656e20636f6d6d69747465642e0000000000606082015260800190565b6020808252603d908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d706c6574696e672061207472616e736974696f6e2e000000606082015260800190565b60208082526031908201527f46756e6374696f6e206d7573742062652063616c6c656420647572696e67207460408201527034329031b7b93932b1ba10383430b9b29760791b606082015260800190565b6020808252601d908201527f496e76616c6964207472616e73616374696f6e2070726f76696465642e000000604082015260600190565b60208082526038908201527f436f6e7472616374206d757374206265207665726966696564206265666f726560408201527f2070726f76696e6720612073746f7261676520736c6f742e0000000000000000606082015260800190565b60006040825283516040830152602084015160608301526040840151600281106142f457fe5b60808381019190915260608501516001600160a01b031660a084015284015161432060c0840182613ce9565b5060a084015160e083015260c084015160e0610100840152614346610120840182613cf6565b9150506116966020830184613ce9565b6040518181016001600160401b038111828210171561437157fe5b604052919050565b60006001600160401b0382111561438c57fe5b50601f01601f191660200190565b60005b838110156143b557818101518382015260200161439d565b838111156143c4576000848401525b50505050565b6001600160a01b03811681146143df57600080fd5b5056fe50726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e52656365697665642061206e6f6465207769746820616e20756e6b6e6f776e20707265666978a264697066735822122098623b5d8a4c0fcdf15bfb72801372ca7a0d19e2a81bde8c6eed2b833d19284964736f6c634300070600334372656174652063616e206f6e6c7920626520646f6e6520627920746865204f564d5f467261756456657269666965722ea2646970667358221220dd4b9e8035653bfb395d28bfa466d3d87570bcf75ea8d58973b1d53f4783560f64736f6c63430007060033", "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", @@ -144,16 +144,16 @@ "storageLayout": { "storage": [ { - "astId": 12856, + "astId": 15303, "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_StateTransitionerFactory.sol:OVM_StateTransitionerFactory", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12849" + "type": "t_contract(Lib_AddressManager)15296" } ], "types": { - "t_contract(Lib_AddressManager)12849": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" diff --git a/packages/contracts/deployments/mainnet/Proxy__OVM_L1CrossDomainMessenger.json b/packages/contracts/deployments/mainnet/Proxy__OVM_L1CrossDomainMessenger.json index 4280247bb614..363133f4ec6c 100644 --- a/packages/contracts/deployments/mainnet/Proxy__OVM_L1CrossDomainMessenger.json +++ b/packages/contracts/deployments/mainnet/Proxy__OVM_L1CrossDomainMessenger.json @@ -1,5 +1,5 @@ { - "address": "0x902e5fF5A99C4eC1C21bbab089fdabE32EF0A5DF", + "address": "0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1", "abi": [ { "inputs": [ @@ -22,30 +22,30 @@ "type": "fallback" } ], - "transactionHash": "0xe198de44f75246ee2a816da72ac4da1b4d9481176a414783acd928e3738434b7", + "transactionHash": "0x3061bc0332ef45e8809cee450c3c487eba2520084c71ff38da85459aee6b9a1d", "receipt": { "to": null, - "from": "0xd033f09cB85621F98F7A84C64dB381ac16Eff818", - "contractAddress": "0x902e5fF5A99C4eC1C21bbab089fdabE32EF0A5DF", - "transactionIndex": 294, + "from": "0x9996571372066A1545D3435C6935e3F9593A7eF5", + "contractAddress": "0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1", + "transactionIndex": 153, "gasUsed": "225024", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x62326c55decffcda8c36fab59693824c82c0f9ab5b90b76ed88c5090ae926052", - "transactionHash": "0xe198de44f75246ee2a816da72ac4da1b4d9481176a414783acd928e3738434b7", + "blockHash": "0xd4ac3db2a7b6711dabac13ef84b398e86c647e5a24f0ffdd3458b3c66ab6cef1", + "transactionHash": "0x3061bc0332ef45e8809cee450c3c487eba2520084c71ff38da85459aee6b9a1d", "logs": [], - "blockNumber": 12410833, - "cumulativeGasUsed": "11217568", + "blockNumber": 12686757, + "cumulativeGasUsed": "11815865", "status": 1, "byzantium": true }, "args": [ - "0x668E5b997b9aE88a56cd40409119d4Db9e6d752E", + "0xdE1FCfB0851916CA5101820A69b13a4E276bd81F", "OVM_L1CrossDomainMessenger" ], - "solcInputHash": "f2bdab652d5102f5f11e78dae866798d", - "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\":\"payable\",\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0xcc9fc5c64f1101a5c6c397594086b1608189a9edc5c9635e1ac38f70aeeeecbf\",\"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 // 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 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 payable\\n {\\n address target = addressManager[address(this)].getAddress(\\n (implementationName[address(this)])\\n );\\n\\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\":\"0xfaecb051b37f1d87d588cafb17a575723cbdf7c3c2079772110f33e747e05027\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506040516104083803806104088339818101604052604081101561003357600080fd5b81516020830180516040519294929383019291908464010000000082111561005a57600080fd5b90830190602082018581111561006f57600080fd5b825164010000000081118282018810171561008957600080fd5b82525081516020918201929091019080838360005b838110156100b657818101518382015260200161009e565b50505050905090810190601f1680156100e35780820380516001836020036101000a031916815260200191505b5060409081523060009081526001602090815282822080546001600160a01b0319166001600160a01b038a16179055818152919020855161012c95509093509085019150610134565b5050506101d5565b828054600181600116156101000203166002900490600052602060002090601f01602090048101928261016a57600085556101b0565b82601f1061018357805160ff19168380011785556101b0565b828001600101855582156101b0579182015b828111156101b0578251825591602001919060010190610195565b506101bc9291506101c0565b5090565b5b808211156101bc57600081556001016101c1565b610224806101e46000396000f3fe60806040818152306000908152600160208181528383205483825293832063bf40fac160e01b909552608490815284546002610100938216159390930260001901169190910460a481905291936001600160a01b039093169263bf40fac192909190819060c490849080156100b55780601f1061008a576101008083540402835291602001916100b5565b820191906000526020600020905b81548152906001019060200180831161009857829003601f168201915b50509250505060206040518083038186803b1580156100d357600080fd5b505afa1580156100e7573d6000803e3d6000fd5b505050506040513d60208110156100fd57600080fd5b505190506001600160a01b0381166101465760405162461bcd60e51b81526004018080602001828103825260238152602001806101cc6023913960400191505060405180910390fd5b600080826001600160a01b03166000366040518083838082843760405192019450600093509091505080830381855af49150503d80600081146101a5576040519150601f19603f3d011682016040523d82523d6000602084013e6101aa565b606091505b509092509050600182151514156101c357805160208201f35b805160208201fdfe5461726765742061646472657373206d75737420626520696e697469616c697a65642ea2646970667358221220ceebc7fc0b8eea3f2d3758756655b8c39c79670618f167c7b41c2b40b2e41b0964736f6c63430007060033", - "deployedBytecode": "0x60806040818152306000908152600160208181528383205483825293832063bf40fac160e01b909552608490815284546002610100938216159390930260001901169190910460a481905291936001600160a01b039093169263bf40fac192909190819060c490849080156100b55780601f1061008a576101008083540402835291602001916100b5565b820191906000526020600020905b81548152906001019060200180831161009857829003601f168201915b50509250505060206040518083038186803b1580156100d357600080fd5b505afa1580156100e7573d6000803e3d6000fd5b505050506040513d60208110156100fd57600080fd5b505190506001600160a01b0381166101465760405162461bcd60e51b81526004018080602001828103825260238152602001806101cc6023913960400191505060405180910390fd5b600080826001600160a01b03166000366040518083838082843760405192019450600093509091505080830381855af49150503d80600081146101a5576040519150601f19603f3d011682016040523d82523d6000602084013e6101aa565b606091505b509092509050600182151514156101c357805160208201f35b805160208201fdfe5461726765742061646472657373206d75737420626520696e697469616c697a65642ea2646970667358221220ceebc7fc0b8eea3f2d3758756655b8c39c79670618f167c7b41c2b40b2e41b0964736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"payable\",\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 // 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 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 payable\\n {\\n address target = addressManager[address(this)].getAddress(\\n (implementationName[address(this)])\\n );\\n\\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\":\"0xfaecb051b37f1d87d588cafb17a575723cbdf7c3c2079772110f33e747e05027\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516104083803806104088339818101604052604081101561003357600080fd5b81516020830180516040519294929383019291908464010000000082111561005a57600080fd5b90830190602082018581111561006f57600080fd5b825164010000000081118282018810171561008957600080fd5b82525081516020918201929091019080838360005b838110156100b657818101518382015260200161009e565b50505050905090810190601f1680156100e35780820380516001836020036101000a031916815260200191505b5060409081523060009081526001602090815282822080546001600160a01b0319166001600160a01b038a16179055818152919020855161012c95509093509085019150610134565b5050506101d5565b828054600181600116156101000203166002900490600052602060002090601f01602090048101928261016a57600085556101b0565b82601f1061018357805160ff19168380011785556101b0565b828001600101855582156101b0579182015b828111156101b0578251825591602001919060010190610195565b506101bc9291506101c0565b5090565b5b808211156101bc57600081556001016101c1565b610224806101e46000396000f3fe60806040818152306000908152600160208181528383205483825293832063bf40fac160e01b909552608490815284546002610100938216159390930260001901169190910460a481905291936001600160a01b039093169263bf40fac192909190819060c490849080156100b55780601f1061008a576101008083540402835291602001916100b5565b820191906000526020600020905b81548152906001019060200180831161009857829003601f168201915b50509250505060206040518083038186803b1580156100d357600080fd5b505afa1580156100e7573d6000803e3d6000fd5b505050506040513d60208110156100fd57600080fd5b505190506001600160a01b0381166101465760405162461bcd60e51b81526004018080602001828103825260238152602001806101cc6023913960400191505060405180910390fd5b600080826001600160a01b03166000366040518083838082843760405192019450600093509091505080830381855af49150503d80600081146101a5576040519150601f19603f3d011682016040523d82523d6000602084013e6101aa565b606091505b509092509050600182151514156101c357805160208201f35b805160208201fdfe5461726765742061646472657373206d75737420626520696e697469616c697a65642ea2646970667358221220d96dd78b72a44c11bfa8efb98d29ee53776a02c67052599da176325fcbf95b6464736f6c63430007060033", + "deployedBytecode": "0x60806040818152306000908152600160208181528383205483825293832063bf40fac160e01b909552608490815284546002610100938216159390930260001901169190910460a481905291936001600160a01b039093169263bf40fac192909190819060c490849080156100b55780601f1061008a576101008083540402835291602001916100b5565b820191906000526020600020905b81548152906001019060200180831161009857829003601f168201915b50509250505060206040518083038186803b1580156100d357600080fd5b505afa1580156100e7573d6000803e3d6000fd5b505050506040513d60208110156100fd57600080fd5b505190506001600160a01b0381166101465760405162461bcd60e51b81526004018080602001828103825260238152602001806101cc6023913960400191505060405180910390fd5b600080826001600160a01b03166000366040518083838082843760405192019450600093509091505080830381855af49150503d80600081146101a5576040519150601f19603f3d011682016040523d82523d6000602084013e6101aa565b606091505b509092509050600182151514156101c357805160208201f35b805160208201fdfe5461726765742061646472657373206d75737420626520696e697469616c697a65642ea2646970667358221220d96dd78b72a44c11bfa8efb98d29ee53776a02c67052599da176325fcbf95b6464736f6c63430007060033", "devdoc": { "kind": "dev", "methods": { @@ -67,7 +67,7 @@ "storageLayout": { "storage": [ { - "astId": 12893, + "astId": 15340, "contract": "contracts/optimistic-ethereum/libraries/resolver/Lib_ResolvedDelegateProxy.sol:Lib_ResolvedDelegateProxy", "label": "implementationName", "offset": 0, @@ -75,12 +75,12 @@ "type": "t_mapping(t_address,t_string_storage)" }, { - "astId": 12897, + "astId": 15344, "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)12849)" + "type": "t_mapping(t_address,t_contract(Lib_AddressManager)15296)" } ], "types": { @@ -89,17 +89,17 @@ "label": "address", "numberOfBytes": "20" }, - "t_contract(Lib_AddressManager)12849": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" }, - "t_mapping(t_address,t_contract(Lib_AddressManager)12849)": { + "t_mapping(t_address,t_contract(Lib_AddressManager)15296)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => contract Lib_AddressManager)", "numberOfBytes": "32", - "value": "t_contract(Lib_AddressManager)12849" + "value": "t_contract(Lib_AddressManager)15296" }, "t_mapping(t_address,t_string_storage)": { "encoding": "mapping", diff --git a/packages/contracts/deployments/mainnet/Proxy__OVM_L1ETHGateway.json b/packages/contracts/deployments/mainnet/Proxy__OVM_L1ETHGateway.json deleted file mode 100644 index 62e8895e754a..000000000000 --- a/packages/contracts/deployments/mainnet/Proxy__OVM_L1ETHGateway.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "address": "0xe681F80966a8b1fFadECf8068bD6F99034791c95", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_libAddressManager", - "type": "address" - }, - { - "internalType": "string", - "name": "_implementationName", - "type": "string" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "stateMutability": "payable", - "type": "fallback" - } - ], - "transactionHash": "0x7734ee79863cabbe3587b8817b53cdad9a8c642c0df1a76e629d04cc0f796d27", - "receipt": { - "to": null, - "from": "0xd033f09cB85621F98F7A84C64dB381ac16Eff818", - "contractAddress": "0xe681F80966a8b1fFadECf8068bD6F99034791c95", - "transactionIndex": 111, - "gasUsed": "224904", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xd2198877ffc22d8735ee15be1c92e4e7923af6048b0cbe6308b2e38ffe8bf0d8", - "transactionHash": "0x7734ee79863cabbe3587b8817b53cdad9a8c642c0df1a76e629d04cc0f796d27", - "logs": [], - "blockNumber": 12410958, - "cumulativeGasUsed": "6370527", - "status": 1, - "byzantium": true - }, - "args": [ - "0x668E5b997b9aE88a56cd40409119d4Db9e6d752E", - "OVM_L1ETHGateway" - ], - "solcInputHash": "f2bdab652d5102f5f11e78dae866798d", - "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\":\"payable\",\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0xcc9fc5c64f1101a5c6c397594086b1608189a9edc5c9635e1ac38f70aeeeecbf\",\"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 // 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 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 payable\\n {\\n address target = addressManager[address(this)].getAddress(\\n (implementationName[address(this)])\\n );\\n\\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\":\"0xfaecb051b37f1d87d588cafb17a575723cbdf7c3c2079772110f33e747e05027\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506040516104083803806104088339818101604052604081101561003357600080fd5b81516020830180516040519294929383019291908464010000000082111561005a57600080fd5b90830190602082018581111561006f57600080fd5b825164010000000081118282018810171561008957600080fd5b82525081516020918201929091019080838360005b838110156100b657818101518382015260200161009e565b50505050905090810190601f1680156100e35780820380516001836020036101000a031916815260200191505b5060409081523060009081526001602090815282822080546001600160a01b0319166001600160a01b038a16179055818152919020855161012c95509093509085019150610134565b5050506101d5565b828054600181600116156101000203166002900490600052602060002090601f01602090048101928261016a57600085556101b0565b82601f1061018357805160ff19168380011785556101b0565b828001600101855582156101b0579182015b828111156101b0578251825591602001919060010190610195565b506101bc9291506101c0565b5090565b5b808211156101bc57600081556001016101c1565b610224806101e46000396000f3fe60806040818152306000908152600160208181528383205483825293832063bf40fac160e01b909552608490815284546002610100938216159390930260001901169190910460a481905291936001600160a01b039093169263bf40fac192909190819060c490849080156100b55780601f1061008a576101008083540402835291602001916100b5565b820191906000526020600020905b81548152906001019060200180831161009857829003601f168201915b50509250505060206040518083038186803b1580156100d357600080fd5b505afa1580156100e7573d6000803e3d6000fd5b505050506040513d60208110156100fd57600080fd5b505190506001600160a01b0381166101465760405162461bcd60e51b81526004018080602001828103825260238152602001806101cc6023913960400191505060405180910390fd5b600080826001600160a01b03166000366040518083838082843760405192019450600093509091505080830381855af49150503d80600081146101a5576040519150601f19603f3d011682016040523d82523d6000602084013e6101aa565b606091505b509092509050600182151514156101c357805160208201f35b805160208201fdfe5461726765742061646472657373206d75737420626520696e697469616c697a65642ea2646970667358221220ceebc7fc0b8eea3f2d3758756655b8c39c79670618f167c7b41c2b40b2e41b0964736f6c63430007060033", - "deployedBytecode": "0x60806040818152306000908152600160208181528383205483825293832063bf40fac160e01b909552608490815284546002610100938216159390930260001901169190910460a481905291936001600160a01b039093169263bf40fac192909190819060c490849080156100b55780601f1061008a576101008083540402835291602001916100b5565b820191906000526020600020905b81548152906001019060200180831161009857829003601f168201915b50509250505060206040518083038186803b1580156100d357600080fd5b505afa1580156100e7573d6000803e3d6000fd5b505050506040513d60208110156100fd57600080fd5b505190506001600160a01b0381166101465760405162461bcd60e51b81526004018080602001828103825260238152602001806101cc6023913960400191505060405180910390fd5b600080826001600160a01b03166000366040518083838082843760405192019450600093509091505080830381855af49150503d80600081146101a5576040519150601f19603f3d011682016040523d82523d6000602084013e6101aa565b606091505b509092509050600182151514156101c357805160208201f35b805160208201fdfe5461726765742061646472657373206d75737420626520696e697469616c697a65642ea2646970667358221220ceebc7fc0b8eea3f2d3758756655b8c39c79670618f167c7b41c2b40b2e41b0964736f6c63430007060033", - "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": 12893, - "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": 12897, - "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)12849)" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_contract(Lib_AddressManager)12849": { - "encoding": "inplace", - "label": "contract Lib_AddressManager", - "numberOfBytes": "20" - }, - "t_mapping(t_address,t_contract(Lib_AddressManager)12849)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => contract Lib_AddressManager)", - "numberOfBytes": "32", - "value": "t_contract(Lib_AddressManager)12849" - }, - "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/packages/contracts/deployments/mainnet/Proxy__OVM_L1StandardBridge.json b/packages/contracts/deployments/mainnet/Proxy__OVM_L1StandardBridge.json new file mode 100644 index 000000000000..4e1fbf899bfb --- /dev/null +++ b/packages/contracts/deployments/mainnet/Proxy__OVM_L1StandardBridge.json @@ -0,0 +1,177 @@ +{ + "address": "0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "getImplementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_code", + "type": "bytes" + } + ], + "name": "setCode", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_key", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_value", + "type": "bytes32" + } + ], + "name": "setStorage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x3fb736def76e27e507bc4e451e5498f1f1beee3e82e6aa67ecef434c638a04ac", + "receipt": { + "to": null, + "from": "0x9996571372066A1545D3435C6935e3F9593A7eF5", + "contractAddress": "0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1", + "transactionIndex": 70, + "gasUsed": "471232", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xb6578d9e60cce4713437b5cf0898dd7040c9284e178aadfb7dfbb590f4f083af", + "transactionHash": "0x3fb736def76e27e507bc4e451e5498f1f1beee3e82e6aa67ecef434c638a04ac", + "logs": [], + "blockNumber": 12686786, + "cumulativeGasUsed": "6551653", + "status": 1, + "byzantium": true + }, + "args": [ + "0x9996571372066A1545D3435C6935e3F9593A7eF5" + ], + "solcInputHash": "7531d7762a77038a37e7490a7b4b176f", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"getImplementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_code\",\"type\":\"bytes\"}],\"name\":\"setCode\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_key\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_value\",\"type\":\"bytes32\"}],\"name\":\"setStorage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Basic ChugSplash proxy contract for L1. Very close to being a normal proxy but has added functions `setCode` and `setStorage` for changing the code or storage of the contract. Nifty! Note for future developers: do NOT make anything in this contract 'public' unless you know what you're doing. Anything public can potentially have a function signature that conflicts with a signature attached to the implementation contract. Public functions SHOULD always have the 'proxyCallIfNotOwner' modifier unless there's some *really* good reason not to have that modifier. And there almost certainly is not a good reason to not have that modifier. Beware!\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_owner\":\"Address of the initial contract owner.\"}},\"getImplementation()\":{\"returns\":{\"_0\":\"Implementation address.\"}},\"getOwner()\":{\"returns\":{\"_0\":\"Owner address.\"}},\"setCode(bytes)\":{\"params\":{\"_code\":\"New contract code to run inside this contract.\"}},\"setOwner(address)\":{\"params\":{\"_owner\":\"New owner of the proxy contract.\"}},\"setStorage(bytes32,bytes32)\":{\"params\":{\"_key\":\"Storage key to modify.\",\"_value\":\"New value for the storage key.\"}}},\"title\":\"L1ChugSplashProxy\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getImplementation()\":{\"notice\":\"Queries the implementation address. Can only be called by the owner OR by making an eth_call and setting the \\\"from\\\" address to address(0).\"},\"getOwner()\":{\"notice\":\"Queries the owner of the proxy contract. Can only be called by the owner OR by making an eth_call and setting the \\\"from\\\" address to address(0).\"},\"setCode(bytes)\":{\"notice\":\"Sets the code that should be running behind this proxy. Note that this scheme is a bit different from the standard proxy scheme where one would typically deploy the code separately and then set the implementation address. We're doing it this way because it gives us a lot more freedom on the client side. Can only be triggered by the contract owner.\"},\"setOwner(address)\":{\"notice\":\"Changes the owner of the proxy contract. Only callable by the owner.\"},\"setStorage(bytes32,bytes32)\":{\"notice\":\"Modifies some storage slot within the proxy contract. Gives us a lot of power to perform upgrades in a more transparent way. Only callable by the owner.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/chugsplash/L1ChugSplashProxy.sol\":\"L1ChugSplashProxy\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/chugsplash/L1ChugSplashProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\nimport { iL1ChugSplashDeployer } from \\\"./interfaces/iL1ChugSplashDeployer.sol\\\";\\n\\n/**\\n * @title L1ChugSplashProxy\\n * @dev Basic ChugSplash proxy contract for L1. Very close to being a normal proxy but has added\\n * functions `setCode` and `setStorage` for changing the code or storage of the contract. Nifty!\\n *\\n * Note for future developers: do NOT make anything in this contract 'public' unless you know what\\n * you're doing. Anything public can potentially have a function signature that conflicts with a\\n * signature attached to the implementation contract. Public functions SHOULD always have the\\n * 'proxyCallIfNotOwner' modifier unless there's some *really* good reason not to have that\\n * modifier. And there almost certainly is not a good reason to not have that modifier. Beware!\\n */\\ncontract L1ChugSplashProxy {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n // \\\"Magic\\\" prefix. When prepended to some arbitrary bytecode and used to create a contract, the\\n // appended bytecode will be deployed as given.\\n bytes13 constant internal DEPLOY_CODE_PREFIX = 0x600D380380600D6000396000f3;\\n\\n // bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n bytes32 constant internal IMPLEMENTATION_KEY = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n // bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1)\\n bytes32 constant internal OWNER_KEY = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n \\n /**\\n * @param _owner Address of the initial contract owner.\\n */\\n constructor(\\n address _owner\\n ) {\\n _setOwner(_owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Blocks a function from being called when the parent signals that the system should be paused\\n * via an isUpgrading function.\\n */\\n modifier onlyWhenNotPaused() {\\n address owner = _getOwner();\\n\\n // We do a low-level call because there's no guarantee that the owner actually *is* an\\n // L1ChugSplashDeployer contract and Solidity will throw errors if we do a normal call and\\n // it turns out that it isn't the right type of contract.\\n (bool success, bytes memory returndata) = owner.staticcall(\\n abi.encodeWithSelector(\\n iL1ChugSplashDeployer.isUpgrading.selector\\n )\\n );\\n\\n // If the call was unsuccessful then we assume that there's no \\\"isUpgrading\\\" method and we\\n // can just continue as normal. We also expect that the return value is exactly 32 bytes\\n // long. If this isn't the case then we can safely ignore the result.\\n if (success && returndata.length == 32) {\\n // Although the expected value is a *boolean*, it's safer to decode as a uint256 in the\\n // case that the isUpgrading function returned something other than 0 or 1. But we only\\n // really care about the case where this value is 0 (= false).\\n uint256 ret = abi.decode(returndata, (uint256));\\n require(\\n ret == 0,\\n \\\"L1ChugSplashProxy: system is currently being upgraded\\\"\\n );\\n }\\n\\n _;\\n }\\n\\n /**\\n * Makes a proxy call instead of triggering the given function when the caller is either the\\n * owner or the zero address. Caller can only ever be the zero address if this function is\\n * being called off-chain via eth_call, which is totally fine and can be convenient for\\n * client-side tooling. Avoids situations where the proxy and implementation share a sighash\\n * and the proxy function ends up being called instead of the implementation one.\\n *\\n * Note: msg.sender == address(0) can ONLY be triggered off-chain via eth_call. If there's a\\n * way for someone to send a transaction with msg.sender == address(0) in any real context then\\n * we have much bigger problems. Primary reason to include this additional allowed sender is\\n * because the owner address can be changed dynamically and we do not want clients to have to\\n * keep track of the current owner in order to make an eth_call that doesn't trigger the\\n * proxied contract.\\n */\\n modifier proxyCallIfNotOwner() {\\n if (msg.sender == _getOwner() || msg.sender == address(0)) {\\n _;\\n } else {\\n // This WILL halt the call frame on completion.\\n _doProxyCall();\\n }\\n }\\n\\n\\n /*********************\\n * Fallback Function *\\n *********************/\\n\\n fallback()\\n external\\n payable\\n {\\n // Proxy call by default.\\n _doProxyCall();\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sets the code that should be running behind this proxy. Note that this scheme is a bit\\n * different from the standard proxy scheme where one would typically deploy the code\\n * separately and then set the implementation address. We're doing it this way because it gives\\n * us a lot more freedom on the client side. Can only be triggered by the contract owner.\\n * @param _code New contract code to run inside this contract.\\n */\\n function setCode(\\n bytes memory _code\\n )\\n proxyCallIfNotOwner\\n public\\n {\\n // Get the code hash of the current implementation.\\n address implementation = _getImplementation();\\n\\n // If the code hash matches the new implementation then we return early.\\n if (keccak256(_code) == _getAccountCodeHash(implementation)) {\\n return;\\n }\\n\\n // Create the deploycode by appending the magic prefix.\\n bytes memory deploycode = abi.encodePacked(\\n DEPLOY_CODE_PREFIX,\\n _code\\n );\\n\\n // Deploy the code and set the new implementation address.\\n address newImplementation;\\n assembly {\\n newImplementation := create(0x0, add(deploycode, 0x20), mload(deploycode))\\n }\\n\\n // Check that the code was actually deployed correctly. I'm not sure if you can ever\\n // actually fail this check. Should only happen if the contract creation from above runs\\n // out of gas but this parent execution thread does NOT run out of gas. Seems like we\\n // should be doing this check anyway though.\\n require(\\n _getAccountCodeHash(newImplementation) == keccak256(_code),\\n \\\"L1ChugSplashProxy: code was not correctly deployed.\\\"\\n );\\n\\n _setImplementation(newImplementation);\\n }\\n\\n /**\\n * Modifies some storage slot within the proxy contract. Gives us a lot of power to perform\\n * upgrades in a more transparent way. Only callable by the owner.\\n * @param _key Storage key to modify.\\n * @param _value New value for the storage key.\\n */\\n function setStorage(\\n bytes32 _key,\\n bytes32 _value\\n )\\n proxyCallIfNotOwner\\n public\\n {\\n assembly {\\n sstore(_key, _value)\\n }\\n }\\n\\n /**\\n * Changes the owner of the proxy contract. Only callable by the owner.\\n * @param _owner New owner of the proxy contract.\\n */\\n function setOwner(\\n address _owner\\n )\\n proxyCallIfNotOwner\\n public\\n {\\n _setOwner(_owner);\\n }\\n\\n /**\\n * Queries the owner of the proxy contract. Can only be called by the owner OR by making an\\n * eth_call and setting the \\\"from\\\" address to address(0).\\n * @return Owner address.\\n */\\n function getOwner()\\n proxyCallIfNotOwner\\n public\\n returns (\\n address\\n )\\n {\\n return _getOwner();\\n }\\n\\n /**\\n * Queries the implementation address. Can only be called by the owner OR by making an\\n * eth_call and setting the \\\"from\\\" address to address(0).\\n * @return Implementation address.\\n */\\n function getImplementation()\\n proxyCallIfNotOwner\\n public\\n returns (\\n address\\n )\\n {\\n return _getImplementation();\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Sets the implementation address.\\n * @param _implementation New implementation address.\\n */\\n function _setImplementation(\\n address _implementation\\n )\\n internal\\n {\\n assembly {\\n sstore(IMPLEMENTATION_KEY, _implementation)\\n }\\n }\\n\\n /**\\n * Queries the implementation address.\\n * @return Implementation address.\\n */\\n function _getImplementation()\\n internal\\n view\\n returns (\\n address\\n )\\n {\\n address implementation;\\n assembly {\\n implementation := sload(IMPLEMENTATION_KEY)\\n }\\n return implementation;\\n }\\n\\n /**\\n * Changes the owner of the proxy contract.\\n * @param _owner New owner of the proxy contract.\\n */\\n function _setOwner(\\n address _owner\\n )\\n internal\\n {\\n assembly {\\n sstore(OWNER_KEY, _owner)\\n }\\n }\\n\\n /**\\n * Queries the owner of the proxy contract.\\n * @return Owner address.\\n */\\n function _getOwner()\\n internal\\n view \\n returns (\\n address\\n )\\n {\\n address owner;\\n assembly {\\n owner := sload(OWNER_KEY)\\n }\\n return owner;\\n }\\n\\n /**\\n * Gets the code hash for a given account.\\n * @param _account Address of the account to get a code hash for.\\n * @return Code hash for the account.\\n */\\n function _getAccountCodeHash(\\n address _account\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n bytes32 codeHash;\\n assembly {\\n codeHash := extcodehash(_account)\\n }\\n return codeHash;\\n }\\n\\n /**\\n * Performs the proxy call via a delegatecall.\\n */\\n function _doProxyCall()\\n onlyWhenNotPaused\\n internal\\n {\\n address implementation = _getImplementation();\\n\\n require(\\n implementation != address(0),\\n \\\"L1ChugSplashProxy: implementation is not set yet\\\"\\n );\\n\\n assembly {\\n // Copy calldata into memory at 0x0....calldatasize.\\n calldatacopy(0x0, 0x0, calldatasize())\\n\\n // Perform the delegatecall, make sure to pass all available gas.\\n let success := delegatecall(gas(), implementation, 0x0, calldatasize(), 0x0, 0x0)\\n\\n // Copy returndata into memory at 0x0....returndatasize. Note that this *will*\\n // overwrite the calldata that we just copied into memory but that doesn't really\\n // matter because we'll be returning in a second anyway.\\n returndatacopy(0x0, 0x0, returndatasize())\\n \\n // Success == 0 means a revert. We'll revert too and pass the data up.\\n if iszero(success) {\\n revert(0x0, returndatasize())\\n }\\n\\n // Otherwise we'll just return and pass the data up.\\n return(0x0, returndatasize())\\n }\\n }\\n}\\n\",\"keccak256\":\"0x654af4f1d1aab76467c49fcce992eaf3522040ed806d656d98735c50ac235eeb\",\"license\":\"MIT\"},\"contracts/chugsplash/interfaces/iL1ChugSplashDeployer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title iL1ChugSplashDeployer\\n */\\ninterface iL1ChugSplashDeployer {\\n function isUpgrading()\\n external\\n view\\n returns (\\n bool\\n );\\n}\\n\",\"keccak256\":\"0xdab3ecb1ce03376523cd2f2ce5f991389c388829c56907987da01d99d3fc44c7\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516107983803806107988339818101604052602081101561003357600080fd5b505161003e81610044565b50610068565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b610721806100776000396000f3fe60806040526004361061004a5760003560e01c806313af4035146100545780636c5d4ad014610087578063893d20e81461013a5780639b0b0fda1461016b578063aaf10f421461019b575b6100526101b0565b005b34801561006057600080fd5b506100526004803603602081101561007757600080fd5b50356001600160a01b031661036c565b34801561009357600080fd5b50610052600480360360208110156100aa57600080fd5b8101906020810181356401000000008111156100c557600080fd5b8201836020820111156100d757600080fd5b803590602001918460018302840111640100000000831117156100f957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506103af945050505050565b34801561014657600080fd5b5061014f610505565b604080516001600160a01b039092168252519081900360200190f35b34801561017757600080fd5b506100526004803603604081101561018e57600080fd5b508035906020013561054b565b3480156101a757600080fd5b5061014f610589565b60006101ba6105bd565b60408051600481526024810182526020810180516001600160e01b0316635bca393160e11b1781529151815193945060009384936001600160a01b0387169392918291908083835b602083106102215780518252601f199092019160209182019101610202565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114610281576040519150601f19603f3d011682016040523d82523d6000602084013e610286565b606091505b5091509150818015610299575080516020145b156102f85760008180602001905160208110156102b557600080fd5b5051905080156102f65760405162461bcd60e51b81526004018080602001828103825260358152602001806106b76035913960400191505060405180910390fd5b505b60006103026105e2565b90506001600160a01b0381166103495760405162461bcd60e51b81526004018080602001828103825260308152602001806106546030913960400191505060405180910390fd5b3660008037600080366000845af43d6000803e80610366573d6000fd5b503d6000f35b6103746105bd565b6001600160a01b0316336001600160a01b03161480610391575033155b156103a45761039f81610607565b6103ac565b6103ac6101b0565b50565b6103b76105bd565b6001600160a01b0316336001600160a01b031614806103d4575033155b156103a45760006103e36105e2565b90506103ee8161062b565b825160208401201415610401575061039f565b60006c600d380380600d6000396000f360981b83604051602001808372ffffffffffffffffffffffffffffffffffffff19168152600d0182805190602001908083835b602083106104635780518252601f199092019160209182019101610444565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052905060008151602083016000f0905083805190602001206104b88261062b565b146104f45760405162461bcd60e51b81526004018080602001828103825260338152602001806106846033913960400191505060405180910390fd5b6104fd8161062f565b5050506103ac565b600061050f6105bd565b6001600160a01b0316336001600160a01b0316148061052c575033155b15610540576105396105bd565b9050610548565b6105486101b0565b90565b6105536105bd565b6001600160a01b0316336001600160a01b03161480610570575033155b1561057d57808255610585565b6105856101b0565b5050565b60006105936105bd565b6001600160a01b0316336001600160a01b031614806105b0575033155b15610540576105396105e2565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b3f90565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe4c314368756753706c61736850726f78793a20696d706c656d656e746174696f6e206973206e6f7420736574207965744c314368756753706c61736850726f78793a20636f646520776173206e6f7420636f72726563746c79206465706c6f7965642e4c314368756753706c61736850726f78793a2073797374656d2069732063757272656e746c79206265696e67207570677261646564a26469706673582212202e20c1d0062b5a698d49624edce72a713b117e88f4cd70877869b53519c1d1f964736f6c63430007060033", + "deployedBytecode": "0x60806040526004361061004a5760003560e01c806313af4035146100545780636c5d4ad014610087578063893d20e81461013a5780639b0b0fda1461016b578063aaf10f421461019b575b6100526101b0565b005b34801561006057600080fd5b506100526004803603602081101561007757600080fd5b50356001600160a01b031661036c565b34801561009357600080fd5b50610052600480360360208110156100aa57600080fd5b8101906020810181356401000000008111156100c557600080fd5b8201836020820111156100d757600080fd5b803590602001918460018302840111640100000000831117156100f957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506103af945050505050565b34801561014657600080fd5b5061014f610505565b604080516001600160a01b039092168252519081900360200190f35b34801561017757600080fd5b506100526004803603604081101561018e57600080fd5b508035906020013561054b565b3480156101a757600080fd5b5061014f610589565b60006101ba6105bd565b60408051600481526024810182526020810180516001600160e01b0316635bca393160e11b1781529151815193945060009384936001600160a01b0387169392918291908083835b602083106102215780518252601f199092019160209182019101610202565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114610281576040519150601f19603f3d011682016040523d82523d6000602084013e610286565b606091505b5091509150818015610299575080516020145b156102f85760008180602001905160208110156102b557600080fd5b5051905080156102f65760405162461bcd60e51b81526004018080602001828103825260358152602001806106b76035913960400191505060405180910390fd5b505b60006103026105e2565b90506001600160a01b0381166103495760405162461bcd60e51b81526004018080602001828103825260308152602001806106546030913960400191505060405180910390fd5b3660008037600080366000845af43d6000803e80610366573d6000fd5b503d6000f35b6103746105bd565b6001600160a01b0316336001600160a01b03161480610391575033155b156103a45761039f81610607565b6103ac565b6103ac6101b0565b50565b6103b76105bd565b6001600160a01b0316336001600160a01b031614806103d4575033155b156103a45760006103e36105e2565b90506103ee8161062b565b825160208401201415610401575061039f565b60006c600d380380600d6000396000f360981b83604051602001808372ffffffffffffffffffffffffffffffffffffff19168152600d0182805190602001908083835b602083106104635780518252601f199092019160209182019101610444565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052905060008151602083016000f0905083805190602001206104b88261062b565b146104f45760405162461bcd60e51b81526004018080602001828103825260338152602001806106846033913960400191505060405180910390fd5b6104fd8161062f565b5050506103ac565b600061050f6105bd565b6001600160a01b0316336001600160a01b0316148061052c575033155b15610540576105396105bd565b9050610548565b6105486101b0565b90565b6105536105bd565b6001600160a01b0316336001600160a01b03161480610570575033155b1561057d57808255610585565b6105856101b0565b5050565b60006105936105bd565b6001600160a01b0316336001600160a01b031614806105b0575033155b15610540576105396105e2565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b3f90565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe4c314368756753706c61736850726f78793a20696d706c656d656e746174696f6e206973206e6f7420736574207965744c314368756753706c61736850726f78793a20636f646520776173206e6f7420636f72726563746c79206465706c6f7965642e4c314368756753706c61736850726f78793a2073797374656d2069732063757272656e746c79206265696e67207570677261646564a26469706673582212202e20c1d0062b5a698d49624edce72a713b117e88f4cd70877869b53519c1d1f964736f6c63430007060033", + "devdoc": { + "details": "Basic ChugSplash proxy contract for L1. Very close to being a normal proxy but has added functions `setCode` and `setStorage` for changing the code or storage of the contract. Nifty! Note for future developers: do NOT make anything in this contract 'public' unless you know what you're doing. Anything public can potentially have a function signature that conflicts with a signature attached to the implementation contract. Public functions SHOULD always have the 'proxyCallIfNotOwner' modifier unless there's some *really* good reason not to have that modifier. And there almost certainly is not a good reason to not have that modifier. Beware!", + "kind": "dev", + "methods": { + "constructor": { + "params": { + "_owner": "Address of the initial contract owner." + } + }, + "getImplementation()": { + "returns": { + "_0": "Implementation address." + } + }, + "getOwner()": { + "returns": { + "_0": "Owner address." + } + }, + "setCode(bytes)": { + "params": { + "_code": "New contract code to run inside this contract." + } + }, + "setOwner(address)": { + "params": { + "_owner": "New owner of the proxy contract." + } + }, + "setStorage(bytes32,bytes32)": { + "params": { + "_key": "Storage key to modify.", + "_value": "New value for the storage key." + } + } + }, + "title": "L1ChugSplashProxy", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "getImplementation()": { + "notice": "Queries the implementation address. Can only be called by the owner OR by making an eth_call and setting the \"from\" address to address(0)." + }, + "getOwner()": { + "notice": "Queries the owner of the proxy contract. Can only be called by the owner OR by making an eth_call and setting the \"from\" address to address(0)." + }, + "setCode(bytes)": { + "notice": "Sets the code that should be running behind this proxy. Note that this scheme is a bit different from the standard proxy scheme where one would typically deploy the code separately and then set the implementation address. We're doing it this way because it gives us a lot more freedom on the client side. Can only be triggered by the contract owner." + }, + "setOwner(address)": { + "notice": "Changes the owner of the proxy contract. Only callable by the owner." + }, + "setStorage(bytes32,bytes32)": { + "notice": "Modifies some storage slot within the proxy contract. Gives us a lot of power to perform upgrades in a more transparent way. Only callable by the owner." + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/mainnet/mockOVM_BondManager.json b/packages/contracts/deployments/mainnet/mockOVM_BondManager.json index a7e9ca474de3..e5119e18c723 100644 --- a/packages/contracts/deployments/mainnet/mockOVM_BondManager.json +++ b/packages/contracts/deployments/mainnet/mockOVM_BondManager.json @@ -1,5 +1,5 @@ { - "address": "0x90c5F8d045bBcCc99d907f30E8707F06D95d065b", + "address": "0xCd76de5C57004d47d0216ec7dAbd3c72D8c49057", "abi": [ { "inputs": [ @@ -173,29 +173,29 @@ "type": "function" } ], - "transactionHash": "0xadf883750d1fe05cb4526571830ad256c35c64c86a378e248f54c284d3fa266c", + "transactionHash": "0x9f307c40b374512c9051b2c2f84df57638556e4f04c1ba45e3894085dbff0126", "receipt": { "to": null, - "from": "0xd033f09cB85621F98F7A84C64dB381ac16Eff818", - "contractAddress": "0x90c5F8d045bBcCc99d907f30E8707F06D95d065b", - "transactionIndex": 241, + "from": "0x9996571372066A1545D3435C6935e3F9593A7eF5", + "contractAddress": "0xCd76de5C57004d47d0216ec7dAbd3c72D8c49057", + "transactionIndex": 79, "gasUsed": "298498", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x324cda21e491b7c979caf4a0b957c1e93e98779989ed66455d8521e06103478d", - "transactionHash": "0xadf883750d1fe05cb4526571830ad256c35c64c86a378e248f54c284d3fa266c", + "blockHash": "0xb3f35390f14261d39b131b06ef5f9e29f94cb484be935149e3743b947ba9d398", + "transactionHash": "0x9f307c40b374512c9051b2c2f84df57638556e4f04c1ba45e3894085dbff0126", "logs": [], - "blockNumber": 12410819, - "cumulativeGasUsed": "10713382", + "blockNumber": 12686751, + "cumulativeGasUsed": "7524620", "status": 1, "byzantium": true }, "args": [ - "0x668E5b997b9aE88a56cd40409119d4Db9e6d752E" + "0xdE1FCfB0851916CA5101820A69b13a4E276bd81F" ], - "solcInputHash": "f2bdab652d5102f5f11e78dae866798d", - "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\":\"_who\",\"type\":\"address\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"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\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"getGasSpent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_who\",\"type\":\"address\"}],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"startWithdrawal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}}},\"title\":\"mockOVM_BondManager\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/mockOVM/verification/mockOVM_BondManager.sol\":\"mockOVM_BondManager\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0xcc9fc5c64f1101a5c6c397594086b1608189a9edc5c9635e1ac38f70aeeeecbf\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"license\":\"MIT\"},\"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 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_Proposer\\\");\\n }\\n\\n function getGasSpent(\\n bytes32, // _preStateRoot,\\n address // _who\\n )\\n override\\n public\\n pure\\n returns (\\n uint256\\n )\\n {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0xe649b49573ba5babca407f116e97dc13f24bf677cbcd03824a2eb98a7750c4e8\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506040516104673803806104678339818101604052602081101561003357600080fd5b5051600080546001600160a01b039092166001600160a01b0319909216919091179055610402806100656000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063abfbbe1311610066578063abfbbe1314610207578063bc2f8dd814610239578063c5b6aa2f14610239578063d0e30db014610239578063dc6453dc146102415761009e565b806302ad4d2a146100a35780631e16e92f146100dd5780631e83409a14610117578063299ca4781461013d578063461a447814610161575b600080fd5b6100c9600480360360208110156100b957600080fd5b50356001600160a01b031661027f565b604080519115158252519081900360200190f35b610115600480360360808110156100f357600080fd5b508035906020810135906001600160a01b0360408201351690606001356102c9565b005b6101156004803603602081101561012d57600080fd5b50356001600160a01b03166102cf565b6101456102d2565b604080516001600160a01b039092168252519081900360200190f35b6101456004803603602081101561017757600080fd5b81019060208101813564010000000081111561019257600080fd5b8201836020820111156101a457600080fd5b803590602001918460018302840111640100000000831117156101c657600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506102e1945050505050565b6101156004803603606081101561021d57600080fd5b508035906001600160a01b0360208201351690604001356103bd565b6101156103c2565b61026d6004803603604081101561025757600080fd5b50803590602001356001600160a01b03166103c4565b60408051918252519081900360200190f35b60006102ae6040518060400160405280600c81526020016b27ab26afa83937b837b9b2b960a11b8152506102e1565b6001600160a01b0316826001600160a01b0316149050919050565b50505050565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610341578181015183820152602001610329565b50505050905090810190601f16801561036e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561038b57600080fd5b505afa15801561039f573d6000803e3d6000fd5b505050506040513d60208110156103b557600080fd5b505192915050565b505050565b565b60009291505056fea26469706673582212203c88b151a9098fd385f72116ea504d04ab99ce35bdd2be87a9d0b1a4e0f1717464736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061009e5760003560e01c8063abfbbe1311610066578063abfbbe1314610207578063bc2f8dd814610239578063c5b6aa2f14610239578063d0e30db014610239578063dc6453dc146102415761009e565b806302ad4d2a146100a35780631e16e92f146100dd5780631e83409a14610117578063299ca4781461013d578063461a447814610161575b600080fd5b6100c9600480360360208110156100b957600080fd5b50356001600160a01b031661027f565b604080519115158252519081900360200190f35b610115600480360360808110156100f357600080fd5b508035906020810135906001600160a01b0360408201351690606001356102c9565b005b6101156004803603602081101561012d57600080fd5b50356001600160a01b03166102cf565b6101456102d2565b604080516001600160a01b039092168252519081900360200190f35b6101456004803603602081101561017757600080fd5b81019060208101813564010000000081111561019257600080fd5b8201836020820111156101a457600080fd5b803590602001918460018302840111640100000000831117156101c657600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506102e1945050505050565b6101156004803603606081101561021d57600080fd5b508035906001600160a01b0360208201351690604001356103bd565b6101156103c2565b61026d6004803603604081101561025757600080fd5b50803590602001356001600160a01b03166103c4565b60408051918252519081900360200190f35b60006102ae6040518060400160405280600c81526020016b27ab26afa83937b837b9b2b960a11b8152506102e1565b6001600160a01b0316826001600160a01b0316149050919050565b50505050565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610341578181015183820152602001610329565b50505050905090810190601f16801561036e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561038b57600080fd5b505afa15801561039f573d6000803e3d6000fd5b505050506040513d60208110156103b557600080fd5b505192915050565b505050565b565b60009291505056fea26469706673582212203c88b151a9098fd385f72116ea504d04ab99ce35bdd2be87a9d0b1a4e0f1717464736f6c63430007060033", + "solcInputHash": "ef3f334bac4d7e77d91b457a0d89ab0a", + "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\":\"_who\",\"type\":\"address\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"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\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"getGasSpent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_who\",\"type\":\"address\"}],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"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\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"startWithdrawal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}}},\"title\":\"mockOVM_BondManager\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/mockOVM/verification/mockOVM_BondManager.sol\":\"mockOVM_BondManager\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 indexed _name,\\n address _newAddress,\\n address _oldAddress\\n );\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n external\\n onlyOwner\\n {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address,\\n oldAddress\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n external\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x636defb785a5c6650d101def6790d9104724cc7570e0d875138624d069eed257\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"license\":\"MIT\"},\"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 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_Proposer\\\");\\n }\\n\\n function getGasSpent(\\n bytes32, // _preStateRoot,\\n address // _who\\n )\\n override\\n public\\n pure\\n returns (\\n uint256\\n )\\n {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0xe649b49573ba5babca407f116e97dc13f24bf677cbcd03824a2eb98a7750c4e8\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516104673803806104678339818101604052602081101561003357600080fd5b5051600080546001600160a01b039092166001600160a01b0319909216919091179055610402806100656000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063abfbbe1311610066578063abfbbe1314610207578063bc2f8dd814610239578063c5b6aa2f14610239578063d0e30db014610239578063dc6453dc146102415761009e565b806302ad4d2a146100a35780631e16e92f146100dd5780631e83409a14610117578063299ca4781461013d578063461a447814610161575b600080fd5b6100c9600480360360208110156100b957600080fd5b50356001600160a01b031661027f565b604080519115158252519081900360200190f35b610115600480360360808110156100f357600080fd5b508035906020810135906001600160a01b0360408201351690606001356102c9565b005b6101156004803603602081101561012d57600080fd5b50356001600160a01b03166102cf565b6101456102d2565b604080516001600160a01b039092168252519081900360200190f35b6101456004803603602081101561017757600080fd5b81019060208101813564010000000081111561019257600080fd5b8201836020820111156101a457600080fd5b803590602001918460018302840111640100000000831117156101c657600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506102e1945050505050565b6101156004803603606081101561021d57600080fd5b508035906001600160a01b0360208201351690604001356103bd565b6101156103c2565b61026d6004803603604081101561025757600080fd5b50803590602001356001600160a01b03166103c4565b60408051918252519081900360200190f35b60006102ae6040518060400160405280600c81526020016b27ab26afa83937b837b9b2b960a11b8152506102e1565b6001600160a01b0316826001600160a01b0316149050919050565b50505050565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610341578181015183820152602001610329565b50505050905090810190601f16801561036e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561038b57600080fd5b505afa15801561039f573d6000803e3d6000fd5b505050506040513d60208110156103b557600080fd5b505192915050565b505050565b565b60009291505056fea2646970667358221220c19aac7427cb83d5b9d44589a9b54252aad926befab3c327ae2aebfd25184a9464736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061009e5760003560e01c8063abfbbe1311610066578063abfbbe1314610207578063bc2f8dd814610239578063c5b6aa2f14610239578063d0e30db014610239578063dc6453dc146102415761009e565b806302ad4d2a146100a35780631e16e92f146100dd5780631e83409a14610117578063299ca4781461013d578063461a447814610161575b600080fd5b6100c9600480360360208110156100b957600080fd5b50356001600160a01b031661027f565b604080519115158252519081900360200190f35b610115600480360360808110156100f357600080fd5b508035906020810135906001600160a01b0360408201351690606001356102c9565b005b6101156004803603602081101561012d57600080fd5b50356001600160a01b03166102cf565b6101456102d2565b604080516001600160a01b039092168252519081900360200190f35b6101456004803603602081101561017757600080fd5b81019060208101813564010000000081111561019257600080fd5b8201836020820111156101a457600080fd5b803590602001918460018302840111640100000000831117156101c657600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506102e1945050505050565b6101156004803603606081101561021d57600080fd5b508035906001600160a01b0360208201351690604001356103bd565b6101156103c2565b61026d6004803603604081101561025757600080fd5b50803590602001356001600160a01b03166103c4565b60408051918252519081900360200190f35b60006102ae6040518060400160405280600c81526020016b27ab26afa83937b837b9b2b960a11b8152506102e1565b6001600160a01b0316826001600160a01b0316149050919050565b50505050565b50565b6000546001600160a01b031681565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610341578181015183820152602001610329565b50505050905090810190601f16801561036e5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561038b57600080fd5b505afa15801561039f573d6000803e3d6000fd5b505050506040513d60208110156103b557600080fd5b505192915050565b505050565b565b60009291505056fea2646970667358221220c19aac7427cb83d5b9d44589a9b54252aad926befab3c327ae2aebfd25184a9464736f6c63430007060033", "devdoc": { "kind": "dev", "methods": { @@ -223,16 +223,16 @@ "storageLayout": { "storage": [ { - "astId": 12856, + "astId": 15303, "contract": "contracts/optimistic-ethereum/mockOVM/verification/mockOVM_BondManager.sol:mockOVM_BondManager", "label": "libAddressManager", "offset": 0, "slot": "0", - "type": "t_contract(Lib_AddressManager)12849" + "type": "t_contract(Lib_AddressManager)15296" } ], "types": { - "t_contract(Lib_AddressManager)12849": { + "t_contract(Lib_AddressManager)15296": { "encoding": "inplace", "label": "contract Lib_AddressManager", "numberOfBytes": "20" diff --git a/packages/contracts/deployments/mainnet/solcInputs/43ee6bb8ef92595aa6d0e22a6c464dff.json b/packages/contracts/deployments/mainnet/solcInputs/43ee6bb8ef92595aa6d0e22a6c464dff.json deleted file mode 100644 index 3b9222dd12bb..000000000000 --- a/packages/contracts/deployments/mainnet/solcInputs/43ee6bb8ef92595aa6d0e22a6c464dff.json +++ /dev/null @@ -1,312 +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 * Enums *\n *********/\n\n enum EOASignatureType {\n EIP155_TRANSACTION,\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 transactionHash;\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 *\n **********************/\n\n /**\n * Decodes an EOA transaction (i.e., native Ethereum RLP encoding).\n * @param _transaction Encoded EOA transaction.\n * @return 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\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 /**\n * Decompresses a compressed EIP155 transaction.\n * @param _transaction Compressed EIP155 transaction bytes.\n * @return Transaction parsed into a struct.\n */\n function decompressEIP155Transaction(\n bytes memory _transaction\n )\n internal\n returns (\n EIP155Transaction memory\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 transaction bytes.\n */\n function encodeTransaction(\n Transaction memory _transaction\n )\n internal\n pure\n returns (\n bytes memory\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 Hashed transaction\n */\n function hashTransaction(\n Transaction memory _transaction\n )\n internal\n pure\n returns (\n bytes32\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 Converted EVM account.\n */\n function toEVMAccount(\n Account memory _in\n )\n internal\n pure\n returns (\n EVMAccount memory\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 RLP-encoded account state.\n */\n function encodeEVMAccount(\n EVMAccount memory _account\n )\n internal\n pure\n returns (\n bytes memory\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 state struct.\n */\n function decodeEVMAccount(\n bytes memory _encoded\n )\n internal\n pure\n returns (\n EVMAccount memory\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 of the header.\n */\n function hashBatchHeader(\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\n )\n internal\n pure\n returns (\n bytes32\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 require(\n out == 0 || out == 1,\n \"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\"\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 = abi.encodePacked(_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 abi.encodePacked(_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 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 /**\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \"true.\"\n * @param _in Input bytes32 value.\n * @return Bytes32 as a boolean.\n */\n function toBool(\n bytes32 _in\n )\n internal\n pure\n returns (\n bool\n )\n {\n return _in != 0;\n }\n\n /**\n * Converts a boolean to a bytes32 value.\n * @param _in Input boolean value.\n * @return Boolean as a bytes32.\n */\n function fromBool(\n bool _in\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n return bytes32(uint256(_in ? 1 : 0));\n }\n\n /**\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\n * @param _in Input bytes32 value.\n * @return Bytes32 as an address.\n */\n function toAddress(\n bytes32 _in\n )\n internal\n pure\n returns (\n address\n )\n {\n return address(uint160(uint256(_in)));\n }\n\n /**\n * Converts an address to a bytes32.\n * @param _in Input address value.\n * @return Address as a bytes32.\n */\n function fromAddress(\n address _in\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n return bytes32(uint256(_in));\n }\n\n /**\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\n * @param _in Input bytes32 value.\n * @return Bytes32 without any leading zeros.\n */\n function removeLeadingZeros(\n bytes32 _in\n )\n internal\n pure\n returns (\n bytes memory\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/* Library Imports */\nimport { Lib_ErrorUtils } from \"../utils/Lib_ErrorUtils.sol\";\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,\n bytes memory\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, bytes));\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 ovmINCREMENTNONCE call.\n */\n function safeINCREMENTNONCE()\n internal\n {\n _safeExecutionManagerInteraction(\n abi.encodeWithSignature(\n \"ovmINCREMENTNONCE()\"\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 Lib_ErrorUtils.encodeRevertString(\n _reason\n )\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/libraries/utils/Lib_ErrorUtils.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/**\n * @title Lib_ErrorUtils\n */\nlibrary Lib_ErrorUtils {\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Encodes an error string into raw solidity-style revert data.\n * (i.e. ascii bytes, prefixed with bytes4(keccak(\"Error(string))\"))\n * Ref: https://docs.soliditylang.org/en/v0.8.2/control-structures.html?highlight=Error(string)#panic-via-assert-and-error-via-require\n * @param _reason Reason for the reversion.\n * @return Standard solidity revert data for the given reason.\n */\n function encodeRevertString(\n string memory _reason\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n return abi.encodeWithSignature(\n \"Error(string)\",\n _reason\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 /*************\n * Constants *\n *************/\n\n // TODO: should be the amount sufficient to cover the gas costs of all of the transactions up\n // to and including the CALL/CREATE which forms the entrypoint of the transaction.\n uint256 constant EXECUTION_VALIDATION_GAS_OVERHEAD = 25000;\n address constant ETH_ERC20_ADDRESS = 0x4200000000000000000000000000000000000006;\n\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 Whether or not the call returned (rather than reverted).\n * @return 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,\n bytes memory\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 mainnet.\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, bytes memory revertData) = Lib_SafeExecutionManagerWrapper.safeCREATE(\n gasleft(),\n decodedTx.data\n );\n\n // Return true if the contract creation succeeded, false w/ revertData otherwise.\n if (created != address(0)) {\n return (true, abi.encode(created));\n } else {\n return (false, revertData);\n }\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.safeINCREMENTNONCE();\n\n return Lib_SafeExecutionManagerWrapper.safeCALL(\n gasleft(),\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\";\nimport { Lib_ErrorUtils } from \"../../libraries/utils/Lib_ErrorUtils.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 \"../predeploys/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 * Default Context Values *\n **************************/\n\n uint256 constant DEFAULT_UINT256 = 0xdefa017defa017defa017defa017defa017defa017defa017defa017defa017d;\n address constant DEFAULT_ADDRESS = 0xdEfa017defA017DeFA017DEfa017DeFA017DeFa0;\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 Lib_AddressResolver(_libAddressManager)\n {\n ovmSafetyChecker = iOVM_SafetyChecker(resolve(\"OVM_SafetyChecker\"));\n gasMeterConfig = _gasMeterConfig;\n globalContext = _globalContext;\n _resetContext();\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 // Make sure that run() is not re-enterable. This condition should awlways be satisfied\n // Once run has been called once, due to the behvaior of _isValidInput().\n if (transactionContext.ovmNUMBER != DEFAULT_UINT256) {\n return;\n }\n\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 (_isValidInput(_transaction) == false) {\n _resetContext();\n return;\n }\n\n // TEMPORARY: Gas metering is disabled for minnet.\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\n // TEMPORARY: Gas metering is disabled for minnet.\n // // Update the cumulative gas based on the amount of gas used.\n // uint256 gasUsed = gasProvided - gasleft();\n // _updateCumulativeGas(gasUsed, _transaction.l1QueueOrigin);\n\n // Wipe the execution context.\n _resetContext();\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 Address of the created contract.\n * @return Revert data, if and only if the creation threw an exception.\n */\n function ovmCREATE(\n bytes memory _bytecode\n )\n override\n public\n notStatic\n fixedGasDiscount(40000)\n returns (\n address,\n bytes memory\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 Address of the created contract.\n * @return Revert data, if and only if the creation threw an exception.\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,\n bytes memory\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 * Bumps the nonce of the current ovmADDRESS by one.\n */\n function ovmINCREMENTNONCE()\n override\n public\n notStatic\n {\n address account = ovmADDRESS();\n uint256 nonce = _getAccountNonce(account);\n\n // Prevent overflow.\n if (nonce + 1 > nonce) {\n _setAccountNonce(account, nonce + 1);\n }\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\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 * 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 Whitelisting *\n ********************************************/\n\n /**\n * Checks whether the given address is on the whitelist 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 semantics perspective, this will appear 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 Final OVM contract address.\n * @return Revertdata, if and only if the creation threw an exception.\n */\n function _createContract(\n address _contractAddress,\n bytes memory _bytecode\n )\n internal\n returns (\n address,\n bytes memory\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 the common logic which occurs between call-type and create-type messages,\n // passing in the creation bytecode and `true` to trigger create-specific logic.\n (bool success, bytes memory data) = _handleExternalMessage(\n nextMessageContext,\n gasleft(),\n _contractAddress,\n _bytecode,\n true\n );\n\n // Yellow paper requires that address returned is zero if the contract deployment fails.\n return (\n success ? _contractAddress : address(0),\n data\n );\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 // EVM does not return data in the success case, see: https://github.com/ethereum/go-ethereum/blob/aae7660410f0ef90279e14afaaf2f429fdc2a186/core/vm/instructions.go#L600-L604\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 _handleExternalMessage(\n _nextMessageContext,\n _gasLimit,\n codeContractAddress,\n _calldata,\n false\n );\n }\n\n /**\n * Handles all interactions which involve the execution manager calling out to untrusted code (both calls and creates).\n * Ensures that OVM-related measures are enforced, including L2 gas refunds, nuisance gas, and flagged reversions.\n *\n * @param _nextMessageContext Message context to be used for the external message.\n * @param _gasLimit Amount of gas to be passed into this message.\n * @param _contract OVM address being called or deployed to\n * @param _data Data for the message (either calldata or creation code)\n * @param _isCreate Whether this is a create-type message.\n * @return Whether or not the message (either a call or deployment) succeeded.\n * @return Data returned by the message.\n */\n function _handleExternalMessage(\n MessageContext memory _nextMessageContext,\n uint256 _gasLimit,\n address _contract,\n bytes memory _data,\n bool _isCreate\n )\n internal\n returns (\n bool,\n bytes memory\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. `_contract` 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\n bool success; \n bytes memory returndata;\n\n if (_isCreate) {\n // safeCREATE() is a function which replicates a CREATE message, but uses return values\n // Which match that of CALL (i.e. bool, bytes). This allows many security checks to be\n // to be shared between untrusted call and create call frames.\n (success, returndata) = address(this).call(\n abi.encodeWithSelector(\n this.safeCREATE.selector,\n _gasLimit,\n _data,\n _contract\n )\n );\n } else {\n (success, returndata) = _contract.call{gas: _gasLimit}(_data);\n }\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 (\n flag == RevertFlag.INTENTIONAL_REVERT\n || _isCreate\n ) {\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 * Handles the creation-specific safety measures required for OVM contract deployment.\n * This function sanitizes the return types for creation messages to match calls (bool, bytes),\n * by being an external function which the EM can call, that mimics the success/fail case of the CREATE.\n * This allows for consistent handling of both types of messages in _handleExternalMessage().\n * Having this step occur as a separate call frame also allows us to easily revert the \n * contract deployment in the event that the code is unsafe.\n * \n * @param _gasLimit Amount of gas to be passed into this creation.\n * @param _creationCode Code to pass into CREATE for deployment.\n * @param _address OVM address being deployed to.\n */\n function safeCREATE(\n uint _gasLimit,\n bytes memory _creationCode,\n address _address\n )\n external\n {\n // The only way this should callable is from within _createContract(),\n // and it should DEFINITELY not be callable by a non-EM code contract.\n if (msg.sender != address(this)) {\n return;\n }\n // Check that there is not already code at this address.\n if (_hasEmptyAccount(_address) == false) {\n // Note: in the EVM, this case burns all allotted gas. For improved\n // developer experience, we do return the remaining gas.\n _revertWithFlag(\n RevertFlag.CREATE_COLLISION,\n Lib_ErrorUtils.encodeRevertString(\"A contract has already been deployed to this address\")\n );\n }\n\n // Check the creation bytecode against the OVM_SafetyChecker.\n if (ovmSafetyChecker.isBytecodeSafe(_creationCode) == false) {\n _revertWithFlag(\n RevertFlag.UNSAFE_BYTECODE,\n Lib_ErrorUtils.encodeRevertString(\"Contract creation code contains unsafe opcodes. Did you use the right compiler or pass an unsafe constructor argument?\")\n );\n }\n\n // We always need to initialize the contract with the default account values.\n _initPendingAccount(_address);\n\n // Actually execute the EVM create message.\n // NOTE: The inline assembly below means we can NOT make any evm calls between here and then.\n address ethAddress = Lib_EthUtils.createContract(_creationCode);\n\n if (ethAddress == address(0)) {\n // If the creation fails, the EVM lets us grab its revert data. This may contain a revert flag\n // to be used above in _handleExternalMessage, so we pass the revert data back up unmodified.\n assembly { \n returndatacopy(0,0,returndatasize())\n revert(0, returndatasize())\n }\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(\n RevertFlag.UNSAFE_BYTECODE,\n Lib_ErrorUtils.encodeRevertString(\"Constructor attempted to deploy unsafe bytecode.\")\n );\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 * 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 ) {\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 view\n {\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 input values of a transaction.\n * @return _valid Whether or not the transaction data is valid.\n */\n function _isValidInput(\n Lib_OVMCodec.Transaction memory _transaction\n )\n view\n internal\n returns (\n bool\n )\n {\n // Prevent reentrancy to run():\n // This check prevents calling run with the default ovmNumber.\n // Combined with the first check in run():\n // if (transactionContext.ovmNUMBER != DEFAULT_UINT256) { return; }\n // It should be impossible to re-enter since run() returns before any other call frames are created.\n // Since this value is already being written to storage, we save much gas compared to\n // using the standard nonReentrant pattern.\n if (_transaction.blockNumber == DEFAULT_UINT256) {\n return false;\n }\n\n if (_isValidGasLimit(_transaction.gasLimit, _transaction.l1QueueOrigin) == false) {\n return false;\n }\n\n return true;\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 view\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 = DEFAULT_ADDRESS;\n transactionContext.ovmTIMESTAMP = DEFAULT_UINT256;\n transactionContext.ovmNUMBER = DEFAULT_UINT256;\n transactionContext.ovmGASLIMIT = DEFAULT_UINT256;\n transactionContext.ovmTXGASLIMIT = DEFAULT_UINT256;\n transactionContext.ovmL1QUEUEORIGIN = Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE;\n\n transactionRecord.ovmGasRefund = DEFAULT_UINT256;\n\n messageContext.ovmCALLER = DEFAULT_ADDRESS;\n messageContext.ovmADDRESS = DEFAULT_ADDRESS;\n messageContext.isStatic = false;\n\n messageRecord.nuisanceGasLeft = DEFAULT_UINT256;\n\n // Reset the ovmStateManager.\n ovmStateManager = iOVM_StateManager(address(0));\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 messageRecord.nuisanceGasLeft = uint(-1);\n\n messageContext.ovmADDRESS = _from;\n\n bool isCreate = _transaction.entrypoint == address(0);\n if (isCreate) {\n (address created, bytes memory revertData) = ovmCREATE(_transaction.data);\n if (created == address(0)) {\n return (false, revertData);\n } else {\n // The eth_call RPC endpoint for to = undefined will return the deployed bytecode\n // in the success case, differing from standard create messages.\n return (true, Lib_EthUtils.getCode(created));\n }\n } else {\n return ovmCALL(\n _transaction.gasLimit,\n _transaction.entrypoint,\n _transaction.data\n );\n }\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 */\nabstract contract Lib_AddressResolver {\n\n /*******************************************\n * Contract Variables: Contract References *\n *******************************************/\n\n Lib_AddressManager public libAddressManager;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address of the Lib_AddressManager.\n */\n constructor(\n address _libAddressManager\n ) {\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 OUT_OF_GAS,\n INTENTIONAL_REVERT,\n EXCEEDS_NUISANCE_GAS,\n INVALID_STATE_ACCESS,\n UNSAFE_BYTECODE,\n CREATE_COLLISION,\n STATIC_VIOLATION,\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 }\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, bytes memory _revertdata);\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract, bytes memory _revertdata);\n\n\n /*******************************\n * Account Abstraction Opcodes *\n ******************************/\n\n function ovmGETNONCE() external returns (uint256 _nonce);\n function ovmINCREMENTNONCE() 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 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_Bytes32Utils } from \"../../libraries/utils/Lib_Bytes32Utils.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 /*************\n * Constants *\n *************/\n\n bytes32 constant IMPLEMENTATION_KEY = 0xdeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _implementation Address of the initial implementation contract.\n */\n constructor(\n address _implementation\n )\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 /**\n * Changes the implementation address.\n * @param _implementation New implementation address.\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 /**\n * Gets the address of the current implementation.\n * @return Current implementation address.\n */\n function getImplementation()\n public\n returns (\n address\n )\n {\n return Lib_Bytes32Utils.toAddress(\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\n IMPLEMENTATION_KEY\n )\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 Lib_Bytes32Utils.fromAddress(_implementation)\n );\n }\n}\n" - }, - "contracts/optimistic-ethereum/OVM/predeploys/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/predeploys/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() {\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/predeploys/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/predeploys/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 _txType Transaction type enum value.\n */\n function _getTransactionType(\n uint8 _transactionType\n )\n internal\n returns (\n TransactionType _txType\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 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 // Prevent the Execution Manager from calling this SM again.\n ovmStateManager.setExecutionManager(address(0));\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 abi.encodePacked(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 /***************\n * Constructor *\n ***************/\n\n constructor(\n address _libAddressManager\n )\n Lib_AddressResolver(_libAddressManager)\n {}\n\n\n /********************\n * Public Functions *\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 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\n )\n {\n require(\n msg.sender == resolve(\"OVM_FraudVerifier\"),\n \"Create can only be done by the OVM_FraudVerifier.\"\n );\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 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\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 * 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 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 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_Proposer\");\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 // For efficiency reasons getMerkleRoot modifies the `_batch` argument in place\n // while calculating the root hash therefore any arguments passed to it must not\n // be used again afterwards\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 * Note that the _elements argument is modified, therefore it must not be used again afterwards\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 pure\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 == 1) {\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 (uint256 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 distinct 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 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 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 * 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 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 {\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 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 = 50000;\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 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 return _getQueueElement(\n _index,\n queue()\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 return _getQueueLength(\n queue()\n );\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 queueRef = queue();\n\n queueRef.push(transactionHash);\n queueRef.push(timestampAndBlockNumber);\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 and subtract 1.\n uint256 queueIndex = queueRef.length() / 2 - 1;\n emit TransactionEnqueued(\n msg.sender,\n _target,\n _gasLimit,\n _data,\n queueIndex,\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 pure\n {\n // TEMPORARY: 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\n require(\n msg.data.length >= nextTransactionPtr,\n \"Not enough BatchContexts provided.\"\n );\n\n // Take a reference to the queue and its length so we don't have to keep resolving it.\n // Length isn't going to change during the course of execution, so it's fine to simply\n // resolve this once at the start. Saves gas.\n iOVM_ChainStorageContainer queueRef = queue();\n uint40 queueLength = _getQueueLength(queueRef);\n\n // Reserve some memory to save gas on hashing later on. This is a relatively safe estimate\n // for the average transaction size that will prevent having to resize this chunk of memory\n // later on. Saves gas.\n bytes memory hashMemory = new bytes((msg.data.length / totalElementsToAppend) * 2);\n\n // Initialize the array of canonical chain leaves that we will append.\n bytes32[] memory leaves = new bytes32[](totalElementsToAppend);\n\n // Each leaf index corresponds to a tx, either sequenced or enqueued.\n uint32 leafIndex = 0;\n\n // Counter for number of sequencer transactions appended so far.\n uint32 numSequencerTransactions = 0;\n\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 for (uint32 i = 0; i < numContexts; i++) {\n BatchContext memory nextContext = _getBatchContext(i);\n\n if (i == 0) {\n // Execute a special check for the first batch.\n _validateFirstBatchContext(nextContext);\n }\n\n // Execute this check on every single batch, including the first one.\n _validateNextBatchContext(\n curContext,\n nextContext,\n nextQueueIndex,\n queueRef\n );\n\n // Now we can update our current context.\n curContext = nextContext;\n\n // Process sequencer transactions first.\n for (uint32 j = 0; j < curContext.numSequencedTransactions; j++) {\n uint256 txDataLength;\n assembly {\n txDataLength := shr(232, calldataload(nextTransactionPtr))\n }\n require(\n txDataLength <= MAX_ROLLUP_TX_SIZE,\n \"Transaction data size exceeds maximum for rollup transaction.\"\n );\n\n leaves[leafIndex] = _getSequencerLeafHash(\n curContext,\n nextTransactionPtr,\n txDataLength,\n hashMemory\n );\n\n nextTransactionPtr += uint40(TX_DATA_HEADER_SIZE + txDataLength);\n numSequencerTransactions++;\n leafIndex++;\n }\n\n // Now process any subsequent queue transactions.\n for (uint32 j = 0; j < curContext.numSubsequentQueueTransactions; j++) {\n require(\n nextQueueIndex < queueLength,\n \"Not enough queued transactions to append.\"\n );\n\n leaves[leafIndex] = _getQueueLeafHash(nextQueueIndex);\n nextQueueIndex++;\n leafIndex++;\n }\n }\n\n _validateFinalBatchContext(\n curContext,\n nextQueueIndex,\n queueLength,\n queueRef\n );\n\n require(\n msg.data.length == 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 blockTimestamp;\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 blockTimestamp = 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 // curContext.numSubsequentQueueTransactions > 0 which means that we've processed at least one queue element.\n // We increment nextQueueIndex after processing each queue element,\n // so the index of the last element we processed is nextQueueIndex - 1.\n Lib_OVMCodec.QueueElement memory lastElement = _getQueueElement(\n nextQueueIndex - 1,\n queueRef\n );\n\n blockTimestamp = lastElement.timestamp;\n blockNumber = lastElement.blockNumber;\n }\n\n // For efficiency reasons getMerkleRoot modifies the `leaves` argument in place\n // while calculating the root hash therefore any arguments passed to it must not\n // be used again afterwards\n _appendBatch(\n Lib_MerkleTree.getMerkleRoot(leaves),\n totalElementsToAppend,\n numQueuedTransactions,\n blockTimestamp,\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 pure\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 * 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 iOVM_ChainStorageContainer _queueRef\n )\n internal\n view\n returns (\n Lib_OVMCodec.QueueElement memory _element\n )\n {\n // The underlying queue data structure stores 2 elements\n // per insertion, so to get the actual desired queue index\n // we need to multiply by 2.\n uint40 trueIndex = uint40(_index * 2);\n bytes32 transactionHash = _queueRef.get(trueIndex);\n bytes32 timestampAndBlockNumber = _queueRef.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 transactionHash: transactionHash,\n timestamp: elementTimestamp,\n blockNumber: elementBlockNumber\n });\n }\n\n /**\n * Retrieves the length of the queue.\n * @return Length of the queue.\n */\n function _getQueueLength(\n iOVM_ChainStorageContainer _queueRef\n )\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.\n return uint40(_queueRef.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 bytes memory _hashMemory\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n // Only allocate more memory if we didn't reserve enough to begin with.\n if (BYTES_TILL_TX_DATA + _txDataLength > _hashMemory.length) {\n _hashMemory = new bytes(BYTES_TILL_TX_DATA + _txDataLength);\n }\n\n uint256 ctxTimestamp = _context.timestamp;\n uint256 ctxBlockNumber = _context.blockNumber;\n\n bytes32 leafHash;\n assembly {\n let chainElementStart := add(_hashMemory, 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 iOVM_ChainStorageContainer batchesRef = batches();\n (uint40 totalElements, uint40 nextQueueIndex,,) = _getBatchExtraData();\n\n Lib_OVMCodec.ChainBatchHeader memory header = Lib_OVMCodec.ChainBatchHeader({\n batchIndex: batchesRef.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 batchesRef.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 have the same context\n // or a later timestamp and block number.\n if (getTotalElements() > 0) {\n (,, uint40 lastTimestamp, uint40 lastBlockNumber) = _getBatchExtraData();\n\n require(\n _firstContext.blockNumber >= lastBlockNumber,\n \"Context block number is lower than last submitted.\"\n );\n\n require(\n _firstContext.timestamp >= lastTimestamp,\n \"Context timestamp is lower than last submitted.\"\n );\n }\n\n // Sequencer cannot submit contexts which are more than the force inclusion period old.\n require(\n _firstContext.timestamp + forceInclusionPeriodSeconds >= block.timestamp,\n \"Context timestamp too far in the past.\"\n );\n\n require(\n _firstContext.blockNumber + forceInclusionPeriodBlocks >= block.number,\n \"Context block number too far in the past.\"\n );\n }\n\n /**\n * Checks that a given batch context has a time context which is below a given que element\n * @param _context The batch context to validate has values lower.\n * @param _queueIndex Index of the queue element we are validating came later than the context.\n * @param _queueRef The storage container for the queue.\n */\n function _validateContextBeforeEnqueue(\n BatchContext memory _context,\n uint40 _queueIndex,\n iOVM_ChainStorageContainer _queueRef\n )\n internal\n view\n {\n Lib_OVMCodec.QueueElement memory nextQueueElement = _getQueueElement(\n _queueIndex,\n _queueRef\n );\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 _context.timestamp <= nextQueueElement.timestamp,\n \"Sequencer transaction timestamp exceeds that of next queue element.\"\n );\n\n require(\n _context.blockNumber <= nextQueueElement.blockNumber,\n \"Sequencer transaction blockNumber exceeds that of next queue element.\"\n );\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 * @param _queueRef The storage container for the queue.\n */\n function _validateNextBatchContext(\n BatchContext memory _prevContext,\n BatchContext memory _nextContext,\n uint40 _nextQueueIndex,\n iOVM_ChainStorageContainer _queueRef\n )\n internal\n view\n {\n // All sequencer transactions' times must be greater than or equal to 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 is going to be a queue element pulled in from this context:\n if (_nextContext.numSubsequentQueueTransactions > 0) {\n _validateContextBeforeEnqueue(\n _nextContext,\n _nextQueueIndex,\n _queueRef\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 * @param _queueLength The length of the queue at the start of the batchAppend call.\n * @param _nextQueueIndex The next element in the queue that will be pulled into the CTC.\n * @param _queueRef The storage container for the queue.\n */\n function _validateFinalBatchContext(\n BatchContext memory _finalContext,\n uint40 _nextQueueIndex,\n uint40 _queueLength,\n iOVM_ChainStorageContainer _queueRef\n )\n internal\n view\n {\n // If the queue is not now empty, check the mononoticity of whatever the next batch that will come in is.\n if (_queueLength - _nextQueueIndex > 0 && _finalContext.numSubsequentQueueTransactions == 0) {\n _validateContextBeforeEnqueue(\n _finalContext,\n _nextQueueIndex,\n _queueRef\n );\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.transactionHash == 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/messaging/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/messaging/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 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 xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\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 xDomainMsgSender = _sender;\n (bool success, ) = _target.call(_message);\n xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\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 predeploy 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 () {\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/messaging/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/messaging/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/messaging/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 * Constants *\n **************/\n\n // The default x-domain message sender being set to a non-zero value makes\n // deployment a bit more expensive, but in exchange the refund on every call to\n // `relayMessage` by the L1 and L2 messengers will be higher.\n address internal constant DEFAULT_XDOMAIN_SENDER = 0x000000000000000000000000000000000000dEaD;\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 internal xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\n\n /********************\n * Public Functions *\n ********************/\n\n constructor() Lib_ReentrancyGuard() {}\n\n function xDomainMessageSender() public override view returns (address) {\n require(xDomainMsgSender != DEFAULT_XDOMAIN_SENDER, \"xDomainMessageSender is not set\");\n return xDomainMsgSender;\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 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 to send.\n * param // 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/messaging/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/messaging/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/messaging/iOVM_L2CrossDomainMessenger.sol\";\nimport { iOVM_L1MessageSender } from \"../../../iOVM/predeploys/iOVM_L1MessageSender.sol\";\nimport { iOVM_L2ToL1MessagePasser } from \"../../../iOVM/predeploys/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 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 // Prevent calls to OVM_L2ToL1MessagePasser, which would enable\n // an attacker to maliciously craft the _message to spoof\n // a call from any L2 account.\n if(_target == resolve(\"OVM_L2ToL1MessagePasser\")){\n // Write to the successfulMessages mapping and return immediately.\n successfulMessages[xDomainCalldataHash] = true;\n return;\n }\n\n xDomainMsgSender = _sender;\n (bool success, ) = _target.call(_message);\n xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\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 view\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/messaging/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/predeploys/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/predeploys/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/predeploys/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/predeploys/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/predeploys/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/predeploys/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/messaging/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 {\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/messaging/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 /***************\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_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_L2DepositedToken } from \"../../../iOVM/bridge/tokens/iOVM_L2DepositedToken.sol\";\n\n/* Library Imports */\nimport { OVM_CrossDomainEnabled } from \"../../../libraries/bridge/OVM_CrossDomainEnabled.sol\";\nimport { Lib_AddressResolver } from \"../../../libraries/resolver/Lib_AddressResolver.sol\";\nimport { Lib_AddressManager } from \"../../../libraries/resolver/Lib_AddressManager.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 /********************\n * Public Constants *\n ********************/\n\n uint32 public constant override getFinalizeDepositL2Gas = 1200000;\n\n /********************************\n * External Contract References *\n ********************************/\n\n address public ovmEth;\n\n /***************\n * Constructor *\n ***************/\n\n // This contract lives behind a proxy, so the constructor parameters will go unused.\n constructor()\n OVM_CrossDomainEnabled(address(0))\n Lib_AddressResolver(address(0))\n public\n {}\n\n /******************\n * Initialization *\n ******************/\n\n /**\n * @param _libAddressManager Address manager for this OE deployment\n * @param _ovmEth L2 OVM_ETH implementation of iOVM_DepositedToken\n */\n function initialize(\n address _libAddressManager,\n address _ovmEth\n )\n public\n {\n require(libAddressManager == Lib_AddressManager(0), \"Contract has already been initialized.\");\n libAddressManager = Lib_AddressManager(_libAddressManager);\n ovmEth = _ovmEth;\n messenger = resolve(\"Proxy__OVM_L1CrossDomainMessenger\");\n }\n\n /**************\n * Depositing *\n **************/\n\n receive()\n external\n payable\n {\n _initiateDeposit(msg.sender, msg.sender);\n }\n\n /**\n * @dev deposit an amount of the ETH 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 ETH 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 ETH and informing the L2 ETH 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 l2ETHGateway.finalizeDeposit(_to, _amount)\n bytes memory data =\n abi.encodeWithSelector(\n iOVM_L2DepositedToken.finalizeDeposit.selector,\n _to,\n msg.value\n );\n\n // Send calldata into L2\n sendCrossDomainMessage(\n ovmEth,\n data,\n getFinalizeDepositL2Gas\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 ETH token.\n * Since only the xDomainMessenger can call this function, it will never be called before the withdrawal is finalized. \n *\n * @param _to L1 address to credit the withdrawal to\n * @param _amount Amount of the ETH to withdraw\n */\n function finalizeWithdrawal(\n address _to,\n uint256 _amount\n )\n external\n override\n onlyFromCrossDomainAccount(ovmEth)\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" - }, - "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 * 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 function getFinalizeDepositL2Gas()\n external\n view\n returns(\n uint32\n );\n}\n" - }, - "contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L2DepositedToken.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0;\npragma experimental ABIEncoderV2;\n\n/**\n * @title iOVM_L2DepositedToken\n */\ninterface iOVM_L2DepositedToken {\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/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 // 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 {\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 payable\n {\n address target = addressManager[address(this)].getAddress(\n (implementationName[address(this)])\n );\n\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/optimistic-ethereum/OVM/bridge/tokens/Abs_L2DepositedToken.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Interface Imports */\nimport { iOVM_L2DepositedToken } from \"../../../iOVM/bridge/tokens/iOVM_L2DepositedToken.sol\";\nimport { iOVM_L1TokenGateway } from \"../../../iOVM/bridge/tokens/iOVM_L1TokenGateway.sol\";\n\n/* Library Imports */\nimport { OVM_CrossDomainEnabled } from \"../../../libraries/bridge/OVM_CrossDomainEnabled.sol\";\n\n/**\n * @title Abs_L2DepositedToken\n * @dev An L2 Deposited Token is an L2 representation of funds which were deposited from L1.\n * Usually 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 * NOTE: This abstract contract gives all the core functionality of a deposited token implementation except for the\n * token's internal accounting itself. This gives developers an easy way to implement children with their own token code.\n *\n * Compiler used: optimistic-solc\n * Runtime target: OVM\n */\nabstract contract Abs_L2DepositedToken is iOVM_L2DepositedToken, OVM_CrossDomainEnabled {\n\n /*******************\n * Contract Events *\n *******************/\n\n event Initialized(iOVM_L1TokenGateway _l1TokenGateway);\n\n /********************************\n * External Contract References *\n ********************************/\n\n iOVM_L1TokenGateway public l1TokenGateway;\n\n /********************************\n * Constructor & Initialization *\n ********************************/\n\n /**\n * @param _l2CrossDomainMessenger L1 Messenger address being used for cross-chain communications.\n */\n constructor(\n address _l2CrossDomainMessenger\n )\n OVM_CrossDomainEnabled(_l2CrossDomainMessenger)\n {}\n\n /**\n * @dev Initialize this contract with the L1 token gateway address.\n * The flow: 1) this contract gets deployed on L2, 2) the L1\n * gateway is deployed with addr from (1), 3) L1 gateway address passed here.\n *\n * @param _l1TokenGateway Address of the corresponding L1 gateway deployed to the main chain\n */\n\n function init(\n iOVM_L1TokenGateway _l1TokenGateway\n )\n public\n {\n require(address(l1TokenGateway) == address(0), \"Contract has already been initialized\");\n\n l1TokenGateway = _l1TokenGateway;\n \n emit Initialized(l1TokenGateway);\n }\n\n /**********************\n * Function Modifiers *\n **********************/\n\n modifier onlyInitialized() {\n require(address(l1TokenGateway) != address(0), \"Contract has not yet been initialized\");\n _;\n }\n\n /********************************\n * Overridable Accounting logic *\n ********************************/\n\n // Default gas value which can be overridden if more complex logic runs on L2.\n uint32 constant DEFAULT_FINALIZE_WITHDRAWAL_L1_GAS = 100000;\n\n /**\n * @dev Core logic to be performed when a withdrawal from L2 is initialized.\n * In most cases, this will simply burn the withdrawn L2 funds.\n *\n * param _to Address being withdrawn to\n * param _amount Amount being withdrawn\n */\n\n function _handleInitiateWithdrawal(\n address, // _to,\n uint // _amount\n )\n internal\n virtual\n {\n revert(\"Accounting must be implemented by child contract.\");\n }\n\n /**\n * @dev Core logic to be performed when a deposit from L2 is finalized on L2.\n * In most cases, this will simply _mint() to credit L2 funds to the recipient.\n *\n * param _to Address being deposited to on L2\n * param _amount Amount which was deposited on L1\n */\n function _handleFinalizeDeposit(\n address, // _to\n uint // _amount\n )\n internal\n virtual\n {\n revert(\"Accounting must be implemented by child contract.\");\n }\n\n /**\n * @dev Overridable getter for the *L1* gas limit of settling the withdrawal, in the case it may be\n * dynamic, and the above public constant does not suffice.\n *\n */\n\n function getFinalizeWithdrawalL1Gas()\n public\n view\n virtual\n returns(\n uint32\n )\n {\n return DEFAULT_FINALIZE_WITHDRAWAL_L1_GAS;\n }\n\n\n /***************\n * Withdrawing *\n ***************/\n\n /**\n * @dev initiate a withdraw of some tokens to the caller's account on L1\n * @param _amount Amount of the token 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 token to a recipient's account on L1\n * @param _to L1 adress to credit the withdrawal to\n * @param _amount Amount of the token to withdraw\n */\n function withdrawTo(\n address _to,\n uint _amount\n )\n external\n override\n onlyInitialized()\n {\n _initiateWithdrawal(_to, _amount);\n }\n\n /**\n * @dev Performs the logic for deposits by storing the token and informing the L2 token Gateway of the deposit.\n *\n * @param _to Account to give the withdrawal to on L1\n * @param _amount Amount of the token to withdraw\n */\n function _initiateWithdrawal(\n address _to,\n uint _amount\n )\n internal\n {\n // Call our withdrawal accounting handler implemented by child contracts (usually a _burn)\n _handleInitiateWithdrawal(_to, _amount);\n\n // Construct calldata for l1TokenGateway.finalizeWithdrawal(_to, _amount)\n bytes memory data = abi.encodeWithSelector(\n iOVM_L1TokenGateway.finalizeWithdrawal.selector,\n _to,\n _amount\n );\n\n // Send message up to L1 gateway\n sendCrossDomainMessage(\n address(l1TokenGateway),\n data,\n getFinalizeWithdrawalL1Gas()\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 token. \n * This call will fail if it did not originate from a corresponding deposit in OVM_l1TokenGateway. \n *\n * @param _to Address to receive the withdrawal at\n * @param _amount Amount of the token to withdraw\n */\n function finalizeDeposit(\n address _to,\n uint _amount\n )\n external\n override \n onlyInitialized()\n onlyFromCrossDomainAccount(address(l1TokenGateway))\n {\n _handleFinalizeDeposit(_to, _amount);\n emit DepositFinalized(_to, _amount);\n }\n}\n" - }, - "contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1TokenGateway.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0;\npragma experimental ABIEncoderV2;\n\n/**\n * @title iOVM_L1TokenGateway\n */\ninterface iOVM_L1TokenGateway {\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/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_L1TokenGateway } from \"../../../iOVM/bridge/tokens/iOVM_L1TokenGateway.sol\";\n\n/* Contract Imports */\nimport { UniswapV2ERC20 } from \"../../../libraries/standards/UniswapV2ERC20.sol\";\n\n/* Library Imports */\nimport { Abs_L2DepositedToken } from \"./Abs_L2DepositedToken.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 * NOTE: This contract implements the Abs_L2DepositedToken contract using Uniswap's ERC20 as the implementation.\n * Alternative implementations can be used in this similar manner.\n *\n * Compiler used: optimistic-solc\n * Runtime target: OVM\n */\ncontract OVM_L2DepositedERC20 is Abs_L2DepositedToken, UniswapV2ERC20 {\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _l2CrossDomainMessenger Cross-domain messenger used by this contract.\n * @param _name ERC20 name\n * @param _symbol ERC20 symbol\n */\n constructor(\n address _l2CrossDomainMessenger,\n string memory _name,\n string memory _symbol\n )\n Abs_L2DepositedToken(_l2CrossDomainMessenger)\n UniswapV2ERC20(_name, _symbol)\n {}\n\n // When a withdrawal is initiated, we burn the withdrawer's funds to prevent subsequent L2 usage.\n function _handleInitiateWithdrawal(\n address, // _to,\n uint _amount\n )\n internal\n override\n {\n _burn(msg.sender, _amount);\n }\n\n // When a deposit is finalized, we credit the account on L2 with the same amount of tokens.\n function _handleFinalizeDeposit(\n address _to,\n uint _amount\n )\n internal\n override\n {\n _mint(_to, _amount);\n }\n}\n" - }, - "contracts/optimistic-ethereum/libraries/standards/UniswapV2ERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma 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 constant override decimals = 18;\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 string memory _name,\n string memory _symbol\n ) {\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": "// SPDX-License-Identifier: MIT\npragma 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": "// SPDX-License-Identifier: MIT\npragma 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/predeploys/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_L1TokenGateway } from \"../../iOVM/bridge/tokens/iOVM_L1TokenGateway.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 \"Ether\",\n \"ETH\"\n )\n {\n init(iOVM_L1TokenGateway(_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_L1TokenGateway } from \"../../../iOVM/bridge/tokens/iOVM_L1TokenGateway.sol\";\nimport { Abs_L1TokenGateway } from \"./Abs_L1TokenGateway.sol\";\nimport { iOVM_ERC20 } from \"../../../iOVM/predeploys/iOVM_ERC20.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 * NOTE: This contract extends Abs_L1TokenGateway, which is where we\n * takes care of most of the initialization and the cross-chain logic.\n * If you are looking to implement your own deposit/withdrawal contracts, you\n * may also want to extend the abstract contract in a similar manner.\n *\n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_L1ERC20Gateway is Abs_L1TokenGateway {\n\n /********************************\n * External Contract References *\n ********************************/\n \n iOVM_ERC20 public l1ERC20;\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 */\n constructor(\n iOVM_ERC20 _l1ERC20,\n address _l2DepositedERC20,\n address _l1messenger \n )\n Abs_L1TokenGateway(\n _l2DepositedERC20,\n _l1messenger\n )\n {\n l1ERC20 = _l1ERC20;\n }\n\n\n /**************\n * Accounting *\n **************/\n\n /**\n * @dev When a deposit is initiated on L1, the L1 Gateway\n * transfers the funds to itself for future withdrawals\n *\n * @param _from L1 address ETH is being deposited from\n * param _to L2 address that the ETH is being deposited to\n * @param _amount Amount of ERC20 to send\n */\n function _handleInitiateDeposit(\n address _from,\n address, // _to,\n uint256 _amount\n )\n internal\n override\n {\n // Hold on to the newly deposited funds\n l1ERC20.transferFrom(\n _from,\n address(this),\n _amount\n );\n }\n\n /**\n * @dev When a withdrawal is finalized on L1, the L1 Gateway\n * transfers the funds to the withdrawer\n *\n * @param _to L1 address that the ERC20 is being withdrawn to\n * @param _amount Amount of ERC20 to send\n */\n function _handleFinalizeWithdrawal(\n address _to,\n uint _amount\n )\n internal\n override\n {\n // Transfer withdrawn funds out to withdrawer\n l1ERC20.transfer(_to, _amount);\n }\n}\n" - }, - "contracts/optimistic-ethereum/OVM/bridge/tokens/Abs_L1TokenGateway.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_L1TokenGateway } from \"../../../iOVM/bridge/tokens/iOVM_L1TokenGateway.sol\";\nimport { iOVM_L2DepositedToken } from \"../../../iOVM/bridge/tokens/iOVM_L2DepositedToken.sol\";\n\n/* Library Imports */\nimport { OVM_CrossDomainEnabled } from \"../../../libraries/bridge/OVM_CrossDomainEnabled.sol\";\n\n/**\n * @title Abs_L1TokenGateway\n * @dev An L1 Token Gateway is a contract which stores deposited L1 funds that are in use on L2.\n * It synchronizes a corresponding L2 representation of the \"deposited token\", informing it\n * of new deposits and releasing L1 funds when there are newly finalized withdrawals.\n *\n * NOTE: This abstract contract gives all the core functionality of an L1 token gateway, \n * but provides easy hooks in case developers need extensions in child contracts.\n * In many cases, the default OVM_L1ERC20Gateway will suffice.\n *\n * Compiler used: solc\n * Runtime target: EVM\n */\nabstract contract Abs_L1TokenGateway is iOVM_L1TokenGateway, OVM_CrossDomainEnabled {\n\n /********************************\n * External Contract References *\n ********************************/\n\n address public l2DepositedToken;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _l2DepositedToken iOVM_L2DepositedToken-compatible address on the chain being deposited into.\n * @param _l1messenger L1 Messenger address being used for cross-chain communications.\n */\n constructor(\n address _l2DepositedToken,\n address _l1messenger \n )\n OVM_CrossDomainEnabled(_l1messenger)\n {\n l2DepositedToken = _l2DepositedToken;\n }\n\n /********************************\n * Overridable Accounting logic *\n ********************************/\n\n // Default gas value which can be overridden if more complex logic runs on L2.\n uint32 public DEFAULT_FINALIZE_DEPOSIT_L2_GAS = 1200000;\n\n /**\n * @dev Core logic to be performed when a withdrawal is finalized on L1.\n * In most cases, this will simply send locked funds to the withdrawer.\n *\n * param _to Address being withdrawn to.\n * param _amount Amount being withdrawn.\n */\n function _handleFinalizeWithdrawal(\n address, // _to,\n uint256 // _amount\n )\n internal\n virtual\n {\n revert(\"Implement me in child contracts\");\n }\n\n /**\n * @dev Core logic to be performed when a deposit is initiated on L1.\n * In most cases, this will simply send locked funds to the withdrawer.\n *\n * param _from Address being deposited from on L1.\n * param _to Address being deposited into on L2.\n * param _amount Amount being deposited.\n */\n function _handleInitiateDeposit(\n address, // _from,\n address, // _to,\n uint256 // _amount\n )\n internal\n virtual\n {\n revert(\"Implement me in child contracts\");\n }\n\n /**\n * @dev Overridable getter for the L2 gas limit, in the case it may be\n * dynamic, and the above public constant does not suffice.\n *\n */\n\n function getFinalizeDepositL2Gas()\n public\n view\n returns(\n uint32\n )\n {\n return DEFAULT_FINALIZE_DEPOSIT_L2_GAS;\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 public\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 public\n override\n {\n _initiateDeposit(msg.sender, _to, _amount);\n }\n\n /**\n * @dev Performs the logic for deposits by informing the L2 Deposited Token\n * contract of the deposit and calling a handler to lock the L1 funds. (e.g. transferFrom)\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 // Call our deposit accounting handler implemented by child contracts.\n _handleInitiateDeposit(\n _from,\n _to,\n _amount\n );\n\n // Construct calldata for l2DepositedToken.finalizeDeposit(_to, _amount)\n bytes memory data = abi.encodeWithSelector(\n iOVM_L2DepositedToken.finalizeDeposit.selector,\n _to,\n _amount\n );\n\n // Send calldata into L2\n sendCrossDomainMessage(\n l2DepositedToken,\n data,\n getFinalizeDepositL2Gas()\n );\n\n emit DepositInitiated(_from, _to, _amount);\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 uint _amount\n )\n external\n override \n onlyFromCrossDomainAccount(l2DepositedToken)\n {\n // Call our withdrawal accounting handler implemented by child contracts.\n _handleFinalizeWithdrawal(\n _to,\n _amount\n );\n\n emit WithdrawalFinalized(_to, _amount);\n }\n}\n" - }, - "contracts/optimistic-ethereum/iOVM/predeploys/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/messaging/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/messaging/iOVM_L1CrossDomainMessenger.sol\";\nimport { iOVM_L1MultiMessageRelayer } from \"../../../iOVM/bridge/messaging/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/messaging/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/messaging/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() {}\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 abi.encodePacked(\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/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 pure \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 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_Proposer\");\n }\n\n function getGasSpent(\n bytes32, // _preStateRoot,\n address // _who\n )\n override\n public\n pure \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 *\n ********************/\n\n /**\n * Creates a new OVM_StateManager\n * @param _owner Owner of the created contract.\n * @return New OVM_StateManager instance.\n */\n function create(\n address _owner\n )\n override\n public\n returns (\n iOVM_StateManager\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 * 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 * Variables *\n *************/\n\n address override public owner;\n address override public ovmExecutionManager;\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 {\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 *\n ********************/\n\n /**\n * Checks whether a given address is allowed to modify this contract.\n * @param _address Address to check.\n * @return Whether or not the address can modify this contract.\n */\n function isAuthenticated(\n address _address\n )\n override\n public\n view\n returns (\n bool\n )\n {\n return (_address == owner || _address == ovmExecutionManager);\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 * 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 for the given address.\n */\n function getAccount(\n address _address\n )\n override\n public\n view\n returns (\n Lib_OVMCodec.Account memory\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 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\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 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\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 of the account.\n */\n function getAccountNonce(\n address _address\n )\n override\n public\n view\n returns (\n uint256\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 Corresponding Ethereum address.\n */\n function getAccountEthAddress(\n address _address\n )\n override\n public\n view\n returns (\n address\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 Corresponding storage root.\n */\n function getAccountStorageRoot(\n address _address\n )\n override\n public\n view\n returns (\n bytes32\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 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\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 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\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 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\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 uncommitted accounts.\n */\n function getTotalUncommittedAccounts()\n override\n public\n view\n returns (\n uint256\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 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\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 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\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 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\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 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\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 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\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 uncommitted storage slots.\n */\n function getTotalUncommittedContractStorage()\n override\n public\n view\n returns (\n uint256\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 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\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.safeINCREMENTNONCE();\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/predeploys/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 /**\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 (\n bool\n )\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 - }, - "metadata": { - "bytecodeHash": "none", - "useLiteralContent": true - }, - "outputSelection": { - "*": { - "*": [ - "storageLayout", - "abi", - "evm.bytecode", - "evm.deployedBytecode", - "evm.methodIdentifiers", - "metadata", - "devdoc", - "userdoc", - "evm.gasEstimates" - ], - "": [ - "ast" - ] - } - } - } -} \ No newline at end of file diff --git a/packages/contracts/deployments/mainnet/solcInputs/7531d7762a77038a37e7490a7b4b176f.json b/packages/contracts/deployments/mainnet/solcInputs/7531d7762a77038a37e7490a7b4b176f.json new file mode 100644 index 000000000000..e0264142f533 --- /dev/null +++ b/packages/contracts/deployments/mainnet/solcInputs/7531d7762a77038a37e7490a7b4b176f.json @@ -0,0 +1,38 @@ +{ + "language": "Solidity", + "sources": { + "contracts/chugsplash/interfaces/iL1ChugSplashDeployer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title iL1ChugSplashDeployer\n */\ninterface iL1ChugSplashDeployer {\n function isUpgrading()\n external\n view\n returns (\n bool\n );\n}\n" + }, + "contracts/chugsplash/L1ChugSplashProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\nimport { iL1ChugSplashDeployer } from \"./interfaces/iL1ChugSplashDeployer.sol\";\n\n/**\n * @title L1ChugSplashProxy\n * @dev Basic ChugSplash proxy contract for L1. Very close to being a normal proxy but has added\n * functions `setCode` and `setStorage` for changing the code or storage of the contract. Nifty!\n *\n * Note for future developers: do NOT make anything in this contract 'public' unless you know what\n * you're doing. Anything public can potentially have a function signature that conflicts with a\n * signature attached to the implementation contract. Public functions SHOULD always have the\n * 'proxyCallIfNotOwner' modifier unless there's some *really* good reason not to have that\n * modifier. And there almost certainly is not a good reason to not have that modifier. Beware!\n */\ncontract L1ChugSplashProxy {\n\n /*************\n * Constants *\n *************/\n\n // \"Magic\" prefix. When prepended to some arbitrary bytecode and used to create a contract, the\n // appended bytecode will be deployed as given.\n bytes13 constant internal DEPLOY_CODE_PREFIX = 0x600D380380600D6000396000f3;\n\n // bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\n bytes32 constant internal IMPLEMENTATION_KEY = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n // bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1)\n bytes32 constant internal OWNER_KEY = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n\n /***************\n * Constructor *\n ***************/\n \n /**\n * @param _owner Address of the initial contract owner.\n */\n constructor(\n address _owner\n ) {\n _setOwner(_owner);\n }\n\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * Blocks a function from being called when the parent signals that the system should be paused\n * via an isUpgrading function.\n */\n modifier onlyWhenNotPaused() {\n address owner = _getOwner();\n\n // We do a low-level call because there's no guarantee that the owner actually *is* an\n // L1ChugSplashDeployer contract and Solidity will throw errors if we do a normal call and\n // it turns out that it isn't the right type of contract.\n (bool success, bytes memory returndata) = owner.staticcall(\n abi.encodeWithSelector(\n iL1ChugSplashDeployer.isUpgrading.selector\n )\n );\n\n // If the call was unsuccessful then we assume that there's no \"isUpgrading\" method and we\n // can just continue as normal. We also expect that the return value is exactly 32 bytes\n // long. If this isn't the case then we can safely ignore the result.\n if (success && returndata.length == 32) {\n // Although the expected value is a *boolean*, it's safer to decode as a uint256 in the\n // case that the isUpgrading function returned something other than 0 or 1. But we only\n // really care about the case where this value is 0 (= false).\n uint256 ret = abi.decode(returndata, (uint256));\n require(\n ret == 0,\n \"L1ChugSplashProxy: system is currently being upgraded\"\n );\n }\n\n _;\n }\n\n /**\n * Makes a proxy call instead of triggering the given function when the caller is either the\n * owner or the zero address. Caller can only ever be the zero address if this function is\n * being called off-chain via eth_call, which is totally fine and can be convenient for\n * client-side tooling. Avoids situations where the proxy and implementation share a sighash\n * and the proxy function ends up being called instead of the implementation one.\n *\n * Note: msg.sender == address(0) can ONLY be triggered off-chain via eth_call. If there's a\n * way for someone to send a transaction with msg.sender == address(0) in any real context then\n * we have much bigger problems. Primary reason to include this additional allowed sender is\n * because the owner address can be changed dynamically and we do not want clients to have to\n * keep track of the current owner in order to make an eth_call that doesn't trigger the\n * proxied contract.\n */\n modifier proxyCallIfNotOwner() {\n if (msg.sender == _getOwner() || msg.sender == address(0)) {\n _;\n } else {\n // This WILL halt the call frame on completion.\n _doProxyCall();\n }\n }\n\n\n /*********************\n * Fallback Function *\n *********************/\n\n fallback()\n external\n payable\n {\n // Proxy call by default.\n _doProxyCall();\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Sets the code that should be running behind this proxy. Note that this scheme is a bit\n * different from the standard proxy scheme where one would typically deploy the code\n * separately and then set the implementation address. We're doing it this way because it gives\n * us a lot more freedom on the client side. Can only be triggered by the contract owner.\n * @param _code New contract code to run inside this contract.\n */\n function setCode(\n bytes memory _code\n )\n proxyCallIfNotOwner\n public\n {\n // Get the code hash of the current implementation.\n address implementation = _getImplementation();\n\n // If the code hash matches the new implementation then we return early.\n if (keccak256(_code) == _getAccountCodeHash(implementation)) {\n return;\n }\n\n // Create the deploycode by appending the magic prefix.\n bytes memory deploycode = abi.encodePacked(\n DEPLOY_CODE_PREFIX,\n _code\n );\n\n // Deploy the code and set the new implementation address.\n address newImplementation;\n assembly {\n newImplementation := create(0x0, add(deploycode, 0x20), mload(deploycode))\n }\n\n // Check that the code was actually deployed correctly. I'm not sure if you can ever\n // actually fail this check. Should only happen if the contract creation from above runs\n // out of gas but this parent execution thread does NOT run out of gas. Seems like we\n // should be doing this check anyway though.\n require(\n _getAccountCodeHash(newImplementation) == keccak256(_code),\n \"L1ChugSplashProxy: code was not correctly deployed.\"\n );\n\n _setImplementation(newImplementation);\n }\n\n /**\n * Modifies some storage slot within the proxy contract. Gives us a lot of power to perform\n * upgrades in a more transparent way. Only callable by the owner.\n * @param _key Storage key to modify.\n * @param _value New value for the storage key.\n */\n function setStorage(\n bytes32 _key,\n bytes32 _value\n )\n proxyCallIfNotOwner\n public\n {\n assembly {\n sstore(_key, _value)\n }\n }\n\n /**\n * Changes the owner of the proxy contract. Only callable by the owner.\n * @param _owner New owner of the proxy contract.\n */\n function setOwner(\n address _owner\n )\n proxyCallIfNotOwner\n public\n {\n _setOwner(_owner);\n }\n\n /**\n * Queries the owner of the proxy contract. Can only be called by the owner OR by making an\n * eth_call and setting the \"from\" address to address(0).\n * @return Owner address.\n */\n function getOwner()\n proxyCallIfNotOwner\n public\n returns (\n address\n )\n {\n return _getOwner();\n }\n\n /**\n * Queries the implementation address. Can only be called by the owner OR by making an\n * eth_call and setting the \"from\" address to address(0).\n * @return Implementation address.\n */\n function getImplementation()\n proxyCallIfNotOwner\n public\n returns (\n address\n )\n {\n return _getImplementation();\n }\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Sets the implementation address.\n * @param _implementation New implementation address.\n */\n function _setImplementation(\n address _implementation\n )\n internal\n {\n assembly {\n sstore(IMPLEMENTATION_KEY, _implementation)\n }\n }\n\n /**\n * Queries the implementation address.\n * @return Implementation address.\n */\n function _getImplementation()\n internal\n view\n returns (\n address\n )\n {\n address implementation;\n assembly {\n implementation := sload(IMPLEMENTATION_KEY)\n }\n return implementation;\n }\n\n /**\n * Changes the owner of the proxy contract.\n * @param _owner New owner of the proxy contract.\n */\n function _setOwner(\n address _owner\n )\n internal\n {\n assembly {\n sstore(OWNER_KEY, _owner)\n }\n }\n\n /**\n * Queries the owner of the proxy contract.\n * @return Owner address.\n */\n function _getOwner()\n internal\n view \n returns (\n address\n )\n {\n address owner;\n assembly {\n owner := sload(OWNER_KEY)\n }\n return owner;\n }\n\n /**\n * Gets the code hash for a given account.\n * @param _account Address of the account to get a code hash for.\n * @return Code hash for the account.\n */\n function _getAccountCodeHash(\n address _account\n )\n internal\n view\n returns (\n bytes32\n )\n {\n bytes32 codeHash;\n assembly {\n codeHash := extcodehash(_account)\n }\n return codeHash;\n }\n\n /**\n * Performs the proxy call via a delegatecall.\n */\n function _doProxyCall()\n onlyWhenNotPaused\n internal\n {\n address implementation = _getImplementation();\n\n require(\n implementation != address(0),\n \"L1ChugSplashProxy: implementation is not set yet\"\n );\n\n assembly {\n // Copy calldata into memory at 0x0....calldatasize.\n calldatacopy(0x0, 0x0, calldatasize())\n\n // Perform the delegatecall, make sure to pass all available gas.\n let success := delegatecall(gas(), implementation, 0x0, calldatasize(), 0x0, 0x0)\n\n // Copy returndata into memory at 0x0....returndatasize. Note that this *will*\n // overwrite the calldata that we just copied into memory but that doesn't really\n // matter because we'll be returning in a second anyway.\n returndatacopy(0x0, 0x0, returndatasize())\n \n // Success == 0 means a revert. We'll revert too and pass the data up.\n if iszero(success) {\n revert(0x0, returndatasize())\n }\n\n // Otherwise we'll just return and pass the data up.\n return(0x0, returndatasize())\n }\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "storageLayout", + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/mainnet/solcInputs/f2bdab652d5102f5f11e78dae866798d.json b/packages/contracts/deployments/mainnet/solcInputs/ef3f334bac4d7e77d91b457a0d89ab0a.json similarity index 60% rename from packages/contracts/deployments/mainnet/solcInputs/f2bdab652d5102f5f11e78dae866798d.json rename to packages/contracts/deployments/mainnet/solcInputs/ef3f334bac4d7e77d91b457a0d89ab0a.json index 5f8bf8e6cf0a..dfd91954d94a 100644 --- a/packages/contracts/deployments/mainnet/solcInputs/f2bdab652d5102f5f11e78dae866798d.json +++ b/packages/contracts/deployments/mainnet/solcInputs/ef3f334bac4d7e77d91b457a0d89ab0a.json @@ -1,122 +1,140 @@ { "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 _encodedTransaction\n )\n external\n returns (\n bool,\n bytes memory\n );\n}\n" + "contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_CrossDomainMessenger.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/**\n * @title iOVM_CrossDomainMessenger\n */\ninterface iOVM_CrossDomainMessenger {\n\n /**********\n * Events *\n **********/\n\n event SentMessage(bytes message);\n event RelayedMessage(bytes32 msgHash);\n event FailedRelayedMessage(bytes32 msgHash);\n\n\n /*************\n * Variables *\n *************/\n\n function xDomainMessageSender() external view returns (address);\n\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/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\";\n\n/**\n * @title Lib_OVMCodec\n */\nlibrary Lib_OVMCodec {\n\n /*********\n * Enums *\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 transactionHash;\n uint40 timestamp;\n uint40 blockNumber;\n }\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Encodes a standard OVM transaction.\n * @param _transaction OVM transaction to encode.\n * @return Encoded transaction bytes.\n */\n function encodeTransaction(\n Transaction memory _transaction\n )\n internal\n pure\n returns (\n bytes memory\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 Hashed transaction\n */\n function hashTransaction(\n Transaction memory _transaction\n )\n internal\n pure\n returns (\n bytes32\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 Converted EVM account.\n */\n function toEVMAccount(\n Account memory _in\n )\n internal\n pure\n returns (\n EVMAccount memory\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 RLP-encoded account state.\n */\n function encodeEVMAccount(\n EVMAccount memory _account\n )\n internal\n pure\n returns (\n bytes memory\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 state struct.\n */\n function decodeEVMAccount(\n bytes memory _encoded\n )\n internal\n pure\n returns (\n EVMAccount memory\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 of the header.\n */\n function hashBatchHeader(\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\n )\n internal\n pure\n returns (\n bytes32\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/bridge/OVM_CrossDomainEnabled.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Interface Imports */\nimport { iOVM_CrossDomainMessenger } from \"../../iOVM/bridge/messaging/iOVM_CrossDomainMessenger.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\n /*************\n * Variables *\n *************/\n\n // Messenger contract used to send and recieve messages from the other domain.\n address public messenger;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _messenger Address of the CrossDomainMessenger on the current layer.\n */\n constructor(\n address _messenger\n ) {\n messenger = _messenger;\n }\n\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * 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\n * 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 /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Gets the messenger, usually from storage. This function is exposed in case a child contract\n * 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 iOVM_CrossDomainMessenger\n )\n {\n return iOVM_CrossDomainMessenger(messenger);\n }\n\n /**\n * Sends a message to an account on another domain\n * @param _crossDomainTarget The intended recipient on the destination domain\n * @param _message The data to send to the target (usually calldata to a function with\n * `onlyFromCrossDomainAccount()`)\n * @param _gasLimit The gasLimit for the receipt of the message on the target domain.\n */\n function sendCrossDomainMessage(\n address _crossDomainTarget,\n uint32 _gasLimit,\n bytes memory _message\n )\n internal\n {\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit);\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 require(\n out == 0 || out == 1,\n \"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\"\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/OVM/bridge/tokens/OVM_L2StandardBridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Interface Imports */\nimport { iOVM_L1StandardBridge } from \"../../../iOVM/bridge/tokens/iOVM_L1StandardBridge.sol\";\nimport { iOVM_L1ERC20Bridge } from \"../../../iOVM/bridge/tokens/iOVM_L1ERC20Bridge.sol\";\nimport { iOVM_L2ERC20Bridge } from \"../../../iOVM/bridge/tokens/iOVM_L2ERC20Bridge.sol\";\n\n/* Library Imports */\nimport { ERC165Checker } from \"@openzeppelin/contracts/introspection/ERC165Checker.sol\";\nimport { OVM_CrossDomainEnabled } from \"../../../libraries/bridge/OVM_CrossDomainEnabled.sol\";\nimport { Lib_PredeployAddresses } from \"../../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Contract Imports */\nimport { IL2StandardERC20 } from \"../../../libraries/standards/IL2StandardERC20.sol\";\n\n/**\n * @title OVM_L2StandardBridge\n * @dev The L2 Standard bridge is a contract which works together with the L1 Standard bridge to enable\n * ETH and ERC20 transitions between L1 and L2.\n * This contract acts as a minter for new tokens when it hears about deposits into the L1 Standard bridge.\n * This contract also acts as a burner of the tokens intended for withdrawal, informing the L1 bridge to release L1 funds.\n *\n * Compiler used: optimistic-solc\n * Runtime target: OVM\n */\ncontract OVM_L2StandardBridge is iOVM_L2ERC20Bridge, OVM_CrossDomainEnabled {\n\n /********************************\n * External Contract References *\n ********************************/\n\n address public l1TokenBridge;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _l2CrossDomainMessenger Cross-domain messenger used by this contract.\n * @param _l1TokenBridge Address of the L1 bridge deployed to the main chain.\n */\n constructor(\n address _l2CrossDomainMessenger,\n address _l1TokenBridge\n )\n OVM_CrossDomainEnabled(_l2CrossDomainMessenger)\n {\n l1TokenBridge = _l1TokenBridge;\n }\n\n /***************\n * Withdrawing *\n ***************/\n\n /**\n * @inheritdoc iOVM_L2ERC20Bridge\n */\n function withdraw(\n address _l2Token,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n )\n external\n override\n virtual\n {\n _initiateWithdrawal(\n _l2Token,\n msg.sender,\n msg.sender,\n _amount,\n _l1Gas,\n _data\n );\n }\n\n /**\n * @inheritdoc iOVM_L2ERC20Bridge\n */\n function withdrawTo(\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n )\n external\n override\n virtual\n {\n _initiateWithdrawal(\n _l2Token,\n msg.sender,\n _to,\n _amount,\n _l1Gas,\n _data\n );\n }\n\n /**\n * @dev Performs the logic for deposits by storing the token and informing the L2 token Gateway of the deposit.\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _from Account to pull the deposit from on L2.\n * @param _to Account to give the withdrawal to on L1.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function _initiateWithdrawal(\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n )\n internal\n {\n // When a withdrawal is initiated, we burn the withdrawer's funds to prevent subsequent L2 usage\n IL2StandardERC20(_l2Token).burn(msg.sender, _amount);\n\n // Construct calldata for l1TokenBridge.finalizeERC20Withdrawal(_to, _amount)\n address l1Token = IL2StandardERC20(_l2Token).l1Token();\n bytes memory message;\n\n if (_l2Token == Lib_PredeployAddresses.OVM_ETH) {\n message = abi.encodeWithSelector(\n iOVM_L1StandardBridge.finalizeETHWithdrawal.selector,\n _from,\n _to,\n _amount,\n _data\n );\n } else {\n message = abi.encodeWithSelector(\n iOVM_L1ERC20Bridge.finalizeERC20Withdrawal.selector,\n l1Token,\n _l2Token,\n _from,\n _to,\n _amount,\n _data\n );\n }\n\n // Send message up to L1 bridge\n sendCrossDomainMessage(\n l1TokenBridge,\n _l1Gas,\n message\n );\n\n emit WithdrawalInitiated(l1Token, _l2Token, msg.sender, _to, _amount, _data);\n }\n\n /************************************\n * Cross-chain Function: Depositing *\n ************************************/\n\n /**\n * @inheritdoc iOVM_L2ERC20Bridge\n */\n function finalizeDeposit(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n )\n external\n override\n virtual\n onlyFromCrossDomainAccount(l1TokenBridge)\n {\n // Check the target token is compliant and\n // verify the deposited token on L1 matches the L2 deposited token representation here\n if (\n ERC165Checker.supportsInterface(_l2Token, 0x1d1d8b63) &&\n _l1Token == IL2StandardERC20(_l2Token).l1Token()\n ) {\n // When a deposit is finalized, we credit the account on L2 with the same amount of tokens.\n IL2StandardERC20(_l2Token).mint(_to, _amount);\n emit DepositFinalized(_l1Token, _l2Token, _from, _to, _amount, _data);\n } else {\n // Either the L2 token which is being deposited-into disagrees about the correct address\n // of its L1 token, or does not support the correct interface.\n // This should only happen if there is a malicious L2 token, or if a user somehow\n // specified the wrong L2 token address to deposit into.\n // In either case, we stop the process here and construct a withdrawal\n // message so that users can get their funds out in some cases.\n // There is no way to prevent malicious token contracts altogether, but this does limit\n // user error and mitigate some forms of malicious contract behavior.\n bytes memory message = abi.encodeWithSelector(\n iOVM_L1ERC20Bridge.finalizeERC20Withdrawal.selector,\n _l1Token,\n _l2Token,\n _to, // switched the _to and _from here to bounce back the deposit to the sender\n _from,\n _amount,\n _data\n );\n\n // Send message up to L1 bridge\n sendCrossDomainMessage(\n l1TokenBridge,\n 0,\n message\n );\n emit DepositFailed(_l1Token, _l2Token, _from, _to, _amount, _data);\n }\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/**\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 The RLP encoded string in bytes.\n */\n function writeBytes(\n bytes memory _in\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n bytes memory encoded;\n\n if (_in.length == 1 && uint8(_in[0]) < 128) {\n encoded = _in;\n } else {\n encoded = abi.encodePacked(_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 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\n )\n {\n bytes memory list = _flatten(_in);\n return abi.encodePacked(_writeLength(list.length, 192), list);\n }\n\n /**\n * RLP encodes a string.\n * @param _in The string to encode.\n * @return The RLP encoded string in bytes.\n */\n function writeString(\n string memory _in\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n return writeBytes(bytes(_in));\n }\n\n /**\n * RLP encodes an address.\n * @param _in The address to encode.\n * @return The RLP encoded address in bytes.\n */\n function writeAddress(\n address _in\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n return writeBytes(abi.encodePacked(_in));\n }\n\n /**\n * RLP encodes a bytes32 value.\n * @param _in The bytes32 to encode.\n * @return _out The RLP encoded bytes32 in bytes.\n */\n function writeBytes32(\n bytes32 _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 The RLP encoded uint256 in bytes.\n */\n function writeUint(\n uint256 _in\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n return writeBytes(_toBinary(_in));\n }\n\n /**\n * RLP encodes a bool.\n * @param _in The bool to encode.\n * @return The RLP encoded bool in bytes.\n */\n function writeBool(\n bool _in\n )\n internal\n pure\n returns (\n bytes memory\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 RLP encoded bytes.\n */\n function _writeLength(\n uint256 _len,\n uint256 _offset\n )\n private\n pure\n returns (\n bytes memory\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 RLP encoded bytes.\n */\n function _toBinary(\n uint256 _x\n )\n private\n pure\n returns (\n bytes memory\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 The flattened byte string.\n */\n function _flatten(\n bytes[] memory _list\n )\n private\n pure\n returns (\n bytes memory\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}\n" + "contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1StandardBridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0;\npragma experimental ABIEncoderV2;\n\nimport './iOVM_L1ERC20Bridge.sol';\n\n/**\n * @title iOVM_L1StandardBridge\n */\ninterface iOVM_L1StandardBridge is iOVM_L1ERC20Bridge {\n\n /**********\n * Events *\n **********/\n event ETHDepositInitiated (\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n event ETHWithdrawalFinalized (\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n \n /**\n * @dev Deposit an amount of the ETH to the caller's balance on L2.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETH (\n uint32 _l2Gas,\n bytes calldata _data\n )\n external\n payable;\n\n /**\n * @dev Deposit an amount of ETH to a recipient's balance on L2.\n * @param _to L2 address to credit the withdrawal to.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETHTo (\n address _to,\n uint32 _l2Gas,\n bytes calldata _data\n )\n external\n payable;\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 ETH token.\n * Since only the xDomainMessenger can call this function, it will never be called before the withdrawal is finalized.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeETHWithdrawal (\n address _from,\n address _to,\n uint _amount,\n bytes calldata _data\n )\n external;\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 slice(\n bytes memory _bytes,\n uint256 _start,\n uint256 _length\n )\n internal\n pure\n returns (\n bytes memory\n )\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 (\n bytes memory\n )\n {\n if (_start >= _bytes.length) {\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 (\n bytes32\n )\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 (\n bytes32\n )\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 (\n uint256\n )\n {\n return uint256(toBytes32(_bytes));\n }\n\n function toUint24(\n bytes memory _bytes,\n uint256 _start\n )\n internal\n pure\n returns (\n uint24\n )\n {\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(\n bytes memory _bytes,\n uint256 _start\n )\n internal\n pure\n returns (\n uint8\n )\n {\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(\n bytes memory _bytes,\n uint256 _start\n )\n internal\n pure\n returns (\n address\n )\n {\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 (\n bytes memory\n )\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 (\n bytes memory\n )\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 (\n bool\n )\n {\n return keccak256(_bytes) == keccak256(_other);\n }\n}\n" + "contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1ERC20Bridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0;\npragma experimental ABIEncoderV2;\n\n/**\n * @title iOVM_L1ERC20Bridge\n */\ninterface iOVM_L1ERC20Bridge {\n\n /**********\n * Events *\n **********/\n\n event ERC20DepositInitiated (\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event ERC20WithdrawalFinalized (\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev deposit an amount of the ERC20 to the caller's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _amount Amount of the ERC20 to deposit\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20 (\n address _l1Token,\n address _l2Token,\n uint _amount,\n uint32 _l2Gas,\n bytes calldata _data\n )\n external;\n\n /**\n * @dev deposit an amount of ERC20 to a recipient's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _to L2 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20To (\n address _l1Token,\n address _l2Token,\n address _to,\n uint _amount,\n uint32 _l2Gas,\n bytes calldata _data\n )\n external;\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 _l1Token Address of L1 token to finalizeWithdrawal for.\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Data provided by the sender on L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeERC20Withdrawal (\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint _amount,\n bytes calldata _data\n )\n external;\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 /**\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \"true.\"\n * @param _in Input bytes32 value.\n * @return Bytes32 as a boolean.\n */\n function toBool(\n bytes32 _in\n )\n internal\n pure\n returns (\n bool\n )\n {\n return _in != 0;\n }\n\n /**\n * Converts a boolean to a bytes32 value.\n * @param _in Input boolean value.\n * @return Boolean as a bytes32.\n */\n function fromBool(\n bool _in\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n return bytes32(uint256(_in ? 1 : 0));\n }\n\n /**\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\n * @param _in Input bytes32 value.\n * @return Bytes32 as an address.\n */\n function toAddress(\n bytes32 _in\n )\n internal\n pure\n returns (\n address\n )\n {\n return address(uint160(uint256(_in)));\n }\n\n /**\n * Converts an address to a bytes32.\n * @param _in Input address value.\n * @return Address as a bytes32.\n */\n function fromAddress(\n address _in\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n return bytes32(uint256(_in));\n }\n\n /**\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\n * @param _in Input bytes32 value.\n * @return Bytes32 without any leading zeros.\n */\n function removeLeadingZeros(\n bytes32 _in\n )\n internal\n pure\n returns (\n bytes memory\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/iOVM/bridge/tokens/iOVM_L2ERC20Bridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0;\npragma experimental ABIEncoderV2;\n\n/**\n * @title iOVM_L2ERC20Bridge\n */\ninterface iOVM_L2ERC20Bridge {\n\n /**********\n * Events *\n **********/\n\n event WithdrawalInitiated (\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFinalized (\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFailed (\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev initiate a withdraw of some tokens to the caller's account on L1\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdraw (\n address _l2Token,\n uint _amount,\n uint32 _l1Gas,\n bytes calldata _data\n )\n external;\n\n /**\n * @dev initiate a withdraw of some token to a recipient's account on L1.\n * @param _l2Token Address of L2 token where withdrawal is initiated.\n * @param _to L1 adress to credit the withdrawal to.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdrawTo (\n address _l2Token,\n address _to,\n uint _amount,\n uint32 _l1Gas,\n bytes calldata _data\n )\n external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a deposit from L1 to L2, and credits funds to the recipient's balance of this\n * L2 token.\n * This call will fail if it did not originate from a corresponding deposit in OVM_l1TokenGateway.\n * @param _l1Token Address for the l1 token this is called with\n * @param _l2Token Address for the l2 token this is called with\n * @param _from Account to pull the deposit from on L2.\n * @param _to Address to receive the withdrawal at\n * @param _amount Amount of the token to withdraw\n * @param _data Data provider by the sender on L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeDeposit (\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint _amount,\n bytes calldata _data\n )\n external;\n\n}\n" }, - "contracts/optimistic-ethereum/libraries/codec/Lib_EIP155Tx.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\";\n\n/**\n * @title Lib_EIP155Tx\n * @dev A simple library for dealing with the transaction type defined by EIP155:\n * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md\n */\nlibrary Lib_EIP155Tx {\n\n /***********\n * Structs *\n ***********/\n\n // Struct representing an EIP155 transaction. See EIP link above for more information.\n struct EIP155Tx {\n // These fields correspond to the actual RLP-encoded fields specified by EIP155.\n uint256 nonce;\n uint256 gasPrice;\n uint256 gasLimit;\n address to;\n uint256 value;\n bytes data;\n uint8 v;\n bytes32 r;\n bytes32 s;\n\n // Chain ID to associate this transaction with. Used all over the place, seemed easier to\n // set this once when we create the transaction rather than providing it as an input to\n // each function. I don't see a strong need to have a transaction with a mutable chain ID.\n uint256 chainId;\n\n // The ECDSA \"recovery parameter,\" should always be 0 or 1. EIP155 specifies that:\n // `v = {0,1} + CHAIN_ID * 2 + 35`\n // Where `{0,1}` is a stand in for our `recovery_parameter`. Now computing our formula for\n // the recovery parameter:\n // 1. `v = {0,1} + CHAIN_ID * 2 + 35`\n // 2. `v = recovery_parameter + CHAIN_ID * 2 + 35`\n // 3. `v - CHAIN_ID * 2 - 35 = recovery_parameter`\n // So we're left with the final formula:\n // `recovery_parameter = v - CHAIN_ID * 2 - 35`\n // NOTE: This variable is a uint8 because `v` is inherently limited to a uint8. If we\n // didn't use a uint8, then recovery_parameter would always be a negative number for chain\n // IDs greater than 110 (`255 - 110 * 2 - 35 = 0`). So we need to wrap around to support\n // anything larger.\n uint8 recoveryParam; \n\n // Whether or not the transaction is a creation. Necessary because we can't make an address\n // \"nil\". Using the zero address creates a potential conflict if the user did actually\n // intend to send a transaction to the zero address.\n bool isCreate; \n }\n\n // Lets us use nicer syntax.\n using Lib_EIP155Tx for EIP155Tx;\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Decodes an EIP155 transaction and attaches a given Chain ID.\n * Transaction *must* be RLP-encoded.\n * @param _encoded RLP-encoded EIP155 transaction.\n * @param _chainId Chain ID to assocaite with this transaction.\n * @return Parsed transaction.\n */\n function decode(\n bytes memory _encoded,\n uint256 _chainId\n )\n internal\n pure\n returns (\n EIP155Tx memory\n )\n {\n Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_encoded);\n\n // Note formula above about how recoveryParam is computed.\n uint8 v = uint8(Lib_RLPReader.readUint256(decoded[6]));\n uint8 recoveryParam = uint8(v - 2 * _chainId - 35);\n\n // Recovery param being anything other than 0 or 1 indicates that we have the wrong chain\n // ID.\n require(\n recoveryParam < 2,\n \"Lib_EIP155Tx: Transaction signed with wrong chain ID\"\n );\n\n // Creations can be detected by looking at the byte length here.\n bool isCreate = Lib_RLPReader.readBytes(decoded[3]).length == 0;\n\n return EIP155Tx({\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 v: v,\n r: Lib_RLPReader.readBytes32(decoded[7]),\n s: Lib_RLPReader.readBytes32(decoded[8]),\n chainId: _chainId,\n recoveryParam: recoveryParam,\n isCreate: isCreate\n });\n }\n\n /**\n * Encodes an EIP155 transaction into RLP.\n * @param _transaction EIP155 transaction to encode.\n * @param _includeSignature Whether or not to encode the signature.\n * @return RLP-encoded transaction.\n */\n function encode(\n EIP155Tx memory _transaction,\n bool _includeSignature\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\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\n // We write the encoding of empty bytes when the transaction is a creation, *not* the zero\n // address as one might assume.\n if (_transaction.isCreate) {\n raw[3] = Lib_RLPWriter.writeBytes('');\n } else {\n raw[3] = Lib_RLPWriter.writeAddress(_transaction.to);\n }\n\n raw[4] = Lib_RLPWriter.writeUint(_transaction.value);\n raw[5] = Lib_RLPWriter.writeBytes(_transaction.data);\n\n if (_includeSignature) {\n raw[6] = Lib_RLPWriter.writeUint(_transaction.v);\n raw[7] = Lib_RLPWriter.writeBytes32(_transaction.r);\n raw[8] = Lib_RLPWriter.writeBytes32(_transaction.s);\n } else {\n // Chain ID *is* included in the unsigned transaction.\n raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId); \n raw[7] = Lib_RLPWriter.writeBytes('');\n raw[8] = Lib_RLPWriter.writeBytes('');\n }\n\n return Lib_RLPWriter.writeList(raw);\n }\n\n /**\n * Computes the hash of an EIP155 transaction. Assumes that you don't want to include the\n * signature in this hash because that's a very uncommon usecase. If you really want to include\n * the signature, just encode with the signature and take the hash yourself.\n */\n function hash(\n EIP155Tx memory _transaction\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n return keccak256(\n _transaction.encode(false)\n );\n }\n\n /**\n * Computes the sender of an EIP155 transaction.\n * @param _transaction EIP155 transaction to get a sender for.\n * @return Address corresponding to the private key that signed this transaction.\n */\n function sender(\n EIP155Tx memory _transaction\n )\n internal\n pure\n returns (\n address\n )\n {\n return ecrecover(\n _transaction.hash(),\n _transaction.recoveryParam + 27,\n _transaction.r,\n _transaction.s\n );\n }\n}\n" + "@openzeppelin/contracts/introspection/ERC165Checker.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.2 <0.8.0;\n\n/**\n * @dev Library used to query support of an interface declared via {IERC165}.\n *\n * Note that these functions return the actual result of the query: they do not\n * `revert` if an interface is not supported. It is up to the caller to decide\n * what to do in these cases.\n */\nlibrary ERC165Checker {\n // As per the EIP-165 spec, no interface should ever match 0xffffffff\n bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;\n\n /*\n * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7\n */\n bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;\n\n /**\n * @dev Returns true if `account` supports the {IERC165} interface,\n */\n function supportsERC165(address account) internal view returns (bool) {\n // Any contract that implements ERC165 must explicitly indicate support of\n // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid\n return _supportsERC165Interface(account, _INTERFACE_ID_ERC165) &&\n !_supportsERC165Interface(account, _INTERFACE_ID_INVALID);\n }\n\n /**\n * @dev Returns true if `account` supports the interface defined by\n * `interfaceId`. Support for {IERC165} itself is queried automatically.\n *\n * See {IERC165-supportsInterface}.\n */\n function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {\n // query support of both ERC165 as per the spec and support of _interfaceId\n return supportsERC165(account) &&\n _supportsERC165Interface(account, interfaceId);\n }\n\n /**\n * @dev Returns a boolean array where each value corresponds to the\n * interfaces passed in and whether they're supported or not. This allows\n * you to batch check interfaces for a contract where your expectation\n * is that some interfaces may not be supported.\n *\n * See {IERC165-supportsInterface}.\n *\n * _Available since v3.4._\n */\n function getSupportedInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool[] memory) {\n // an array of booleans corresponding to interfaceIds and whether they're supported or not\n bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);\n\n // query support of ERC165 itself\n if (supportsERC165(account)) {\n // query support of each interface in interfaceIds\n for (uint256 i = 0; i < interfaceIds.length; i++) {\n interfaceIdsSupported[i] = _supportsERC165Interface(account, interfaceIds[i]);\n }\n }\n\n return interfaceIdsSupported;\n }\n\n /**\n * @dev Returns true if `account` supports all the interfaces defined in\n * `interfaceIds`. Support for {IERC165} itself is queried automatically.\n *\n * Batch-querying can lead to gas savings by skipping repeated checks for\n * {IERC165} support.\n *\n * See {IERC165-supportsInterface}.\n */\n function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {\n // query support of ERC165 itself\n if (!supportsERC165(account)) {\n return false;\n }\n\n // query support of each interface in _interfaceIds\n for (uint256 i = 0; i < interfaceIds.length; i++) {\n if (!_supportsERC165Interface(account, interfaceIds[i])) {\n return false;\n }\n }\n\n // all interfaces supported\n return true;\n }\n\n /**\n * @notice Query if a contract implements an interface, does not check ERC165 support\n * @param account The address of the contract to query for support of an interface\n * @param interfaceId The interface identifier, as specified in ERC-165\n * @return true if the contract at account indicates support of the interface with\n * identifier interfaceId, false otherwise\n * @dev Assumes that account contains a contract that supports ERC165, otherwise\n * the behavior of this method is undefined. This precondition can be checked\n * with {supportsERC165}.\n * Interface identification is specified in ERC-165.\n */\n function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) {\n // success determines whether the staticcall succeeded and result determines\n // whether the contract at account indicates support of _interfaceId\n (bool success, bool result) = _callERC165SupportsInterface(account, interfaceId);\n\n return (success && result);\n }\n\n /**\n * @notice Calls the function with selector 0x01ffc9a7 (ERC165) and suppresses throw\n * @param account The address of the contract to query for support of an interface\n * @param interfaceId The interface identifier, as specified in ERC-165\n * @return success true if the STATICCALL succeeded, false otherwise\n * @return result true if the STATICCALL succeeded and the contract at account\n * indicates support of the interface with identifier interfaceId, false otherwise\n */\n function _callERC165SupportsInterface(address account, bytes4 interfaceId)\n private\n view\n returns (bool, bool)\n {\n bytes memory encodedParams = abi.encodeWithSelector(_INTERFACE_ID_ERC165, interfaceId);\n (bool success, bytes memory result) = account.staticcall{ gas: 30000 }(encodedParams);\n if (result.length < 32) return (false, false);\n return (success, abi.decode(result, (bool)));\n }\n}\n" }, - "contracts/optimistic-ethereum/OVM/predeploys/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_L1TokenGateway } from \"../../iOVM/bridge/tokens/iOVM_L1TokenGateway.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 \"Ether\",\n \"ETH\"\n )\n {\n init(iOVM_L1TokenGateway(_l1ETHGateway));\n }\n}\n" + "contracts/optimistic-ethereum/libraries/constants/Lib_PredeployAddresses.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title Lib_PredeployAddresses\n */\nlibrary Lib_PredeployAddresses {\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\n address internal constant ECDSA_CONTRACT_ACCOUNT = 0x4200000000000000000000000000000000000003;\n address internal constant SEQUENCER_ENTRYPOINT = 0x4200000000000000000000000000000000000005;\n address payable internal constant OVM_ETH = 0x4200000000000000000000000000000000000006;\n address internal constant L2_CROSS_DOMAIN_MESSENGER = 0x4200000000000000000000000000000000000007;\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\n address internal constant EXECUTION_MANAGER_WRAPPER = 0x420000000000000000000000000000000000000B;\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\n address internal constant ERC1820_REGISTRY = 0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24;\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\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/libraries/standards/IL2StandardERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.16 <0.8.0;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IERC165 } from \"@openzeppelin/contracts/introspection/IERC165.sol\";\n\ninterface IL2StandardERC20 is IERC20, IERC165 {\n function l1Token() external returns (address);\n\n function mint(address _to, uint256 _amount) external;\n\n function burn(address _from, uint256 _amount) external;\n\n event Mint(address indexed _account, uint256 _amount);\n event Burn(address indexed _account, uint256 _amount);\n}\n" }, - "contracts/optimistic-ethereum/libraries/utils/Lib_ErrorUtils.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/**\n * @title Lib_ErrorUtils\n */\nlibrary Lib_ErrorUtils {\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Encodes an error string into raw solidity-style revert data.\n * (i.e. ascii bytes, prefixed with bytes4(keccak(\"Error(string))\"))\n * Ref: https://docs.soliditylang.org/en/v0.8.2/control-structures.html?highlight=Error(string)#panic-via-assert-and-error-via-require\n * @param _reason Reason for the reversion.\n * @return Standard solidity revert data for the given reason.\n */\n function encodeRevertString(\n string memory _reason\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n return abi.encodeWithSignature(\n \"Error(string)\",\n _reason\n );\n }\n}\n" + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\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 */\nabstract contract Lib_AddressResolver {\n\n /*************\n * Variables *\n *************/\n\n Lib_AddressManager public libAddressManager;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address of the Lib_AddressManager.\n */\n constructor(\n address _libAddressManager\n ) {\n libAddressManager = Lib_AddressManager(_libAddressManager);\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Resolves the address associated with a given name.\n * @param _name Name to resolve an address for.\n * @return Address associated with the given name.\n */\n function resolve(\n string memory _name\n )\n public\n view\n returns (\n address\n )\n {\n return libAddressManager.getAddress(_name);\n }\n}\n" + "@openzeppelin/contracts/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" }, - "contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1TokenGateway.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0;\npragma experimental ABIEncoderV2;\n\n/**\n * @title iOVM_L1TokenGateway\n */\ninterface iOVM_L1TokenGateway {\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/OVM/predeploys/OVM_SequencerFeeVault.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Contract Imports */\nimport { OVM_ETH } from \"../predeploys/OVM_ETH.sol\";\nimport { OVM_L2StandardBridge } from \"../bridge/tokens/OVM_L2StandardBridge.sol\";\n\n/**\n * @title OVM_SequencerFeeVault\n * @dev Simple holding contract for fees paid to the Sequencer. Likely to be replaced in the future\n * but \"good enough for now\".\n *\n * Compiler used: optimistic-solc\n * Runtime target: OVM\n */\ncontract OVM_SequencerFeeVault {\n\n /*************\n * Constants *\n *************/\n\n // Minimum ETH balance that can be withdrawn in a single withdrawal.\n uint256 public constant MIN_WITHDRAWAL_AMOUNT = 15 ether;\n\n\n /*************\n * Variables *\n *************/\n\n // Address on L1 that will hold the fees once withdrawn. Dynamically initialized within l2geth.\n address public l1FeeWallet;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _l1FeeWallet Initial address for the L1 wallet that will hold fees once withdrawn.\n * Currently HAS NO EFFECT in production because l2geth will mutate this storage slot during\n * the genesis block. This is ONLY for testing purposes.\n */\n constructor(\n address _l1FeeWallet\n ) {\n l1FeeWallet = _l1FeeWallet;\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n function withdraw()\n public\n {\n uint256 balance = OVM_ETH(Lib_PredeployAddresses.OVM_ETH).balanceOf(address(this));\n\n require(\n balance >= MIN_WITHDRAWAL_AMOUNT,\n \"OVM_SequencerFeeVault: withdrawal amount must be greater than minimum withdrawal amount\"\n );\n\n OVM_L2StandardBridge(Lib_PredeployAddresses.L2_STANDARD_BRIDGE).withdrawTo(\n Lib_PredeployAddresses.OVM_ETH,\n l1FeeWallet,\n balance,\n 0,\n bytes(\"\")\n );\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_L1TokenGateway } from \"../../../iOVM/bridge/tokens/iOVM_L1TokenGateway.sol\";\n\n/* Contract Imports */\nimport { UniswapV2ERC20 } from \"../../../libraries/standards/UniswapV2ERC20.sol\";\n\n/* Library Imports */\nimport { Abs_L2DepositedToken } from \"./Abs_L2DepositedToken.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 * NOTE: This contract implements the Abs_L2DepositedToken contract using Uniswap's ERC20 as the implementation.\n * Alternative implementations can be used in this similar manner.\n *\n * Compiler used: optimistic-solc\n * Runtime target: OVM\n */\ncontract OVM_L2DepositedERC20 is Abs_L2DepositedToken, UniswapV2ERC20 {\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _l2CrossDomainMessenger Cross-domain messenger used by this contract.\n * @param _name ERC20 name\n * @param _symbol ERC20 symbol\n */\n constructor(\n address _l2CrossDomainMessenger,\n string memory _name,\n string memory _symbol\n )\n Abs_L2DepositedToken(_l2CrossDomainMessenger)\n UniswapV2ERC20(_name, _symbol)\n {}\n\n // When a withdrawal is initiated, we burn the withdrawer's funds to prevent subsequent L2 usage.\n function _handleInitiateWithdrawal(\n address, // _to,\n uint _amount\n )\n internal\n override\n {\n _burn(msg.sender, _amount);\n }\n\n // When a deposit is finalized, we credit the account on L2 with the same amount of tokens.\n function _handleFinalizeDeposit(\n address _to,\n uint _amount\n )\n internal\n override\n {\n _mint(_to, _amount);\n }\n}\n" + "contracts/optimistic-ethereum/OVM/predeploys/OVM_ETH.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Contract Imports */\nimport { L2StandardERC20 } from \"../../libraries/standards/L2StandardERC20.sol\";\nimport { IWETH9 } from \"../../libraries/standards/IWETH9.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 L2StandardERC20, IWETH9 {\n\n /***************\n * Constructor *\n ***************/\n\n constructor()\n L2StandardERC20(\n Lib_PredeployAddresses.L2_STANDARD_BRIDGE,\n address(0),\n \"Ether\",\n \"ETH\"\n )\n {}\n\n\n /******************************\n * Custom WETH9 Functionality *\n ******************************/\n fallback() external payable {\n deposit();\n }\n\n /**\n * Implements the WETH9 deposit() function as a no-op.\n * WARNING: this function does NOT have to do with cross-chain asset bridging. The\n * relevant deposit and withdraw functions for that use case can be found at L2StandardBridge.sol.\n * This function allows developers to treat OVM_ETH as WETH without any modifications to their code.\n */\n function deposit()\n public\n payable\n override\n {\n // Calling deposit() with nonzero value will send the ETH to this contract address. Once recieved here,\n // We transfer it back by sending to the msg.sender.\n _transfer(address(this), msg.sender, msg.value);\n\n emit Deposit(msg.sender, msg.value);\n }\n\n /**\n * Implements the WETH9 withdraw() function as a no-op.\n * WARNING: this function does NOT have to do with cross-chain asset bridging. The\n * relevant deposit and withdraw functions for that use case can be found at L2StandardBridge.sol.\n * This function allows developers to treat OVM_ETH as WETH without any modifications to their code.\n * @param _wad Amount being withdrawn\n */\n function withdraw(\n uint256 _wad\n )\n external\n override\n {\n // Calling withdraw() with value exceeding the withdrawer's ovmBALANCE should revert, as in WETH9.\n require(balanceOf(msg.sender) >= _wad);\n\n // Other than emitting an event, OVM_ETH already is native ETH, so we don't need to do anything else.\n emit Withdrawal(msg.sender, _wad);\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/* External Imports */\nimport { Ownable } from \"@openzeppelin/contracts/access/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 /*************\n * Variables *\n *************/\n\n mapping (bytes32 => address) private addresses;\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Changes the address associated with a particular name.\n * @param _name String name to associate an address with.\n * @param _address Address to associate with the name.\n */\n function setAddress(\n string memory _name,\n address _address\n )\n external\n onlyOwner\n {\n addresses[_getNameHash(_name)] = _address;\n\n emit AddressSet(\n _name,\n _address\n );\n }\n\n /**\n * Retrieves the address associated with a given name.\n * @param _name Name to retrieve an address for.\n * @return Address associated with the given name.\n */\n function getAddress(\n string memory _name\n )\n external\n view\n returns (\n address\n )\n {\n return addresses[_getNameHash(_name)];\n }\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Computes the hash of a name.\n * @param _name Name to compute a hash for.\n * @return Hash of the given name.\n */\n function _getNameHash(\n string memory _name\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n return keccak256(abi.encodePacked(_name));\n }\n}\n" + "contracts/optimistic-ethereum/libraries/standards/L2StandardERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.5.16 <0.8.0;\n\nimport { ERC20 } from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\nimport './IL2StandardERC20.sol';\n\ncontract L2StandardERC20 is IL2StandardERC20, ERC20 {\n address public override l1Token;\n address public l2Bridge;\n\n /**\n * @param _l1Token Address of the corresponding L1 token.\n * @param _name ERC20 name.\n * @param _symbol ERC20 symbol.\n */\n constructor(\n address _l2Bridge,\n address _l1Token,\n string memory _name,\n string memory _symbol\n )\n ERC20(_name, _symbol) {\n l1Token = _l1Token;\n l2Bridge = _l2Bridge;\n }\n\n modifier onlyL2Bridge {\n require(msg.sender == l2Bridge, \"Only L2 Bridge can mint and burn\");\n _;\n }\n\n function supportsInterface(bytes4 _interfaceId) public override pure returns (bool) {\n bytes4 firstSupportedInterface = bytes4(keccak256(\"supportsInterface(bytes4)\")); // ERC165\n bytes4 secondSupportedInterface = IL2StandardERC20.l1Token.selector\n ^ IL2StandardERC20.mint.selector\n ^ IL2StandardERC20.burn.selector;\n return _interfaceId == firstSupportedInterface || _interfaceId == secondSupportedInterface;\n }\n\n function mint(address _to, uint256 _amount) public override onlyL2Bridge {\n _mint(_to, _amount);\n\n emit Mint(_to, _amount);\n }\n\n function burn(address _from, uint256 _amount) public override onlyL2Bridge {\n _burn(_from, _amount);\n\n emit Burn(_from, _amount);\n }\n}\n" }, - "@openzeppelin/contracts/access/Ownable.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\nimport \"../utils/Context.sol\";\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor () internal {\n address msgSender = _msgSender();\n _owner = msgSender;\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\n }\n}\n" + "contracts/optimistic-ethereum/libraries/standards/IWETH9.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity =0.7.6;\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\n/// @title Interface for WETH9. Also contains the non-ERC20 events normally present in the WETH9 implementation.\ninterface IWETH9 is IERC20 {\n event Deposit(address indexed dst, uint256 wad);\n event Withdrawal(address indexed src, uint256 wad);\n\n /// @notice Deposit ether to get wrapped ether\n function deposit() external payable;\n\n /// @notice Withdraw wrapped ether to get ether\n function withdraw(uint256) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\nimport \"../../utils/Context.sol\";\nimport \"./IERC20.sol\";\nimport \"../../math/SafeMath.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin guidelines: functions revert instead\n * of returning `false` on failure. This behavior is nonetheless conventional\n * and does not conflict with the expectations of ERC20 applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20 {\n using SafeMath for uint256;\n\n mapping (address => uint256) private _balances;\n\n mapping (address => mapping (address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n uint8 private _decimals;\n\n /**\n * @dev Sets the values for {name} and {symbol}, initializes {decimals} with\n * a default value of 18.\n *\n * To select a different value for {decimals}, use {_setupDecimals}.\n *\n * All three of these values are immutable: they can only be set once during\n * construction.\n */\n constructor (string memory name_, string memory symbol_) public {\n _name = name_;\n _symbol = symbol_;\n _decimals = 18;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5,05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is\n * called.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual returns (uint8) {\n return _decimals;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, \"ERC20: transfer amount exceeds allowance\"));\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, \"ERC20: decreased allowance below zero\"));\n return true;\n }\n\n /**\n * @dev Moves tokens `amount` from `sender` to `recipient`.\n *\n * This is internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(address sender, address recipient, uint256 amount) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n _balances[sender] = _balances[sender].sub(amount, \"ERC20: transfer amount exceeds balance\");\n _balances[recipient] = _balances[recipient].add(amount);\n emit Transfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply = _totalSupply.add(amount);\n _balances[account] = _balances[account].add(amount);\n emit Transfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n _balances[account] = _balances[account].sub(amount, \"ERC20: burn amount exceeds balance\");\n _totalSupply = _totalSupply.sub(amount);\n emit Transfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Sets {decimals} to a value other than the default one of 18.\n *\n * WARNING: This function should only be called from the constructor. Most\n * applications that interact with token contracts will not expect\n * {decimals} to ever change, and may work incorrectly if it does.\n */\n function _setupDecimals(uint8 decimals_) internal virtual {\n _decimals = decimals_;\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be to transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }\n}\n" }, "@openzeppelin/contracts/utils/Context.sol": { "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/*\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with GSN meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address payable) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes memory) {\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n return msg.data;\n }\n}\n" }, - "contracts/optimistic-ethereum/libraries/standards/UniswapV2ERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma 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 constant override decimals = 18;\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 string memory _name,\n string memory _symbol\n ) {\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" + "@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/bridge/tokens/Abs_L2DepositedToken.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Interface Imports */\nimport { iOVM_L2DepositedToken } from \"../../../iOVM/bridge/tokens/iOVM_L2DepositedToken.sol\";\nimport { iOVM_L1TokenGateway } from \"../../../iOVM/bridge/tokens/iOVM_L1TokenGateway.sol\";\n\n/* Library Imports */\nimport { OVM_CrossDomainEnabled } from \"../../../libraries/bridge/OVM_CrossDomainEnabled.sol\";\n\n/**\n * @title Abs_L2DepositedToken\n * @dev An L2 Deposited Token is an L2 representation of funds which were deposited from L1.\n * Usually 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 * NOTE: This abstract contract gives all the core functionality of a deposited token implementation except for the\n * token's internal accounting itself. This gives developers an easy way to implement children with their own token code.\n *\n * Compiler used: optimistic-solc\n * Runtime target: OVM\n */\nabstract contract Abs_L2DepositedToken is iOVM_L2DepositedToken, OVM_CrossDomainEnabled {\n\n /*******************\n * Contract Events *\n *******************/\n\n event Initialized(iOVM_L1TokenGateway _l1TokenGateway);\n\n /********************************\n * External Contract References *\n ********************************/\n\n iOVM_L1TokenGateway public l1TokenGateway;\n\n /********************************\n * Constructor & Initialization *\n ********************************/\n\n /**\n * @param _l2CrossDomainMessenger L1 Messenger address being used for cross-chain communications.\n */\n constructor(\n address _l2CrossDomainMessenger\n )\n OVM_CrossDomainEnabled(_l2CrossDomainMessenger)\n {}\n\n /**\n * @dev Initialize this contract with the L1 token gateway address.\n * The flow: 1) this contract gets deployed on L2, 2) the L1\n * gateway is deployed with addr from (1), 3) L1 gateway address passed here.\n *\n * @param _l1TokenGateway Address of the corresponding L1 gateway deployed to the main chain\n */\n function init(\n iOVM_L1TokenGateway _l1TokenGateway\n )\n public\n {\n require(address(l1TokenGateway) == address(0), \"Contract has already been initialized\");\n\n l1TokenGateway = _l1TokenGateway;\n\n emit Initialized(l1TokenGateway);\n }\n\n /**********************\n * Function Modifiers *\n **********************/\n\n modifier onlyInitialized() {\n require(address(l1TokenGateway) != address(0), \"Contract has not yet been initialized\");\n _;\n }\n\n /********************************\n * Overridable Accounting logic *\n ********************************/\n\n // Default gas value which can be overridden if more complex logic runs on L1.\n uint32 internal constant DEFAULT_FINALIZE_WITHDRAWAL_L1_GAS = 100000;\n\n /**\n * @dev Core logic to be performed when a withdrawal from L2 is initialized.\n * In most cases, this will simply burn the withdrawn L2 funds.\n *\n * param _to Address being withdrawn to\n * param _amount Amount being withdrawn\n */\n function _handleInitiateWithdrawal(\n address, // _to,\n uint // _amount\n )\n internal\n virtual\n {\n revert(\"Accounting must be implemented by child contract.\");\n }\n\n /**\n * @dev Core logic to be performed when a deposit from L2 is finalized on L2.\n * In most cases, this will simply _mint() to credit L2 funds to the recipient.\n *\n * param _to Address being deposited to on L2\n * param _amount Amount which was deposited on L1\n */\n function _handleFinalizeDeposit(\n address, // _to\n uint // _amount\n )\n internal\n virtual\n {\n revert(\"Accounting must be implemented by child contract.\");\n }\n\n /**\n * @dev Overridable getter for the *L1* gas limit of settling the withdrawal, in the case it may be\n * dynamic, and the above public constant does not suffice.\n */\n function getFinalizeWithdrawalL1Gas()\n public\n view\n virtual\n returns(\n uint32\n )\n {\n return DEFAULT_FINALIZE_WITHDRAWAL_L1_GAS;\n }\n\n\n /***************\n * Withdrawing *\n ***************/\n\n /**\n * @dev initiate a withdraw of some tokens to the caller's account on L1\n * @param _amount Amount of the token to withdraw\n */\n function withdraw(\n uint _amount\n )\n external\n override\n virtual\n onlyInitialized()\n {\n _initiateWithdrawal(msg.sender, _amount);\n }\n\n /**\n * @dev initiate a withdraw of some token to a recipient's account on L1\n * @param _to L1 adress to credit the withdrawal to\n * @param _amount Amount of the token to withdraw\n */\n function withdrawTo(\n address _to,\n uint _amount\n )\n external\n override\n virtual\n onlyInitialized()\n {\n _initiateWithdrawal(_to, _amount);\n }\n\n /**\n * @dev Performs the logic for deposits by storing the token and informing the L2 token Gateway of the deposit.\n *\n * @param _to Account to give the withdrawal to on L1\n * @param _amount Amount of the token to withdraw\n */\n function _initiateWithdrawal(\n address _to,\n uint _amount\n )\n internal\n {\n // Call our withdrawal accounting handler implemented by child contracts (usually a _burn)\n _handleInitiateWithdrawal(_to, _amount);\n\n // Construct calldata for l1TokenGateway.finalizeWithdrawal(_to, _amount)\n bytes memory data = abi.encodeWithSelector(\n iOVM_L1TokenGateway.finalizeWithdrawal.selector,\n _to,\n _amount\n );\n\n // Send message up to L1 gateway\n sendCrossDomainMessage(\n address(l1TokenGateway),\n data,\n getFinalizeWithdrawalL1Gas()\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 token.\n * This call will fail if it did not originate from a corresponding deposit in OVM_l1TokenGateway.\n *\n * @param _to Address to receive the withdrawal at\n * @param _amount Amount of the token to withdraw\n */\n function finalizeDeposit(\n address _to,\n uint _amount\n )\n external\n override\n virtual\n onlyInitialized()\n onlyFromCrossDomainAccount(address(l1TokenGateway))\n {\n _handleFinalizeDeposit(_to, _amount);\n emit DepositFinalized(_to, _amount);\n }\n}\n" + "@openzeppelin/contracts/token/ERC20/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"../../math/SafeMath.sol\";\nimport \"../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using SafeMath for uint256;\n using Address for address;\n\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n // solhint-disable-next-line max-line-length\n require((value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 newAllowance = token.allowance(address(this), spender).add(value);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 newAllowance = token.allowance(address(this), spender).sub(value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) { // Return data is optional\n // solhint-disable-next-line max-line-length\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" }, - "contracts/optimistic-ethereum/libraries/standards/IUniswapV2ERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma 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" + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.2 <0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n // solhint-disable-next-line no-inline-assembly\n assembly { size := extcodesize(account) }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\n (bool success, ) = recipient.call{ value: amount }(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain`call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.call{ value: value }(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.staticcall(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" }, - "contracts/optimistic-ethereum/libraries/standards/UniSafeMath.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma 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/bridge/tokens/OVM_L1StandardBridge.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_L1StandardBridge } from \"../../../iOVM/bridge/tokens/iOVM_L1StandardBridge.sol\";\nimport { iOVM_L1ERC20Bridge } from \"../../../iOVM/bridge/tokens/iOVM_L1ERC20Bridge.sol\";\nimport { iOVM_L2ERC20Bridge } from \"../../../iOVM/bridge/tokens/iOVM_L2ERC20Bridge.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/* Library Imports */\nimport { OVM_CrossDomainEnabled } from \"../../../libraries/bridge/OVM_CrossDomainEnabled.sol\";\nimport { Lib_PredeployAddresses } from \"../../../libraries/constants/Lib_PredeployAddresses.sol\";\nimport { SafeMath } from \"@openzeppelin/contracts/math/SafeMath.sol\";\nimport { Address } from \"@openzeppelin/contracts/utils/Address.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/SafeERC20.sol\";\n\n/**\n * @title OVM_L1StandardBridge\n * @dev The L1 ETH and ERC20 Bridge is a contract which stores deposited L1 funds and standard tokens that are in use on L2.\n * It synchronizes a corresponding L2 Bridge, informing it of deposits, and listening to it for newly finalized withdrawals.\n *\n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_L1StandardBridge is iOVM_L1StandardBridge, OVM_CrossDomainEnabled {\n using SafeMath for uint;\n using SafeERC20 for IERC20;\n\n /********************************\n * External Contract References *\n ********************************/\n\n address public l2TokenBridge;\n\n // Maps L1 token to L2 token to balance of the L1 token deposited\n mapping(address => mapping (address => uint256)) public deposits;\n\n /***************\n * Constructor *\n ***************/\n\n // This contract lives behind a proxy, so the constructor parameters will go unused.\n constructor()\n OVM_CrossDomainEnabled(address(0))\n {}\n\n /******************\n * Initialization *\n ******************/\n\n /**\n * @param _l1messenger L1 Messenger address being used for cross-chain communications.\n * @param _l2TokenBridge L2 standard bridge address.\n */\n function initialize(\n address _l1messenger,\n address _l2TokenBridge\n )\n public\n {\n require(messenger == address(0), \"Contract has already been initialized.\");\n messenger = _l1messenger;\n l2TokenBridge = _l2TokenBridge;\n }\n\n /**************\n * Depositing *\n **************/\n\n /// @dev Modifier requiring sender to be EOA. This check could be bypassed by a malicious contract via initcode, but it takes care of the user error we want to avoid.\n modifier onlyEOA() {\n // Used to stop deposits from contracts (avoid accidentally lost tokens)\n require(!Address.isContract(msg.sender), \"Account not EOA\");\n _;\n }\n\n /**\n * @dev This function can be called with no data\n * to deposit an amount of ETH to the caller's balance on L2.\n * Since the receive function doesn't take data, a conservative\n * default amount is forwarded to L2.\n */\n receive()\n external\n payable\n onlyEOA()\n {\n _initiateETHDeposit(\n msg.sender,\n msg.sender,\n 1_300_000,\n bytes(\"\")\n );\n }\n\n /**\n * @inheritdoc iOVM_L1StandardBridge\n */\n function depositETH(\n uint32 _l2Gas,\n bytes calldata _data\n )\n external\n override\n payable\n onlyEOA()\n {\n _initiateETHDeposit(\n msg.sender,\n msg.sender,\n _l2Gas,\n _data\n );\n }\n\n /**\n * @inheritdoc iOVM_L1StandardBridge\n */\n function depositETHTo(\n address _to,\n uint32 _l2Gas,\n bytes calldata _data\n )\n external\n override\n payable\n {\n _initiateETHDeposit(\n msg.sender,\n _to,\n _l2Gas,\n _data\n );\n }\n\n /**\n * @dev Performs the logic for deposits by storing the ETH and informing the L2 ETH Gateway of the deposit.\n * @param _from Account to pull the deposit from on L1.\n * @param _to Account to give the deposit to on L2.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function _initiateETHDeposit(\n address _from,\n address _to,\n uint32 _l2Gas,\n bytes memory _data\n )\n internal\n {\n // Construct calldata for finalizeDeposit call\n bytes memory message =\n abi.encodeWithSelector(\n iOVM_L2ERC20Bridge.finalizeDeposit.selector,\n address(0),\n Lib_PredeployAddresses.OVM_ETH,\n _from,\n _to,\n msg.value,\n _data\n );\n\n // Send calldata into L2\n sendCrossDomainMessage(\n l2TokenBridge,\n _l2Gas,\n message\n );\n\n emit ETHDepositInitiated(_from, _to, msg.value, _data);\n }\n\n /**\n * @inheritdoc iOVM_L1ERC20Bridge\n */\n function depositERC20(\n address _l1Token,\n address _l2Token,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n )\n external\n override\n virtual\n onlyEOA()\n {\n _initiateERC20Deposit(_l1Token, _l2Token, msg.sender, msg.sender, _amount, _l2Gas, _data);\n }\n\n /**\n * @inheritdoc iOVM_L1ERC20Bridge\n */\n function depositERC20To(\n address _l1Token,\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n )\n external\n override\n virtual\n {\n _initiateERC20Deposit(_l1Token, _l2Token, msg.sender, _to, _amount, _l2Gas, _data);\n }\n\n /**\n * @dev Performs the logic for deposits by informing the L2 Deposited Token\n * contract of the deposit and calling a handler to lock the L1 funds. (e.g. transferFrom)\n *\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\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 * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function _initiateERC20Deposit(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n )\n internal\n {\n // When a deposit is initiated on L1, the L1 Bridge transfers the funds to itself for future withdrawals.\n // safeTransferFrom also checks if the contract has code, so this will fail if _from is an EOA or address(0).\n IERC20(_l1Token).safeTransferFrom(\n _from,\n address(this),\n _amount\n );\n\n // Construct calldata for _l2Token.finalizeDeposit(_to, _amount)\n bytes memory message = abi.encodeWithSelector(\n iOVM_L2ERC20Bridge.finalizeDeposit.selector,\n _l1Token,\n _l2Token,\n _from,\n _to,\n _amount,\n _data\n );\n\n // Send calldata into L2\n sendCrossDomainMessage(\n l2TokenBridge,\n _l2Gas,\n message\n );\n\n deposits[_l1Token][_l2Token] = deposits[_l1Token][_l2Token].add(_amount);\n\n emit ERC20DepositInitiated(_l1Token, _l2Token, _from, _to, _amount, _data);\n }\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @inheritdoc iOVM_L1StandardBridge\n */\n function finalizeETHWithdrawal(\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n )\n external\n override\n onlyFromCrossDomainAccount(l2TokenBridge)\n {\n (bool success, ) = _to.call{value: _amount}(new bytes(0));\n require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');\n\n emit ETHWithdrawalFinalized(_from, _to, _amount, _data);\n }\n\n /**\n * @inheritdoc iOVM_L1ERC20Bridge\n */\n function finalizeERC20Withdrawal(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n )\n external\n override\n onlyFromCrossDomainAccount(l2TokenBridge)\n {\n deposits[_l1Token][_l2Token] = deposits[_l1Token][_l2Token].sub(_amount);\n\n // When a withdrawal is finalized on L1, the L1 Bridge transfers the funds to the withdrawer.\n IERC20(_l1Token).safeTransfer(_to, _amount);\n\n emit ERC20WithdrawalFinalized(_l1Token, _l2Token, _from, _to, _amount, _data);\n }\n\n /*****************************\n * Temporary - Migrating ETH *\n *****************************/\n\n /**\n * @dev Adds ETH balance to the account. This is meant to allow for ETH\n * to be migrated from an old gateway to a new gateway.\n * NOTE: This is left for one upgrade only so we are able to receive the migrated ETH from the old contract\n */\n function donateETH() external payable {}\n}\n" }, - "contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L2DepositedToken.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0;\npragma experimental ABIEncoderV2;\n\n/**\n * @title iOVM_L2DepositedToken\n */\ninterface iOVM_L2DepositedToken {\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/OVM/predeploys/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/predeploys/iOVM_ECDSAContractAccount.sol\";\n\n/* Library Imports */\nimport { Lib_EIP155Tx } from \"../../libraries/codec/Lib_EIP155Tx.sol\";\nimport { Lib_ExecutionManagerWrapper } from \"../../libraries/wrappers/Lib_ExecutionManagerWrapper.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Contract Imports */\nimport { OVM_ETH } from \"../predeploys/OVM_ETH.sol\";\n\n/* External Imports */\nimport { SafeMath } from \"@openzeppelin/contracts/math/SafeMath.sol\";\nimport { ECDSA } from \"@openzeppelin/contracts/cryptography/ECDSA.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 EIP155 formatted transaction encodings.\n *\n * Compiler used: optimistic-solc\n * Runtime target: OVM\n */\ncontract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount {\n\n /*************\n * Libraries *\n *************/\n\n using Lib_EIP155Tx for Lib_EIP155Tx.EIP155Tx;\n\n\n /*************\n * Constants *\n *************/\n\n // TODO: should be the amount sufficient to cover the gas costs of all of the transactions up\n // to and including the CALL/CREATE which forms the entrypoint of the transaction.\n uint256 constant EXECUTION_VALIDATION_GAS_OVERHEAD = 25000;\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * No-op fallback mirrors behavior of calling an EOA on L1.\n */\n fallback()\n external\n payable\n {\n return;\n }\n\n /**\n * @dev Should return whether the signature provided is valid for the provided data\n * @param hash Hash of the data to be signed\n * @param signature Signature byte array associated with _data\n */\n function isValidSignature(\n bytes32 hash,\n bytes memory signature\n )\n public\n view\n returns (\n bytes4 magicValue\n )\n {\n return ECDSA.recover(hash, signature) == address(this) ?\n this.isValidSignature.selector :\n bytes4(0);\n }\n\n /**\n * Executes a signed transaction.\n * @param _transaction Signed EIP155 transaction.\n * @return Whether or not the call returned (rather than reverted).\n * @return Data returned by the call.\n */\n function execute(\n Lib_EIP155Tx.EIP155Tx memory _transaction\n )\n override\n public\n returns (\n bool,\n bytes memory\n )\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 require(\n _transaction.sender() == Lib_ExecutionManagerWrapper.ovmADDRESS(),\n \"Signature provided for EOA transaction execution is invalid.\"\n );\n\n require(\n _transaction.chainId == Lib_ExecutionManagerWrapper.ovmCHAINID(),\n \"Transaction signed with wrong chain ID\"\n );\n\n // Need to make sure that the transaction nonce is right.\n require(\n _transaction.nonce == Lib_ExecutionManagerWrapper.ovmGETNONCE(),\n \"Transaction nonce does not match the expected nonce.\"\n );\n\n // TEMPORARY: Disable gas checks for mainnet.\n // // Need to make sure that the gas is sufficient to execute the transaction.\n // require(\n // gasleft() >= SafeMath.add(transaction.gasLimit, EXECUTION_VALIDATION_GAS_OVERHEAD),\n // \"Gas is not sufficient to execute the transaction.\"\n // );\n\n // Transfer fee to relayer.\n require(\n OVM_ETH(Lib_PredeployAddresses.OVM_ETH).transfer(\n Lib_PredeployAddresses.SEQUENCER_FEE_WALLET,\n SafeMath.mul(_transaction.gasLimit, _transaction.gasPrice)\n ),\n \"Fee was not transferred to relayer.\"\n );\n\n if (_transaction.isCreate) {\n // TEMPORARY: Disable value transfer for contract creations.\n require(\n _transaction.value == 0,\n \"Value transfer in contract creation not supported.\"\n );\n\n (address created, bytes memory revertdata) = Lib_ExecutionManagerWrapper.ovmCREATE(\n _transaction.data\n );\n\n // Return true if the contract creation succeeded, false w/ revertdata otherwise.\n if (created != address(0)) {\n return (true, abi.encode(created));\n } else {\n return (false, revertdata);\n }\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_ExecutionManagerWrapper.ovmINCREMENTNONCE();\n\n // NOTE: Upgrades are temporarily disabled because users can, in theory, modify their EOA\n // so that they don't have to pay any fees to the sequencer. Function will remain disabled\n // until a robust solution is in place.\n require(\n _transaction.to != Lib_ExecutionManagerWrapper.ovmADDRESS(),\n \"Calls to self are disabled until upgradability is re-enabled.\"\n );\n\n return _transaction.to.call{value: _transaction.value}(_transaction.data);\n }\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\n/* Interface Imports */\nimport { iAbs_BaseCrossDomainMessenger } from \"../../iOVM/bridge/messaging/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\n /*************\n * Variables *\n *************/\n\n // Messenger contract used to send and recieve messages from the other domain.\n address public messenger;\n\n\n /***************\n * Constructor *\n ***************/ \n\n /**\n * @param _messenger Address of the CrossDomainMessenger on the current layer.\n */\n constructor(\n address _messenger\n ) {\n messenger = _messenger;\n }\n\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * 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\n * 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 /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Gets the messenger, usually from storage. This function is exposed in case a child contract\n * 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 * 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\n * `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 )\n internal\n {\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _data, _gasLimit);\n }\n}\n" + "contracts/optimistic-ethereum/iOVM/predeploys/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_EIP155Tx } from \"../../libraries/codec/Lib_EIP155Tx.sol\";\n\n/**\n * @title iOVM_ECDSAContractAccount\n */\ninterface iOVM_ECDSAContractAccount {\n\n /********************\n * Public Functions *\n ********************/\n\n function execute(\n Lib_EIP155Tx.EIP155Tx memory _transaction\n )\n external\n returns (\n bool,\n bytes memory\n );\n}\n" }, - "contracts/optimistic-ethereum/iOVM/bridge/messaging/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\n event SentMessage(bytes message);\n event RelayedMessage(bytes32 msgHash);\n event FailedRelayedMessage(bytes32 msgHash);\n\n\n /*************\n * Variables *\n *************/\n\n function xDomainMessageSender() external view returns (address);\n\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/libraries/codec/Lib_EIP155Tx.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\";\n\n/**\n * @title Lib_EIP155Tx\n * @dev A simple library for dealing with the transaction type defined by EIP155:\n * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md\n */\nlibrary Lib_EIP155Tx {\n\n /***********\n * Structs *\n ***********/\n\n // Struct representing an EIP155 transaction. See EIP link above for more information.\n struct EIP155Tx {\n // These fields correspond to the actual RLP-encoded fields specified by EIP155.\n uint256 nonce;\n uint256 gasPrice;\n uint256 gasLimit;\n address to;\n uint256 value;\n bytes data;\n uint8 v;\n bytes32 r;\n bytes32 s;\n\n // Chain ID to associate this transaction with. Used all over the place, seemed easier to\n // set this once when we create the transaction rather than providing it as an input to\n // each function. I don't see a strong need to have a transaction with a mutable chain ID.\n uint256 chainId;\n\n // The ECDSA \"recovery parameter,\" should always be 0 or 1. EIP155 specifies that:\n // `v = {0,1} + CHAIN_ID * 2 + 35`\n // Where `{0,1}` is a stand in for our `recovery_parameter`. Now computing our formula for\n // the recovery parameter:\n // 1. `v = {0,1} + CHAIN_ID * 2 + 35`\n // 2. `v = recovery_parameter + CHAIN_ID * 2 + 35`\n // 3. `v - CHAIN_ID * 2 - 35 = recovery_parameter`\n // So we're left with the final formula:\n // `recovery_parameter = v - CHAIN_ID * 2 - 35`\n // NOTE: This variable is a uint8 because `v` is inherently limited to a uint8. If we\n // didn't use a uint8, then recovery_parameter would always be a negative number for chain\n // IDs greater than 110 (`255 - 110 * 2 - 35 = 0`). So we need to wrap around to support\n // anything larger.\n uint8 recoveryParam;\n\n // Whether or not the transaction is a creation. Necessary because we can't make an address\n // \"nil\". Using the zero address creates a potential conflict if the user did actually\n // intend to send a transaction to the zero address.\n bool isCreate;\n }\n\n // Lets us use nicer syntax.\n using Lib_EIP155Tx for EIP155Tx;\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Decodes an EIP155 transaction and attaches a given Chain ID.\n * Transaction *must* be RLP-encoded.\n * @param _encoded RLP-encoded EIP155 transaction.\n * @param _chainId Chain ID to assocaite with this transaction.\n * @return Parsed transaction.\n */\n function decode(\n bytes memory _encoded,\n uint256 _chainId\n )\n internal\n pure\n returns (\n EIP155Tx memory\n )\n {\n Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_encoded);\n\n // Note formula above about how recoveryParam is computed.\n uint8 v = uint8(Lib_RLPReader.readUint256(decoded[6]));\n uint8 recoveryParam = uint8(v - 2 * _chainId - 35);\n\n // Recovery param being anything other than 0 or 1 indicates that we have the wrong chain\n // ID.\n require(\n recoveryParam < 2,\n \"Lib_EIP155Tx: Transaction signed with wrong chain ID\"\n );\n\n // Creations can be detected by looking at the byte length here.\n bool isCreate = Lib_RLPReader.readBytes(decoded[3]).length == 0;\n\n return EIP155Tx({\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 v: v,\n r: Lib_RLPReader.readBytes32(decoded[7]),\n s: Lib_RLPReader.readBytes32(decoded[8]),\n chainId: _chainId,\n recoveryParam: recoveryParam,\n isCreate: isCreate\n });\n }\n\n /**\n * Encodes an EIP155 transaction into RLP.\n * @param _transaction EIP155 transaction to encode.\n * @param _includeSignature Whether or not to encode the signature.\n * @return RLP-encoded transaction.\n */\n function encode(\n EIP155Tx memory _transaction,\n bool _includeSignature\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\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\n // We write the encoding of empty bytes when the transaction is a creation, *not* the zero\n // address as one might assume.\n if (_transaction.isCreate) {\n raw[3] = Lib_RLPWriter.writeBytes('');\n } else {\n raw[3] = Lib_RLPWriter.writeAddress(_transaction.to);\n }\n\n raw[4] = Lib_RLPWriter.writeUint(_transaction.value);\n raw[5] = Lib_RLPWriter.writeBytes(_transaction.data);\n\n if (_includeSignature) {\n raw[6] = Lib_RLPWriter.writeUint(_transaction.v);\n raw[7] = Lib_RLPWriter.writeBytes32(_transaction.r);\n raw[8] = Lib_RLPWriter.writeBytes32(_transaction.s);\n } else {\n // Chain ID *is* included in the unsigned transaction.\n raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId);\n raw[7] = Lib_RLPWriter.writeBytes('');\n raw[8] = Lib_RLPWriter.writeBytes('');\n }\n\n return Lib_RLPWriter.writeList(raw);\n }\n\n /**\n * Computes the hash of an EIP155 transaction. Assumes that you don't want to include the\n * signature in this hash because that's a very uncommon usecase. If you really want to include\n * the signature, just encode with the signature and take the hash yourself.\n */\n function hash(\n EIP155Tx memory _transaction\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n return keccak256(\n _transaction.encode(false)\n );\n }\n\n /**\n * Computes the sender of an EIP155 transaction.\n * @param _transaction EIP155 transaction to get a sender for.\n * @return Address corresponding to the private key that signed this transaction.\n */\n function sender(\n EIP155Tx memory _transaction\n )\n internal\n pure\n returns (\n address\n )\n {\n return ecrecover(\n _transaction.hash(),\n _transaction.recoveryParam + 27,\n _transaction.r,\n _transaction.s\n );\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 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_Proposer\");\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 // For efficiency reasons getMerkleRoot modifies the `_batch` argument in place\n // while calculating the root hash therefore any arguments passed to it must not\n // be used again afterwards\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/wrappers/Lib_ExecutionManagerWrapper.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_ErrorUtils } from \"../utils/Lib_ErrorUtils.sol\";\nimport { Lib_PredeployAddresses } from \"../constants/Lib_PredeployAddresses.sol\";\n\n/**\n * @title Lib_ExecutionManagerWrapper\n * @dev This library acts as a utility for easily calling the OVM_ExecutionManagerWrapper, the\n * predeployed contract which exposes the `kall` builtin. Effectively, this contract allows the\n * user to trigger OVM opcodes by directly calling the OVM_ExecutionManger.\n *\n * Compiler used: solc\n * Runtime target: OVM\n */\nlibrary Lib_ExecutionManagerWrapper {\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Performs a safe ovmCREATE call.\n * @param _bytecode Code for the new contract.\n * @return Address of the created contract.\n */\n function ovmCREATE(\n bytes memory _bytecode\n )\n internal\n returns (\n address,\n bytes memory\n )\n {\n bytes memory returndata = _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmCREATE(bytes)\",\n _bytecode\n )\n );\n\n return abi.decode(returndata, (address, bytes));\n }\n\n /**\n * Performs a safe ovmGETNONCE call.\n * @return Result of calling ovmGETNONCE.\n */\n function ovmGETNONCE()\n internal\n returns (\n uint256\n )\n {\n bytes memory returndata = _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmGETNONCE()\"\n )\n );\n\n return abi.decode(returndata, (uint256));\n }\n\n /**\n * Performs a safe ovmINCREMENTNONCE call.\n */\n function ovmINCREMENTNONCE()\n internal\n {\n _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmINCREMENTNONCE()\"\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 ovmCREATEEOA(\n bytes32 _messageHash,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n )\n internal\n {\n _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\",\n _messageHash,\n _v,\n _r,\n _s\n )\n );\n }\n\n /**\n * Calls the ovmL1TXORIGIN opcode.\n * @return Address that sent this message from L1.\n */\n function ovmL1TXORIGIN()\n internal\n returns (\n address\n )\n {\n bytes memory returndata = _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmL1TXORIGIN()\"\n )\n );\n\n return abi.decode(returndata, (address));\n }\n\n /**\n * Calls the ovmCHAINID opcode.\n * @return Chain ID of the current network.\n */\n function ovmCHAINID()\n internal\n returns (\n uint256\n )\n {\n bytes memory returndata = _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmCHAINID()\"\n )\n );\n\n return abi.decode(returndata, (uint256));\n }\n\n /**\n * Performs a safe ovmADDRESS call.\n * @return Result of calling ovmADDRESS.\n */\n function ovmADDRESS()\n internal\n returns (\n address\n )\n {\n bytes memory returndata = _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmADDRESS()\"\n )\n );\n\n return abi.decode(returndata, (address));\n }\n\n /**\n * Calls the value-enabled ovmCALL opcode.\n * @param _gasLimit Amount of gas to be passed into this call.\n * @param _address Address of the contract to call.\n * @param _value ETH value to pass with the 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 uint256 _value,\n bytes memory _calldata\n )\n internal\n returns (\n bool,\n bytes memory\n )\n {\n bytes memory returndata = _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmCALL(uint256,address,uint256,bytes)\",\n _gasLimit,\n _address,\n _value,\n _calldata\n )\n );\n\n return abi.decode(returndata, (bool, bytes));\n }\n\n /**\n * Calls the ovmBALANCE opcode.\n * @param _address OVM account to query the balance of.\n * @return Balance of the account.\n */\n function ovmBALANCE(\n address _address\n )\n internal\n returns (\n uint256\n )\n {\n bytes memory returndata = _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmBALANCE(address)\",\n _address\n )\n );\n\n return abi.decode(returndata, (uint256));\n }\n\n /**\n * Calls the ovmCALLVALUE opcode.\n * @return Value of the current call frame.\n */\n function ovmCALLVALUE()\n internal\n returns (\n uint256\n )\n {\n bytes memory returndata = _callWrapperContract(\n abi.encodeWithSignature(\n \"ovmCALLVALUE()\"\n )\n );\n\n return abi.decode(returndata, (uint256));\n }\n\n\n /*********************\n * Private Functions *\n *********************/\n\n /**\n * Performs an ovm interaction and the necessary safety checks.\n * @param _calldata Data to send to the OVM_ExecutionManager (encoded with sighash).\n * @return Data sent back by the OVM_ExecutionManager.\n */\n function _callWrapperContract(\n bytes memory _calldata\n )\n private\n returns (\n bytes memory\n )\n {\n (bool success, bytes memory returndata) = Lib_PredeployAddresses.EXECUTION_MANAGER_WRAPPER.delegatecall(_calldata);\n\n if (success == true) {\n return returndata;\n } else {\n assembly {\n revert(add(returndata, 0x20), mload(returndata))\n }\n }\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 * Note that the _elements argument is modified, therefore it must not be used again afterwards\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 pure\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 == 1) {\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 (uint256 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/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n // Check the signature length\n if (signature.length != 65) {\n revert(\"ECDSA: invalid signature length\");\n }\n\n // Divide the signature in r, s and v variables\n bytes32 r;\n bytes32 s;\n uint8 v;\n\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n\n return recover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover-bytes32-bytes-} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n require(uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, \"ECDSA: invalid signature 's' value\");\n require(v == 27 || v == 28, \"ECDSA: invalid signature 'v' value\");\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n require(signer != address(0), \"ECDSA: invalid signature\");\n\n return signer;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * replicates the behavior of the\n * https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign[`eth_sign`]\n * JSON-RPC method.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\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/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 require(\n out == 0 || out == 1,\n \"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\"\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/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/libraries/rlp/Lib_RLPWriter.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\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 The RLP encoded string in bytes.\n */\n function writeBytes(\n bytes memory _in\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n bytes memory encoded;\n\n if (_in.length == 1 && uint8(_in[0]) < 128) {\n encoded = _in;\n } else {\n encoded = abi.encodePacked(_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 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\n )\n {\n bytes memory list = _flatten(_in);\n return abi.encodePacked(_writeLength(list.length, 192), list);\n }\n\n /**\n * RLP encodes a string.\n * @param _in The string to encode.\n * @return The RLP encoded string in bytes.\n */\n function writeString(\n string memory _in\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n return writeBytes(bytes(_in));\n }\n\n /**\n * RLP encodes an address.\n * @param _in The address to encode.\n * @return The RLP encoded address in bytes.\n */\n function writeAddress(\n address _in\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n return writeBytes(abi.encodePacked(_in));\n }\n\n /**\n * RLP encodes a bytes32 value.\n * @param _in The bytes32 to encode.\n * @return _out The RLP encoded bytes32 in bytes.\n */\n function writeBytes32(\n bytes32 _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 The RLP encoded uint256 in bytes.\n */\n function writeUint(\n uint256 _in\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n return writeBytes(_toBinary(_in));\n }\n\n /**\n * RLP encodes a bool.\n * @param _in The bool to encode.\n * @return The RLP encoded bool in bytes.\n */\n function writeBool(\n bool _in\n )\n internal\n pure\n returns (\n bytes memory\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 RLP encoded bytes.\n */\n function _writeLength(\n uint256 _len,\n uint256 _offset\n )\n private\n pure\n returns (\n bytes memory\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 RLP encoded bytes.\n */\n function _toBinary(\n uint256 _x\n )\n private\n pure\n returns (\n bytes memory\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 The flattened byte string.\n */\n function _flatten(\n bytes[] memory _list\n )\n private\n pure\n returns (\n bytes memory\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}\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/libraries/utils/Lib_ErrorUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/**\n * @title Lib_ErrorUtils\n */\nlibrary Lib_ErrorUtils {\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Encodes an error string into raw solidity-style revert data.\n * (i.e. ascii bytes, prefixed with bytes4(keccak(\"Error(string))\"))\n * Ref: https://docs.soliditylang.org/en/v0.8.2/control-structures.html?highlight=Error(string)#panic-via-assert-and-error-via-require\n * @param _reason Reason for the reversion.\n * @return Standard solidity revert data for the given reason.\n */\n function encodeRevertString(\n string memory _reason\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n return abi.encodeWithSignature(\n \"Error(string)\",\n _reason\n );\n }\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/OVM/predeploys/OVM_ProxyEOA.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\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\nimport { Lib_ExecutionManagerWrapper } from \"../../libraries/wrappers/Lib_ExecutionManagerWrapper.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: optimistic-solc\n * Runtime target: OVM\n */\ncontract OVM_ProxyEOA {\n\n /**********\n * Events *\n **********/\n\n event Upgraded(\n address indexed implementation\n );\n\n\n /*************\n * Constants *\n *************/\n\n bytes32 constant IMPLEMENTATION_KEY = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; //bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1);\n\n\n /*********************\n * Fallback Function *\n *********************/\n\n fallback()\n external\n payable\n {\n (bool success, bytes memory returndata) = getImplementation().delegatecall(msg.data);\n\n if (success) {\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 // WARNING: We use the deployed bytecode of this contract as a template to create ProxyEOA\n // contracts. As a result, we must *not* perform any constructor logic. Use initialization\n // functions if necessary.\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Changes the implementation address.\n * @param _implementation New implementation address.\n */\n function upgrade(\n address _implementation\n )\n external\n {\n require(\n msg.sender == Lib_ExecutionManagerWrapper.ovmADDRESS(),\n \"EOAs can only upgrade their own EOA implementation.\"\n );\n\n _setImplementation(_implementation);\n emit Upgraded(_implementation);\n }\n\n /**\n * Gets the address of the current implementation.\n * @return Current implementation address.\n */\n function getImplementation()\n public\n view\n returns (\n address\n )\n {\n bytes32 addr32;\n assembly {\n addr32 := sload(IMPLEMENTATION_KEY)\n }\n\n address implementation = Lib_Bytes32Utils.toAddress(addr32);\n if (implementation == address(0)) {\n return Lib_PredeployAddresses.ECDSA_CONTRACT_ACCOUNT;\n } else {\n return implementation;\n }\n }\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n function _setImplementation(\n address _implementation\n )\n internal\n {\n bytes32 addr32 = Lib_Bytes32Utils.fromAddress(_implementation);\n assembly {\n sstore(IMPLEMENTATION_KEY, addr32)\n }\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 * 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/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 /**\n * Converts a bytes32 value to a boolean. Anything non-zero will be converted to \"true.\"\n * @param _in Input bytes32 value.\n * @return Bytes32 as a boolean.\n */\n function toBool(\n bytes32 _in\n )\n internal\n pure\n returns (\n bool\n )\n {\n return _in != 0;\n }\n\n /**\n * Converts a boolean to a bytes32 value.\n * @param _in Input boolean value.\n * @return Boolean as a bytes32.\n */\n function fromBool(\n bool _in\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n return bytes32(uint256(_in ? 1 : 0));\n }\n\n /**\n * Converts a bytes32 value to an address. Takes the *last* 20 bytes.\n * @param _in Input bytes32 value.\n * @return Bytes32 as an address.\n */\n function toAddress(\n bytes32 _in\n )\n internal\n pure\n returns (\n address\n )\n {\n return address(uint160(uint256(_in)));\n }\n\n /**\n * Converts an address to a bytes32.\n * @param _in Input address value.\n * @return Address as a bytes32.\n */\n function fromAddress(\n address _in\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n return bytes32(uint256(_in));\n }\n\n /**\n * Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.\n * @param _in Input bytes32 value.\n * @return Bytes32 without any leading zeros.\n */\n function removeLeadingZeros(\n bytes32 _in\n )\n internal\n pure\n returns (\n bytes memory\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/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/OVM/predeploys/OVM_SequencerEntrypoint.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_EIP155Tx } from \"../../libraries/codec/Lib_EIP155Tx.sol\";\nimport { Lib_ExecutionManagerWrapper } from \"../../libraries/wrappers/Lib_ExecutionManagerWrapper.sol\";\nimport { iOVM_ECDSAContractAccount } from \"../../iOVM/predeploys/iOVM_ECDSAContractAccount.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 * Compiler used: optimistic-solc\n * Runtime target: OVM\n */\ncontract OVM_SequencerEntrypoint {\n\n /*************\n * Libraries *\n *************/\n\n using Lib_EIP155Tx for Lib_EIP155Tx.EIP155Tx;\n\n\n /*********************\n * Fallback Function *\n *********************/\n\n /**\n * Expects an RLP-encoded EIP155 transaction as input. See the EIP for a more detailed\n * description of this transaction format:\n * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md\n */\n fallback()\n external\n {\n // We use this twice, so it's more gas efficient to store a copy of it (barely).\n bytes memory encodedTx = msg.data;\n\n // Decode the tx with the correct chain ID.\n Lib_EIP155Tx.EIP155Tx memory transaction = Lib_EIP155Tx.decode(\n encodedTx,\n Lib_ExecutionManagerWrapper.ovmCHAINID()\n );\n\n // Value is computed on the fly. Keep it in the stack to save some gas.\n address target = transaction.sender();\n\n bool isEmptyContract;\n assembly {\n isEmptyContract := iszero(extcodesize(target))\n }\n\n // If the account is empty, deploy the default EOA to that address.\n if (isEmptyContract) {\n Lib_ExecutionManagerWrapper.ovmCREATEEOA(\n transaction.hash(),\n transaction.recoveryParam,\n transaction.r,\n transaction.s\n );\n }\n\n // Forward the transaction over to the EOA.\n (bool success, bytes memory returndata) = target.call(\n abi.encodeWithSelector(iOVM_ECDSAContractAccount.execute.selector, transaction)\n );\n\n if (success) {\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/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 distinct 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 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 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/test-libraries/codec/TestLib_EIP155Tx.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_EIP155Tx } from \"../../optimistic-ethereum/libraries/codec/Lib_EIP155Tx.sol\";\n\n/**\n * @title TestLib_EIP155Tx\n */\ncontract TestLib_EIP155Tx {\n function decode(\n bytes memory _encoded,\n uint256 _chainId\n )\n public\n pure\n returns (\n Lib_EIP155Tx.EIP155Tx memory\n )\n {\n return Lib_EIP155Tx.decode(\n _encoded,\n _chainId\n );\n }\n\n function encode(\n Lib_EIP155Tx.EIP155Tx memory _transaction,\n bool _includeSignature\n )\n public\n pure\n returns (\n bytes memory\n )\n {\n return Lib_EIP155Tx.encode(\n _transaction,\n _includeSignature\n );\n }\n\n function hash(\n Lib_EIP155Tx.EIP155Tx memory _transaction\n )\n public\n pure\n returns (\n bytes32\n )\n {\n return Lib_EIP155Tx.hash(\n _transaction\n );\n }\n\n function sender(\n Lib_EIP155Tx.EIP155Tx memory _transaction\n )\n public\n pure\n returns (\n address\n )\n {\n return Lib_EIP155Tx.sender(\n _transaction\n );\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 * 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 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 {\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/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/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 /***************\n * Constructor *\n ***************/\n\n constructor(\n address _libAddressManager\n )\n Lib_AddressResolver(_libAddressManager)\n {}\n\n\n /********************\n * Public Functions *\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 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\n )\n {\n require(\n msg.sender == resolve(\"OVM_FraudVerifier\"),\n \"Create can only be done by the OVM_FraudVerifier.\"\n );\n\n return new OVM_StateTransitioner(\n _libAddressManager,\n _stateTransitionIndex,\n _preStateRoot,\n _transactionHash\n );\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() {}\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/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/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 abi.encodePacked(\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/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 slice(\n bytes memory _bytes,\n uint256 _start,\n uint256 _length\n )\n internal\n pure\n returns (\n bytes memory\n )\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 (\n bytes memory\n )\n {\n if (_start >= _bytes.length) {\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 (\n bytes32\n )\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 (\n bytes32\n )\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 (\n uint256\n )\n {\n return uint256(toBytes32(_bytes));\n }\n\n function toUint24(\n bytes memory _bytes,\n uint256 _start\n )\n internal\n pure\n returns (\n uint24\n )\n {\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(\n bytes memory _bytes,\n uint256 _start\n )\n internal\n pure\n returns (\n uint8\n )\n {\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(\n bytes memory _bytes,\n uint256 _start\n )\n internal\n pure\n returns (\n address\n )\n {\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 (\n bytes memory\n )\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 (\n bytes memory\n )\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 (\n bool\n )\n {\n return keccak256(_bytes) == keccak256(_other);\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 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 external\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 external\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 external\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 external\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 external\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 external\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 // Prevent the Execution Manager from calling this SM again.\n ovmStateManager.setExecutionManager(address(0));\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 external\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 external\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 external\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/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\";\n\n/**\n * @title Lib_OVMCodec\n */\nlibrary Lib_OVMCodec {\n\n /*********\n * Enums *\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 transactionHash;\n uint40 timestamp;\n uint40 blockNumber;\n }\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Encodes a standard OVM transaction.\n * @param _transaction OVM transaction to encode.\n * @return Encoded transaction bytes.\n */\n function encodeTransaction(\n Transaction memory _transaction\n )\n internal\n pure\n returns (\n bytes memory\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 Hashed transaction\n */\n function hashTransaction(\n Transaction memory _transaction\n )\n internal\n pure\n returns (\n bytes32\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 Converted EVM account.\n */\n function toEVMAccount(\n Account memory _in\n )\n internal\n pure\n returns (\n EVMAccount memory\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 RLP-encoded account state.\n */\n function encodeEVMAccount(\n EVMAccount memory _account\n )\n internal\n pure\n returns (\n bytes memory\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 state struct.\n */\n function decodeEVMAccount(\n bytes memory _encoded\n )\n internal\n pure\n returns (\n EVMAccount memory\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 of the header.\n */\n function hashBatchHeader(\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\n )\n internal\n pure\n returns (\n bytes32\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/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 */\nabstract contract Lib_AddressResolver {\n\n /*************\n * Variables *\n *************/\n\n Lib_AddressManager public libAddressManager;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address of the Lib_AddressManager.\n */\n constructor(\n address _libAddressManager\n ) {\n libAddressManager = Lib_AddressManager(_libAddressManager);\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Resolves the address associated with a given name.\n * @param _name Name to resolve an address for.\n * @return Address associated with the given name.\n */\n function resolve(\n string memory _name\n )\n public\n view\n returns (\n address\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 *\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 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\n )\n {\n bytes memory code;\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 Full code of the contract.\n */\n function getCode(\n address _address\n )\n internal\n view\n returns (\n bytes memory\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 Size of the contract's code in bytes.\n */\n function getCodeSize(\n address _address\n )\n internal\n view\n returns (\n uint256\n )\n {\n uint256 codeSize;\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 Hash of the contract's code.\n */\n function getCodeHash(\n address _address\n )\n internal\n view\n returns (\n bytes32\n )\n {\n bytes32 codeHash;\n assembly {\n codeHash := extcodehash(_address)\n }\n\n return codeHash;\n }\n\n /**\n * Creates a contract with some given initialization code.\n * @param _code Contract initialization code.\n * @return Address of the created contract.\n */\n function createContract(\n bytes memory _code\n )\n internal\n returns (\n address\n )\n {\n address created;\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 to be generated by CREATE.\n */\n function getAddressForCREATE(\n address _creator,\n uint256 _nonce\n )\n internal\n pure\n returns (\n 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 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 (\n address\n )\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/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 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_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 OUT_OF_GAS,\n INTENTIONAL_REVERT,\n EXCEEDS_NUISANCE_GAS,\n INVALID_STATE_ACCESS,\n UNSAFE_BYTECODE,\n CREATE_COLLISION,\n STATIC_VIOLATION,\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 }\n\n\n /************************************\n * Transaction Execution Entrypoint *\n ************************************/\n\n function run(\n Lib_OVMCodec.Transaction calldata _transaction,\n address _txStateManager\n ) external returns (bytes memory);\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, bytes memory _revertdata);\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract, bytes memory _revertdata);\n\n\n /*******************************\n * Account Abstraction Opcodes *\n ******************************/\n\n function ovmGETNONCE() external returns (uint256 _nonce);\n function ovmINCREMENTNONCE() 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 Context *\n ***************************************/\n\n function getMaxTransactionGasLimit() external view returns (uint _maxTransactionGasLimit);\n}\n" + "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 OUT_OF_GAS,\n INTENTIONAL_REVERT,\n EXCEEDS_NUISANCE_GAS,\n INVALID_STATE_ACCESS,\n UNSAFE_BYTECODE,\n CREATE_COLLISION,\n STATIC_VIOLATION,\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 enum MessageType {\n ovmCALL,\n ovmSTATICCALL,\n ovmDELEGATECALL,\n ovmCREATE,\n ovmCREATE2\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 uint256 ovmCALLVALUE;\n bool isStatic;\n }\n\n struct MessageRecord {\n uint256 nuisanceGasLeft;\n }\n\n\n /************************************\n * Transaction Execution Entrypoint *\n ************************************/\n\n function run(\n Lib_OVMCodec.Transaction calldata _transaction,\n address _txStateManager\n ) external returns (bytes memory);\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 ovmCALLVALUE() external view returns (uint _callValue);\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, bytes memory _revertdata);\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract, bytes memory _revertdata);\n\n\n /*******************************\n * Account Abstraction Opcodes *\n ******************************/\n\n function ovmGETNONCE() external returns (uint256 _nonce);\n function ovmINCREMENTNONCE() external;\n function ovmCREATEEOA(bytes32 _messageHash, uint8 _v, bytes32 _r, bytes32 _s) external;\n\n\n /****************************\n * Contract Calling Opcodes *\n ****************************/\n\n // Valueless ovmCALL for maintaining backwards compatibility with legacy OVM bytecode.\n function ovmCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\n function ovmCALL(uint256 _gasLimit, address _address, uint256 _value, 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 * ETH Value Opcodes *\n *********************/\n\n function ovmBALANCE(address _contract) external returns (uint256 _balance);\n function ovmSELFBALANCE() external returns (uint256 _balance);\n\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" @@ -127,17 +145,62 @@ "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/resolver/Lib_AddressManager.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* External Imports */\nimport { Ownable } from \"@openzeppelin/contracts/access/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 indexed _name,\n address _newAddress,\n address _oldAddress\n );\n\n\n /*************\n * Variables *\n *************/\n\n mapping (bytes32 => address) private addresses;\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Changes the address associated with a particular name.\n * @param _name String name to associate an address with.\n * @param _address Address to associate with the name.\n */\n function setAddress(\n string memory _name,\n address _address\n )\n external\n onlyOwner\n {\n bytes32 nameHash = _getNameHash(_name);\n address oldAddress = addresses[nameHash];\n addresses[nameHash] = _address;\n\n emit AddressSet(\n _name,\n _address,\n oldAddress\n );\n }\n\n /**\n * Retrieves the address associated with a given name.\n * @param _name Name to retrieve an address for.\n * @return Address associated with the given name.\n */\n function getAddress(\n string memory _name\n )\n external\n view\n returns (\n address\n )\n {\n return addresses[_getNameHash(_name)];\n }\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Computes the hash of a name.\n * @param _name Name to compute a hash for.\n * @return Hash of the given name.\n */\n function _getNameHash(\n string memory _name\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n return keccak256(abi.encodePacked(_name));\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\nimport \"../utils/Context.sol\";\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor () internal {\n address msgSender = _msgSender();\n _owner = msgSender;\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\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 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, _key, 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 != pathRemainder.length) {\n // Our extension node is not identical to the remainder.\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 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 path may include\n * additional nodes (e.g., it comes directly from a proof) and we can't resize in-memory\n * arrays without costly duplication.\n * @param _key Full original key.\n * @param _keyRemainder Portion of the initial key that must be inserted 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 _key,\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 // Reference: https://github.com/ethereumjs/merkle-patricia-tree/blob/c0a10395aab37d42c175a47114ebfcbd7efcf059/src/baseTrie.ts#L294-L313\n bool matchLeaf = false;\n if (lastNodeType == NodeType.LeafNode) {\n uint256 l = 0;\n if (_path.length > 0) {\n for (uint256 i = 0; i < _path.length - 1; i++) {\n if (_getNodeType(_path[i]) == NodeType.BranchNode) {\n l++;\n } else {\n l += _getNodeKey(_path[i]).length;\n }\n }\n }\n\n if (\n _getSharedNibbleLength(\n _getNodeKey(lastNode),\n Lib_BytesUtils.slice(Lib_BytesUtils.toNibbles(_key), l)\n ) == _getNodeKey(lastNode).length\n && keyRemainder.length == 0\n ) {\n matchLeaf = true;\n }\n }\n\n if (matchLeaf) {\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 = _editExtensionNodeValue(currentNode, 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 * Creates a new extension node with the same key but a different value.\n * @param _node Extension node to copy and modify.\n * @param _value New value for the extension node.\n * @return New node with the same key and different value.\n */\n function _editExtensionNodeValue(\n TrieNode memory _node,\n bytes memory _value\n )\n private\n pure\n returns (\n TrieNode memory\n )\n {\n bytes[] memory raw = new bytes[](2);\n bytes memory key = _addHexPrefix(_getNodeKey(_node), false);\n raw[0] = Lib_RLPWriter.writeBytes(Lib_BytesUtils.fromNibbles(key));\n if (_value.length < 32) {\n raw[1] = _value;\n } else {\n raw[1] = Lib_RLPWriter.writeBytes(_value);\n }\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 abi.encodePacked(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 /***************\n * Constructor *\n ***************/\n\n constructor(\n address _libAddressManager\n )\n Lib_AddressResolver(_libAddressManager)\n {}\n\n\n /********************\n * Public Functions *\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 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\n )\n {\n require(\n msg.sender == resolve(\"OVM_FraudVerifier\"),\n \"Create can only be done by the OVM_FraudVerifier.\"\n );\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 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\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 * 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" + }, + "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 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 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_Proposer\");\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 // For efficiency reasons getMerkleRoot modifies the `_batch` argument in place\n // while calculating the root hash therefore any arguments passed to it must not\n // be used again afterwards\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 * Note that the _elements argument is modified, therefore it must not be used again afterwards\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 pure\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 == 1) {\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 (uint256 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" + }, + "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_Buffer } from \"../../libraries/utils/Lib_Buffer.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 distinct 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_Buffer for Lib_Buffer.Buffer;\n\n\n /*************\n * Variables *\n *************/\n\n string public owner;\n Lib_Buffer.Buffer 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 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 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" + }, + "contracts/optimistic-ethereum/libraries/utils/Lib_Buffer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title Lib_Buffer\n * @dev This library implements a bytes32 storage array with some additional gas-optimized\n * functionality. In particular, it encodes its length as a uint40, and tightly packs this with an\n * overwritable \"extra data\" field so we can store more information with a single SSTORE.\n */\nlibrary Lib_Buffer {\n\n /*************\n * Libraries *\n *************/\n\n using Lib_Buffer for Buffer;\n\n\n /***********\n * Structs *\n ***********/\n\n struct Buffer {\n bytes32 context;\n mapping (uint256 => bytes32) buf;\n }\n\n struct BufferContext {\n // Stores the length of the array. Uint40 is way more elements than we'll ever reasonably\n // need in an array and we get an extra 27 bytes of extra data to play with.\n uint40 length;\n\n // Arbitrary extra data that can be modified whenever the length is updated. Useful for\n // squeezing out some gas optimizations.\n bytes27 extraData;\n }\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 Global extra data.\n */\n function push(\n Buffer storage _self,\n bytes32 _value,\n bytes27 _extraData\n )\n internal\n {\n BufferContext memory ctx = _self.getContext();\n\n _self.buf[ctx.length] = _value;\n\n // Bump the global index and insert our extra data, then save the context.\n ctx.length++;\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 Buffer storage _self,\n bytes32 _value\n )\n internal\n {\n BufferContext memory ctx = _self.getContext();\n\n _self.push(\n _value,\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 Buffer storage _self,\n uint256 _index\n )\n internal\n view\n returns (\n bytes32\n )\n {\n BufferContext memory ctx = _self.getContext();\n\n require(\n _index < ctx.length,\n \"Index out of bounds.\"\n );\n\n return _self.buf[_index];\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 Buffer storage _self,\n uint40 _index,\n bytes27 _extraData\n )\n internal\n {\n BufferContext memory ctx = _self.getContext();\n\n require(\n _index < ctx.length,\n \"Index out of bounds.\"\n );\n\n // Set our length and extra data, save the context.\n ctx.length = _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 Buffer storage _self,\n uint40 _index\n )\n internal\n {\n BufferContext 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 Buffer storage _self\n )\n internal\n view\n returns (\n uint40\n )\n {\n BufferContext memory ctx = _self.getContext();\n return ctx.length;\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 Buffer storage _self,\n bytes27 _extraData\n )\n internal\n {\n BufferContext 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 Buffer storage _self\n )\n internal\n view\n returns (\n bytes27\n )\n {\n BufferContext memory ctx = _self.getContext();\n return ctx.extraData;\n }\n\n /**\n * Sets the current buffer context.\n * @param _self Buffer to access.\n * @param _ctx Current buffer context.\n */\n function setContext(\n Buffer storage _self,\n BufferContext memory _ctx\n )\n internal\n {\n bytes32 context;\n uint40 length = _ctx.length;\n bytes27 extraData = _ctx.extraData;\n assembly {\n context := length\n context := or(context, extraData)\n }\n\n if (_self.context != context) {\n _self.context = context;\n }\n }\n\n /**\n * Retrieves the current buffer context.\n * @param _self Buffer to access.\n * @return Current buffer context.\n */\n function getContext(\n Buffer storage _self\n )\n internal\n view\n returns (\n BufferContext memory\n )\n {\n bytes32 context = _self.context;\n uint40 length;\n bytes27 extraData;\n assembly {\n length := and(context, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\n extraData := and(context, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000)\n }\n\n return BufferContext({\n length: length,\n extraData: extraData\n });\n }\n}\n" + }, + "contracts/test-libraries/utils/TestLib_Buffer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_Buffer } from \"../../optimistic-ethereum/libraries/utils/Lib_Buffer.sol\";\n\n/**\n * @title TestLib_Buffer\n */\ncontract TestLib_Buffer {\n using Lib_Buffer for Lib_Buffer.Buffer;\n\n Lib_Buffer.Buffer 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 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 )\n public\n {\n return buf.deleteElementsAfterInclusive(\n _index\n );\n }\n\n function deleteElementsAfterInclusive(\n uint40 _index,\n bytes27 _extraData\n )\n public\n {\n return buf.deleteElementsAfterInclusive(\n _index,\n _extraData\n );\n }\n\n function getLength()\n public\n view\n returns (\n uint40\n )\n {\n return buf.getLength();\n }\n\n function setExtraData(\n bytes27 _extraData\n )\n public\n {\n return buf.setExtraData(\n _extraData\n );\n }\n\n function getExtraData()\n public\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\";\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/* External Imports */\nimport { Math } from \"@openzeppelin/contracts/math/Math.sol\";\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 = 50000;\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 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 return _getQueueElement(\n _index,\n queue()\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 return _getQueueLength(\n queue()\n );\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 queueRef = queue();\n\n queueRef.push(transactionHash);\n queueRef.push(timestampAndBlockNumber);\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 and subtract 1.\n uint256 queueIndex = queueRef.length() / 2 - 1;\n emit TransactionEnqueued(\n msg.sender,\n _target,\n _gasLimit,\n _data,\n queueIndex,\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 pure\n {\n // TEMPORARY: Disable `appendQueueBatch` for minnet\n revert(\"appendQueueBatch is currently disabled.\");\n\n // _numQueuedTransactions = 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\n require(\n msg.data.length >= nextTransactionPtr,\n \"Not enough BatchContexts provided.\"\n );\n\n // Take a reference to the queue and its length so we don't have to keep resolving it.\n // Length isn't going to change during the course of execution, so it's fine to simply\n // resolve this once at the start. Saves gas.\n iOVM_ChainStorageContainer queueRef = queue();\n uint40 queueLength = _getQueueLength(queueRef);\n\n // Reserve some memory to save gas on hashing later on. This is a relatively safe estimate\n // for the average transaction size that will prevent having to resize this chunk of memory\n // later on. Saves gas.\n bytes memory hashMemory = new bytes((msg.data.length / totalElementsToAppend) * 2);\n\n // Initialize the array of canonical chain leaves that we will append.\n bytes32[] memory leaves = new bytes32[](totalElementsToAppend);\n\n // Each leaf index corresponds to a tx, either sequenced or enqueued.\n uint32 leafIndex = 0;\n\n // Counter for number of sequencer transactions appended so far.\n uint32 numSequencerTransactions = 0;\n\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 for (uint32 i = 0; i < numContexts; i++) {\n BatchContext memory nextContext = _getBatchContext(i);\n\n if (i == 0) {\n // Execute a special check for the first batch.\n _validateFirstBatchContext(nextContext);\n }\n\n // Execute this check on every single batch, including the first one.\n _validateNextBatchContext(\n curContext,\n nextContext,\n nextQueueIndex,\n queueRef\n );\n\n // Now we can update our current context.\n curContext = nextContext;\n\n // Process sequencer transactions first.\n for (uint32 j = 0; j < curContext.numSequencedTransactions; j++) {\n uint256 txDataLength;\n assembly {\n txDataLength := shr(232, calldataload(nextTransactionPtr))\n }\n require(\n txDataLength <= MAX_ROLLUP_TX_SIZE,\n \"Transaction data size exceeds maximum for rollup transaction.\"\n );\n\n leaves[leafIndex] = _getSequencerLeafHash(\n curContext,\n nextTransactionPtr,\n txDataLength,\n hashMemory\n );\n\n nextTransactionPtr += uint40(TX_DATA_HEADER_SIZE + txDataLength);\n numSequencerTransactions++;\n leafIndex++;\n }\n\n // Now process any subsequent queue transactions.\n for (uint32 j = 0; j < curContext.numSubsequentQueueTransactions; j++) {\n require(\n nextQueueIndex < queueLength,\n \"Not enough queued transactions to append.\"\n );\n\n leaves[leafIndex] = _getQueueLeafHash(nextQueueIndex);\n nextQueueIndex++;\n leafIndex++;\n }\n }\n\n _validateFinalBatchContext(\n curContext,\n nextQueueIndex,\n queueLength,\n queueRef\n );\n\n require(\n msg.data.length == 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 blockTimestamp;\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 blockTimestamp = 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 // curContext.numSubsequentQueueTransactions > 0 which means that we've processed at least one queue element.\n // We increment nextQueueIndex after processing each queue element,\n // so the index of the last element we processed is nextQueueIndex - 1.\n Lib_OVMCodec.QueueElement memory lastElement = _getQueueElement(\n nextQueueIndex - 1,\n queueRef\n );\n\n blockTimestamp = lastElement.timestamp;\n blockNumber = lastElement.blockNumber;\n }\n\n // For efficiency reasons getMerkleRoot modifies the `leaves` argument in place\n // while calculating the root hash therefore any arguments passed to it must not\n // be used again afterwards\n _appendBatch(\n Lib_MerkleTree.getMerkleRoot(leaves),\n totalElementsToAppend,\n numQueuedTransactions,\n blockTimestamp,\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 pure\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 * 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 iOVM_ChainStorageContainer _queueRef\n )\n internal\n view\n returns (\n Lib_OVMCodec.QueueElement memory _element\n )\n {\n // The underlying queue data structure stores 2 elements\n // per insertion, so to get the actual desired queue index\n // we need to multiply by 2.\n uint40 trueIndex = uint40(_index * 2);\n bytes32 transactionHash = _queueRef.get(trueIndex);\n bytes32 timestampAndBlockNumber = _queueRef.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 transactionHash: transactionHash,\n timestamp: elementTimestamp,\n blockNumber: elementBlockNumber\n });\n }\n\n /**\n * Retrieves the length of the queue.\n * @return Length of the queue.\n */\n function _getQueueLength(\n iOVM_ChainStorageContainer _queueRef\n )\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.\n return uint40(_queueRef.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 bytes memory _hashMemory\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n // Only allocate more memory if we didn't reserve enough to begin with.\n if (BYTES_TILL_TX_DATA + _txDataLength > _hashMemory.length) {\n _hashMemory = new bytes(BYTES_TILL_TX_DATA + _txDataLength);\n }\n\n uint256 ctxTimestamp = _context.timestamp;\n uint256 ctxBlockNumber = _context.blockNumber;\n\n bytes32 leafHash;\n assembly {\n let chainElementStart := add(_hashMemory, 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 iOVM_ChainStorageContainer batchesRef = batches();\n (uint40 totalElements, uint40 nextQueueIndex,,) = _getBatchExtraData();\n\n Lib_OVMCodec.ChainBatchHeader memory header = Lib_OVMCodec.ChainBatchHeader({\n batchIndex: batchesRef.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 batchesRef.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 have the same context\n // or a later timestamp and block number.\n if (getTotalElements() > 0) {\n (,, uint40 lastTimestamp, uint40 lastBlockNumber) = _getBatchExtraData();\n\n require(\n _firstContext.blockNumber >= lastBlockNumber,\n \"Context block number is lower than last submitted.\"\n );\n\n require(\n _firstContext.timestamp >= lastTimestamp,\n \"Context timestamp is lower than last submitted.\"\n );\n }\n\n // Sequencer cannot submit contexts which are more than the force inclusion period old.\n require(\n _firstContext.timestamp + forceInclusionPeriodSeconds >= block.timestamp,\n \"Context timestamp too far in the past.\"\n );\n\n require(\n _firstContext.blockNumber + forceInclusionPeriodBlocks >= block.number,\n \"Context block number too far in the past.\"\n );\n }\n\n /**\n * Checks that a given batch context has a time context which is below a given que element\n * @param _context The batch context to validate has values lower.\n * @param _queueIndex Index of the queue element we are validating came later than the context.\n * @param _queueRef The storage container for the queue.\n */\n function _validateContextBeforeEnqueue(\n BatchContext memory _context,\n uint40 _queueIndex,\n iOVM_ChainStorageContainer _queueRef\n )\n internal\n view\n {\n Lib_OVMCodec.QueueElement memory nextQueueElement = _getQueueElement(\n _queueIndex,\n _queueRef\n );\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 _context.timestamp <= nextQueueElement.timestamp,\n \"Sequencer transaction timestamp exceeds that of next queue element.\"\n );\n\n require(\n _context.blockNumber <= nextQueueElement.blockNumber,\n \"Sequencer transaction blockNumber exceeds that of next queue element.\"\n );\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 * @param _queueRef The storage container for the queue.\n */\n function _validateNextBatchContext(\n BatchContext memory _prevContext,\n BatchContext memory _nextContext,\n uint40 _nextQueueIndex,\n iOVM_ChainStorageContainer _queueRef\n )\n internal\n view\n {\n // All sequencer transactions' times must be greater than or equal to 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 is going to be a queue element pulled in from this context:\n if (_nextContext.numSubsequentQueueTransactions > 0) {\n _validateContextBeforeEnqueue(\n _nextContext,\n _nextQueueIndex,\n _queueRef\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 * @param _queueLength The length of the queue at the start of the batchAppend call.\n * @param _nextQueueIndex The next element in the queue that will be pulled into the CTC.\n * @param _queueRef The storage container for the queue.\n */\n function _validateFinalBatchContext(\n BatchContext memory _finalContext,\n uint40 _nextQueueIndex,\n uint40 _queueLength,\n iOVM_ChainStorageContainer _queueRef\n )\n internal\n view\n {\n // If the queue is not now empty, check the mononoticity of whatever the next batch that will come in is.\n if (_queueLength - _nextQueueIndex > 0 && _finalContext.numSubsequentQueueTransactions == 0) {\n _validateContextBeforeEnqueue(\n _finalContext,\n _nextQueueIndex,\n _queueRef\n );\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.transactionHash == 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" + "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\";\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/* External Imports */\nimport { Math } from \"@openzeppelin/contracts/math/Math.sol\";\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 = 50000;\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 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 return _getQueueElement(\n _index,\n queue()\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 return _getQueueLength(\n queue()\n );\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 queueRef = queue();\n\n queueRef.push(transactionHash);\n queueRef.push(timestampAndBlockNumber);\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 and subtract 1.\n uint256 queueIndex = queueRef.length() / 2 - 1;\n emit TransactionEnqueued(\n msg.sender,\n _target,\n _gasLimit,\n _data,\n queueIndex,\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 pure\n {\n // TEMPORARY: Disable `appendQueueBatch` for minnet\n revert(\"appendQueueBatch is currently disabled.\");\n\n // _numQueuedTransactions = 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\n require(\n msg.data.length >= nextTransactionPtr,\n \"Not enough BatchContexts provided.\"\n );\n\n // Take a reference to the queue and its length so we don't have to keep resolving it.\n // Length isn't going to change during the course of execution, so it's fine to simply\n // resolve this once at the start. Saves gas.\n iOVM_ChainStorageContainer queueRef = queue();\n uint40 queueLength = _getQueueLength(queueRef);\n\n // Reserve some memory to save gas on hashing later on. This is a relatively safe estimate\n // for the average transaction size that will prevent having to resize this chunk of memory\n // later on. Saves gas.\n bytes memory hashMemory = new bytes((msg.data.length / totalElementsToAppend) * 2);\n\n // Initialize the array of canonical chain leaves that we will append.\n bytes32[] memory leaves = new bytes32[](totalElementsToAppend);\n\n // Each leaf index corresponds to a tx, either sequenced or enqueued.\n uint32 leafIndex = 0;\n\n // Counter for number of sequencer transactions appended so far.\n uint32 numSequencerTransactions = 0;\n\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 for (uint32 i = 0; i < numContexts; i++) {\n BatchContext memory nextContext = _getBatchContext(i);\n\n if (i == 0) {\n // Execute a special check for the first batch.\n _validateFirstBatchContext(nextContext);\n }\n\n // Execute this check on every single batch, including the first one.\n _validateNextBatchContext(\n curContext,\n nextContext,\n nextQueueIndex,\n queueRef\n );\n\n // Now we can update our current context.\n curContext = nextContext;\n\n // Process sequencer transactions first.\n for (uint32 j = 0; j < curContext.numSequencedTransactions; j++) {\n uint256 txDataLength;\n assembly {\n txDataLength := shr(232, calldataload(nextTransactionPtr))\n }\n require(\n txDataLength <= MAX_ROLLUP_TX_SIZE,\n \"Transaction data size exceeds maximum for rollup transaction.\"\n );\n\n leaves[leafIndex] = _getSequencerLeafHash(\n curContext,\n nextTransactionPtr,\n txDataLength,\n hashMemory\n );\n\n nextTransactionPtr += uint40(TX_DATA_HEADER_SIZE + txDataLength);\n numSequencerTransactions++;\n leafIndex++;\n }\n\n // Now process any subsequent queue transactions.\n for (uint32 j = 0; j < curContext.numSubsequentQueueTransactions; j++) {\n require(\n nextQueueIndex < queueLength,\n \"Not enough queued transactions to append.\"\n );\n\n leaves[leafIndex] = _getQueueLeafHash(nextQueueIndex);\n nextQueueIndex++;\n leafIndex++;\n }\n }\n\n _validateFinalBatchContext(\n curContext,\n nextQueueIndex,\n queueLength,\n queueRef\n );\n\n require(\n msg.data.length == 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 blockTimestamp;\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 blockTimestamp = 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 // curContext.numSubsequentQueueTransactions > 0 which means that we've processed at least one queue element.\n // We increment nextQueueIndex after processing each queue element,\n // so the index of the last element we processed is nextQueueIndex - 1.\n Lib_OVMCodec.QueueElement memory lastElement = _getQueueElement(\n nextQueueIndex - 1,\n queueRef\n );\n\n blockTimestamp = lastElement.timestamp;\n blockNumber = lastElement.blockNumber;\n }\n\n // For efficiency reasons getMerkleRoot modifies the `leaves` argument in place\n // while calculating the root hash therefore any arguments passed to it must not\n // be used again afterwards\n _appendBatch(\n Lib_MerkleTree.getMerkleRoot(leaves),\n totalElementsToAppend,\n numQueuedTransactions,\n blockTimestamp,\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 pure\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 * 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 iOVM_ChainStorageContainer _queueRef\n )\n internal\n view\n returns (\n Lib_OVMCodec.QueueElement memory _element\n )\n {\n // The underlying queue data structure stores 2 elements\n // per insertion, so to get the actual desired queue index\n // we need to multiply by 2.\n uint40 trueIndex = uint40(_index * 2);\n bytes32 transactionHash = _queueRef.get(trueIndex);\n bytes32 timestampAndBlockNumber = _queueRef.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 transactionHash: transactionHash,\n timestamp: elementTimestamp,\n blockNumber: elementBlockNumber\n });\n }\n\n /**\n * Retrieves the length of the queue.\n * @return Length of the queue.\n */\n function _getQueueLength(\n iOVM_ChainStorageContainer _queueRef\n )\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.\n return uint40(_queueRef.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 bytes memory _hashMemory\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n // Only allocate more memory if we didn't reserve enough to begin with.\n if (BYTES_TILL_TX_DATA + _txDataLength > _hashMemory.length) {\n _hashMemory = new bytes(BYTES_TILL_TX_DATA + _txDataLength);\n }\n\n uint256 ctxTimestamp = _context.timestamp;\n uint256 ctxBlockNumber = _context.blockNumber;\n\n bytes32 leafHash;\n assembly {\n let chainElementStart := add(_hashMemory, 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 iOVM_ChainStorageContainer batchesRef = batches();\n (uint40 totalElements, uint40 nextQueueIndex,,) = _getBatchExtraData();\n\n Lib_OVMCodec.ChainBatchHeader memory header = Lib_OVMCodec.ChainBatchHeader({\n batchIndex: batchesRef.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 batchesRef.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 have the same context\n // or a later timestamp and block number.\n if (getTotalElements() > 0) {\n (,, uint40 lastTimestamp, uint40 lastBlockNumber) = _getBatchExtraData();\n\n require(\n _firstContext.blockNumber >= lastBlockNumber,\n \"Context block number is lower than last submitted.\"\n );\n\n require(\n _firstContext.timestamp >= lastTimestamp,\n \"Context timestamp is lower than last submitted.\"\n );\n }\n\n // Sequencer cannot submit contexts which are more than the force inclusion period old.\n require(\n _firstContext.timestamp + forceInclusionPeriodSeconds >= block.timestamp,\n \"Context timestamp too far in the past.\"\n );\n\n require(\n _firstContext.blockNumber + forceInclusionPeriodBlocks >= block.number,\n \"Context block number too far in the past.\"\n );\n }\n\n /**\n * Checks that a given batch context has a time context which is below a given que element\n * @param _context The batch context to validate has values lower.\n * @param _queueIndex Index of the queue element we are validating came later than the context.\n * @param _queueRef The storage container for the queue.\n */\n function _validateContextBeforeEnqueue(\n BatchContext memory _context,\n uint40 _queueIndex,\n iOVM_ChainStorageContainer _queueRef\n )\n internal\n view\n {\n Lib_OVMCodec.QueueElement memory nextQueueElement = _getQueueElement(\n _queueIndex,\n _queueRef\n );\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 _context.timestamp <= nextQueueElement.timestamp,\n \"Sequencer transaction timestamp exceeds that of next queue element.\"\n );\n\n require(\n _context.blockNumber <= nextQueueElement.blockNumber,\n \"Sequencer transaction blockNumber exceeds that of next queue element.\"\n );\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 * @param _queueRef The storage container for the queue.\n */\n function _validateNextBatchContext(\n BatchContext memory _prevContext,\n BatchContext memory _nextContext,\n uint40 _nextQueueIndex,\n iOVM_ChainStorageContainer _queueRef\n )\n internal\n view\n {\n // All sequencer transactions' times must be greater than or equal to 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 is going to be a queue element pulled in from this context:\n if (_nextContext.numSubsequentQueueTransactions > 0) {\n _validateContextBeforeEnqueue(\n _nextContext,\n _nextQueueIndex,\n _queueRef\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 * @param _queueLength The length of the queue at the start of the batchAppend call.\n * @param _nextQueueIndex The next element in the queue that will be pulled into the CTC.\n * @param _queueRef The storage container for the queue.\n */\n function _validateFinalBatchContext(\n BatchContext memory _finalContext,\n uint40 _nextQueueIndex,\n uint40 _queueLength,\n iOVM_ChainStorageContainer _queueRef\n )\n internal\n view\n {\n // If the queue is not now empty, check the mononoticity of whatever the next batch that will come in is.\n if (_queueLength - _nextQueueIndex > 0 && _finalContext.numSubsequentQueueTransactions == 0) {\n _validateContextBeforeEnqueue(\n _finalContext,\n _nextQueueIndex,\n _queueRef\n );\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.transactionHash == 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/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\";\nimport { Lib_ErrorUtils } from \"../../libraries/utils/Lib_ErrorUtils.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_DeployerWhitelist } from \"../predeploys/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 * Default Context Values *\n **************************/\n\n uint256 constant DEFAULT_UINT256 = 0xdefa017defa017defa017defa017defa017defa017defa017defa017defa017d;\n address constant DEFAULT_ADDRESS = 0xdEfa017defA017DeFA017DEfa017DeFA017DeFa0;\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 Lib_AddressResolver(_libAddressManager)\n {\n ovmSafetyChecker = iOVM_SafetyChecker(resolve(\"OVM_SafetyChecker\"));\n gasMeterConfig = _gasMeterConfig;\n globalContext = _globalContext;\n _resetContext();\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 external\n returns (\n bytes memory\n )\n {\n // Make sure that run() is not re-enterable. This condition should always be satisfied\n // Once run has been called once, due to the behavior of _isValidInput().\n if (transactionContext.ovmNUMBER != DEFAULT_UINT256) {\n return bytes(\"\");\n }\n\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 (_isValidInput(_transaction) == false) {\n _resetContext();\n return bytes(\"\");\n }\n\n // TEMPORARY: Gas metering is disabled for minnet.\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 (, bytes memory returndata) = ovmCALL(\n _transaction.gasLimit - gasMeterConfig.minTransactionGasLimit,\n _transaction.entrypoint,\n _transaction.data\n );\n\n // TEMPORARY: Gas metering is disabled for minnet.\n // // Update the cumulative gas based on the amount of gas used.\n // uint256 gasUsed = gasProvided - gasleft();\n // _updateCumulativeGas(gasUsed, _transaction.l1QueueOrigin);\n\n // Wipe the execution context.\n _resetContext();\n\n return returndata;\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 external\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 external\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 external\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 external\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 external\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 source (Sequencer or Queue) this transaction originated from.\n * @return _queueOrigin Enum indicating the ovmL1QUEUEORIGIN within the current message context.\n */\n function ovmL1QUEUEORIGIN()\n override\n external\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 external\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 Address of the created contract.\n * @return Revert data, if and only if the creation threw an exception.\n */\n function ovmCREATE(\n bytes memory _bytecode\n )\n override\n public\n notStatic\n fixedGasDiscount(40000)\n returns (\n address,\n bytes memory\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 Address of the created contract.\n * @return Revert data, if and only if the creation threw an exception.\n */\n function ovmCREATE2(\n bytes memory _bytecode,\n bytes32 _salt\n )\n override\n external\n notStatic\n fixedGasDiscount(40000)\n returns (\n address,\n bytes memory\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 external\n returns (\n uint256 _nonce\n )\n {\n return _getAccountNonce(ovmADDRESS());\n }\n\n /**\n * Bumps the nonce of the current ovmADDRESS by one.\n */\n function ovmINCREMENTNONCE()\n override\n external\n notStatic\n {\n address account = ovmADDRESS();\n uint256 nonce = _getAccountNonce(account);\n\n // Prevent overflow.\n if (nonce + 1 > nonce) {\n _setAccountNonce(account, nonce + 1);\n }\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 // Creates a duplicate of the OVM_ProxyEOA located at 0x42....09. Uses the following\n // \"magic\" prefix to deploy an exact copy of the code:\n // PUSH1 0x0D # size of this prefix in bytes\n // CODESIZE\n // SUB # subtract prefix size from codesize\n // DUP1\n // PUSH1 0x0D\n // PUSH1 0x00\n // CODECOPY # copy everything after prefix into memory at pos 0\n // PUSH1 0x00\n // RETURN # return the copied code\n address proxyEOA = Lib_EthUtils.createContract(abi.encodePacked(\n hex\"600D380380600D6000396000f3\",\n ovmEXTCODECOPY(\n 0x4200000000000000000000000000000000000009,\n 0,\n ovmEXTCODESIZE(0x4200000000000000000000000000000000000009)\n )\n ));\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 external\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 external\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\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 external\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 external\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 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 external\n returns (\n bytes32 _EXTCODEHASH\n )\n {\n return Lib_EthUtils.getCodeHash(\n _getAccountEthAddress(_contract)\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 Whitelisting *\n ********************************************/\n\n /**\n * Checks whether the given address is on the whitelist 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 semantics perspective, this will appear 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 Final OVM contract address.\n * @return Revertdata, if and only if the creation threw an exception.\n */\n function _createContract(\n address _contractAddress,\n bytes memory _bytecode\n )\n internal\n returns (\n address,\n bytes memory\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 the common logic which occurs between call-type and create-type messages,\n // passing in the creation bytecode and `true` to trigger create-specific logic.\n (bool success, bytes memory data) = _handleExternalMessage(\n nextMessageContext,\n gasleft(),\n _contractAddress,\n _bytecode,\n true\n );\n\n // Yellow paper requires that address returned is zero if the contract deployment fails.\n return (\n success ? _contractAddress : address(0),\n data\n );\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 // EVM does not return data in the success case, see: https://github.com/ethereum/go-ethereum/blob/aae7660410f0ef90279e14afaaf2f429fdc2a186/core/vm/instructions.go#L600-L604\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 _handleExternalMessage(\n _nextMessageContext,\n _gasLimit,\n codeContractAddress,\n _calldata,\n false\n );\n }\n\n /**\n * Handles all interactions which involve the execution manager calling out to untrusted code (both calls and creates).\n * Ensures that OVM-related measures are enforced, including L2 gas refunds, nuisance gas, and flagged reversions.\n *\n * @param _nextMessageContext Message context to be used for the external message.\n * @param _gasLimit Amount of gas to be passed into this message.\n * @param _contract OVM address being called or deployed to\n * @param _data Data for the message (either calldata or creation code)\n * @param _isCreate Whether this is a create-type message.\n * @return Whether or not the message (either a call or deployment) succeeded.\n * @return Data returned by the message.\n */\n function _handleExternalMessage(\n MessageContext memory _nextMessageContext,\n uint256 _gasLimit,\n address _contract,\n bytes memory _data,\n bool _isCreate\n )\n internal\n returns (\n bool,\n bytes memory\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. `_contract` 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\n bool success;\n bytes memory returndata;\n if (_isCreate) {\n // safeCREATE() is a function which replicates a CREATE message, but uses return values\n // Which match that of CALL (i.e. bool, bytes). This allows many security checks to be\n // to be shared between untrusted call and create call frames.\n (success, returndata) = address(this).call(\n abi.encodeWithSelector(\n this.safeCREATE.selector,\n _gasLimit,\n _data,\n _contract\n )\n );\n } else {\n (success, returndata) = _contract.call{gas: _gasLimit}(_data);\n }\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 (\n flag == RevertFlag.INTENTIONAL_REVERT\n || _isCreate\n ) {\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 * Handles the creation-specific safety measures required for OVM contract deployment.\n * This function sanitizes the return types for creation messages to match calls (bool, bytes),\n * by being an external function which the EM can call, that mimics the success/fail case of the CREATE.\n * This allows for consistent handling of both types of messages in _handleExternalMessage().\n * Having this step occur as a separate call frame also allows us to easily revert the\n * contract deployment in the event that the code is unsafe.\n *\n * @param _gasLimit Amount of gas to be passed into this creation.\n * @param _creationCode Code to pass into CREATE for deployment.\n * @param _address OVM address being deployed to.\n */\n function safeCREATE(\n uint _gasLimit,\n bytes memory _creationCode,\n address _address\n )\n external\n {\n // The only way this should callable is from within _createContract(),\n // and it should DEFINITELY not be callable by a non-EM code contract.\n if (msg.sender != address(this)) {\n return;\n }\n // Check that there is not already code at this address.\n if (_hasEmptyAccount(_address) == false) {\n // Note: in the EVM, this case burns all allotted gas. For improved\n // developer experience, we do return the remaining gas.\n _revertWithFlag(\n RevertFlag.CREATE_COLLISION,\n Lib_ErrorUtils.encodeRevertString(\"A contract has already been deployed to this address\")\n );\n }\n\n // Check the creation bytecode against the OVM_SafetyChecker.\n if (ovmSafetyChecker.isBytecodeSafe(_creationCode) == false) {\n _revertWithFlag(\n RevertFlag.UNSAFE_BYTECODE,\n Lib_ErrorUtils.encodeRevertString(\"Contract creation code contains unsafe opcodes. Did you use the right compiler or pass an unsafe constructor argument?\")\n );\n }\n\n // We always need to initialize the contract with the default account values.\n _initPendingAccount(_address);\n\n // Actually execute the EVM create message.\n // NOTE: The inline assembly below means we can NOT make any evm calls between here and then.\n address ethAddress = Lib_EthUtils.createContract(_creationCode);\n\n if (ethAddress == address(0)) {\n // If the creation fails, the EVM lets us grab its revert data. This may contain a revert flag\n // to be used above in _handleExternalMessage, so we pass the revert data back up unmodified.\n assembly {\n returndatacopy(0,0,returndatasize())\n revert(0, returndatasize())\n }\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(\n RevertFlag.UNSAFE_BYTECODE,\n Lib_ErrorUtils.encodeRevertString(\"Constructor attempted to deploy unsafe bytecode.\")\n );\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 * 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 ) {\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 view\n {\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 input values of a transaction.\n * @return _valid Whether or not the transaction data is valid.\n */\n function _isValidInput(\n Lib_OVMCodec.Transaction memory _transaction\n )\n view\n internal\n returns (\n bool\n )\n {\n // Prevent reentrancy to run():\n // This check prevents calling run with the default ovmNumber.\n // Combined with the first check in run():\n // if (transactionContext.ovmNUMBER != DEFAULT_UINT256) { return; }\n // It should be impossible to re-enter since run() returns before any other call frames are created.\n // Since this value is already being written to storage, we save much gas compared to\n // using the standard nonReentrant pattern.\n if (_transaction.blockNumber == DEFAULT_UINT256) {\n return false;\n }\n\n if (_isValidGasLimit(_transaction.gasLimit, _transaction.l1QueueOrigin) == false) {\n return false;\n }\n\n return true;\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 view\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 = DEFAULT_ADDRESS;\n transactionContext.ovmTIMESTAMP = DEFAULT_UINT256;\n transactionContext.ovmNUMBER = DEFAULT_UINT256;\n transactionContext.ovmGASLIMIT = DEFAULT_UINT256;\n transactionContext.ovmTXGASLIMIT = DEFAULT_UINT256;\n transactionContext.ovmL1QUEUEORIGIN = Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE;\n\n transactionRecord.ovmGasRefund = DEFAULT_UINT256;\n\n messageContext.ovmCALLER = DEFAULT_ADDRESS;\n messageContext.ovmADDRESS = DEFAULT_ADDRESS;\n messageContext.isStatic = false;\n\n messageRecord.nuisanceGasLeft = DEFAULT_UINT256;\n\n // Reset the ovmStateManager.\n ovmStateManager = iOVM_StateManager(address(0));\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 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 messageRecord.nuisanceGasLeft = uint(-1);\n\n messageContext.ovmADDRESS = _from;\n\n bool isCreate = _transaction.entrypoint == address(0);\n if (isCreate) {\n (address created, bytes memory revertData) = ovmCREATE(_transaction.data);\n if (created == address(0)) {\n return abi.encode(false, revertData);\n } else {\n // The eth_call RPC endpoint for to = undefined will return the deployed bytecode\n // in the success case, differing from standard create messages.\n return abi.encode(true, Lib_EthUtils.getCode(created));\n }\n } else {\n (bool success, bytes memory returndata) = ovmCALL(\n _transaction.gasLimit,\n _transaction.entrypoint,\n _transaction.data\n );\n return abi.encode(success, returndata);\n }\n }\n}\n" + "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_Bytes32Utils } from \"../../libraries/utils/Lib_Bytes32Utils.sol\";\nimport { Lib_EthUtils } from \"../../libraries/utils/Lib_EthUtils.sol\";\nimport { Lib_ErrorUtils } from \"../../libraries/utils/Lib_ErrorUtils.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.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_DeployerWhitelist } from \"../predeploys/OVM_DeployerWhitelist.sol\";\n\n/* External Imports */\nimport { Math } from \"@openzeppelin/contracts/math/Math.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 * Native Value Constants *\n **************************/\n\n // Public so we can access and make assertions in integration tests.\n uint256 public constant CALL_WITH_VALUE_INTRINSIC_GAS = 90000;\n\n\n /**************************\n * Default Context Values *\n **************************/\n\n uint256 constant DEFAULT_UINT256 = 0xdefa017defa017defa017defa017defa017defa017defa017defa017defa017d;\n address constant DEFAULT_ADDRESS = 0xdEfa017defA017DeFA017DEfa017DeFA017DeFa0;\n\n\n /*************************************\n * Container Contract Address Prefix *\n *************************************/\n\n /**\n * @dev The Execution Manager and State Manager each have this 30 byte prefix, and are uncallable.\n */\n address constant CONTAINER_CONTRACT_PREFIX = 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000;\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 Lib_AddressResolver(_libAddressManager)\n {\n ovmSafetyChecker = iOVM_SafetyChecker(resolve(\"OVM_SafetyChecker\"));\n gasMeterConfig = _gasMeterConfig;\n globalContext = _globalContext;\n _resetContext();\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 external\n returns (\n bytes memory\n )\n {\n // Make sure that run() is not re-enterable. This condition should always be satisfied\n // Once run has been called once, due to the behavior of _isValidInput().\n if (transactionContext.ovmNUMBER != DEFAULT_UINT256) {\n return bytes(\"\");\n }\n\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 (_isValidInput(_transaction) == false) {\n _resetContext();\n return bytes(\"\");\n }\n\n // TEMPORARY: Gas metering is disabled for minnet.\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 (, bytes memory returndata) = ovmCALL(\n _transaction.gasLimit - gasMeterConfig.minTransactionGasLimit,\n _transaction.entrypoint,\n 0,\n _transaction.data\n );\n\n // TEMPORARY: Gas metering is disabled for minnet.\n // // Update the cumulative gas based on the amount of gas used.\n // uint256 gasUsed = gasProvided - gasleft();\n // _updateCumulativeGas(gasUsed, _transaction.l1QueueOrigin);\n\n // Wipe the execution context.\n _resetContext();\n\n return returndata;\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 external\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 CALLVALUE.\n * @return _CALLVALUE Value sent along with the call according to the current message context.\n */\n function ovmCALLVALUE()\n override\n public\n view\n returns (\n uint256 _CALLVALUE\n )\n {\n return messageContext.ovmCALLVALUE;\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 external\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 external\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 external\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 external\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 source (Sequencer or Queue) this transaction originated from.\n * @return _queueOrigin Enum indicating the ovmL1QUEUEORIGIN within the current message context.\n */\n function ovmL1QUEUEORIGIN()\n override\n external\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 external\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 Address of the created contract.\n * @return Revert data, if and only if the creation threw an exception.\n */\n function ovmCREATE(\n bytes memory _bytecode\n )\n override\n public\n notStatic\n fixedGasDiscount(40000)\n returns (\n address,\n bytes memory\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 MessageType.ovmCREATE\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 Address of the created contract.\n * @return Revert data, if and only if the creation threw an exception.\n */\n function ovmCREATE2(\n bytes memory _bytecode,\n bytes32 _salt\n )\n override\n external\n notStatic\n fixedGasDiscount(40000)\n returns (\n address,\n bytes memory\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 MessageType.ovmCREATE2\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 external\n returns (\n uint256 _nonce\n )\n {\n return _getAccountNonce(ovmADDRESS());\n }\n\n /**\n * Bumps the nonce of the current ovmADDRESS by one.\n */\n function ovmINCREMENTNONCE()\n override\n external\n notStatic\n {\n address account = ovmADDRESS();\n uint256 nonce = _getAccountNonce(account);\n\n // Prevent overflow.\n if (nonce + 1 > nonce) {\n _setAccountNonce(account, nonce + 1);\n }\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 // Creates a duplicate of the OVM_ProxyEOA located at 0x42....09. Uses the following\n // \"magic\" prefix to deploy an exact copy of the code:\n // PUSH1 0x0D # size of this prefix in bytes\n // CODESIZE\n // SUB # subtract prefix size from codesize\n // DUP1\n // PUSH1 0x0D\n // PUSH1 0x00\n // CODECOPY # copy everything after prefix into memory at pos 0\n // PUSH1 0x00\n // RETURN # return the copied code\n address proxyEOA = Lib_EthUtils.createContract(abi.encodePacked(\n hex\"600D380380600D6000396000f3\",\n ovmEXTCODECOPY(\n Lib_PredeployAddresses.PROXY_EOA,\n 0,\n ovmEXTCODESIZE(Lib_PredeployAddresses.PROXY_EOA)\n )\n ));\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 _value ETH value to pass with the 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 uint256 _value,\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 nextMessageContext.ovmCALLVALUE = _value;\n\n return _callContract(\n nextMessageContext,\n _gasLimit,\n _address,\n _calldata,\n MessageType.ovmCALL\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, valueless context.\n MessageContext memory nextMessageContext = messageContext;\n nextMessageContext.ovmCALLER = nextMessageContext.ovmADDRESS;\n nextMessageContext.ovmADDRESS = _address;\n nextMessageContext.isStatic = true;\n nextMessageContext.ovmCALLVALUE = 0;\n\n return _callContract(\n nextMessageContext,\n _gasLimit,\n _address,\n _calldata,\n MessageType.ovmSTATICCALL\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\n return _callContract(\n nextMessageContext,\n _gasLimit,\n _address,\n _calldata,\n MessageType.ovmDELEGATECALL\n );\n }\n\n /**\n * @notice Legacy ovmCALL function which did not support ETH value; this maintains backwards compatibility.\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 returns(\n bool _success,\n bytes memory _returndata\n )\n {\n // Legacy ovmCALL assumed always-0 value.\n return ovmCALL(\n _gasLimit,\n _address,\n 0,\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 external\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 external\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 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 external\n returns (\n bytes32 _EXTCODEHASH\n )\n {\n return Lib_EthUtils.getCodeHash(\n _getAccountEthAddress(_contract)\n );\n }\n\n\n /***************************************\n * Public Functions: ETH Value Opcodes *\n ***************************************/\n\n /**\n * @notice Overrides BALANCE.\n * NOTE: In the future, this could be optimized to directly invoke EM._getContractStorage(...).\n * @param _contract Address of the contract to query the OVM_ETH balance of.\n * @return _BALANCE OVM_ETH balance of the requested contract.\n */\n function ovmBALANCE(\n address _contract\n )\n override\n public\n returns (\n uint256 _BALANCE\n )\n {\n // Easiest way to get the balance is query OVM_ETH as normal.\n bytes memory balanceOfCalldata = abi.encodeWithSignature(\n \"balanceOf(address)\",\n _contract\n );\n\n // Static call because this should be a read-only query.\n (bool success, bytes memory returndata) = ovmSTATICCALL(\n gasleft(),\n Lib_PredeployAddresses.OVM_ETH,\n balanceOfCalldata\n );\n\n // All balanceOf queries should successfully return a uint, otherwise this must be an OOG.\n if (!success || returndata.length != 32) {\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\n }\n\n // Return the decoded balance.\n return abi.decode(returndata, (uint256));\n }\n\n /**\n * @notice Overrides SELFBALANCE.\n * @return _BALANCE OVM_ETH balance of the requesting contract.\n */\n function ovmSELFBALANCE()\n override\n external\n returns (\n uint256 _BALANCE\n )\n {\n return ovmBALANCE(ovmADDRESS());\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 Whitelisting *\n ********************************************/\n\n /**\n * Checks whether the given address is on the whitelist 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 semantics perspective, this will appear 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) = ovmSTATICCALL(\n gasleft(),\n Lib_PredeployAddresses.DEPLOYER_WHITELIST,\n abi.encodeWithSelector(\n OVM_DeployerWhitelist.isDeployerAllowed.selector,\n _deployerAddress\n )\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 Final OVM contract address.\n * @return Revertdata, if and only if the creation threw an exception.\n */\n function _createContract(\n address _contractAddress,\n bytes memory _bytecode,\n MessageType _messageType\n )\n internal\n returns (\n address,\n bytes memory\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 the common logic which occurs between call-type and create-type messages,\n // passing in the creation bytecode and `true` to trigger create-specific logic.\n (bool success, bytes memory data) = _handleExternalMessage(\n nextMessageContext,\n gasleft(),\n _contractAddress,\n _bytecode,\n _messageType\n );\n\n // Yellow paper requires that address returned is zero if the contract deployment fails.\n return (\n success ? _contractAddress : address(0),\n data\n );\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 MessageType _messageType\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(CONTAINER_CONTRACT_PREFIX)\n ) {\n // EVM does not return data in the success case, see: https://github.com/ethereum/go-ethereum/blob/aae7660410f0ef90279e14afaaf2f429fdc2a186/core/vm/instructions.go#L600-L604\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 _handleExternalMessage(\n _nextMessageContext,\n _gasLimit,\n codeContractAddress,\n _calldata,\n _messageType\n );\n }\n\n /**\n * Handles all interactions which involve the execution manager calling out to untrusted code (both calls and creates).\n * Ensures that OVM-related measures are enforced, including L2 gas refunds, nuisance gas, and flagged reversions.\n *\n * @param _nextMessageContext Message context to be used for the external message.\n * @param _gasLimit Amount of gas to be passed into this message. NOTE: this argument is overwritten in some cases to avoid stack-too-deep.\n * @param _contract OVM address being called or deployed to\n * @param _data Data for the message (either calldata or creation code)\n * @param _messageType What type of ovmOPCODE this message corresponds to.\n * @return Whether or not the message (either a call or deployment) succeeded.\n * @return Data returned by the message.\n */\n function _handleExternalMessage(\n MessageContext memory _nextMessageContext,\n // NOTE: this argument is overwritten in some cases to avoid stack-too-deep.\n uint256 _gasLimit,\n address _contract,\n bytes memory _data,\n MessageType _messageType\n )\n internal\n returns (\n bool,\n bytes memory\n )\n {\n uint256 messageValue = _nextMessageContext.ovmCALLVALUE;\n // If there is value in this message, we need to transfer the ETH over before switching contexts.\n if (\n messageValue > 0\n && _isValueType(_messageType)\n ) {\n // Handle out-of-intrinsic gas consistent with EVM behavior -- the subcall \"appears to revert\" if we don't have enough gas to transfer the ETH.\n // Similar to dynamic gas cost of value exceeding gas here:\n // https://github.com/ethereum/go-ethereum/blob/c503f98f6d5e80e079c1d8a3601d188af2a899da/core/vm/interpreter.go#L268-L273\n if (gasleft() < CALL_WITH_VALUE_INTRINSIC_GAS) {\n return (false, hex\"\");\n }\n\n // If there *is* enough gas to transfer ETH, then we need to make sure this amount of gas is reserved (i.e. not\n // given to the _contract.call below) to guarantee that _handleExternalMessage can't run out of gas.\n // In particular, in the event that the call fails, we will need to transfer the ETH back to the sender.\n // Taking the lesser of _gasLimit and gasleft() - CALL_WITH_VALUE_INTRINSIC_GAS guarantees that the second\n // _attemptForcedEthTransfer below, if needed, always has enough gas to succeed.\n _gasLimit = Math.min(\n _gasLimit,\n gasleft() - CALL_WITH_VALUE_INTRINSIC_GAS // Cannot overflow due to the above check.\n );\n\n // Now transfer the value of the call.\n // The target is interpreted to be the next message's ovmADDRESS account.\n bool transferredOvmEth = _attemptForcedEthTransfer(\n _nextMessageContext.ovmADDRESS,\n messageValue\n );\n\n // If the ETH transfer fails (should only be possible in the case of insufficient balance), then treat this as a revert.\n // This mirrors EVM behavior, see https://github.com/ethereum/go-ethereum/blob/2dee31930c9977af2a9fcb518fb9838aa609a7cf/core/vm/evm.go#L298\n if (!transferredOvmEth) {\n return (false, hex\"\");\n }\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. `_contract` 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\n bool success;\n bytes memory returndata;\n if (_isCreateType(_messageType)) {\n // safeCREATE() is a function which replicates a CREATE message, but uses return values\n // Which match that of CALL (i.e. bool, bytes). This allows many security checks to be\n // to be shared between untrusted call and create call frames.\n (success, returndata) = address(this).call{gas: _gasLimit}(\n abi.encodeWithSelector(\n this.safeCREATE.selector,\n _data,\n _contract\n )\n );\n } else {\n (success, returndata) = _contract.call{gas: _gasLimit}(_data);\n }\n\n // If the message threw an exception, its value should be returned back to the sender.\n // So, we force it back, BEFORE returning the messageContext to the previous addresses.\n // This operation is part of the reason we \"reserved the intrinsic gas\" above.\n if (\n messageValue > 0\n && _isValueType(_messageType)\n && !success\n ) {\n bool transferredOvmEth = _attemptForcedEthTransfer(\n prevMessageContext.ovmADDRESS,\n messageValue\n );\n\n // Since we transferred it in above and the call reverted, the transfer back should always pass.\n // This code path should NEVER be triggered since we sent `messageValue` worth of OVM_ETH into the target\n // and reserved sufficient gas to execute the transfer, but in case there is some edge case which has\n // been missed, we revert the entire frame (and its parent) to make sure the ETH gets sent back.\n if (!transferredOvmEth) {\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\n }\n }\n\n // Switch back to the original message context now that we're out of the call and all OVM_ETH is in the right place.\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. Additionally, we surface custom error messages\n // to developers in the case of unsafe creations for improved devex.\n // All other revert types return no data.\n if (\n flag == RevertFlag.INTENTIONAL_REVERT\n || flag == RevertFlag.UNSAFE_BYTECODE\n ) {\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 * Handles the creation-specific safety measures required for OVM contract deployment.\n * This function sanitizes the return types for creation messages to match calls (bool, bytes),\n * by being an external function which the EM can call, that mimics the success/fail case of the CREATE.\n * This allows for consistent handling of both types of messages in _handleExternalMessage().\n * Having this step occur as a separate call frame also allows us to easily revert the\n * contract deployment in the event that the code is unsafe.\n *\n * @param _creationCode Code to pass into CREATE for deployment.\n * @param _address OVM address being deployed to.\n */\n function safeCREATE(\n bytes memory _creationCode,\n address _address\n )\n external\n {\n // The only way this should callable is from within _createContract(),\n // and it should DEFINITELY not be callable by a non-EM code contract.\n if (msg.sender != address(this)) {\n return;\n }\n // Check that there is not already code at this address.\n if (_hasEmptyAccount(_address) == false) {\n // Note: in the EVM, this case burns all allotted gas. For improved\n // developer experience, we do return the remaining gas.\n _revertWithFlag(\n RevertFlag.CREATE_COLLISION\n );\n }\n\n // Check the creation bytecode against the OVM_SafetyChecker.\n if (ovmSafetyChecker.isBytecodeSafe(_creationCode) == false) {\n // Note: in the EVM, this case burns all allotted gas. For improved\n // developer experience, we do return the remaining gas.\n _revertWithFlag(\n RevertFlag.UNSAFE_BYTECODE,\n Lib_ErrorUtils.encodeRevertString(\"Contract creation code contains unsafe opcodes. Did you use the right compiler or pass an unsafe constructor argument?\")\n );\n }\n\n // We always need to initialize the contract with the default account values.\n _initPendingAccount(_address);\n\n // Actually execute the EVM create message.\n // NOTE: The inline assembly below means we can NOT make any evm calls between here and then.\n address ethAddress = Lib_EthUtils.createContract(_creationCode);\n\n if (ethAddress == address(0)) {\n // If the creation fails, the EVM lets us grab its revert data. This may contain a revert flag\n // to be used above in _handleExternalMessage, so we pass the revert data back up unmodified.\n assembly {\n returndatacopy(0,0,returndatasize())\n revert(0, returndatasize())\n }\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(\n RevertFlag.UNSAFE_BYTECODE,\n Lib_ErrorUtils.encodeRevertString(\"Constructor attempted to deploy unsafe bytecode.\")\n );\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 * Internal Functions: Value Manipulation *\n ******************************************/\n\n /**\n * Invokes an ovmCALL to OVM_ETH.transfer on behalf of the current ovmADDRESS, allowing us to force movement of OVM_ETH in correspondence with ETH's native value functionality.\n * WARNING: this will send on behalf of whatever the messageContext.ovmADDRESS is in storage at the time of the call.\n * NOTE: In the future, this could be optimized to directly invoke EM._setContractStorage(...).\n * @param _to Amount of OVM_ETH to be sent.\n * @param _value Amount of OVM_ETH to send.\n * @return _success Whether or not the transfer worked.\n */\n function _attemptForcedEthTransfer(\n address _to,\n uint256 _value\n )\n internal\n returns(\n bool _success\n )\n {\n bytes memory transferCalldata = abi.encodeWithSignature(\n \"transfer(address,uint256)\",\n _to,\n _value\n );\n\n // OVM_ETH inherits from the UniswapV2ERC20 standard. In this implementation, its return type\n // is a boolean. However, the implementation always returns true if it does not revert.\n // Thus, success of the call frame is sufficient to infer success of the transfer itself.\n (bool success, ) = ovmCALL(\n gasleft(),\n Lib_PredeployAddresses.OVM_ETH,\n 0,\n transferCalldata\n );\n\n return success;\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 ) {\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 view\n {\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 input values of a transaction.\n * @return _valid Whether or not the transaction data is valid.\n */\n function _isValidInput(\n Lib_OVMCodec.Transaction memory _transaction\n )\n view\n internal\n returns (\n bool\n )\n {\n // Prevent reentrancy to run():\n // This check prevents calling run with the default ovmNumber.\n // Combined with the first check in run():\n // if (transactionContext.ovmNUMBER != DEFAULT_UINT256) { return; }\n // It should be impossible to re-enter since run() returns before any other call frames are created.\n // Since this value is already being written to storage, we save much gas compared to\n // using the standard nonReentrant pattern.\n if (_transaction.blockNumber == DEFAULT_UINT256) {\n return false;\n }\n\n if (_isValidGasLimit(_transaction.gasLimit, _transaction.l1QueueOrigin) == false) {\n return false;\n }\n\n return true;\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 view\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 // These conditionals allow us to avoid unneccessary SSTOREs. However, they do mean that the current storage\n // value for the messageContext MUST equal the _prevMessageContext argument, or an SSTORE might be erroneously skipped.\n if (_prevMessageContext.ovmCALLER != _nextMessageContext.ovmCALLER) {\n messageContext.ovmCALLER = _nextMessageContext.ovmCALLER;\n }\n\n if (_prevMessageContext.ovmADDRESS != _nextMessageContext.ovmADDRESS) {\n messageContext.ovmADDRESS = _nextMessageContext.ovmADDRESS;\n }\n\n if (_prevMessageContext.isStatic != _nextMessageContext.isStatic) {\n messageContext.isStatic = _nextMessageContext.isStatic;\n }\n\n if (_prevMessageContext.ovmCALLVALUE != _nextMessageContext.ovmCALLVALUE) {\n messageContext.ovmCALLVALUE = _nextMessageContext.ovmCALLVALUE;\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 = DEFAULT_ADDRESS;\n transactionContext.ovmTIMESTAMP = DEFAULT_UINT256;\n transactionContext.ovmNUMBER = DEFAULT_UINT256;\n transactionContext.ovmGASLIMIT = DEFAULT_UINT256;\n transactionContext.ovmTXGASLIMIT = DEFAULT_UINT256;\n transactionContext.ovmL1QUEUEORIGIN = Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE;\n\n transactionRecord.ovmGasRefund = DEFAULT_UINT256;\n\n messageContext.ovmCALLER = DEFAULT_ADDRESS;\n messageContext.ovmADDRESS = DEFAULT_ADDRESS;\n messageContext.isStatic = false;\n\n messageRecord.nuisanceGasLeft = DEFAULT_UINT256;\n\n // Reset the ovmStateManager.\n ovmStateManager = iOVM_StateManager(address(0));\n }\n\n\n /******************************************\n * Internal Functions: Message Typechecks *\n ******************************************/\n\n /**\n * Returns whether or not the given message type is a CREATE-type.\n * @param _messageType the message type in question.\n */\n function _isCreateType(\n MessageType _messageType\n )\n internal\n pure\n returns(\n bool\n )\n {\n return (\n _messageType == MessageType.ovmCREATE\n || _messageType == MessageType.ovmCREATE2\n );\n }\n\n /**\n * Returns whether or not the given message type (potentially) requires the transfer of ETH value along with the message.\n * @param _messageType the message type in question.\n */\n function _isValueType(\n MessageType _messageType\n )\n internal\n pure\n returns(\n bool\n )\n {\n // ovmSTATICCALL and ovmDELEGATECALL types do not accept or transfer value.\n return (\n _messageType == MessageType.ovmCALL\n || _messageType == MessageType.ovmCREATE\n || _messageType == MessageType.ovmCREATE2\n );\n }\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 * @param _value the amount of ETH value to send.\n * @param _ovmStateManager the address of the OVM_StateManager precompile in the L2 state.\n */\n function simulateMessage(\n Lib_OVMCodec.Transaction memory _transaction,\n address _from,\n uint256 _value,\n iOVM_StateManager _ovmStateManager\n )\n external\n returns (\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 // Initialize the EM's internal state, ignoring nuisance gas.\n ovmStateManager = _ovmStateManager;\n _initContext(_transaction);\n messageRecord.nuisanceGasLeft = uint(-1);\n\n // Set the ovmADDRESS to the _from so that the subsequent call frame \"comes from\" them.\n messageContext.ovmADDRESS = _from;\n\n // Execute the desired message.\n bool isCreate = _transaction.entrypoint == address(0);\n if (isCreate) {\n (address created, bytes memory revertData) = ovmCREATE(_transaction.data);\n if (created == address(0)) {\n return abi.encode(false, revertData);\n } else {\n // The eth_call RPC endpoint for to = undefined will return the deployed bytecode\n // in the success case, differing from standard create messages.\n return abi.encode(true, Lib_EthUtils.getCode(created));\n }\n } else {\n (bool success, bytes memory returndata) = ovmCALL(\n _transaction.gasLimit,\n _transaction.entrypoint,\n _value,\n _transaction.data\n );\n return abi.encode(success, returndata);\n }\n }\n}\n" }, "@openzeppelin/contracts/math/Math.sol": { "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow, so we distribute\n return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);\n }\n}\n" @@ -164,13 +227,13 @@ "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 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" }, "contracts/optimistic-ethereum/OVM/bridge/messaging/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\";\n\n/* Interface Imports */\nimport { iOVM_L1CrossDomainMessenger } from \"../../../iOVM/bridge/messaging/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/* External Imports */\nimport { OwnableUpgradeable } from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport { PausableUpgradeable } from \"@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol\";\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol\";\n\n/**\n * @title OVM_L1CrossDomainMessenger\n * @dev The L1 Cross Domain Messenger contract sends messages from L1 to L2, and relays messages\n * from L2 onto L1. In the event that a message sent from L1 to L2 is rejected for exceeding the L2\n * epoch gas limit, it can be resubmitted via this contract's replay function.\n *\n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_L1CrossDomainMessenger is\n iOVM_L1CrossDomainMessenger,\n Abs_BaseCrossDomainMessenger,\n Lib_AddressResolver,\n OwnableUpgradeable,\n PausableUpgradeable,\n ReentrancyGuardUpgradeable\n{\n\n /**********\n * Events *\n **********/\n\n event MessageBlocked(\n bytes32 indexed _xDomainCalldataHash\n );\n\n event MessageAllowed(\n bytes32 indexed _xDomainCalldataHash\n );\n\n /**********************\n * Contract Variables *\n **********************/\n\n mapping (bytes32 => bool) public blockedMessages;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * This contract is intended to be behind a delegate proxy.\n * We pass the zero address to the address resolver just to satisfy the constructor.\n * We still need to set this value in initialize().\n */\n constructor()\n Lib_AddressResolver(address(0))\n {}\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * Modifier to enforce that, if configured, only the OVM_L2MessageRelayer contract may\n * 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 * @param _libAddressManager Address of the Address Manager.\n */\n function initialize(\n address _libAddressManager\n )\n public\n initializer\n {\n require(\n address(libAddressManager) == address(0),\n \"L1CrossDomainMessenger already intialized.\"\n );\n libAddressManager = Lib_AddressManager(_libAddressManager);\n xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\n\n // Initialize upgradable OZ contracts\n __Context_init_unchained(); // Context is a dependency for both Ownable and Pausable\n __Ownable_init_unchained();\n __Pausable_init_unchained();\n __ReentrancyGuard_init_unchained();\n }\n\n /**\n * Pause relaying.\n */\n function pause()\n external\n onlyOwner\n {\n _pause();\n }\n\n /**\n * Block a message.\n * @param _xDomainCalldataHash Hash of the message to block.\n */\n function blockMessage(\n bytes32 _xDomainCalldataHash\n )\n external\n onlyOwner\n {\n blockedMessages[_xDomainCalldataHash] = true;\n emit MessageBlocked(_xDomainCalldataHash);\n }\n\n /**\n * Allow a message.\n * @param _xDomainCalldataHash Hash of the message to block.\n */\n function allowMessage(\n bytes32 _xDomainCalldataHash\n )\n external\n onlyOwner\n {\n blockedMessages[_xDomainCalldataHash] = false;\n emit MessageAllowed(_xDomainCalldataHash);\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 whenNotPaused\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 require(\n blockedMessages[xDomainCalldataHash] == false,\n \"Provided message has been blocked.\"\n );\n\n xDomainMsgSender = _sender;\n (bool success, ) = _target.call(_message);\n xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\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 } else {\n emit FailedRelayedMessage(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(\n resolve(\"OVM_StateCommitmentChain\")\n );\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 predeploy 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" + "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_OVMCodec } from \"../../../libraries/codec/Lib_OVMCodec.sol\";\nimport { Lib_AddressManager } from \"../../../libraries/resolver/Lib_AddressManager.sol\";\nimport { Lib_SecureMerkleTrie } from \"../../../libraries/trie/Lib_SecureMerkleTrie.sol\";\nimport { Lib_PredeployAddresses } from \"../../../libraries/constants/Lib_PredeployAddresses.sol\";\nimport { Lib_CrossDomainUtils } from \"../../../libraries/bridge/Lib_CrossDomainUtils.sol\";\n\n/* Interface Imports */\nimport { iOVM_L1CrossDomainMessenger } from \"../../../iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol\";\nimport { iOVM_CanonicalTransactionChain } from \"../../../iOVM/chain/iOVM_CanonicalTransactionChain.sol\";\nimport { iOVM_StateCommitmentChain } from \"../../../iOVM/chain/iOVM_StateCommitmentChain.sol\";\n\n/* External Imports */\nimport { OwnableUpgradeable } from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport { PausableUpgradeable } from \"@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol\";\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol\";\n\n/**\n * @title OVM_L1CrossDomainMessenger\n * @dev The L1 Cross Domain Messenger contract sends messages from L1 to L2, and relays messages\n * from L2 onto L1. In the event that a message sent from L1 to L2 is rejected for exceeding the L2\n * epoch gas limit, it can be resubmitted via this contract's replay function.\n *\n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_L1CrossDomainMessenger is\n iOVM_L1CrossDomainMessenger,\n Lib_AddressResolver,\n OwnableUpgradeable,\n PausableUpgradeable,\n ReentrancyGuardUpgradeable\n{\n\n /**********\n * Events *\n **********/\n\n event MessageBlocked(\n bytes32 indexed _xDomainCalldataHash\n );\n\n event MessageAllowed(\n bytes32 indexed _xDomainCalldataHash\n );\n\n /*************\n * Constants *\n *************/\n\n // The default x-domain message sender being set to a non-zero value makes\n // deployment a bit more expensive, but in exchange the refund on every call to\n // `relayMessage` by the L1 and L2 messengers will be higher.\n address internal constant DEFAULT_XDOMAIN_SENDER = 0x000000000000000000000000000000000000dEaD;\n\n /**********************\n * Contract Variables *\n **********************/\n\n mapping (bytes32 => bool) public blockedMessages;\n mapping (bytes32 => bool) public relayedMessages;\n mapping (bytes32 => bool) public successfulMessages;\n\n address internal xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * This contract is intended to be behind a delegate proxy.\n * We pass the zero address to the address resolver just to satisfy the constructor.\n * We still need to set this value in initialize().\n */\n constructor()\n Lib_AddressResolver(address(0))\n {}\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * Modifier to enforce that, if configured, only the OVM_L2MessageRelayer contract may\n * 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 * @param _libAddressManager Address of the Address Manager.\n */\n function initialize(\n address _libAddressManager\n )\n public\n initializer\n {\n require(\n address(libAddressManager) == address(0),\n \"L1CrossDomainMessenger already intialized.\"\n );\n libAddressManager = Lib_AddressManager(_libAddressManager);\n xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\n\n // Initialize upgradable OZ contracts\n __Context_init_unchained(); // Context is a dependency for both Ownable and Pausable\n __Ownable_init_unchained();\n __Pausable_init_unchained();\n __ReentrancyGuard_init_unchained();\n }\n\n /**\n * Pause relaying.\n */\n function pause()\n external\n onlyOwner\n {\n _pause();\n }\n\n /**\n * Block a message.\n * @param _xDomainCalldataHash Hash of the message to block.\n */\n function blockMessage(\n bytes32 _xDomainCalldataHash\n )\n external\n onlyOwner\n {\n blockedMessages[_xDomainCalldataHash] = true;\n emit MessageBlocked(_xDomainCalldataHash);\n }\n\n /**\n * Allow a message.\n * @param _xDomainCalldataHash Hash of the message to block.\n */\n function allowMessage(\n bytes32 _xDomainCalldataHash\n )\n external\n onlyOwner\n {\n blockedMessages[_xDomainCalldataHash] = false;\n emit MessageAllowed(_xDomainCalldataHash);\n }\n\n function xDomainMessageSender()\n public\n override\n view\n returns (\n address\n )\n {\n require(xDomainMsgSender != DEFAULT_XDOMAIN_SENDER, \"xDomainMessageSender is not set\");\n return xDomainMsgSender;\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 memory _message,\n uint32 _gasLimit\n )\n override\n public\n {\n address ovmCanonicalTransactionChain = resolve(\"OVM_CanonicalTransactionChain\");\n // Use the CTC queue length as nonce\n uint40 nonce = iOVM_CanonicalTransactionChain(ovmCanonicalTransactionChain).getQueueLength();\n\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n msg.sender,\n _message,\n nonce\n );\n\n address l2CrossDomainMessenger = resolve(\"OVM_L2CrossDomainMessenger\");\n _sendXDomainMessage(ovmCanonicalTransactionChain, l2CrossDomainMessenger, xDomainCalldata, _gasLimit);\n emit SentMessage(xDomainCalldata);\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 whenNotPaused\n {\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\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 require(\n blockedMessages[xDomainCalldataHash] == false,\n \"Provided message has been blocked.\"\n );\n\n xDomainMsgSender = _sender;\n (bool success, ) = _target.call(_message);\n xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\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 } else {\n emit FailedRelayedMessage(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 _queueIndex,\n uint32 _gasLimit\n )\n override\n public\n {\n // Verify that the message is in the queue:\n address canonicalTransactionChain = resolve(\"OVM_CanonicalTransactionChain\");\n Lib_OVMCodec.QueueElement memory element = iOVM_CanonicalTransactionChain(canonicalTransactionChain).getQueueElement(_queueIndex);\n\n address l2CrossDomainMessenger = resolve(\"OVM_L2CrossDomainMessenger\");\n // Compute the transactionHash\n bytes32 transactionHash = keccak256(\n abi.encode(\n address(this),\n l2CrossDomainMessenger,\n _gasLimit,\n _message\n )\n );\n\n require(\n transactionHash == element.transactionHash,\n \"Provided message has not been enqueued.\"\n );\n\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n _sender,\n _message,\n _queueIndex\n );\n\n _sendXDomainMessage(canonicalTransactionChain, l2CrossDomainMessenger, 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(\n resolve(\"OVM_StateCommitmentChain\")\n );\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(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER),\n _proof.stateTrieWitness,\n _proof.stateRoot\n );\n\n require(\n exists == true,\n \"Message passing predeploy 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 _canonicalTransactionChain Address of the OVM_CanonicalTransactionChain instance.\n * @param _l2CrossDomainMessenger Address of the OVM_L2CrossDomainMessenger instance.\n * @param _message Message to send.\n * @param _gasLimit OVM gas limit for the message.\n */\n function _sendXDomainMessage(\n address _canonicalTransactionChain,\n address _l2CrossDomainMessenger,\n bytes memory _message,\n uint256 _gasLimit\n )\n internal\n {\n iOVM_CanonicalTransactionChain(_canonicalTransactionChain).enqueue(\n _l2CrossDomainMessenger,\n _gasLimit,\n _message\n );\n }\n}\n" }, - "contracts/optimistic-ethereum/iOVM/bridge/messaging/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/libraries/bridge/Lib_CrossDomainUtils.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\";\n\n/**\n * @title Lib_CrossDomainUtils\n */\nlibrary Lib_CrossDomainUtils {\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 encodeXDomainCalldata(\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" }, - "contracts/optimistic-ethereum/OVM/bridge/messaging/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/messaging/iAbs_BaseCrossDomainMessenger.sol\";\n\n/**\n * @title Abs_BaseCrossDomainMessenger\n * @dev The Base Cross Domain Messenger is an abstract contract providing the interface and common\n * functionality used in the L1 and L2 Cross Domain Messengers. It can also serve as a template for\n * developers wishing to implement a custom bridge 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 {\n\n /*************\n * Constants *\n *************/\n\n // The default x-domain message sender being set to a non-zero value makes\n // deployment a bit more expensive, but in exchange the refund on every call to\n // `relayMessage` by the L1 and L2 messengers will be higher.\n address internal constant DEFAULT_XDOMAIN_SENDER = 0x000000000000000000000000000000000000dEaD;\n\n\n /*************\n * 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 internal xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\n\n\n /***************\n * Constructor *\n ***************/\n\n constructor() {}\n\n\n /********************\n * Public Functions *\n ********************/\n\n function xDomainMessageSender()\n public\n override\n view\n returns (\n address\n )\n {\n require(xDomainMsgSender != DEFAULT_XDOMAIN_SENDER, \"xDomainMessageSender is not set\");\n return xDomainMsgSender;\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 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 /**********************\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 to send.\n * param // 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/messaging/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 { iOVM_CrossDomainMessenger } from \"./iOVM_CrossDomainMessenger.sol\";\n\n/**\n * @title iOVM_L1CrossDomainMessenger\n */\ninterface iOVM_L1CrossDomainMessenger is iOVM_CrossDomainMessenger {\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 _queueIndex CTC Queue index for the message to replay.\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 _queueIndex,\n uint32 _gasLimit\n ) external;\n}\n" }, "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/Initializable.sol\";\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal initializer {\n __Context_init_unchained();\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal initializer {\n address msgSender = _msgSender();\n _owner = msgSender;\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\n }\n uint256[49] private __gap;\n}\n" @@ -190,11 +253,17 @@ "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.2 <0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n // solhint-disable-next-line no-inline-assembly\n assembly { size := extcodesize(account) }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\n (bool success, ) = recipient.call{ value: amount }(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain`call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.call{ value: value }(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.staticcall(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" }, + "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1MultiMessageRelayer.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_L1CrossDomainMessenger } from \"../../../iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol\";\nimport { iOVM_L1MultiMessageRelayer } from \"../../../iOVM/bridge/messaging/iOVM_L1MultiMessageRelayer.sol\";\n\n/* Library Imports */\nimport { Lib_AddressResolver } from \"../../../libraries/resolver/Lib_AddressResolver.sol\";\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\n /**\n * @param _libAddressManager Address of the Address Manager.\n */\n constructor(\n address _libAddressManager\n )\n Lib_AddressResolver(_libAddressManager)\n {}\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 /********************\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(\n L2ToL1Message[] calldata _messages\n ) \n override\n external\n onlyBatchRelayer\n {\n iOVM_L1CrossDomainMessenger messenger = iOVM_L1CrossDomainMessenger(\n resolve(\"Proxy__OVM_L1CrossDomainMessenger\")\n );\n\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/messaging/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/messaging/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/optimistic-ethereum/OVM/bridge/messaging/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\";\n\n/* Interface Imports */\nimport { iOVM_L2CrossDomainMessenger } from \"../../../iOVM/bridge/messaging/iOVM_L2CrossDomainMessenger.sol\";\nimport { iOVM_L1MessageSender } from \"../../../iOVM/predeploys/iOVM_L1MessageSender.sol\";\nimport { iOVM_L2ToL1MessagePasser } from \"../../../iOVM/predeploys/iOVM_L2ToL1MessagePasser.sol\";\n\n/* Contract Imports */\nimport { Abs_BaseCrossDomainMessenger } from \"./Abs_BaseCrossDomainMessenger.sol\";\n\n/* External Imports */\nimport { ReentrancyGuard } from \"@openzeppelin/contracts/utils/ReentrancyGuard.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\n iOVM_L2CrossDomainMessenger,\n Abs_BaseCrossDomainMessenger,\n Lib_AddressResolver,\n ReentrancyGuard\n{\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address of the Address Manager.\n */\n constructor(\n address _libAddressManager\n )\n Lib_AddressResolver(_libAddressManager)\n ReentrancyGuard()\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 // Prevent calls to OVM_L2ToL1MessagePasser, which would enable\n // an attacker to maliciously craft the _message to spoof\n // a call from any L2 account.\n if(_target == resolve(\"OVM_L2ToL1MessagePasser\")){\n // Write to the successfulMessages mapping and return immediately.\n successfulMessages[xDomainCalldataHash] = true;\n return;\n }\n\n xDomainMsgSender = _sender;\n (bool success, ) = _target.call(_message);\n xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\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 } else {\n emit FailedRelayedMessage(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\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 view\n internal\n returns (\n bool _valid\n )\n {\n return (\n iOVM_L1MessageSender(\n resolve(\"OVM_L1MessageSender\")\n ).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" + "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_CrossDomainUtils } from \"../../../libraries/bridge/Lib_CrossDomainUtils.sol\";\n\n/* Interface Imports */\nimport { iOVM_L2CrossDomainMessenger } from \"../../../iOVM/bridge/messaging/iOVM_L2CrossDomainMessenger.sol\";\nimport { iOVM_L1MessageSender } from \"../../../iOVM/predeploys/iOVM_L1MessageSender.sol\";\nimport { iOVM_L2ToL1MessagePasser } from \"../../../iOVM/predeploys/iOVM_L2ToL1MessagePasser.sol\";\n\n/* External Imports */\nimport { ReentrancyGuard } from \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\";\n\n/* External Imports */\nimport { ReentrancyGuard } from \"@openzeppelin/contracts/utils/ReentrancyGuard.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\n iOVM_L2CrossDomainMessenger,\n Lib_AddressResolver,\n ReentrancyGuard\n{\n\n /*************\n * Constants *\n *************/\n\n // The default x-domain message sender being set to a non-zero value makes\n // deployment a bit more expensive, but in exchange the refund on every call to\n // `relayMessage` by the L1 and L2 messengers will be higher.\n address internal constant DEFAULT_XDOMAIN_SENDER = 0x000000000000000000000000000000000000dEaD;\n\n /*************\n * 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 internal xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address of the Address Manager.\n */\n constructor(address _libAddressManager) Lib_AddressResolver(_libAddressManager) ReentrancyGuard() {}\n\n\n /********************\n * Public Functions *\n ********************/\n\n function xDomainMessageSender()\n public\n override\n view\n returns (\n address\n )\n {\n require(xDomainMsgSender != DEFAULT_XDOMAIN_SENDER, \"xDomainMessageSender is not set\");\n return xDomainMsgSender;\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 memory _message,\n uint32 _gasLimit\n )\n override\n public\n {\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\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 * 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 = Lib_CrossDomainUtils.encodeXDomainCalldata(\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 // Prevent calls to OVM_L2ToL1MessagePasser, which would enable\n // an attacker to maliciously craft the _message to spoof\n // a call from any L2 account.\n if(_target == resolve(\"OVM_L2ToL1MessagePasser\")){\n // Write to the successfulMessages mapping and return immediately.\n successfulMessages[xDomainCalldataHash] = true;\n return;\n }\n\n xDomainMsgSender = _sender;\n (bool success, ) = _target.call(_message);\n xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;\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 } else {\n emit FailedRelayedMessage(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\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 view\n internal\n returns (\n bool _valid\n )\n {\n return (\n iOVM_L1MessageSender(\n resolve(\"OVM_L1MessageSender\")\n ).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 internal\n {\n iOVM_L2ToL1MessagePasser(resolve(\"OVM_L2ToL1MessagePasser\")).passMessageToL1(_message);\n }\n}\n" }, "contracts/optimistic-ethereum/iOVM/bridge/messaging/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" + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Interface Imports */\nimport { iOVM_CrossDomainMessenger } from \"./iOVM_CrossDomainMessenger.sol\";\n\n/**\n * @title iOVM_L2CrossDomainMessenger\n */\ninterface iOVM_L2CrossDomainMessenger is iOVM_CrossDomainMessenger {\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/predeploys/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" @@ -206,76 +275,37 @@ "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.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 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/OVM/predeploys/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/predeploys/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" + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Interface Imports */\nimport { iOVM_L2ToL1MessagePasser } from \"../../iOVM/predeploys/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 * 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/predeploys/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/predeploys/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/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_L2DepositedToken } from \"../../../iOVM/bridge/tokens/iOVM_L2DepositedToken.sol\";\n\n/* Library Imports */\nimport { OVM_CrossDomainEnabled } from \"../../../libraries/bridge/OVM_CrossDomainEnabled.sol\";\nimport { Lib_AddressResolver } from \"../../../libraries/resolver/Lib_AddressResolver.sol\";\nimport { Lib_AddressManager } from \"../../../libraries/resolver/Lib_AddressManager.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 /********************\n * Public Constants *\n ********************/\n\n uint32 public constant override getFinalizeDepositL2Gas = 1200000;\n\n /********************************\n * External Contract References *\n ********************************/\n\n address public ovmEth;\n\n /***************\n * Constructor *\n ***************/\n\n // This contract lives behind a proxy, so the constructor parameters will go unused.\n constructor()\n OVM_CrossDomainEnabled(address(0))\n Lib_AddressResolver(address(0))\n public\n {}\n\n /******************\n * Initialization *\n ******************/\n\n /**\n * @param _libAddressManager Address manager for this OE deployment\n * @param _ovmEth L2 OVM_ETH implementation of iOVM_DepositedToken\n */\n function initialize(\n address _libAddressManager,\n address _ovmEth\n )\n public\n {\n require(libAddressManager == Lib_AddressManager(0), \"Contract has already been initialized.\");\n libAddressManager = Lib_AddressManager(_libAddressManager);\n ovmEth = _ovmEth;\n messenger = resolve(\"Proxy__OVM_L1CrossDomainMessenger\");\n }\n\n /**************\n * Depositing *\n **************/\n\n receive()\n external\n payable\n {\n _initiateDeposit(msg.sender, msg.sender);\n }\n\n /**\n * @dev deposit an amount of the ETH 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 ETH 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 ETH and informing the L2 ETH 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 l2ETHGateway.finalizeDeposit(_to, _amount)\n bytes memory data =\n abi.encodeWithSelector(\n iOVM_L2DepositedToken.finalizeDeposit.selector,\n _to,\n msg.value\n );\n\n // Send calldata into L2\n sendCrossDomainMessage(\n ovmEth,\n data,\n getFinalizeDepositL2Gas\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 ETH token.\n * Since only the xDomainMessenger can call this function, it will never be called before the withdrawal is finalized.\n *\n * @param _to L1 address to credit the withdrawal to\n * @param _amount Amount of the ETH to withdraw\n */\n function finalizeWithdrawal(\n address _to,\n uint256 _amount\n )\n external\n override\n onlyFromCrossDomainAccount(ovmEth)\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 * Temporary - Migrating ETH *\n *****************************/\n\n /**\n * @dev Migrates entire ETH balance to another gateway\n * @param _to Gateway Proxy address to migrate ETH to\n */\n function migrateEth(address payable _to) external {\n address owner = Lib_AddressManager(libAddressManager).owner();\n require(msg.sender == owner, \"Only the owner can migrate ETH\");\n uint256 balance = address(this).balance;\n OVM_L1ETHGateway(_to).donateETH{value:balance}();\n }\n\n /**\n * @dev Adds ETH balance to the account. This is meant to allow for ETH\n * to be migrated from an old gateway to a new gateway\n */\n function donateETH() external payable {}\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 * 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 function getFinalizeDepositL2Gas()\n external\n view\n returns(\n uint32\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 // 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 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 payable\n {\n address target = addressManager[address(this)].getAddress(\n (implementationName[address(this)])\n );\n\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/optimistic-ethereum/OVM/bridge/tokens/Abs_L1TokenGateway.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_L1TokenGateway } from \"../../../iOVM/bridge/tokens/iOVM_L1TokenGateway.sol\";\nimport { iOVM_L2DepositedToken } from \"../../../iOVM/bridge/tokens/iOVM_L2DepositedToken.sol\";\n\n/* Library Imports */\nimport { OVM_CrossDomainEnabled } from \"../../../libraries/bridge/OVM_CrossDomainEnabled.sol\";\n\n/**\n * @title Abs_L1TokenGateway\n * @dev An L1 Token Gateway is a contract which stores deposited L1 funds that are in use on L2.\n * It synchronizes a corresponding L2 representation of the \"deposited token\", informing it\n * of new deposits and releasing L1 funds when there are newly finalized withdrawals.\n *\n * NOTE: This abstract contract gives all the core functionality of an L1 token gateway,\n * but provides easy hooks in case developers need extensions in child contracts.\n * In many cases, the default OVM_L1ERC20Gateway will suffice.\n *\n * Compiler used: solc\n * Runtime target: EVM\n */\nabstract contract Abs_L1TokenGateway is iOVM_L1TokenGateway, OVM_CrossDomainEnabled {\n\n /********************************\n * External Contract References *\n ********************************/\n\n address public l2DepositedToken;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _l2DepositedToken iOVM_L2DepositedToken-compatible address on the chain being deposited into.\n * @param _l1messenger L1 Messenger address being used for cross-chain communications.\n */\n constructor(\n address _l2DepositedToken,\n address _l1messenger\n )\n OVM_CrossDomainEnabled(_l1messenger)\n {\n l2DepositedToken = _l2DepositedToken;\n }\n\n /********************************\n * Overridable Accounting logic *\n ********************************/\n\n // Default gas value which can be overridden if more complex logic runs on L2.\n uint32 internal constant DEFAULT_FINALIZE_DEPOSIT_L2_GAS = 1200000;\n\n /**\n * @dev Core logic to be performed when a withdrawal is finalized on L1.\n * In most cases, this will simply send locked funds to the withdrawer.\n *\n * param _to Address being withdrawn to.\n * param _amount Amount being withdrawn.\n */\n function _handleFinalizeWithdrawal(\n address, // _to,\n uint256 // _amount\n )\n internal\n virtual\n {\n revert(\"Implement me in child contracts\");\n }\n\n /**\n * @dev Core logic to be performed when a deposit is initiated on L1.\n * In most cases, this will simply send locked funds to the withdrawer.\n *\n * param _from Address being deposited from on L1.\n * param _to Address being deposited into on L2.\n * param _amount Amount being deposited.\n */\n function _handleInitiateDeposit(\n address, // _from,\n address, // _to,\n uint256 // _amount\n )\n internal\n virtual\n {\n revert(\"Implement me in child contracts\");\n }\n\n /**\n * @dev Overridable getter for the L2 gas limit, in the case it may be\n * dynamic, and the above public constant does not suffice.\n *\n */\n function getFinalizeDepositL2Gas()\n public\n view\n virtual\n returns(\n uint32\n )\n {\n return DEFAULT_FINALIZE_DEPOSIT_L2_GAS;\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 virtual\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 virtual\n {\n _initiateDeposit(msg.sender, _to, _amount);\n }\n\n /**\n * @dev Performs the logic for deposits by informing the L2 Deposited Token\n * contract of the deposit and calling a handler to lock the L1 funds. (e.g. transferFrom)\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 // Call our deposit accounting handler implemented by child contracts.\n _handleInitiateDeposit(\n _from,\n _to,\n _amount\n );\n\n // Construct calldata for l2DepositedToken.finalizeDeposit(_to, _amount)\n bytes memory data = abi.encodeWithSelector(\n iOVM_L2DepositedToken.finalizeDeposit.selector,\n _to,\n _amount\n );\n\n // Send calldata into L2\n sendCrossDomainMessage(\n l2DepositedToken,\n data,\n getFinalizeDepositL2Gas()\n );\n\n emit DepositInitiated(_from, _to, _amount);\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 uint _amount\n )\n external\n override\n virtual\n onlyFromCrossDomainAccount(l2DepositedToken)\n {\n // Call our withdrawal accounting handler implemented by child contracts.\n _handleFinalizeWithdrawal(\n _to,\n _amount\n );\n\n emit WithdrawalFinalized(_to, _amount);\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_L1TokenGateway } from \"../../../iOVM/bridge/tokens/iOVM_L1TokenGateway.sol\";\nimport { Abs_L1TokenGateway } from \"./Abs_L1TokenGateway.sol\";\nimport { iOVM_ERC20 } from \"../../../iOVM/predeploys/iOVM_ERC20.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 * NOTE: This contract extends Abs_L1TokenGateway, which is where we\n * takes care of most of the initialization and the cross-chain logic.\n * If you are looking to implement your own deposit/withdrawal contracts, you\n * may also want to extend the abstract contract in a similar manner.\n *\n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_L1ERC20Gateway is Abs_L1TokenGateway {\n\n /********************************\n * External Contract References *\n ********************************/\n\n iOVM_ERC20 public l1ERC20;\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 */\n constructor(\n iOVM_ERC20 _l1ERC20,\n address _l2DepositedERC20,\n address _l1messenger\n )\n Abs_L1TokenGateway(\n _l2DepositedERC20,\n _l1messenger\n )\n {\n l1ERC20 = _l1ERC20;\n }\n\n\n /**************\n * Accounting *\n **************/\n\n /**\n * @dev When a deposit is initiated on L1, the L1 Gateway\n * transfers the funds to itself for future withdrawals\n *\n * @param _from L1 address ETH is being deposited from\n * param _to L2 address that the ETH is being deposited to\n * @param _amount Amount of ERC20 to send\n */\n function _handleInitiateDeposit(\n address _from,\n address, // _to,\n uint256 _amount\n )\n internal\n override\n {\n // Hold on to the newly deposited funds\n l1ERC20.transferFrom(\n _from,\n address(this),\n _amount\n );\n }\n\n /**\n * @dev When a withdrawal is finalized on L1, the L1 Gateway\n * transfers the funds to the withdrawer\n *\n * @param _to L1 address that the ERC20 is being withdrawn to\n * @param _amount Amount of ERC20 to send\n */\n function _handleFinalizeWithdrawal(\n address _to,\n uint _amount\n )\n internal\n override\n {\n // Transfer withdrawn funds out to withdrawer\n l1ERC20.transfer(_to, _amount);\n }\n}\n" - }, - "contracts/optimistic-ethereum/iOVM/predeploys/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/messaging/OVM_L1MultiMessageRelayer.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_L1CrossDomainMessenger } from \"../../../iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol\";\nimport { iOVM_L1MultiMessageRelayer } from \"../../../iOVM/bridge/messaging/iOVM_L1MultiMessageRelayer.sol\";\n\n/* Library Imports */\nimport { Lib_AddressResolver } from \"../../../libraries/resolver/Lib_AddressResolver.sol\";\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\n /**\n * @param _libAddressManager Address of the Address Manager.\n */\n constructor(\n address _libAddressManager\n )\n Lib_AddressResolver(_libAddressManager)\n {}\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 /********************\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(\n L2ToL1Message[] calldata _messages\n ) \n override\n external\n onlyBatchRelayer\n {\n iOVM_L1CrossDomainMessenger messenger = iOVM_L1CrossDomainMessenger(\n resolve(\"Proxy__OVM_L1CrossDomainMessenger\")\n );\n\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/messaging/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/messaging/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 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/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/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 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() {}\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/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 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/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 abi.encodePacked(\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/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 // 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 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 payable\n {\n address target = addressManager[address(this)].getAddress(\n (implementationName[address(this)])\n );\n\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_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/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* External Imports */\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\n\n/**\n * @title OVM_GasPriceOracle\n * @dev This contract exposes the current l2 gas price, a measure of how congested the network\n * currently is. This measure is used by the Sequencer to determine what fee to charge for\n * transactions. When the system is more congested, the l2 gas price will increase and fees\n * will also increase as a result.\n *\n * Compiler used: optimistic-solc\n * Runtime target: OVM\n */\ncontract OVM_GasPriceOracle is Ownable {\n\n /*************\n * Variables *\n *************/\n\n // Current l2 gas price\n uint256 public gasPrice;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _owner Address that will initially own this contract.\n */\n constructor(\n address _owner,\n uint256 _initialGasPrice\n )\n Ownable()\n {\n setGasPrice(_initialGasPrice);\n transferOwnership(_owner);\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Allows the owner to modify the l2 gas price.\n * @param _gasPrice New l2 gas price.\n */\n function setGasPrice(\n uint256 _gasPrice\n )\n public\n onlyOwner\n {\n gasPrice = _gasPrice;\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/codec/TestLib_EIP155Tx.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_EIP155Tx } from \"../../optimistic-ethereum/libraries/codec/Lib_EIP155Tx.sol\";\n\n/**\n * @title TestLib_EIP155Tx\n */\ncontract TestLib_EIP155Tx {\n function decode(\n bytes memory _encoded,\n uint256 _chainId\n )\n public\n pure\n returns (\n Lib_EIP155Tx.EIP155Tx memory\n )\n {\n return Lib_EIP155Tx.decode(\n _encoded,\n _chainId\n );\n }\n\n function encode(\n Lib_EIP155Tx.EIP155Tx memory _transaction,\n bool _includeSignature\n )\n public\n pure\n returns (\n bytes memory\n )\n {\n return Lib_EIP155Tx.encode(\n _transaction,\n _includeSignature\n );\n }\n\n function hash(\n Lib_EIP155Tx.EIP155Tx memory _transaction\n )\n public\n pure\n returns (\n bytes32\n )\n {\n return Lib_EIP155Tx.hash(\n _transaction\n );\n }\n\n function sender(\n Lib_EIP155Tx.EIP155Tx memory _transaction\n )\n public\n pure\n returns (\n address\n )\n {\n return Lib_EIP155Tx.sender(\n _transaction\n );\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/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 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/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 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_Proposer\");\n }\n\n function getGasSpent(\n bytes32, // _preStateRoot,\n address // _who\n )\n override\n public\n pure\n returns (\n uint256\n )\n {\n return 0;\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_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 pure\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/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 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/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 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_Proposer\");\n }\n\n function getGasSpent(\n bytes32, // _preStateRoot,\n address // _who\n )\n override\n public\n pure\n returns (\n uint256\n )\n {\n return 0;\n }\n}\n" } }, "settings": { diff --git a/packages/contracts/src/connect-contracts.ts b/packages/contracts/src/connect-contracts.ts index d68ae07b7bb1..48fab726653a 100644 --- a/packages/contracts/src/connect-contracts.ts +++ b/packages/contracts/src/connect-contracts.ts @@ -8,11 +8,9 @@ interface L1Contracts { canonicalTransactionChain: Contract executionManager: Contract fraudVerifier: Contract - ethGateway: Contract multiMessageRelayer: Contract stateCommitmentChain: Contract xDomainMessengerProxy: Contract - l1EthGatewayProxy: Contract bondManager: Contract } @@ -74,7 +72,6 @@ export const connectL1Contracts = async ( ), executionManager: toEthersContract(l1ContractData.OVM_ExecutionManager), fraudVerifier: toEthersContract(l1ContractData.OVM_FraudVerifier), - ethGateway: toEthersContract(l1ContractData.OVM_L1ETHGateway), multiMessageRelayer: toEthersContract( l1ContractData.OVM_L1MultiMessageRelayer ), @@ -84,7 +81,6 @@ export const connectL1Contracts = async ( xDomainMessengerProxy: toEthersContract( l1ContractData.Proxy__OVM_L1CrossDomainMessenger ), - l1EthGatewayProxy: toEthersContract(l1ContractData.Proxy__OVM_L1ETHGateway), // TODO: update this with actual bond manager when its ready bondManager: toEthersContract(l1ContractData.mockOVM_BondManager), } diff --git a/packages/contracts/src/contract-data.ts b/packages/contracts/src/contract-data.ts index c81e80f2430c..d8e025c64c1b 100644 --- a/packages/contracts/src/contract-data.ts +++ b/packages/contracts/src/contract-data.ts @@ -13,14 +13,12 @@ const Mainnet__OVM_CanonicalTransactionChain = require('../deployments/mainnet/O const Mainnet__OVM_ExecutionManager = require('../deployments/mainnet/OVM_ExecutionManager.json') const Mainnet__OVM_FraudVerifier = require('../deployments/mainnet/OVM_FraudVerifier.json') const Mainnet__OVM_L1CrossDomainMessenger = require('../deployments/mainnet/OVM_L1CrossDomainMessenger.json') -const Mainnet__OVM_L1ETHGateway = require('../deployments/mainnet/OVM_L1ETHGateway.json') const Mainnet__OVM_L1MultiMessageRelayer = require('../deployments/mainnet/OVM_L1MultiMessageRelayer.json') const Mainnet__OVM_SafetyChecker = require('../deployments/mainnet/OVM_SafetyChecker.json') const Mainnet__OVM_StateCommitmentChain = require('../deployments/mainnet/OVM_StateCommitmentChain.json') const Mainnet__OVM_StateManagerFactory = require('../deployments/mainnet/OVM_StateManagerFactory.json') const Mainnet__OVM_StateTransitionerFactory = require('../deployments/mainnet/OVM_StateTransitionerFactory.json') const Mainnet__Proxy__OVM_L1CrossDomainMessenger = require('../deployments/mainnet/Proxy__OVM_L1CrossDomainMessenger.json') -const Mainnet__Proxy__OVM_L1ETHGateway = require('../deployments/mainnet/Proxy__OVM_L1ETHGateway.json') const Mainnet__mockOVM_BondManager = require('../deployments/mainnet/mockOVM_BondManager.json') const Kovan__Lib_AddressManager = require('../deployments/kovan/Lib_AddressManager.json') @@ -28,14 +26,12 @@ const Kovan__OVM_CanonicalTransactionChain = require('../deployments/kovan/OVM_C const Kovan__OVM_ExecutionManager = require('../deployments/kovan/OVM_ExecutionManager.json') const Kovan__OVM_FraudVerifier = require('../deployments/kovan/OVM_FraudVerifier.json') const Kovan__OVM_L1CrossDomainMessenger = require('../deployments/kovan/OVM_L1CrossDomainMessenger.json') -const Kovan__OVM_L1ETHGateway = require('../deployments/kovan/OVM_L1ETHGateway.json') const Kovan__OVM_L1MultiMessageRelayer = require('../deployments/kovan/OVM_L1MultiMessageRelayer.json') const Kovan__OVM_SafetyChecker = require('../deployments/kovan/OVM_SafetyChecker.json') const Kovan__OVM_StateCommitmentChain = require('../deployments/kovan/OVM_StateCommitmentChain.json') const Kovan__OVM_StateManagerFactory = require('../deployments/kovan/OVM_StateManagerFactory.json') const Kovan__OVM_StateTransitionerFactory = require('../deployments/kovan/OVM_StateTransitionerFactory.json') const Kovan__Proxy__OVM_L1CrossDomainMessenger = require('../deployments/kovan/Proxy__OVM_L1CrossDomainMessenger.json') -const Kovan__Proxy__OVM_L1ETHGateway = require('../deployments/kovan/Proxy__OVM_L1ETHGateway.json') const Kovan__mockOVM_BondManager = require('../deployments/kovan/mockOVM_BondManager.json') const Goerli__Lib_AddressManager = require('../deployments/goerli/Lib_AddressManager.json') @@ -43,14 +39,12 @@ const Goerli__OVM_CanonicalTransactionChain = require('../deployments/goerli/OVM const Goerli__OVM_ExecutionManager = require('../deployments/goerli/OVM_ExecutionManager.json') const Goerli__OVM_FraudVerifier = require('../deployments/goerli/OVM_FraudVerifier.json') const Goerli__OVM_L1CrossDomainMessenger = require('../deployments/goerli/OVM_L1CrossDomainMessenger.json') -const Goerli__OVM_L1ETHGateway = require('../deployments/goerli/OVM_L1ETHGateway.json') const Goerli__OVM_L1MultiMessageRelayer = require('../deployments/goerli/OVM_L1MultiMessageRelayer.json') const Goerli__OVM_SafetyChecker = require('../deployments/goerli/OVM_SafetyChecker.json') const Goerli__OVM_StateCommitmentChain = require('../deployments/goerli/OVM_StateCommitmentChain.json') const Goerli__OVM_StateManagerFactory = require('../deployments/goerli/OVM_StateManagerFactory.json') const Goerli__OVM_StateTransitionerFactory = require('../deployments/goerli/OVM_StateTransitionerFactory.json') const Goerli__Proxy__OVM_L1CrossDomainMessenger = require('../deployments/goerli/Proxy__OVM_L1CrossDomainMessenger.json') -const Goerli__Proxy__OVM_L1ETHGateway = require('../deployments/goerli/Proxy__OVM_L1ETHGateway.json') const Goerli__mockOVM_BondManager = require('../deployments/goerli/mockOVM_BondManager.json') export const getL1ContractData = (network: Network) => { @@ -80,11 +74,6 @@ export const getL1ContractData = (network: Network) => { kovan: Kovan__OVM_L1CrossDomainMessenger, goerli: Goerli__OVM_L1CrossDomainMessenger, }[network], - OVM_L1ETHGateway: { - mainnet: Mainnet__OVM_L1ETHGateway, - kovan: Kovan__OVM_L1ETHGateway, - goerli: Goerli__OVM_L1ETHGateway, - }[network], OVM_L1MultiMessageRelayer: { mainnet: Mainnet__OVM_L1MultiMessageRelayer, kovan: Kovan__OVM_L1MultiMessageRelayer, @@ -115,11 +104,6 @@ export const getL1ContractData = (network: Network) => { kovan: Kovan__Proxy__OVM_L1CrossDomainMessenger, goerli: Goerli__Proxy__OVM_L1CrossDomainMessenger, }[network], - Proxy__OVM_L1ETHGateway: { - mainnet: Mainnet__Proxy__OVM_L1ETHGateway, - kovan: Kovan__Proxy__OVM_L1ETHGateway, - goerli: Goerli__Proxy__OVM_L1ETHGateway, - }[network], mockOVM_BondManager: { mainnet: Mainnet__mockOVM_BondManager, kovan: Kovan__mockOVM_BondManager, diff --git a/packages/contracts/test/connect-contracts.spec.ts b/packages/contracts/test/connect-contracts.spec.ts index fdf5684507d6..ed2d7c762e34 100644 --- a/packages/contracts/test/connect-contracts.spec.ts +++ b/packages/contracts/test/connect-contracts.spec.ts @@ -13,11 +13,9 @@ describe('connectL1Contracts', () => { 'canonicalTransactionChain', 'executionManager', 'fraudVerifier', - 'ethGateway', 'multiMessageRelayer', 'stateCommitmentChain', 'xDomainMessengerProxy', - 'l1EthGatewayProxy', 'bondManager', ] From 40b99a6ed4de28fd8481c77c546bf4a68ea2d993 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Wed, 23 Jun 2021 09:23:04 -0700 Subject: [PATCH 121/125] feat: `rollup gasPrices` RPC endpoint (#1136) * feature: l2geth endpoint * chore: add changeset Co-authored-by: Liam Horne --- .changeset/little-badgers-hammer.md | 6 ++++++ integration-tests/test/rpc.spec.ts | 11 +++++++++++ integration-tests/test/shared/env.ts | 9 ++++++++- l2geth/internal/ethapi/api.go | 21 +++++++++++++++++++++ 4 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 .changeset/little-badgers-hammer.md diff --git a/.changeset/little-badgers-hammer.md b/.changeset/little-badgers-hammer.md new file mode 100644 index 000000000000..2c0beafb1d23 --- /dev/null +++ b/.changeset/little-badgers-hammer.md @@ -0,0 +1,6 @@ +--- +'@eth-optimism/integration-tests': patch +'@eth-optimism/l2geth': patch +--- + +Add new RPC endpoint `rollup_gasPrices` diff --git a/integration-tests/test/rpc.spec.ts b/integration-tests/test/rpc.spec.ts index 29a816cf9659..122740747bff 100644 --- a/integration-tests/test/rpc.spec.ts +++ b/integration-tests/test/rpc.spec.ts @@ -426,4 +426,15 @@ describe('Basic RPC tests', () => { .reverted }) }) + + describe('rollup_gasPrices', () => { + it('should return the L1 and L2 gas prices', async () => { + const result = await provider.send('rollup_gasPrices', []); + const l1GasPrice = await env.l1Wallet.provider.getGasPrice() + const l2GasPrice = await env.gasPriceOracle.gasPrice() + + expect(BigNumber.from(result.l1GasPrice)).to.deep.eq(l1GasPrice) + expect((BigNumber.from(result.l2GasPrice))).to.deep.eq(l2GasPrice) + }) + }) }) diff --git a/integration-tests/test/shared/env.ts b/integration-tests/test/shared/env.ts index 4b4f29e5071f..9da4690cf7aa 100644 --- a/integration-tests/test/shared/env.ts +++ b/integration-tests/test/shared/env.ts @@ -1,4 +1,4 @@ -import { getContractFactory } from '@eth-optimism/contracts' +import { getContractFactory, predeploys } from '@eth-optimism/contracts' import { Watcher } from '@eth-optimism/core-utils' import { Contract, utils, Wallet } from 'ethers' import { @@ -32,6 +32,7 @@ export class OptimismEnv { ovmEth: Contract l2Bridge: Contract l2Messenger: Contract + gasPriceOracle: Contract // The L1 <> L2 State watcher watcher: Watcher @@ -47,6 +48,7 @@ export class OptimismEnv { this.ovmEth = args.ovmEth this.l2Bridge = args.l2Bridge this.l2Messenger = args.l2Messenger + this.gasPriceOracle = args.gasPriceOracle this.watcher = args.watcher this.l1Wallet = args.l1Wallet this.l2Wallet = args.l2Wallet @@ -79,12 +81,17 @@ export class OptimismEnv { .connect(l1Wallet) .attach(ctcAddress) + const gasPriceOracle = getContractFactory('OVM_GasPriceOracle') + .connect(l2Wallet) + .attach(predeploys.OVM_GasPriceOracle) + return new OptimismEnv({ addressManager, l1Bridge, ctc, l1Messenger, ovmEth, + gasPriceOracle, l2Bridge, l2Messenger, watcher, diff --git a/l2geth/internal/ethapi/api.go b/l2geth/internal/ethapi/api.go index a8b3852c6e14..097a8e16b3c0 100644 --- a/l2geth/internal/ethapi/api.go +++ b/l2geth/internal/ethapi/api.go @@ -1983,6 +1983,27 @@ func (api *PublicRollupAPI) GetInfo(ctx context.Context) rollupInfo { } } +type gasPrices struct { + L1GasPrice *hexutil.Big `json:"l1GasPrice"` + L2GasPrice *hexutil.Big `json:"l2GasPrice"` +} + +// GasPrices returns the L1 and L2 gas price known by the node +func (api *PublicRollupAPI) GasPrices(ctx context.Context) (*gasPrices, error) { + l1GasPrice, err := api.b.SuggestL1GasPrice(ctx) + if err != nil { + return nil, err + } + l2GasPrice, err := api.b.SuggestL2GasPrice(ctx) + if err != nil { + return nil, err + } + return &gasPrices{ + L1GasPrice: (*hexutil.Big)(l1GasPrice), + L2GasPrice: (*hexutil.Big)(l2GasPrice), + }, nil +} + // PrivatelRollupAPI provides private RPC methods to control the sequencer. // These methods can be abused by external users and must be considered insecure for use by untrusted users. type PrivateRollupAPI struct { From 0112650986a5c8c65ad0765741157f0ac1351ff6 Mon Sep 17 00:00:00 2001 From: Matt Masurka Date: Wed, 23 Jun 2021 11:11:47 -0700 Subject: [PATCH 122/125] Adds l2 standard bridge to contracts markdown file (#1151) --- packages/contracts/deployments/README.md | 1 + .../contracts/scripts/generate-markdown.js | 89 ++++++++++--------- 2 files changed, 47 insertions(+), 43 deletions(-) diff --git a/packages/contracts/deployments/README.md b/packages/contracts/deployments/README.md index 85e9b2e03c92..e9ad554bd658 100644 --- a/packages/contracts/deployments/README.md +++ b/packages/contracts/deployments/README.md @@ -11,6 +11,7 @@ |Contract|Address| |--|--| |OVM_ETH: | `0x4200000000000000000000000000000000000006` +|OVM_L2StandardBridge: | `0x4200000000000000000000000000000000000010` |OVM_L2CrossDomainMessenger: | `0x4200000000000000000000000000000000000007` |OVM_L2ToL1MessagePasser: | `0x4200000000000000000000000000000000000000` |OVM_L1MessageSender: | `0x4200000000000000000000000000000000000001` diff --git a/packages/contracts/scripts/generate-markdown.js b/packages/contracts/scripts/generate-markdown.js index 16c73ca1077a..0110cfac1dc7 100644 --- a/packages/contracts/scripts/generate-markdown.js +++ b/packages/contracts/scripts/generate-markdown.js @@ -1,6 +1,6 @@ #!/usr/bin/env node -const dirtree = require("directory-tree"); -const fs = require("fs"); +const dirtree = require('directory-tree') +const fs = require('fs') /** * @@ -9,22 +9,22 @@ const fs = require("fs"); */ const networks = { - 1: "mainnet", - 3: "ropsten", - 4: "rinkeby", - 5: "goerli", - 42: "kovan", -}; + 1: 'mainnet', + 3: 'ropsten', + 4: 'rinkeby', + 5: 'goerli', + 42: 'kovan', +} -(async () => { - console.log(`Writing contract addresses`); +;(async () => { + console.log(`Writing contract addresses`) const deployments = dirtree(`./deployments`) .children.filter((child) => { - return child.type === "directory"; + return child.type === 'directory' }) .map((d) => d.name) - .reverse(); + .reverse() let md = `# Optimism Regenesis Deployments ## LAYER 2 @@ -39,6 +39,7 @@ const networks = { |Contract|Address| |--|--| |OVM_ETH: | \`0x4200000000000000000000000000000000000006\` +|OVM_L2StandardBridge: | \`0x4200000000000000000000000000000000000010\` |OVM_L2CrossDomainMessenger: | \`0x4200000000000000000000000000000000000007\` |OVM_L2ToL1MessagePasser: | \`0x4200000000000000000000000000000000000000\` |OVM_L1MessageSender: | \`0x4200000000000000000000000000000000000001\` @@ -51,62 +52,64 @@ const networks = { --- --- -## LAYER 1\n\n`; +## LAYER 1\n\n` - for (let deployment of deployments) { - md += `## ${deployment.toUpperCase()}\n\n`; + for (const deployment of deployments) { + md += `## ${deployment.toUpperCase()}\n\n` const chainId = Number( fs.readFileSync(`./deployments/${deployment}/.chainId`) - ); - const network = networks[chainId]; + ) + const network = networks[chainId] - md += `Network : __${network} (chain id: ${chainId})__\n\n`; + md += `Network : __${network} (chain id: ${chainId})__\n\n` - md += `|Contract|Address|\n`; - md += `|--|--|\n`; + md += `|Contract|Address|\n` + md += `|--|--|\n` const contracts = dirtree(`./deployments/${deployment}`) .children.filter((child) => { - return child.extension === ".json"; + return child.extension === '.json' }) .map((child) => { - return child.name.replace(".json", ""); - }); + return child.name.replace('.json', '') + }) - proxiedContracts = []; + proxiedContracts = [] for (let i = 0; i < contracts.length; i++) { - if (contracts[i] == 'OVM_L1CrossDomainMessenger') - proxiedContracts.push(contracts.splice(i, 1)[0]); - if (contracts[i] == 'OVM_L1ETHGateway') - proxiedContracts.push(contracts.splice(i, 1)[0]); + if (contracts[i] == 'OVM_L1CrossDomainMessenger') { + proxiedContracts.push(contracts.splice(i, 1)[0]) + } + if (contracts[i] == 'OVM_L1ETHGateway') { + proxiedContracts.push(contracts.splice(i, 1)[0]) + } } for (const contract of contracts) { - const colonizedName = contract.split(':').join('-'); + const colonizedName = contract.split(':').join('-') - const deploymentInfo = require(`../deployments/${deployment}/${contract}.json`); + const deploymentInfo = require(`../deployments/${deployment}/${contract}.json`) - const escPrefix = chainId !== 1 ? `${network}.` : ""; - const etherscanUrl = `https://${escPrefix}etherscan.io/address/${deploymentInfo.address}`; - md += `|${colonizedName}|[${deploymentInfo.address}](${etherscanUrl})|\n`; + const escPrefix = chainId !== 1 ? `${network}.` : '' + const etherscanUrl = `https://${escPrefix}etherscan.io/address/${deploymentInfo.address}` + md += `|${colonizedName}|[${deploymentInfo.address}](${etherscanUrl})|\n` } - md += `\n`; - md += `---\n`; + md += `-->\n` + md += `---\n` } - fs.writeFileSync(`./deployments/README.md`, md); -})().catch(console.error); + fs.writeFileSync(`./deployments/README.md`, md) +})().catch(console.error) From 095ce8c7de9e9799750dfaadca5889deb9a3d5e6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 23 Jun 2021 15:47:55 -0400 Subject: [PATCH 123/125] Version Packages (#1150) Co-authored-by: github-actions[bot] --- .changeset/little-badgers-hammer.md | 6 ------ .changeset/warm-dancers-switch.md | 5 ----- integration-tests/CHANGELOG.md | 6 ++++++ integration-tests/package.json | 4 ++-- l2geth/CHANGELOG.md | 6 ++++++ l2geth/package.json | 2 +- packages/contracts/CHANGELOG.md | 6 ++++++ packages/contracts/package.json | 2 +- 8 files changed, 22 insertions(+), 15 deletions(-) delete mode 100644 .changeset/little-badgers-hammer.md delete mode 100644 .changeset/warm-dancers-switch.md diff --git a/.changeset/little-badgers-hammer.md b/.changeset/little-badgers-hammer.md deleted file mode 100644 index 2c0beafb1d23..000000000000 --- a/.changeset/little-badgers-hammer.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@eth-optimism/integration-tests': patch -'@eth-optimism/l2geth': patch ---- - -Add new RPC endpoint `rollup_gasPrices` diff --git a/.changeset/warm-dancers-switch.md b/.changeset/warm-dancers-switch.md deleted file mode 100644 index d420f4ca61e8..000000000000 --- a/.changeset/warm-dancers-switch.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@eth-optimism/contracts': patch ---- - -Add 0.4.0 deployment artifacts diff --git a/integration-tests/CHANGELOG.md b/integration-tests/CHANGELOG.md index 80029d217be2..723c586e379d 100644 --- a/integration-tests/CHANGELOG.md +++ b/integration-tests/CHANGELOG.md @@ -1,5 +1,11 @@ # @eth-optimism/integration-tests +## 0.1.1 + +### Patch Changes + +- 40b99a6e: Add new RPC endpoint `rollup_gasPrices` + ## 0.1.0 ### Minor Changes diff --git a/integration-tests/package.json b/integration-tests/package.json index c59b9ae426db..a17433a472b5 100644 --- a/integration-tests/package.json +++ b/integration-tests/package.json @@ -1,6 +1,6 @@ { "name": "@eth-optimism/integration-tests", - "version": "0.1.0", + "version": "0.1.1", "description": "[Optimism] Integration Tests", "private": true, "author": "Optimism PBC", @@ -17,7 +17,7 @@ "clean": "rimraf cache artifacts artifacts-ovm cache-ovm" }, "devDependencies": { - "@eth-optimism/contracts": "^0.4.0", + "@eth-optimism/contracts": "^0.4.1", "@eth-optimism/core-utils": "^0.4.6", "@eth-optimism/hardhat-ovm": "^0.2.2", "@ethersproject/providers": "^5.0.24", diff --git a/l2geth/CHANGELOG.md b/l2geth/CHANGELOG.md index a73773b63dbc..15136ed6a93c 100644 --- a/l2geth/CHANGELOG.md +++ b/l2geth/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 0.4.1 + +### Patch Changes + +- 40b99a6e: Add new RPC endpoint `rollup_gasPrices` + ## 0.4.0 ### Minor Changes diff --git a/l2geth/package.json b/l2geth/package.json index eda61b932e12..153ff28abc91 100644 --- a/l2geth/package.json +++ b/l2geth/package.json @@ -1,6 +1,6 @@ { "name": "@eth-optimism/l2geth", - "version": "0.4.0", + "version": "0.4.1", "private": true, "devDependencies": {} } diff --git a/packages/contracts/CHANGELOG.md b/packages/contracts/CHANGELOG.md index 1bd6c17ad6a2..0c56b8d3a0fa 100644 --- a/packages/contracts/CHANGELOG.md +++ b/packages/contracts/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 0.4.1 + +### Patch Changes + +- 98e02cfa: Add 0.4.0 deployment artifacts + ## 0.4.0 ### Minor Changes diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 0d692f4b9a86..4483255d97f2 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -1,6 +1,6 @@ { "name": "@eth-optimism/contracts", - "version": "0.4.0", + "version": "0.4.1", "main": "dist/index", "files": [ "dist/**/*.js", From 0c98b04aa3bfa804429ed00da29b6350e4a90fe1 Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Wed, 23 Jun 2021 16:16:26 -0400 Subject: [PATCH 124/125] Add more info about our branching strategy to the README (#1114) * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md --- README.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/README.md b/README.md index 0f4d185446df..dc179472a6e7 100644 --- a/README.md +++ b/README.md @@ -174,6 +174,49 @@ yarn build:integration yarn test:integration ``` +## Branching Model and Releases + + + +### Active Branches + +| Branch | Status | +| --------------- | -------------------------------------------------------------------------------- | +| [master](https://github.com/ethereum-optimism/optimism/tree/master/) | Accepts PRs from `develop` when we intend to deploy to mainnet. | +| [develop](https://github.com/ethereum-optimism/optimism/tree/develop/) | Accepts PRs that are compatible with `master` OR from `regenesis/X.X.X` branches. | +| regenesis/X.X.X | Accepts PRs for all changes, particularly those not backwards compatible with `develop` and `master`. | + +### Overview + +We generally follow [this Git branching model](https://nvie.com/posts/a-successful-git-branching-model/). +Please read the linked post if you're planning to make frequent PRs into this repository (e.g., people working at/with Optimism). + +### The `master` branch + +The `master` branch contains the code for our latest "stable" releases. +Updates from `master` always come from the `develop` branch. +We only ever update the `master` branch when we intend to deploy code within the `develop` to the Optimistic Ethereum mainnet. +Our update process takes the form of a PR merging the `develop` branch into the `master` branch. + +### The `develop` branch + +Our primary development branch is [`develop`](https://github.com/ethereum-optimism/optimism/tree/develop/). +`develop` contains the most up-to-date software that remains backwards compatible with our latest experimental [network deployments](https://community.optimism.io/docs/developers/networks.html). +If you're making a backwards compatible change, please direct your pull request towards `develop`. + +**Changes to contracts within `packages/contracts/contracts/optimistic-ethereum` are usually NOT considered backwards compatible and SHOULD be made against a release candidate branch**. +Some exceptions to this rule exist for cases in which we absolutely must deploy some new contract after a release candidate branch has already been fully deployed. +If you're changing or adding a contract and you're unsure about which branch to make a PR into, default to using the latest release candidate branch. +See below for info about release candidate branches. + +### Release candidate branches + +Branches marked `regenesis/X.X.X` are **release candidate branches**. +Changes that are not backwards compatible and all changes to contracts within `packages/contracts/contracts/optimistic-ethereum` MUST be directed towards a release candidate branch. +Release candidates are merged into `develop` and then into `master` once they've been fully deployed. +We may sometimes have more than one active `regenesis/X.X.X` branch if we're in the middle of a deployment. +See table in the **Active Branches** section above to find the right branch to target. + ## Additional Reference Material ### Running contract static analysis From e6e85a6220de0c4e1d28749bc4b1d27d4dd7e4c1 Mon Sep 17 00:00:00 2001 From: Elena Gesheva Date: Wed, 23 Jun 2021 23:20:51 +0300 Subject: [PATCH 125/125] Remove references to OVM_L1ETHGateway in deployments and readme (#1119) --- packages/contracts/deployments/README.md | 155 +++++---- .../deployments/kovan/OVM_L1ETHGateway.json | 293 ------------------ .../kovan/Proxy__OVM_L1ETHGateway.json | 118 ------- 3 files changed, 77 insertions(+), 489 deletions(-) delete mode 100644 packages/contracts/deployments/kovan/OVM_L1ETHGateway.json delete mode 100644 packages/contracts/deployments/kovan/Proxy__OVM_L1ETHGateway.json diff --git a/packages/contracts/deployments/README.md b/packages/contracts/deployments/README.md index e9ad554bd658..6c58787db86e 100644 --- a/packages/contracts/deployments/README.md +++ b/packages/contracts/deployments/README.md @@ -8,18 +8,18 @@ *The contracts relevant for the majority of developers are `OVM_ETH` and the cross-domain messengers. The L2 addresses don't change.* ### Predeploy contracts: -|Contract|Address| -|--|--| -|OVM_ETH: | `0x4200000000000000000000000000000000000006` -|OVM_L2StandardBridge: | `0x4200000000000000000000000000000000000010` -|OVM_L2CrossDomainMessenger: | `0x4200000000000000000000000000000000000007` -|OVM_L2ToL1MessagePasser: | `0x4200000000000000000000000000000000000000` -|OVM_L1MessageSender: | `0x4200000000000000000000000000000000000001` -|OVM_DeployerWhitelist: | `0x4200000000000000000000000000000000000002` -|OVM_ECDSAContractAccount: | `0x4200000000000000000000000000000000000003` -|OVM_SequencerEntrypoint: | `0x4200000000000000000000000000000000000005` -|Lib_AddressManager: | `0x4200000000000000000000000000000000000008` -|ERC1820Registry: | `0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24` +| Contract | Address | +| --------------------------- | -------------------------------------------- | +| OVM_ETH: | `0x4200000000000000000000000000000000000006` | +| OVM_L2StandardBridge: | `0x4200000000000000000000000000000000000010` | +| OVM_L2CrossDomainMessenger: | `0x4200000000000000000000000000000000000007` | +| OVM_L2ToL1MessagePasser: | `0x4200000000000000000000000000000000000000` | +| OVM_L1MessageSender: | `0x4200000000000000000000000000000000000001` | +| OVM_DeployerWhitelist: | `0x4200000000000000000000000000000000000002` | +| OVM_ECDSAContractAccount: | `0x4200000000000000000000000000000000000003` | +| OVM_SequencerEntrypoint: | `0x4200000000000000000000000000000000000005` | +| Lib_AddressManager: | `0x4200000000000000000000000000000000000008` | +| ERC1820Registry: | `0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24` | --- --- @@ -30,9 +30,9 @@ Network : __undefined (chain id: 69)__ -|Contract|Address| -|--|--| -|OVM_GasPriceOracle|[0x038a8825A3C3B0c08d52Cc76E5E361953Cf6Dc76](https://undefined.etherscan.io/address/0x038a8825A3C3B0c08d52Cc76E5E361953Cf6Dc76)| +| Contract | Address | +| ------------------ | ------------------------------------------------------------------------------------------------------------------------------- | +| OVM_GasPriceOracle | [0x038a8825A3C3B0c08d52Cc76E5E361953Cf6Dc76](https://undefined.etherscan.io/address/0x038a8825A3C3B0c08d52Cc76E5E361953Cf6Dc76) | --- ## KOVAN Network : __kovan (chain id: 42)__ -|Contract|Address| -|--|--| -|Lib_AddressManager|[0x100Dd3b414Df5BbA2B542864fF94aF8024aFdf3a](https://kovan.etherscan.io/address/0x100Dd3b414Df5BbA2B542864fF94aF8024aFdf3a)| -|OVM_CanonicalTransactionChain|[0xe28c499EB8c36C0C18d1bdCdC47a51585698cb93](https://kovan.etherscan.io/address/0xe28c499EB8c36C0C18d1bdCdC47a51585698cb93)| -|OVM_ChainStorageContainer-CTC-batches|[0xF95D79298FD12e5ED778CCf717aA30f638b060E1](https://kovan.etherscan.io/address/0xF95D79298FD12e5ED778CCf717aA30f638b060E1)| -|OVM_ChainStorageContainer-CTC-queue|[0x2BE00E5F043a0f62c3e4d775F3235E28A0239395](https://kovan.etherscan.io/address/0x2BE00E5F043a0f62c3e4d775F3235E28A0239395)| -|OVM_ChainStorageContainer-SCC-batches|[0x50DA41A2A185fb917aecEFfa1CB4534dC5C264b4](https://kovan.etherscan.io/address/0x50DA41A2A185fb917aecEFfa1CB4534dC5C264b4)| -|OVM_ExecutionManager|[0xC68795aC9d96374eaE746DAcC1334ba54798e17D](https://kovan.etherscan.io/address/0xC68795aC9d96374eaE746DAcC1334ba54798e17D)| -|OVM_FraudVerifier|[0xaeEd60e029Eb435f960d78C355786060589738B3](https://kovan.etherscan.io/address/0xaeEd60e029Eb435f960d78C355786060589738B3)| -|OVM_L1MultiMessageRelayer|[0x5818840763Ee28ff0A3E3e8CB9eDeDd07Fb1Cd3f](https://kovan.etherscan.io/address/0x5818840763Ee28ff0A3E3e8CB9eDeDd07Fb1Cd3f)| -|OVM_SafetyChecker|[0xf0FaB0ce35a6d3F82b0B42f09A2734065908dB6a](https://kovan.etherscan.io/address/0xf0FaB0ce35a6d3F82b0B42f09A2734065908dB6a)| -|OVM_StateCommitmentChain|[0xa2487713665AC596b0b3E4881417f276834473d2](https://kovan.etherscan.io/address/0xa2487713665AC596b0b3E4881417f276834473d2)| -|OVM_StateManagerFactory|[0xBcca22E9F5579193E27dD39aD821A03778C44EFA](https://kovan.etherscan.io/address/0xBcca22E9F5579193E27dD39aD821A03778C44EFA)| -|OVM_StateTransitionerFactory|[0xFD7B9268e790837d393Fd371Ddeb42FE5EC45B54](https://kovan.etherscan.io/address/0xFD7B9268e790837d393Fd371Ddeb42FE5EC45B54)| -|Proxy__OVM_L1CrossDomainMessenger|[0x4361d0F75A0186C05f971c566dC6bEa5957483fD](https://kovan.etherscan.io/address/0x4361d0F75A0186C05f971c566dC6bEa5957483fD)| -|Proxy__OVM_L1ETHGateway|[0xB191d67F69e823445cD59e5A88953a82be73b9C6](https://kovan.etherscan.io/address/0xB191d67F69e823445cD59e5A88953a82be73b9C6)| -|Proxy__OVM_L1StandardBridge|[0x22F24361D548e5FaAfb36d1437839f080363982B](https://kovan.etherscan.io/address/0x22F24361D548e5FaAfb36d1437839f080363982B)| -|mockOVM_BondManager|[0xD6143943447DFf503d948Fba3D8af3d4Df28f45c](https://kovan.etherscan.io/address/0xD6143943447DFf503d948Fba3D8af3d4Df28f45c)| +| Contract | Address | +| ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | +| Lib_AddressManager | [0x100Dd3b414Df5BbA2B542864fF94aF8024aFdf3a](https://kovan.etherscan.io/address/0x100Dd3b414Df5BbA2B542864fF94aF8024aFdf3a) | +| OVM_CanonicalTransactionChain | [0xe28c499EB8c36C0C18d1bdCdC47a51585698cb93](https://kovan.etherscan.io/address/0xe28c499EB8c36C0C18d1bdCdC47a51585698cb93) | +| OVM_ChainStorageContainer-CTC-batches | [0xF95D79298FD12e5ED778CCf717aA30f638b060E1](https://kovan.etherscan.io/address/0xF95D79298FD12e5ED778CCf717aA30f638b060E1) | +| OVM_ChainStorageContainer-CTC-queue | [0x2BE00E5F043a0f62c3e4d775F3235E28A0239395](https://kovan.etherscan.io/address/0x2BE00E5F043a0f62c3e4d775F3235E28A0239395) | +| OVM_ChainStorageContainer-SCC-batches | [0x50DA41A2A185fb917aecEFfa1CB4534dC5C264b4](https://kovan.etherscan.io/address/0x50DA41A2A185fb917aecEFfa1CB4534dC5C264b4) | +| OVM_ExecutionManager | [0xC68795aC9d96374eaE746DAcC1334ba54798e17D](https://kovan.etherscan.io/address/0xC68795aC9d96374eaE746DAcC1334ba54798e17D) | +| OVM_FraudVerifier | [0xaeEd60e029Eb435f960d78C355786060589738B3](https://kovan.etherscan.io/address/0xaeEd60e029Eb435f960d78C355786060589738B3) | +| OVM_L1MultiMessageRelayer | [0x5818840763Ee28ff0A3E3e8CB9eDeDd07Fb1Cd3f](https://kovan.etherscan.io/address/0x5818840763Ee28ff0A3E3e8CB9eDeDd07Fb1Cd3f) | +| OVM_SafetyChecker | [0xf0FaB0ce35a6d3F82b0B42f09A2734065908dB6a](https://kovan.etherscan.io/address/0xf0FaB0ce35a6d3F82b0B42f09A2734065908dB6a) | +| OVM_StateCommitmentChain | [0xa2487713665AC596b0b3E4881417f276834473d2](https://kovan.etherscan.io/address/0xa2487713665AC596b0b3E4881417f276834473d2) | +| OVM_StateManagerFactory | [0xBcca22E9F5579193E27dD39aD821A03778C44EFA](https://kovan.etherscan.io/address/0xBcca22E9F5579193E27dD39aD821A03778C44EFA) | +| OVM_StateTransitionerFactory | [0xFD7B9268e790837d393Fd371Ddeb42FE5EC45B54](https://kovan.etherscan.io/address/0xFD7B9268e790837d393Fd371Ddeb42FE5EC45B54) | +| Proxy__OVM_L1CrossDomainMessenger | [0x4361d0F75A0186C05f971c566dC6bEa5957483fD](https://kovan.etherscan.io/address/0x4361d0F75A0186C05f971c566dC6bEa5957483fD) | +| Proxy__OVM_L1StandardBridge | [0x22F24361D548e5FaAfb36d1437839f080363982B](https://kovan.etherscan.io/address/0x22F24361D548e5FaAfb36d1437839f080363982B) | +| mockOVM_BondManager | [0xD6143943447DFf503d948Fba3D8af3d4Df28f45c](https://kovan.etherscan.io/address/0xD6143943447DFf503d948Fba3D8af3d4Df28f45c) | --- ## GOERLI Network : __goerli (chain id: 5)__ -|Contract|Address| -|--|--| -|Lib_AddressManager|[0xA4346c8c120DdCE2c5447e68790625F10Bb4d47A](https://goerli.etherscan.io/address/0xA4346c8c120DdCE2c5447e68790625F10Bb4d47A)| -|OVM_CanonicalTransactionChain|[0x4781674AAe242bbDf6C58b81Cf4F06F1534cd37d](https://goerli.etherscan.io/address/0x4781674AAe242bbDf6C58b81Cf4F06F1534cd37d)| -|OVM_ChainStorageContainer-CTC-batches|[0xd5F2B9f6Ee80065b2Ce18bF1e629c5aC1C98c7F6](https://goerli.etherscan.io/address/0xd5F2B9f6Ee80065b2Ce18bF1e629c5aC1C98c7F6)| -|OVM_ChainStorageContainer-CTC-queue|[0x3EA657c5aA0E4Bce1D8919dC7f248724d7B0987a](https://goerli.etherscan.io/address/0x3EA657c5aA0E4Bce1D8919dC7f248724d7B0987a)| -|OVM_ChainStorageContainer-SCC-batches|[0x777adA49d40DAC02AE5b4FdC292feDf9066435A3](https://goerli.etherscan.io/address/0x777adA49d40DAC02AE5b4FdC292feDf9066435A3)| -|OVM_ExecutionManager|[0x838a74bAdfD28Fd0e32E4A88BddDa502D56ae7F7](https://goerli.etherscan.io/address/0x838a74bAdfD28Fd0e32E4A88BddDa502D56ae7F7)| -|OVM_FraudVerifier|[0x916f75037b87Bf4Fe0Dc7719815bd972F0618669](https://goerli.etherscan.io/address/0x916f75037b87Bf4Fe0Dc7719815bd972F0618669)| -|OVM_L1MultiMessageRelayer|[0x2545fa928d5d278cA75Fd47306e4a89096ff6403](https://goerli.etherscan.io/address/0x2545fa928d5d278cA75Fd47306e4a89096ff6403)| -|OVM_SafetyChecker|[0x71D4ea896C9a2D4a973CC5c7E347B6707691ECa0](https://goerli.etherscan.io/address/0x71D4ea896C9a2D4a973CC5c7E347B6707691ECa0)| -|OVM_StateCommitmentChain|[0x9bA5E286934F0A29fb2f8421f60d3eE8A853447C](https://goerli.etherscan.io/address/0x9bA5E286934F0A29fb2f8421f60d3eE8A853447C)| -|OVM_StateManagerFactory|[0x24C7F0a4a2B926613B31c4cDDA4c0f90c0772f2b](https://goerli.etherscan.io/address/0x24C7F0a4a2B926613B31c4cDDA4c0f90c0772f2b)| -|OVM_StateTransitionerFactory|[0x703303Ce2d92Ef95F17a622E3d538390251165E8](https://goerli.etherscan.io/address/0x703303Ce2d92Ef95F17a622E3d538390251165E8)| -|Proxy__OVM_L1CrossDomainMessenger|[0xa85716330ff84Ab312D5B43F3BfDcC7E650fd88A](https://goerli.etherscan.io/address/0xa85716330ff84Ab312D5B43F3BfDcC7E650fd88A)| -|Proxy__OVM_L1ETHGateway|[0xA721CF3e39E5cB4CfEEc0e32EE05B3D05AA9aE39](https://goerli.etherscan.io/address/0xA721CF3e39E5cB4CfEEc0e32EE05B3D05AA9aE39)| -|Proxy__OVM_L1StandardBridge|[0x74B6CC2F377fB769cEd6c697bC4C58a9c342E424](https://goerli.etherscan.io/address/0x74B6CC2F377fB769cEd6c697bC4C58a9c342E424)| -|mockOVM_BondManager|[0x795F355F75f9B28AEC6cC6A887704191e630065b](https://goerli.etherscan.io/address/0x795F355F75f9B28AEC6cC6A887704191e630065b)| +| Contract | Address | +| ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | +| Lib_AddressManager | [0xA4346c8c120DdCE2c5447e68790625F10Bb4d47A](https://goerli.etherscan.io/address/0xA4346c8c120DdCE2c5447e68790625F10Bb4d47A) | +| OVM_CanonicalTransactionChain | [0x4781674AAe242bbDf6C58b81Cf4F06F1534cd37d](https://goerli.etherscan.io/address/0x4781674AAe242bbDf6C58b81Cf4F06F1534cd37d) | +| OVM_ChainStorageContainer-CTC-batches | [0xd5F2B9f6Ee80065b2Ce18bF1e629c5aC1C98c7F6](https://goerli.etherscan.io/address/0xd5F2B9f6Ee80065b2Ce18bF1e629c5aC1C98c7F6) | +| OVM_ChainStorageContainer-CTC-queue | [0x3EA657c5aA0E4Bce1D8919dC7f248724d7B0987a](https://goerli.etherscan.io/address/0x3EA657c5aA0E4Bce1D8919dC7f248724d7B0987a) | +| OVM_ChainStorageContainer-SCC-batches | [0x777adA49d40DAC02AE5b4FdC292feDf9066435A3](https://goerli.etherscan.io/address/0x777adA49d40DAC02AE5b4FdC292feDf9066435A3) | +| OVM_ExecutionManager | [0x838a74bAdfD28Fd0e32E4A88BddDa502D56ae7F7](https://goerli.etherscan.io/address/0x838a74bAdfD28Fd0e32E4A88BddDa502D56ae7F7) | +| OVM_FraudVerifier | [0x916f75037b87Bf4Fe0Dc7719815bd972F0618669](https://goerli.etherscan.io/address/0x916f75037b87Bf4Fe0Dc7719815bd972F0618669) | +| OVM_L1MultiMessageRelayer | [0x2545fa928d5d278cA75Fd47306e4a89096ff6403](https://goerli.etherscan.io/address/0x2545fa928d5d278cA75Fd47306e4a89096ff6403) | +| OVM_SafetyChecker | [0x71D4ea896C9a2D4a973CC5c7E347B6707691ECa0](https://goerli.etherscan.io/address/0x71D4ea896C9a2D4a973CC5c7E347B6707691ECa0) | +| OVM_StateCommitmentChain | [0x9bA5E286934F0A29fb2f8421f60d3eE8A853447C](https://goerli.etherscan.io/address/0x9bA5E286934F0A29fb2f8421f60d3eE8A853447C) | +| OVM_StateManagerFactory | [0x24C7F0a4a2B926613B31c4cDDA4c0f90c0772f2b](https://goerli.etherscan.io/address/0x24C7F0a4a2B926613B31c4cDDA4c0f90c0772f2b) | +| OVM_StateTransitionerFactory | [0x703303Ce2d92Ef95F17a622E3d538390251165E8](https://goerli.etherscan.io/address/0x703303Ce2d92Ef95F17a622E3d538390251165E8) | +| Proxy__OVM_L1CrossDomainMessenger | [0xa85716330ff84Ab312D5B43F3BfDcC7E650fd88A](https://goerli.etherscan.io/address/0xa85716330ff84Ab312D5B43F3BfDcC7E650fd88A) | +| Proxy__OVM_L1StandardBridge | [0x74B6CC2F377fB769cEd6c697bC4C58a9c342E424](https://goerli.etherscan.io/address/0x74B6CC2F377fB769cEd6c697bC4C58a9c342E424) | +| mockOVM_BondManager | [0x795F355F75f9B28AEC6cC6A887704191e630065b](https://goerli.etherscan.io/address/0x795F355F75f9B28AEC6cC6A887704191e630065b) | --- diff --git a/packages/contracts/deployments/kovan/OVM_L1ETHGateway.json b/packages/contracts/deployments/kovan/OVM_L1ETHGateway.json deleted file mode 100644 index 71e3eabd74fb..000000000000 --- a/packages/contracts/deployments/kovan/OVM_L1ETHGateway.json +++ /dev/null @@ -1,293 +0,0 @@ -{ - "address": "0x25bb69ee5665536Ce6aeb51094F0bed9e4DACc30", - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_from", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "_to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "DepositInitiated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "WithdrawalFinalized", - "type": "event" - }, - { - "inputs": [], - "name": "deposit", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_to", - "type": "address" - } - ], - "name": "depositTo", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "finalizeWithdrawal", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "getFinalizeDepositL2Gas", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_libAddressManager", - "type": "address" - }, - { - "internalType": "address", - "name": "_ovmEth", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "libAddressManager", - "outputs": [ - { - "internalType": "contract Lib_AddressManager", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "messenger", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "ovmEth", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "_name", - "type": "string" - } - ], - "name": "resolve", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } - ], - "transactionHash": "0xdee55e4f063e0e623d64d84766a08cdff904d121126b845ebc3e565fad826f6b", - "receipt": { - "to": null, - "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", - "contractAddress": "0x25bb69ee5665536Ce6aeb51094F0bed9e4DACc30", - "transactionIndex": 3, - "gasUsed": "608764", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x7b251469ad62221d42e05992bb7fac0bb492bc2939a072d90039a585f58e524f", - "transactionHash": "0xdee55e4f063e0e623d64d84766a08cdff904d121126b845ebc3e565fad826f6b", - "logs": [], - "blockNumber": 24572892, - "cumulativeGasUsed": "752908", - "status": 1, - "byzantium": true - }, - "args": [], - "solcInputHash": "5ee8e508e2c54cb5ac6783b4855b1558", - "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"DepositInitiated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"WithdrawalFinalized\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"}],\"name\":\"depositTo\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"finalizeWithdrawal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getFinalizeDepositL2Gas\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_ovmEth\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"messenger\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ovmEth\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"The L1 ETH Gateway is a contract which stores deposited ETH that is in use on L2. Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{\"deposit()\":{\"details\":\"deposit an amount of the ETH to the caller's balance on L2\"},\"depositTo(address)\":{\"details\":\"deposit an amount of ETH to a recipients's balance on L2\",\"params\":{\"_to\":\"L2 address to credit the withdrawal to\"}},\"finalizeWithdrawal(address,uint256)\":{\"details\":\"Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the L1 ETH token. Since only the xDomainMessenger can call this function, it will never be called before the withdrawal is finalized.\",\"params\":{\"_amount\":\"Amount of the ETH to withdraw\",\"_to\":\"L1 address to credit the withdrawal to\"}},\"initialize(address,address)\":{\"params\":{\"_libAddressManager\":\"Address manager for this OE deployment\",\"_ovmEth\":\"L2 OVM_ETH implementation of iOVM_DepositedToken\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}}},\"title\":\"OVM_L1ETHGateway\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ETHGateway.sol\":\"OVM_L1ETHGateway\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"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_L2DepositedToken } from \\\"../../../iOVM/bridge/tokens/iOVM_L2DepositedToken.sol\\\";\\n\\n/* Library Imports */\\nimport { OVM_CrossDomainEnabled } from \\\"../../../libraries/bridge/OVM_CrossDomainEnabled.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../../libraries/resolver/Lib_AddressResolver.sol\\\";\\nimport { Lib_AddressManager } from \\\"../../../libraries/resolver/Lib_AddressManager.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 /********************\\n * Public Constants *\\n ********************/\\n\\n uint32 public constant override getFinalizeDepositL2Gas = 1200000;\\n\\n /********************************\\n * External Contract References *\\n ********************************/\\n\\n address public ovmEth;\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n // This contract lives behind a proxy, so the constructor parameters will go unused.\\n constructor()\\n OVM_CrossDomainEnabled(address(0))\\n Lib_AddressResolver(address(0))\\n public\\n {}\\n\\n /******************\\n * Initialization *\\n ******************/\\n\\n /**\\n * @param _libAddressManager Address manager for this OE deployment\\n * @param _ovmEth L2 OVM_ETH implementation of iOVM_DepositedToken\\n */\\n function initialize(\\n address _libAddressManager,\\n address _ovmEth\\n )\\n public\\n {\\n require(libAddressManager == Lib_AddressManager(0), \\\"Contract has already been initialized.\\\");\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n ovmEth = _ovmEth;\\n messenger = resolve(\\\"Proxy__OVM_L1CrossDomainMessenger\\\");\\n }\\n\\n /**************\\n * Depositing *\\n **************/\\n\\n receive()\\n external\\n payable\\n {\\n _initiateDeposit(msg.sender, msg.sender);\\n }\\n\\n /**\\n * @dev deposit an amount of the ETH 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 ETH 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 ETH and informing the L2 ETH 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 l2ETHGateway.finalizeDeposit(_to, _amount)\\n bytes memory data =\\n abi.encodeWithSelector(\\n iOVM_L2DepositedToken.finalizeDeposit.selector,\\n _to,\\n msg.value\\n );\\n\\n // Send calldata into L2\\n sendCrossDomainMessage(\\n ovmEth,\\n data,\\n getFinalizeDepositL2Gas\\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 ETH token.\\n * Since only the xDomainMessenger can call this function, it will never be called before the withdrawal is finalized.\\n *\\n * @param _to L1 address to credit the withdrawal to\\n * @param _amount Amount of the ETH to withdraw\\n */\\n function finalizeWithdrawal(\\n address _to,\\n uint256 _amount\\n )\\n external\\n override\\n onlyFromCrossDomainAccount(ovmEth)\\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\",\"keccak256\":\"0xee7c0d4bea0e01b0de4def829c9c8aa313ad6a788a7150adcc62c1e4190831db\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messaging/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\\n event SentMessage(bytes message);\\n event RelayedMessage(bytes32 msgHash);\\n event FailedRelayedMessage(bytes32 msgHash);\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n function xDomainMessageSender() external view returns (address);\\n\\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\":\"0x89981ed48e99d6939cc6cdef827d484fa3e2292d66c0ba5056c7050cb6282d7e\",\"license\":\"MIT\"},\"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 * 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 function getFinalizeDepositL2Gas()\\n external\\n view\\n returns(\\n uint32\\n );\\n}\\n\",\"keccak256\":\"0x7e6805c5cacfd159410c7cd57a3d586e0fc5810bc46600bbd840a252e243e5ba\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L2DepositedToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0;\\npragma experimental ABIEncoderV2;\\n\\n/**\\n * @title iOVM_L2DepositedToken\\n */\\ninterface iOVM_L2DepositedToken {\\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\",\"keccak256\":\"0x59c807dfb01dbc00409431820457c350681af30d2f972a065231483a8ec926c4\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/bridge/OVM_CrossDomainEnabled.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Interface Imports */\\nimport { iAbs_BaseCrossDomainMessenger } from \\\"../../iOVM/bridge/messaging/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\\n /*************\\n * Variables *\\n *************/\\n\\n // Messenger contract used to send and recieve messages from the other domain.\\n address public messenger;\\n\\n\\n /***************\\n * Constructor *\\n ***************/ \\n\\n /**\\n * @param _messenger Address of the CrossDomainMessenger on the current layer.\\n */\\n constructor(\\n address _messenger\\n ) {\\n messenger = _messenger;\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * 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\\n * 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 /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Gets the messenger, usually from storage. This function is exposed in case a child contract\\n * 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 * 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\\n * `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 )\\n internal\\n {\\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _data, _gasLimit);\\n }\\n}\\n\",\"keccak256\":\"0x054c802a5c1318566b7727ff5327a1ad4dc0f18038a4586b7ada467cc6b08761\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x2ce671a0e004df88b136bea5a3c59d0732cea8887c8496da1d509e0200b03d7d\",\"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 */\\nabstract contract Lib_AddressResolver {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Resolves the address associated with a given name.\\n * @param _name Name to resolve an address for.\\n * @return Address associated with the given name.\\n */\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x65981feeabff6a81783ea97d44baf988a18a86c8cb374c46fdb71819cbacc7c0\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50600080546001600160a01b03199081169091556001805490911690556109fb8061003c6000396000f3fe60806040526004361061008a5760003560e01c8063485cc95511610059578063485cc95514610122578063490b5b7814610142578063b760faf914610157578063d0e30db01461016a578063f4f7b41a146101725761009b565b80631273a090146100a0578063299ca478146100cb5780633cb747bf146100ed578063461a4478146101025761009b565b3661009b576100993333610192565b005b600080fd5b3480156100ac57600080fd5b506100b5610246565b6040516100c29190610935565b60405180910390f35b3480156100d757600080fd5b506100e061024d565b6040516100c29190610865565b3480156100f957600080fd5b506100e061025c565b34801561010e57600080fd5b506100e061011d366004610797565b61026b565b34801561012e57600080fd5b5061009961013d36600461073c565b610347565b34801561014e57600080fd5b506100e06103ef565b61009961016536600461071b565b6103fe565b61009961040b565b34801561017e57600080fd5b5061009961018d36600461076e565b610417565b6000638d6e9a5b60e01b82346040516024016101af929190610879565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526002549091506101fe906001600160a01b03168262124f80610578565b826001600160a01b03167ff531653a5819e21265de50358610d55dbe6594c61605b209dfa4280d277938c18334604051610239929190610879565b60405180910390a2505050565b62124f8081565b6001546001600160a01b031681565b6000546001600160a01b031681565b60015460405163bf40fac160e01b81526020600482018181528451602484015284516000946001600160a01b03169363bf40fac1938793928392604401918501908083838b5b838110156102c95781810151838201526020016102b1565b50505050905090810190601f1680156102f65780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561031357600080fd5b505afa158015610327573d6000803e3d6000fd5b505050506040513d602081101561033d57600080fd5b505190505b919050565b6001546001600160a01b0316156103795760405162461bcd60e51b8152600401610370906108e6565b60405180910390fd5b600180546001600160a01b038085166001600160a01b0319928316179092556002805492841692909116919091179055604080516060810190915260218082526103cb91906109a5602083013961026b565b600080546001600160a01b0319166001600160a01b03929092169190911790555050565b6002546001600160a01b031681565b6104083382610192565b50565b6104153333610192565b565b6002546001600160a01b031661042b610663565b6001600160a01b0316336001600160a01b03161461047a5760405162461bcd60e51b815260040180806020018281038252602e815260200180610947602e913960400191505060405180910390fd5b806001600160a01b031661048c610663565b6001600160a01b0316636e296e456040518163ffffffff1660e01b815260040160206040518083038186803b1580156104c457600080fd5b505afa1580156104d8573d6000803e3d6000fd5b505050506040513d60208110156104ee57600080fd5b50516001600160a01b0316146105355760405162461bcd60e51b81526004018080602001828103825260308152602001806109756030913960400191505060405180910390fd5b61053f8383610672565b826001600160a01b03167f9e5c4f9f4e46b8629d3dda85f43a69194f50254404a72dc62b9e932d9c94eda883604051610239919061092c565b610580610663565b6001600160a01b0316633dbb202b8484846040518463ffffffff1660e01b815260040180846001600160a01b03168152602001806020018363ffffffff168152602001828103825284818151815260200191508051906020019080838360005b838110156105f85781810151838201526020016105e0565b50505050905090810190601f1680156106255780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b15801561064657600080fd5b505af115801561065a573d6000803e3d6000fd5b50505050505050565b6000546001600160a01b031690565b604080516000808252602082019092526001600160a01b03841690839060405161069c919061082c565b60006040518083038185875af1925050503d80600081146106d9576040519150601f19603f3d011682016040523d82523d6000602084013e6106de565b606091505b50509050806106ff5760405162461bcd60e51b815260040161037090610892565b505050565b80356001600160a01b038116811461034257600080fd5b60006020828403121561072c578081fd5b61073582610704565b9392505050565b6000806040838503121561074e578081fd5b61075783610704565b915061076560208401610704565b90509250929050565b60008060408385031215610780578182fd5b61078983610704565b946020939093013593505050565b600060208083850312156107a9578182fd5b823567ffffffffffffffff808211156107c0578384fd5b818501915085601f8301126107d3578384fd5b8135818111156107df57fe5b604051601f8201601f19168101850183811182821017156107fc57fe5b6040528181528382018501881015610812578586fd5b818585018683013790810190930193909352509392505050565b60008251815b8181101561084c5760208186018101518583015201610832565b8181111561085a5782828501525b509190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b60208082526034908201527f5472616e7366657248656c7065723a3a736166655472616e736665724554483a60408201527308115512081d1c985b9cd9995c8819985a5b195960621b606082015260800190565b60208082526026908201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616040820152653634bd32b21760d11b606082015260800190565b90815260200190565b63ffffffff9190911681526020019056fe4f564d5f58434841494e3a206d657373656e67657220636f6e747261637420756e61757468656e746963617465644f564d5f58434841494e3a2077726f6e672073656e646572206f662063726f73732d646f6d61696e206d65737361676550726f78795f5f4f564d5f4c3143726f7373446f6d61696e4d657373656e676572a2646970667358221220d8a6002280930d6eb8035b95d663889b1a8e3dbd1b07997ca03239bd5372e85b64736f6c63430007060033", - "deployedBytecode": "0x60806040526004361061008a5760003560e01c8063485cc95511610059578063485cc95514610122578063490b5b7814610142578063b760faf914610157578063d0e30db01461016a578063f4f7b41a146101725761009b565b80631273a090146100a0578063299ca478146100cb5780633cb747bf146100ed578063461a4478146101025761009b565b3661009b576100993333610192565b005b600080fd5b3480156100ac57600080fd5b506100b5610246565b6040516100c29190610935565b60405180910390f35b3480156100d757600080fd5b506100e061024d565b6040516100c29190610865565b3480156100f957600080fd5b506100e061025c565b34801561010e57600080fd5b506100e061011d366004610797565b61026b565b34801561012e57600080fd5b5061009961013d36600461073c565b610347565b34801561014e57600080fd5b506100e06103ef565b61009961016536600461071b565b6103fe565b61009961040b565b34801561017e57600080fd5b5061009961018d36600461076e565b610417565b6000638d6e9a5b60e01b82346040516024016101af929190610879565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526002549091506101fe906001600160a01b03168262124f80610578565b826001600160a01b03167ff531653a5819e21265de50358610d55dbe6594c61605b209dfa4280d277938c18334604051610239929190610879565b60405180910390a2505050565b62124f8081565b6001546001600160a01b031681565b6000546001600160a01b031681565b60015460405163bf40fac160e01b81526020600482018181528451602484015284516000946001600160a01b03169363bf40fac1938793928392604401918501908083838b5b838110156102c95781810151838201526020016102b1565b50505050905090810190601f1680156102f65780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561031357600080fd5b505afa158015610327573d6000803e3d6000fd5b505050506040513d602081101561033d57600080fd5b505190505b919050565b6001546001600160a01b0316156103795760405162461bcd60e51b8152600401610370906108e6565b60405180910390fd5b600180546001600160a01b038085166001600160a01b0319928316179092556002805492841692909116919091179055604080516060810190915260218082526103cb91906109a5602083013961026b565b600080546001600160a01b0319166001600160a01b03929092169190911790555050565b6002546001600160a01b031681565b6104083382610192565b50565b6104153333610192565b565b6002546001600160a01b031661042b610663565b6001600160a01b0316336001600160a01b03161461047a5760405162461bcd60e51b815260040180806020018281038252602e815260200180610947602e913960400191505060405180910390fd5b806001600160a01b031661048c610663565b6001600160a01b0316636e296e456040518163ffffffff1660e01b815260040160206040518083038186803b1580156104c457600080fd5b505afa1580156104d8573d6000803e3d6000fd5b505050506040513d60208110156104ee57600080fd5b50516001600160a01b0316146105355760405162461bcd60e51b81526004018080602001828103825260308152602001806109756030913960400191505060405180910390fd5b61053f8383610672565b826001600160a01b03167f9e5c4f9f4e46b8629d3dda85f43a69194f50254404a72dc62b9e932d9c94eda883604051610239919061092c565b610580610663565b6001600160a01b0316633dbb202b8484846040518463ffffffff1660e01b815260040180846001600160a01b03168152602001806020018363ffffffff168152602001828103825284818151815260200191508051906020019080838360005b838110156105f85781810151838201526020016105e0565b50505050905090810190601f1680156106255780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b15801561064657600080fd5b505af115801561065a573d6000803e3d6000fd5b50505050505050565b6000546001600160a01b031690565b604080516000808252602082019092526001600160a01b03841690839060405161069c919061082c565b60006040518083038185875af1925050503d80600081146106d9576040519150601f19603f3d011682016040523d82523d6000602084013e6106de565b606091505b50509050806106ff5760405162461bcd60e51b815260040161037090610892565b505050565b80356001600160a01b038116811461034257600080fd5b60006020828403121561072c578081fd5b61073582610704565b9392505050565b6000806040838503121561074e578081fd5b61075783610704565b915061076560208401610704565b90509250929050565b60008060408385031215610780578182fd5b61078983610704565b946020939093013593505050565b600060208083850312156107a9578182fd5b823567ffffffffffffffff808211156107c0578384fd5b818501915085601f8301126107d3578384fd5b8135818111156107df57fe5b604051601f8201601f19168101850183811182821017156107fc57fe5b6040528181528382018501881015610812578586fd5b818585018683013790810190930193909352509392505050565b60008251815b8181101561084c5760208186018101518583015201610832565b8181111561085a5782828501525b509190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b60208082526034908201527f5472616e7366657248656c7065723a3a736166655472616e736665724554483a60408201527308115512081d1c985b9cd9995c8819985a5b195960621b606082015260800190565b60208082526026908201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616040820152653634bd32b21760d11b606082015260800190565b90815260200190565b63ffffffff9190911681526020019056fe4f564d5f58434841494e3a206d657373656e67657220636f6e747261637420756e61757468656e746963617465644f564d5f58434841494e3a2077726f6e672073656e646572206f662063726f73732d646f6d61696e206d65737361676550726f78795f5f4f564d5f4c3143726f7373446f6d61696e4d657373656e676572a2646970667358221220d8a6002280930d6eb8035b95d663889b1a8e3dbd1b07997ca03239bd5372e85b64736f6c63430007060033", - "devdoc": { - "details": "The L1 ETH Gateway is a contract which stores deposited ETH that is in use on L2. Compiler used: solc Runtime target: EVM", - "kind": "dev", - "methods": { - "deposit()": { - "details": "deposit an amount of the ETH to the caller's balance on L2" - }, - "depositTo(address)": { - "details": "deposit an amount of ETH to a recipients's balance on L2", - "params": { - "_to": "L2 address to credit the withdrawal to" - } - }, - "finalizeWithdrawal(address,uint256)": { - "details": "Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the L1 ETH token. Since only the xDomainMessenger can call this function, it will never be called before the withdrawal is finalized.", - "params": { - "_amount": "Amount of the ETH to withdraw", - "_to": "L1 address to credit the withdrawal to" - } - }, - "initialize(address,address)": { - "params": { - "_libAddressManager": "Address manager for this OE deployment", - "_ovmEth": "L2 OVM_ETH implementation of iOVM_DepositedToken" - } - }, - "resolve(string)": { - "params": { - "_name": "Name to resolve an address for." - }, - "returns": { - "_0": "Address associated with the given name." - } - } - }, - "title": "OVM_L1ETHGateway", - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "resolve(string)": { - "notice": "Resolves the address associated with a given name." - } - }, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 11988, - "contract": "contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ETHGateway.sol:OVM_L1ETHGateway", - "label": "messenger", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 12800, - "contract": "contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ETHGateway.sol:OVM_L1ETHGateway", - "label": "libAddressManager", - "offset": 0, - "slot": "1", - "type": "t_contract(Lib_AddressManager)12793" - }, - { - "astId": 2661, - "contract": "contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ETHGateway.sol:OVM_L1ETHGateway", - "label": "ovmEth", - "offset": 0, - "slot": "2", - "type": "t_address" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_contract(Lib_AddressManager)12793": { - "encoding": "inplace", - "label": "contract Lib_AddressManager", - "numberOfBytes": "20" - } - } - } -} \ No newline at end of file diff --git a/packages/contracts/deployments/kovan/Proxy__OVM_L1ETHGateway.json b/packages/contracts/deployments/kovan/Proxy__OVM_L1ETHGateway.json deleted file mode 100644 index 65948c09a9c2..000000000000 --- a/packages/contracts/deployments/kovan/Proxy__OVM_L1ETHGateway.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "address": "0xB191d67F69e823445cD59e5A88953a82be73b9C6", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_libAddressManager", - "type": "address" - }, - { - "internalType": "string", - "name": "_implementationName", - "type": "string" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "stateMutability": "payable", - "type": "fallback" - } - ], - "transactionHash": "0xbb58732ffd132b5fa62c010e3bdc4ee2a500adf82d3ced38f1175e2b00cd0afb", - "receipt": { - "to": null, - "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", - "contractAddress": "0xB191d67F69e823445cD59e5A88953a82be73b9C6", - "transactionIndex": 1, - "gasUsed": "222304", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x918daf79ddefb51f9a507188032a29c44ad2b8e42bd1d90fda2943895ad18806", - "transactionHash": "0xbb58732ffd132b5fa62c010e3bdc4ee2a500adf82d3ced38f1175e2b00cd0afb", - "logs": [], - "blockNumber": 24572909, - "cumulativeGasUsed": "267164", - "status": 1, - "byzantium": true - }, - "args": [ - "0xd56F695e73286ac252A37593DD4E7c14270eC1Df", - "OVM_L1ETHGateway" - ], - "solcInputHash": "5ee8e508e2c54cb5ac6783b4855b1558", - "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\":\"payable\",\"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\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor () internal {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0x15e2d5bd4c28a88548074c54d220e8086f638a71ed07e6b3ba5a70066fcf458d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"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/* External Imports */\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/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 /*************\\n * Variables *\\n *************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Changes the address associated with a particular name.\\n * @param _name String name to associate an address with.\\n * @param _address Address to associate with the name.\\n */\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n addresses[_getNameHash(_name)] = _address;\\n\\n emit AddressSet(\\n _name,\\n _address\\n );\\n }\\n\\n /**\\n * Retrieves the address associated with a given name.\\n * @param _name Name to retrieve an address for.\\n * @return Address associated with the given name.\\n */\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address\\n )\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Computes the hash of a name.\\n * @param _name Name to compute a hash for.\\n * @return Hash of the given name.\\n */\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x2ce671a0e004df88b136bea5a3c59d0732cea8887c8496da1d509e0200b03d7d\",\"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 // 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 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 payable\\n {\\n address target = addressManager[address(this)].getAddress(\\n (implementationName[address(this)])\\n );\\n\\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\":\"0xfaecb051b37f1d87d588cafb17a575723cbdf7c3c2079772110f33e747e05027\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506040516104083803806104088339818101604052604081101561003357600080fd5b81516020830180516040519294929383019291908464010000000082111561005a57600080fd5b90830190602082018581111561006f57600080fd5b825164010000000081118282018810171561008957600080fd5b82525081516020918201929091019080838360005b838110156100b657818101518382015260200161009e565b50505050905090810190601f1680156100e35780820380516001836020036101000a031916815260200191505b5060409081523060009081526001602090815282822080546001600160a01b0319166001600160a01b038a16179055818152919020855161012c95509093509085019150610134565b5050506101d5565b828054600181600116156101000203166002900490600052602060002090601f01602090048101928261016a57600085556101b0565b82601f1061018357805160ff19168380011785556101b0565b828001600101855582156101b0579182015b828111156101b0578251825591602001919060010190610195565b506101bc9291506101c0565b5090565b5b808211156101bc57600081556001016101c1565b610224806101e46000396000f3fe60806040818152306000908152600160208181528383205483825293832063bf40fac160e01b909552608490815284546002610100938216159390930260001901169190910460a481905291936001600160a01b039093169263bf40fac192909190819060c490849080156100b55780601f1061008a576101008083540402835291602001916100b5565b820191906000526020600020905b81548152906001019060200180831161009857829003601f168201915b50509250505060206040518083038186803b1580156100d357600080fd5b505afa1580156100e7573d6000803e3d6000fd5b505050506040513d60208110156100fd57600080fd5b505190506001600160a01b0381166101465760405162461bcd60e51b81526004018080602001828103825260238152602001806101cc6023913960400191505060405180910390fd5b600080826001600160a01b03166000366040518083838082843760405192019450600093509091505080830381855af49150503d80600081146101a5576040519150601f19603f3d011682016040523d82523d6000602084013e6101aa565b606091505b509092509050600182151514156101c357805160208201f35b805160208201fdfe5461726765742061646472657373206d75737420626520696e697469616c697a65642ea264697066735822122026d4992ed7562b49b7d3e306977cab94c29f8fb64a137b48d18960cc5ef1341d64736f6c63430007060033", - "deployedBytecode": "0x60806040818152306000908152600160208181528383205483825293832063bf40fac160e01b909552608490815284546002610100938216159390930260001901169190910460a481905291936001600160a01b039093169263bf40fac192909190819060c490849080156100b55780601f1061008a576101008083540402835291602001916100b5565b820191906000526020600020905b81548152906001019060200180831161009857829003601f168201915b50509250505060206040518083038186803b1580156100d357600080fd5b505afa1580156100e7573d6000803e3d6000fd5b505050506040513d60208110156100fd57600080fd5b505190506001600160a01b0381166101465760405162461bcd60e51b81526004018080602001828103825260238152602001806101cc6023913960400191505060405180910390fd5b600080826001600160a01b03166000366040518083838082843760405192019450600093509091505080830381855af49150503d80600081146101a5576040519150601f19603f3d011682016040523d82523d6000602084013e6101aa565b606091505b509092509050600182151514156101c357805160208201f35b805160208201fdfe5461726765742061646472657373206d75737420626520696e697469616c697a65642ea264697066735822122026d4992ed7562b49b7d3e306977cab94c29f8fb64a137b48d18960cc5ef1341d64736f6c63430007060033", - "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": 12837, - "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": 12841, - "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)12793)" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_contract(Lib_AddressManager)12793": { - "encoding": "inplace", - "label": "contract Lib_AddressManager", - "numberOfBytes": "20" - }, - "t_mapping(t_address,t_contract(Lib_AddressManager)12793)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => contract Lib_AddressManager)", - "numberOfBytes": "32", - "value": "t_contract(Lib_AddressManager)12793" - }, - "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