From b799caab202889f1fb2c9a7f8db4261e67accd29 Mon Sep 17 00:00:00 2001 From: Karl Floersch Date: Mon, 10 May 2021 14:43:02 -0700 Subject: [PATCH] feat: v0.3.0 release candidate (#603) * feat: Attempt to decode txs as RLP first (#563) Co-authored-by: smartcontracts * l2geth: remove eth_sendRawEthSignTransaction endpoint (#589) * feat[contracts]: Use standard RLP transaction format (#566) * feat[contracts]: Use standard RLP transaction format * fix[l2geth]: Encode transaction as RLP * fix: Correct gas estimation in integration tests * fix: Correct gas estimation in integration tests * Update packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerEntrypoint.sol Co-authored-by: ben-chain * fix[contracts]: Use isCreate instead of checking target address * fix[contracts]: Minor optimization in SequencerEntrypoint * fix[contracts]: Pass max gas to contract call in EOA contract Co-authored-by: ben-chain * feat[contracts]: Make ProxyEOA compatible with eip1967 (#592) * feat[contracts]: Make ProxyEOA compatible with eip1967 * fix[contracts]: Fix bug introduced by indirect constant * chore[contracts]: Add changeset * Update .changeset/old-cycles-invite.md Co-authored-by: Georgios Konstantopoulos * l2geth: remove ovmsigner (#591) * l2geth: remove ovmsigner Also reduce the diff Co-authored-by: smartcontracts * l2geth: add changeset * l2geth: set rlp encoded tx in txmeta in RPC layer (#644) * l2geth: set rlp encoded tx in txmeta in RPC layer * l2geth: remove extra setter of txmeta * chore: add changeset * feat: Have ExecutionManager pass data upwards (#643) * feat[contracts]: Make ExecutionManager return data * fix[l2geth]: fix linting error * fix[contracts]: Fix build error * fix[contracts]: fix failing unit tests * Add changeset Co-authored-by: Karl Floersch * rpc: only allow txs with no calldata when there is value (#645) * l2geth: api checks for 0 value * chore: add changeset * l2geth: remove check for specific gasprice * feat[contracts]: Add value transfer support to ECDSAContractAccount (#619) * feat[contracts]: Use standard RLP transaction format (#566) * feat[contracts]: Use standard RLP transaction format * fix[l2geth]: Encode transaction as RLP * fix: Correct gas estimation in integration tests * fix: Correct gas estimation in integration tests * Update packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerEntrypoint.sol Co-authored-by: ben-chain * fix[contracts]: Use isCreate instead of checking target address * fix[contracts]: Minor optimization in SequencerEntrypoint * fix[contracts]: Pass max gas to contract call in EOA contract Co-authored-by: ben-chain * feat[contracts]: Add value transfer to contract account * fix[contracts]: Tweak transfer logic and add tests * fix[geth]: Remove logic that rejects value gt 0 txs * fix: nonce issue in rpc tests * fix: use correct wallet in rpc value tests * Update rpc.spec.ts * cleanup: remove double definition * chore: add changeset * chore: add changeset * tests: delete dead test * l2geth: log the tx value * l2geth: pass through zero value at top level * test: receipt passes * test: more specifically set balance Co-authored-by: ben-chain Co-authored-by: Mark Tyneway * dtl: remove legacy encoding (#618) * dtl: remove legacy decoding * tests: remove dead test * chore: add changeset * Add Goerli v3 deployment (#651) * Add Goerli v3 deployment * Add Goerli v3 to README * dtlL fix syncing off by one (#687) * dtl: syncing off by one error * chore: add changeset * dtl: index the value field (#686) * chore: add changeset * chore: add changeset * dtl: pass through value field * core-utils: update and test toRpcString * lint: fix * l2geth: parse value fields * chore: add changeset * rpc: gas fixes (#695) * l2geth: prevent fees lower than 21000 * l2geth: remove old check for too high tx gaslimit * tests: update to use new min gas estimated value * chore: add changeset * test: update expected values * test: remove dead test * examples: fix waffle example + gas changes in tests (#724) * examples: fix waffle example * tests: update gas price in assertion * chore: add changeset * l2geth: estimate gas assertion in decimal * test: use configurable key * ops: delete extra whitespace (#731) * fix: prevent eth sendtransaction (#725) * api: prevent unsafe calls * api: fill in txmeta * chore: add changeset * chore: add changeset * l2geth + contracts: standard interface for systems contracts and userland contracts (#721) * l2geth: fix call returndata parsing * contracts: standardize simulateMessage and run to return bytes * chore: add changeset * chore: add changeset * l2geth: more simple decoding * contracts: remove named arguments * chore: fix linter errors * Add contract deployment to Kovan (#715) * fix: remove type check in rollup client (#750) * l2geth: remove tx type check in client * chore: add changeset * dtl: prevent null reference in L1 handler (#757) * dtl: prevent reference of null value * chore: add changeset * test: eth_call exceptions (#800) * feat[l2geth]: Pass up contract revert reasons during DoEstimateGas (#774) * wip: Starting work on geth revert reasons during estimate gas fix: error in comment fix: I got things backwards fix: Use UnpackValues instead of Unpack Update l2geth/accounts/abi/abi.go Co-authored-by: Georgios Konstantopoulos * Add integration test for reverts fix: build error * chore: Add changeset Co-authored-by: Georgios Konstantopoulos * chore: add changeset (#831) * Migrate ETH between gateways (#778) * add migrate ETH functionality * contracts: add eth gateway docstring (#832) Co-authored-by: Mark Tyneway Co-authored-by: smartcontracts Co-authored-by: Mark Tyneway Co-authored-by: smartcontracts Co-authored-by: ben-chain Co-authored-by: Georgios Konstantopoulos Co-authored-by: Maurelian Co-authored-by: Kevin Ho --- .changeset/beige-keys-hammer.md | 5 + .changeset/blue-needles-clap.md | 5 + .changeset/brown-bananas-deny.md | 5 + .changeset/chilly-grapes-greet.md | 5 + .changeset/curly-pumas-wait.md | 5 + .changeset/early-hats-sell.md | 6 + .changeset/eight-beers-prove.md | 6 + .changeset/fuzzy-gorillas-accept.md | 7 + .changeset/good-poets-march.md | 5 + .changeset/great-clouds-call.md | 5 + .changeset/grumpy-bananas-brush.md | 5 + .changeset/kind-plants-tickle.md | 5 + .changeset/light-needles-brush.md | 5 + .changeset/mean-comics-rush.md | 6 + .changeset/old-cycles-invite.md | 5 + .changeset/sharp-flowers-fail.md | 5 + .changeset/six-ties-invent.md | 10 + .changeset/ten-keys-share.md | 5 + .changeset/thirty-radios-sniff.md | 5 + .changeset/tough-lamps-hammer.md | 5 + .changeset/violet-comics-reflect.md | 5 + .changeset/weak-suits-burn.md | 5 + examples/waffle/test/erc20.spec.js | 64 +- .../contracts/ConstructorReverter.sol | 10 + integration-tests/contracts/ERC20.sol | 2 +- integration-tests/contracts/Reverter.sol | 10 + integration-tests/hardhat.config.ts | 1 + integration-tests/package.json | 1 + integration-tests/test/erc20.spec.ts | 11 +- integration-tests/test/fee-payment.spec.ts | 9 - integration-tests/test/native-eth.spec.ts | 4 +- integration-tests/test/rpc.spec.ts | 177 ++- integration-tests/test/shared/utils.ts | 8 +- l2geth/accounts/abi/abi.go | 24 + l2geth/core/state_transition.go | 2 +- l2geth/core/state_transition_ovm.go | 2 +- l2geth/core/types/transaction_signing.go | 153 +- l2geth/core/types/transaction_signing_test.go | 97 -- l2geth/core/types/transaction_test.go | 2 +- l2geth/core/vm/evm.go | 171 +-- l2geth/eth/api_backend.go | 17 +- l2geth/eth/api_backend_test.go | 41 - l2geth/internal/ethapi/api.go | 95 +- l2geth/miner/worker.go | 2 +- l2geth/rollup/client.go | 21 +- l2geth/rollup/sync_service.go | 112 -- ops/docker-compose.yml | 4 +- .../OVM/accounts/OVM_ECDSAContractAccount.sol | 94 +- .../OVM/accounts/OVM_ProxyEOA.sol | 12 +- .../OVM/bridge/tokens/OVM_L1ETHGateway.sol | 21 + .../OVM/execution/OVM_ExecutionManager.sol | 19 +- .../predeploys/OVM_SequencerEntrypoint.sol | 131 +- .../accounts/iOVM_ECDSAContractAccount.sol | 13 +- .../iOVM/execution/iOVM_ExecutionManager.sol | 2 +- .../libraries/codec/Lib_EIP155Tx.sol | 203 +++ .../libraries/codec/Lib_OVMCodec.sol | 138 -- .../libraries/rlp/Lib_RLPWriter.sol | 17 + .../libraries/utils/Lib_ECDSAUtils.sol | 98 -- .../wrappers/Lib_ExecutionManagerWrapper.sol | 19 + .../test-libraries/codec/TestLib_EIP155Tx.sol | 71 + .../test-libraries/codec/TestLib_OVMCodec.sol | 29 - .../utils/TestLib_ECDSAUtils.sol | 33 - packages/contracts/deployments/README.md | 2 +- .../contracts/deployments/goerli-v3/.chainId | 1 + .../goerli-v3/Lib_AddressManager.json | 230 +++ .../OVM_CanonicalTransactionChain.json | 819 +++++++++++ ...OVM_ChainStorageContainer:CTC:batches.json | 453 ++++++ .../OVM_ChainStorageContainer:CTC:queue.json | 453 ++++++ ...OVM_ChainStorageContainer:SCC:batches.json | 453 ++++++ .../goerli-v3/OVM_ExecutionManager.json | 1269 +++++++++++++++++ .../goerli-v3/OVM_FraudVerifier.json | 576 ++++++++ .../goerli-v3/OVM_L1CrossDomainMessenger.json | 514 +++++++ .../goerli-v3/OVM_L1ETHGateway.json | 293 ++++ .../goerli-v3/OVM_L1MultiMessageRelayer.json | 234 +++ .../goerli-v3/OVM_SafetyChecker.json | 74 + .../goerli-v3/OVM_StateCommitmentChain.json | 529 +++++++ .../goerli-v3/OVM_StateManagerFactory.json | 74 + .../OVM_StateTransitionerFactory.json | 163 +++ .../Proxy__OVM_L1CrossDomainMessenger.json | 118 ++ .../goerli-v3/Proxy__OVM_L1ETHGateway.json | 118 ++ .../goerli-v3/mockOVM_BondManager.json | 242 ++++ .../dde656dd41f49cad9eac9bc7065fd6a7.json | 290 ++++ .../contracts/deployments/kovan-v3/.chainId | 1 + .../kovan-v3/Lib_AddressManager.json | 230 +++ .../OVM_CanonicalTransactionChain.json | 819 +++++++++++ ...OVM_ChainStorageContainer:CTC:batches.json | 453 ++++++ .../OVM_ChainStorageContainer:CTC:queue.json | 453 ++++++ ...OVM_ChainStorageContainer:SCC:batches.json | 453 ++++++ .../kovan-v3/OVM_ExecutionManager.json | 1269 +++++++++++++++++ .../kovan-v3/OVM_FraudVerifier.json | 576 ++++++++ .../kovan-v3/OVM_L1CrossDomainMessenger.json | 798 +++++++++++ .../kovan-v3/OVM_L1ETHGateway.json | 293 ++++ .../kovan-v3/OVM_L1MultiMessageRelayer.json | 234 +++ .../kovan-v3/OVM_SafetyChecker.json | 74 + .../kovan-v3/OVM_StateCommitmentChain.json | 529 +++++++ .../kovan-v3/OVM_StateManagerFactory.json | 74 + .../OVM_StateTransitionerFactory.json | 163 +++ .../Proxy__OVM_L1CrossDomainMessenger.json | 118 ++ .../kovan-v3/Proxy__OVM_L1ETHGateway.json | 118 ++ .../kovan-v3/mockOVM_BondManager.json | 242 ++++ .../5ee8e508e2c54cb5ac6783b4855b1558.json | 308 ++++ .../accounts/OVM_ECDSAContractAccount.spec.ts | 265 ++-- .../OVM/accounts/OVM_ProxyEOA.spec.ts | 2 +- .../bridge/assets/OVM_L1ETHGateway.spec.ts | 43 +- .../OVM_ExecutionManager.gas-spec.ts | 2 +- .../OVM_SequencerEntrypoint.spec.ts | 145 +- .../libraries/codec/Lib_EIP155Tx.spec.ts | 15 + .../libraries/utils/Lib_ECDSAUtils.spec.ts | 9 - packages/contracts/test/data/index.ts | 2 +- .../libraries/codec/Lib_EIP155Tx.test.json | 725 ++++++++++ .../libraries/codec/Lib_OVMCodec.test.json | 19 - .../libraries/utils/Lib_ECDSAUtils.test.json | 126 -- .../contracts/test/helpers/codec/encoding.ts | 112 -- .../helpers/test-runner/json-test-runner.ts | 8 +- .../handlers/sequencer-batch-appended.ts | 49 +- .../src/services/server/service.ts | 3 +- .../handlers/sequencer-batch-appended.spec.ts | 59 - 117 files changed, 16099 insertions(+), 1655 deletions(-) create mode 100644 .changeset/beige-keys-hammer.md create mode 100644 .changeset/blue-needles-clap.md create mode 100644 .changeset/brown-bananas-deny.md create mode 100644 .changeset/chilly-grapes-greet.md create mode 100644 .changeset/curly-pumas-wait.md create mode 100644 .changeset/early-hats-sell.md create mode 100644 .changeset/eight-beers-prove.md create mode 100644 .changeset/fuzzy-gorillas-accept.md create mode 100644 .changeset/good-poets-march.md create mode 100644 .changeset/great-clouds-call.md create mode 100644 .changeset/grumpy-bananas-brush.md create mode 100644 .changeset/kind-plants-tickle.md create mode 100644 .changeset/light-needles-brush.md create mode 100644 .changeset/mean-comics-rush.md create mode 100644 .changeset/old-cycles-invite.md create mode 100644 .changeset/sharp-flowers-fail.md create mode 100644 .changeset/six-ties-invent.md create mode 100644 .changeset/ten-keys-share.md create mode 100644 .changeset/thirty-radios-sniff.md create mode 100644 .changeset/tough-lamps-hammer.md create mode 100644 .changeset/violet-comics-reflect.md create mode 100644 .changeset/weak-suits-burn.md create mode 100644 integration-tests/contracts/ConstructorReverter.sol create mode 100644 integration-tests/contracts/Reverter.sol delete mode 100644 l2geth/eth/api_backend_test.go create mode 100644 packages/contracts/contracts/optimistic-ethereum/libraries/codec/Lib_EIP155Tx.sol delete mode 100644 packages/contracts/contracts/optimistic-ethereum/libraries/utils/Lib_ECDSAUtils.sol create mode 100644 packages/contracts/contracts/test-libraries/codec/TestLib_EIP155Tx.sol delete mode 100644 packages/contracts/contracts/test-libraries/utils/TestLib_ECDSAUtils.sol create mode 100644 packages/contracts/deployments/goerli-v3/.chainId create mode 100644 packages/contracts/deployments/goerli-v3/Lib_AddressManager.json create mode 100644 packages/contracts/deployments/goerli-v3/OVM_CanonicalTransactionChain.json create mode 100644 packages/contracts/deployments/goerli-v3/OVM_ChainStorageContainer:CTC:batches.json create mode 100644 packages/contracts/deployments/goerli-v3/OVM_ChainStorageContainer:CTC:queue.json create mode 100644 packages/contracts/deployments/goerli-v3/OVM_ChainStorageContainer:SCC:batches.json create mode 100644 packages/contracts/deployments/goerli-v3/OVM_ExecutionManager.json create mode 100644 packages/contracts/deployments/goerli-v3/OVM_FraudVerifier.json create mode 100644 packages/contracts/deployments/goerli-v3/OVM_L1CrossDomainMessenger.json create mode 100644 packages/contracts/deployments/goerli-v3/OVM_L1ETHGateway.json create mode 100644 packages/contracts/deployments/goerli-v3/OVM_L1MultiMessageRelayer.json create mode 100644 packages/contracts/deployments/goerli-v3/OVM_SafetyChecker.json create mode 100644 packages/contracts/deployments/goerli-v3/OVM_StateCommitmentChain.json create mode 100644 packages/contracts/deployments/goerli-v3/OVM_StateManagerFactory.json create mode 100644 packages/contracts/deployments/goerli-v3/OVM_StateTransitionerFactory.json create mode 100644 packages/contracts/deployments/goerli-v3/Proxy__OVM_L1CrossDomainMessenger.json create mode 100644 packages/contracts/deployments/goerli-v3/Proxy__OVM_L1ETHGateway.json create mode 100644 packages/contracts/deployments/goerli-v3/mockOVM_BondManager.json create mode 100644 packages/contracts/deployments/goerli-v3/solcInputs/dde656dd41f49cad9eac9bc7065fd6a7.json create mode 100644 packages/contracts/deployments/kovan-v3/.chainId create mode 100644 packages/contracts/deployments/kovan-v3/Lib_AddressManager.json create mode 100644 packages/contracts/deployments/kovan-v3/OVM_CanonicalTransactionChain.json create mode 100644 packages/contracts/deployments/kovan-v3/OVM_ChainStorageContainer:CTC:batches.json create mode 100644 packages/contracts/deployments/kovan-v3/OVM_ChainStorageContainer:CTC:queue.json create mode 100644 packages/contracts/deployments/kovan-v3/OVM_ChainStorageContainer:SCC:batches.json create mode 100644 packages/contracts/deployments/kovan-v3/OVM_ExecutionManager.json create mode 100644 packages/contracts/deployments/kovan-v3/OVM_FraudVerifier.json create mode 100644 packages/contracts/deployments/kovan-v3/OVM_L1CrossDomainMessenger.json create mode 100644 packages/contracts/deployments/kovan-v3/OVM_L1ETHGateway.json create mode 100644 packages/contracts/deployments/kovan-v3/OVM_L1MultiMessageRelayer.json create mode 100644 packages/contracts/deployments/kovan-v3/OVM_SafetyChecker.json create mode 100644 packages/contracts/deployments/kovan-v3/OVM_StateCommitmentChain.json create mode 100644 packages/contracts/deployments/kovan-v3/OVM_StateManagerFactory.json create mode 100644 packages/contracts/deployments/kovan-v3/OVM_StateTransitionerFactory.json create mode 100644 packages/contracts/deployments/kovan-v3/Proxy__OVM_L1CrossDomainMessenger.json create mode 100644 packages/contracts/deployments/kovan-v3/Proxy__OVM_L1ETHGateway.json create mode 100644 packages/contracts/deployments/kovan-v3/mockOVM_BondManager.json create mode 100644 packages/contracts/deployments/kovan-v3/solcInputs/5ee8e508e2c54cb5ac6783b4855b1558.json create mode 100644 packages/contracts/test/contracts/libraries/codec/Lib_EIP155Tx.spec.ts delete mode 100644 packages/contracts/test/contracts/libraries/utils/Lib_ECDSAUtils.spec.ts create mode 100644 packages/contracts/test/data/json/libraries/codec/Lib_EIP155Tx.test.json delete mode 100644 packages/contracts/test/data/json/libraries/utils/Lib_ECDSAUtils.test.json diff --git a/.changeset/beige-keys-hammer.md b/.changeset/beige-keys-hammer.md new file mode 100644 index 000000000000..c7f737b87862 --- /dev/null +++ b/.changeset/beige-keys-hammer.md @@ -0,0 +1,5 @@ +--- +"@eth-optimism/data-transport-layer": patch +--- + +Parse and index the value field in the data transport layer diff --git a/.changeset/blue-needles-clap.md b/.changeset/blue-needles-clap.md new file mode 100644 index 000000000000..fccbfa51e50c --- /dev/null +++ b/.changeset/blue-needles-clap.md @@ -0,0 +1,5 @@ +--- +"@eth-optimism/data-transport-layer": patch +--- + +Account for the off by one with regards to the l2geth block number and the CTC index diff --git a/.changeset/brown-bananas-deny.md b/.changeset/brown-bananas-deny.md new file mode 100644 index 000000000000..0f8c2ca18e10 --- /dev/null +++ b/.changeset/brown-bananas-deny.md @@ -0,0 +1,5 @@ +--- +"@eth-optimism/l2geth": patch +--- + +Add value parsing to the rollup client diff --git a/.changeset/chilly-grapes-greet.md b/.changeset/chilly-grapes-greet.md new file mode 100644 index 000000000000..71ca9dbc8974 --- /dev/null +++ b/.changeset/chilly-grapes-greet.md @@ -0,0 +1,5 @@ +--- +"@eth-optimism/l2geth": patch +--- + +Removes the extra setting of the txmeta in the syncservice and instead sets the raw tx in the txmeta at the rpc layer diff --git a/.changeset/curly-pumas-wait.md b/.changeset/curly-pumas-wait.md new file mode 100644 index 000000000000..897732aaa67c --- /dev/null +++ b/.changeset/curly-pumas-wait.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/l2geth': patch +--- + +Fill in the raw transaction into the txmeta in the `eth_sendTransaction` codepath diff --git a/.changeset/early-hats-sell.md b/.changeset/early-hats-sell.md new file mode 100644 index 000000000000..9dc4ac0b0247 --- /dev/null +++ b/.changeset/early-hats-sell.md @@ -0,0 +1,6 @@ +--- +'@eth-optimism/integration-tests': patch +'@eth-optimism/l2geth': patch +--- + +Add support for parsed revert reasons in DoEstimateGas diff --git a/.changeset/eight-beers-prove.md b/.changeset/eight-beers-prove.md new file mode 100644 index 000000000000..c6d68aec6c29 --- /dev/null +++ b/.changeset/eight-beers-prove.md @@ -0,0 +1,6 @@ +--- +"@eth-optimism/integration-tests": patch +"@eth-optimism/l2geth": patch +--- + +Update minimum response from estimate gas diff --git a/.changeset/fuzzy-gorillas-accept.md b/.changeset/fuzzy-gorillas-accept.md new file mode 100644 index 000000000000..3bede02b3aaf --- /dev/null +++ b/.changeset/fuzzy-gorillas-accept.md @@ -0,0 +1,7 @@ +--- +"@eth-optimism/integration-tests": patch +"@eth-optimism/l2geth": patch +"@eth-optimism/contracts": patch +--- + +Add value transfer support to ECDSAContractAccount diff --git a/.changeset/good-poets-march.md b/.changeset/good-poets-march.md new file mode 100644 index 000000000000..9473af129b13 --- /dev/null +++ b/.changeset/good-poets-march.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/l2geth': patch +--- + +Ignore the deprecated type field in the API diff --git a/.changeset/great-clouds-call.md b/.changeset/great-clouds-call.md new file mode 100644 index 000000000000..2afa4f4c8032 --- /dev/null +++ b/.changeset/great-clouds-call.md @@ -0,0 +1,5 @@ +--- +"@eth-optimism/l2geth": patch +--- + +Return bytes from both ExecutionManager.run and ExecutionManager.simulateMessage and be sure to properly ABI decode the return values and the nested (bool, returndata) diff --git a/.changeset/grumpy-bananas-brush.md b/.changeset/grumpy-bananas-brush.md new file mode 100644 index 000000000000..d0ce1dfe421d --- /dev/null +++ b/.changeset/grumpy-bananas-brush.md @@ -0,0 +1,5 @@ +--- +"@eth-optimism/data-transport-layer": patch +--- + +Remove legacy transaction deserialization to support RLP batch encoding diff --git a/.changeset/kind-plants-tickle.md b/.changeset/kind-plants-tickle.md new file mode 100644 index 000000000000..818beff88b52 --- /dev/null +++ b/.changeset/kind-plants-tickle.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/l2geth': patch +--- + +Block access to RPCs related to signing transactions diff --git a/.changeset/light-needles-brush.md b/.changeset/light-needles-brush.md new file mode 100644 index 000000000000..8e66a47dbb77 --- /dev/null +++ b/.changeset/light-needles-brush.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/integration-tests': patch +--- + +Update expected gas prices based on minimum of 21k value diff --git a/.changeset/mean-comics-rush.md b/.changeset/mean-comics-rush.md new file mode 100644 index 000000000000..c255f1fec8f1 --- /dev/null +++ b/.changeset/mean-comics-rush.md @@ -0,0 +1,6 @@ +--- +"@eth-optimism/l2geth": patch +"@eth-optimism/contracts": patch +--- + +Add ExecutionManager return data & RLP encoding diff --git a/.changeset/old-cycles-invite.md b/.changeset/old-cycles-invite.md new file mode 100644 index 000000000000..d05596e7bedf --- /dev/null +++ b/.changeset/old-cycles-invite.md @@ -0,0 +1,5 @@ +--- +"@eth-optimism/contracts": patch +--- + +Makes ProxyEOA compatible with EIP1967, not backwards compatible since the storage slot changes. diff --git a/.changeset/sharp-flowers-fail.md b/.changeset/sharp-flowers-fail.md new file mode 100644 index 000000000000..ebc8482578a8 --- /dev/null +++ b/.changeset/sharp-flowers-fail.md @@ -0,0 +1,5 @@ +--- +"@eth-optimism/l2geth": patch +--- + +Update gas related things in the RPC to allow transactions with high gas limits and prevent gas estimations from being too small diff --git a/.changeset/six-ties-invent.md b/.changeset/six-ties-invent.md new file mode 100644 index 000000000000..95cf98203972 --- /dev/null +++ b/.changeset/six-ties-invent.md @@ -0,0 +1,10 @@ +--- +'@eth-optimism/l2geth': minor +'@eth-optimism/contracts': minor +'@eth-optimism/data-transport-layer': minor +'@eth-optimism/batch-submitter': minor +'@eth-optimism/hardhat-ovm': minor +'@eth-optimism/message-relayer': minor +--- + +Updates to use RLP encoded transactions in batches for the `v0.3.0` release diff --git a/.changeset/ten-keys-share.md b/.changeset/ten-keys-share.md new file mode 100644 index 000000000000..05727782102e --- /dev/null +++ b/.changeset/ten-keys-share.md @@ -0,0 +1,5 @@ +--- +"@eth-optimism/l2geth": patch +--- + +Remove the OVMSigner diff --git a/.changeset/thirty-radios-sniff.md b/.changeset/thirty-radios-sniff.md new file mode 100644 index 000000000000..3340bc37e236 --- /dev/null +++ b/.changeset/thirty-radios-sniff.md @@ -0,0 +1,5 @@ +--- +"@eth-optimism/l2geth": patch +--- + +Prevent 0 value transactions with calldata via RPC diff --git a/.changeset/tough-lamps-hammer.md b/.changeset/tough-lamps-hammer.md new file mode 100644 index 000000000000..204262b71f8f --- /dev/null +++ b/.changeset/tough-lamps-hammer.md @@ -0,0 +1,5 @@ +--- +"@eth-optimism/core-utils": patch +--- + +Update toRpcHexString to accept ethers.BigNumber and add tests diff --git a/.changeset/violet-comics-reflect.md b/.changeset/violet-comics-reflect.md new file mode 100644 index 000000000000..8f52dda5c2b9 --- /dev/null +++ b/.changeset/violet-comics-reflect.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/data-transport-layer': patch +--- + +Prevent access of null value in L1 transaction deserialization diff --git a/.changeset/weak-suits-burn.md b/.changeset/weak-suits-burn.md new file mode 100644 index 000000000000..77d40acef164 --- /dev/null +++ b/.changeset/weak-suits-burn.md @@ -0,0 +1,5 @@ +--- +"@eth-optimism/contracts": patch +--- + +Update ABI of simulateMessage to match run diff --git a/examples/waffle/test/erc20.spec.js b/examples/waffle/test/erc20.spec.js index 6d71783a3543..78469492111a 100644 --- a/examples/waffle/test/erc20.spec.js +++ b/examples/waffle/test/erc20.spec.js @@ -9,30 +9,26 @@ const { getArtifact } = require('./getArtifact') use(solidity) +const config = { + l2Url: process.env.L2_URL || 'http://127.0.0.1:8545', + l1Url: process.env.L1_URL || 'http://127.0.0.1:9545', + useL2: process.env.TARGET === 'OVM', + privateKey: process.env.PRIVATE_KEY || '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80' +} + describe('ERC20 smart contract', () => { let ERC20, - provider, - wallet, - walletTo, - walletEmpty, - walletAddress, - walletToAddress, - walletEmptyAddress - - const privateKey = ethers.Wallet.createRandom().privateKey - const privateKeyEmpty = ethers.Wallet.createRandom().privateKey - const useL2 = process.env.TARGET === 'OVM' - - if (useL2 == true) { - provider = new ethers.providers.JsonRpcProvider('http://127.0.0.1:8545') + provider + + if (config.useL2) { + provider = new ethers.providers.JsonRpcProvider(config.l2Url) provider.pollingInterval = 100 provider.getGasPrice = async () => ethers.BigNumber.from(0) } else { - provider = new ethers.providers.JsonRpcProvider('http://127.0.0.1:9545') + provider = new ethers.providers.JsonRpcProvider(config.l1Url) } - walletTo = new ethers.Wallet(privateKey, provider) - walletEmpty = new ethers.Wallet(privateKeyEmpty, provider) + const wallet = new ethers.Wallet(config.privateKey).connect(provider) // parameters to use for our test coin const COIN_NAME = 'OVM Test Coin' @@ -41,12 +37,7 @@ describe('ERC20 smart contract', () => { describe('when using a deployed contract instance', () => { before(async () => { - wallet = await provider.getSigner(0) - walletAddress = await wallet.getAddress() - walletToAddress = await walletTo.getAddress() - walletEmptyAddress = await walletEmpty.getAddress() - - const Artifact__ERC20 = getArtifact(useL2) + const Artifact__ERC20 = getArtifact(config.useL2) const Factory__ERC20 = new ethers.ContractFactory( Artifact__ERC20.abi, Artifact__ERC20.bytecode, @@ -64,7 +55,8 @@ describe('ERC20 smart contract', () => { }) it('should assigns initial balance', async () => { - expect(await ERC20.balanceOf(walletAddress)).to.equal(1000) + const address = await wallet.getAddress() + expect(await ERC20.balanceOf(address)).to.equal(1000) }) it('should correctly set vanity information', async () => { @@ -79,29 +71,35 @@ describe('ERC20 smart contract', () => { }) it('should transfer amount to destination account', async () => { - const tx = await ERC20.connect(wallet).transfer(walletToAddress, 7) + const freshWallet = ethers.Wallet.createRandom() + const destination = await freshWallet.getAddress() + const tx = await ERC20.connect(wallet).transfer(destination, 7) await tx.wait() - const walletToBalance = await ERC20.balanceOf(walletToAddress) + const walletToBalance = await ERC20.balanceOf(destination) expect(walletToBalance.toString()).to.equal('7') }) it('should emit Transfer event', async () => { - const tx = ERC20.connect(wallet).transfer(walletToAddress, 7) + const address = await wallet.getAddress() + const tx = ERC20.connect(wallet).transfer(address, 7) await expect(tx) .to.emit(ERC20, 'Transfer') - .withArgs(walletAddress, walletToAddress, 7) + .withArgs(address, address, 7) }) it('should not transfer above the amount', async () => { - const walletToBalanceBefore = await ERC20.balanceOf(walletToAddress) - await expect(ERC20.transfer(walletToAddress, 1007)).to.be.reverted - const walletToBalanceAfter = await ERC20.balanceOf(walletToAddress) + const address = await wallet.getAddress() + const walletToBalanceBefore = await ERC20.balanceOf(address) + await expect(ERC20.transfer(address, 1007)).to.be.reverted + const walletToBalanceAfter = await ERC20.balanceOf(address) expect(walletToBalanceBefore).to.eq(walletToBalanceAfter) }) it('should not transfer from empty account', async () => { - const ERC20FromOtherWallet = ERC20.connect(walletEmpty) - await expect(ERC20FromOtherWallet.transfer(walletEmptyAddress, 1)).to.be + const emptyWallet = ethers.Wallet.createRandom() + const address = await emptyWallet.getAddress() + const ERC20FromOtherWallet = ERC20.connect(emptyWallet) + await expect(ERC20FromOtherWallet.transfer(address, 1)).to.be .reverted }) }) diff --git a/integration-tests/contracts/ConstructorReverter.sol b/integration-tests/contracts/ConstructorReverter.sol new file mode 100644 index 000000000000..e8a284014010 --- /dev/null +++ b/integration-tests/contracts/ConstructorReverter.sol @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.7.0; + +import { Reverter } from './Reverter.sol'; + +contract ConstructorReverter is Reverter { + constructor() { + doRevert(); + } +} diff --git a/integration-tests/contracts/ERC20.sol b/integration-tests/contracts/ERC20.sol index d000f71722b6..610ea5d83480 100644 --- a/integration-tests/contracts/ERC20.sol +++ b/integration-tests/contracts/ERC20.sol @@ -33,7 +33,7 @@ contract ERC20 { } function transfer(address _to, uint256 _value) public returns (bool success) { - require(balances[msg.sender] >= _value); + require(balances[msg.sender] >= _value, "insufficient balance"); balances[msg.sender] -= _value; balances[_to] += _value; emit Transfer(msg.sender, _to, _value); diff --git a/integration-tests/contracts/Reverter.sol b/integration-tests/contracts/Reverter.sol new file mode 100644 index 000000000000..d2d3921386df --- /dev/null +++ b/integration-tests/contracts/Reverter.sol @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.7.0; + +contract Reverter { + string constant public revertMessage = "This is a simple reversion."; + + function doRevert() public pure { + revert(revertMessage); + } +} diff --git a/integration-tests/hardhat.config.ts b/integration-tests/hardhat.config.ts index 722e35e9604b..b68e8646ba7b 100644 --- a/integration-tests/hardhat.config.ts +++ b/integration-tests/hardhat.config.ts @@ -2,6 +2,7 @@ import { HardhatUserConfig } from 'hardhat/types' // Hardhat plugins import '@nomiclabs/hardhat-ethers' +import '@nomiclabs/hardhat-waffle' import '@eth-optimism/hardhat-ovm' import 'hardhat-gas-reporter' diff --git a/integration-tests/package.json b/integration-tests/package.json index 712cff307d89..3293fe305aaa 100644 --- a/integration-tests/package.json +++ b/integration-tests/package.json @@ -21,6 +21,7 @@ "@eth-optimism/hardhat-ovm": "^0.1.1", "@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/mocha": "^8.2.2", diff --git a/integration-tests/test/erc20.spec.ts b/integration-tests/test/erc20.spec.ts index 9eb7105ee0de..0dd99ed41ccb 100644 --- a/integration-tests/test/erc20.spec.ts +++ b/integration-tests/test/erc20.spec.ts @@ -1,8 +1,11 @@ import { Contract, ContractFactory, Wallet } from 'ethers' import { ethers } from 'hardhat' -import { expect } from 'chai' +import chai, { expect } from 'chai' import { GWEI } from './shared/utils' import { OptimismEnv } from './shared/env' +import { solidity } from 'ethereum-waffle' + +chai.use(solidity) describe('Basic ERC20 interactions', async () => { const initialAmount = 1000 @@ -79,4 +82,10 @@ describe('Basic ERC20 interactions', async () => { expect(receiverBalance.toNumber()).to.equal(100) expect(senderBalance.toNumber()).to.equal(900) }) + + it('should revert if trying to transfer too much', async () => { + await expect( + ERC20.transfer(other.address, initialAmount * 2) + ).to.be.revertedWith('insufficient balance') + }) }) diff --git a/integration-tests/test/fee-payment.spec.ts b/integration-tests/test/fee-payment.spec.ts index 2005c57513c2..5b94edb1afd5 100644 --- a/integration-tests/test/fee-payment.spec.ts +++ b/integration-tests/test/fee-payment.spec.ts @@ -25,13 +25,4 @@ describe('Fee Payment Integration Tests', async () => { tx.gasPrice.mul(tx.gasLimit).add(amount) ) }) - - it('sequencer rejects transaction with a non-multiple-of-1M gasPrice', async () => { - const gasPrice = BigNumber.from(1_000_000 - 1) - await expect( - env.ovmEth.transfer(other, 0, { gasPrice }) - ).to.be.eventually.rejectedWith( - 'Gas price must be a multiple of 1,000,000 wei' - ) - }) }) diff --git a/integration-tests/test/native-eth.spec.ts b/integration-tests/test/native-eth.spec.ts index 716749141c12..fe2364cfa560 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(17344)) + expect(gas).to.be.deep.eq(BigNumber.from(21000)) }) 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(14400)) + expect(gas).to.be.deep.eq(BigNumber.from(21000)) }) }) diff --git a/integration-tests/test/rpc.spec.ts b/integration-tests/test/rpc.spec.ts index fa8b4c6620d4..66f3cfa23a5b 100644 --- a/integration-tests/test/rpc.spec.ts +++ b/integration-tests/test/rpc.spec.ts @@ -1,13 +1,26 @@ import { injectL2Context } from '@eth-optimism/core-utils' -import { Wallet, BigNumber } from 'ethers' +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, + GWEI, + encodeSolidityRevertMessage, +} from './shared/utils' import chaiAsPromised from 'chai-as-promised' import { OptimismEnv } from './shared/env' +import { + TransactionReceipt, + TransactionRequest, +} from '@ethersproject/providers' +import { solidity } from 'ethereum-waffle' chai.use(chaiAsPromised) +chai.use(solidity) describe('Basic RPC tests', () => { let env: OptimismEnv + let wallet: Wallet const DEFAULT_TRANSACTION = { to: '0x' + '1234'.repeat(10), @@ -18,10 +31,33 @@ describe('Basic RPC tests', () => { } const provider = injectL2Context(l2Provider) - const wallet = Wallet.createRandom().connect(provider) + + let Reverter: Contract + let revertMessage: string + let revertingTx: TransactionRequest + let revertingDeployTx: TransactionRequest before(async () => { env = await OptimismEnv.new() + wallet = env.l2Wallet + const Factory__Reverter = await ethers.getContractFactory( + 'Reverter', + wallet + ) + Reverter = await Factory__Reverter.connect(env.l2Wallet).deploy() + await Reverter.deployTransaction.wait() + revertMessage = await Reverter.revertMessage() + revertingTx = { + to: Reverter.address, + data: Reverter.interface.encodeFunctionData('doRevert'), + } + const Factory__ConstructorReverter = await ethers.getContractFactory( + 'ConstructorReverter', + wallet + ) + revertingDeployTx = { + data: Factory__ConstructorReverter.bytecode, + } }) describe('eth_sendRawTransaction', () => { @@ -59,20 +95,124 @@ describe('Basic RPC tests', () => { ).to.be.rejectedWith('Cannot submit unprotected transaction') }) - it('should not accept a transaction with a value', async () => { + it('should accept a transaction with a value', async () => { const tx = { ...DEFAULT_TRANSACTION, - chainId: await wallet.getChainId(), - value: 100, + chainId: await env.l2Wallet.getChainId(), + data: '0x', + value: ethers.utils.parseEther('5'), } - await expect( - provider.sendTransaction(await wallet.signTransaction(tx)) - ).to.be.rejectedWith( - 'Cannot send transaction with non-zero value. Use WETH.transfer()' + + const balanceBefore = await provider.getBalance(env.l2Wallet.address) + const result = await env.l2Wallet.sendTransaction(tx) + const receipt = await result.wait() + expect(receipt.status).to.deep.equal(1) + + expect(await provider.getBalance(env.l2Wallet.address)).to.deep.equal( + balanceBefore.sub(ethers.utils.parseEther('5')) + ) + }) + + it('should reject a transaction with higher value than user balance', async () => { + const balance = await env.l2Wallet.getBalance() + const tx = { + ...DEFAULT_TRANSACTION, + chainId: await env.l2Wallet.getChainId(), + data: '0x', + value: balance.add(ethers.utils.parseEther('1')), + } + + await expect(env.l2Wallet.sendTransaction(tx)).to.be.rejectedWith( + 'invalid transaction: insufficient funds for gas * price + value' ) }) }) + describe('eth_call', () => { + let expectedReverterRevertData: string + + before(async () => { + expectedReverterRevertData = encodeSolidityRevertMessage(revertMessage) + }) + + it('should correctly return solidity revert data from a call', async () => { + const revertData = await provider.call(revertingTx) + const expectedRevertData = encodeSolidityRevertMessage(revertMessage) + expect(revertData).to.eq(expectedRevertData) + }) + + it('should produce error when called from ethers', async () => { + await expect(Reverter.doRevert()).to.be.revertedWith(revertMessage) + }) + + it('should correctly return revert data from contract creation', async () => { + const revertData = await provider.call(revertingDeployTx) + + expect(revertData).to.eq(expectedReverterRevertData) + }) + + it('should return the correct error message when attempting to deploy unsafe initcode', async () => { + // PUSH1 0x00 PUSH1 0x00 SSTORE + const unsafeCode = '0x6000600055' + const tx: TransactionRequest = { + data: unsafeCode, + } + const result = await provider.call(tx) + const expected = encodeSolidityRevertMessage( + 'Contract creation code contains unsafe opcodes. Did you use the right compiler or pass an unsafe constructor argument?' + ) + expect(result).to.eq(expected) + }) + }) + + describe('eth_getTransactionReceipt', () => { + it('correctly exposes revert data for contract calls', async () => { + const req: TransactionRequest = { + ...revertingTx, + gasLimit: 8_999_999, // override gas estimation + } + + const tx = await wallet.sendTransaction(req) + + let errored = false + try { + await tx.wait() + } catch (e) { + errored = true + } + expect(errored).to.be.true + + const receipt: TransactionReceipt = await provider.getTransactionReceipt( + tx.hash + ) + + expect(receipt.status).to.eq(0) + }) + + it('correctly exposes revert data for contract creations', async () => { + const req: TransactionRequest = { + ...revertingDeployTx, + gasLimit: 8_999_999, // override gas estimation + } + + const tx = await wallet.sendTransaction(req) + + let errored = false + try { + await tx.wait() + } catch (e) { + errored = true + } + expect(errored).to.be.true + + const receipt: TransactionReceipt = await provider.getTransactionReceipt( + tx.hash + ) + + expect(receipt.status).to.eq(0) + }) + }) + describe('eth_getTransactionByHash', () => { it('should be able to get all relevant l1/l2 transaction data', async () => { const tx = DEFAULT_TRANSACTION @@ -168,10 +308,23 @@ describe('Basic RPC tests', () => { // we normalize by gwei here because the RPC does it as well, since the // user provides a 1gwei gas price when submitting txs via the eth_gasPrice - // rpc call - const expected = expectedCost[i].mul(l1GasPrice).div(GWEI) + // rpc call. The smallest possible value for the expected cost is 21000 + let expected = expectedCost[i].mul(l1GasPrice).div(GWEI) + if (expected.lt(BigNumber.from(21000))) { + expected = BigNumber.from(21000) + } expect(estimate).to.be.deep.eq(expected) } }) + + it('should fail for a reverting call transaction', async () => { + await expect(provider.send('eth_estimateGas', [revertingTx])).to.be + .reverted + }) + + it('should fail for a reverting deploy transaction', async () => { + await expect(provider.send('eth_estimateGas', [revertingDeployTx])).to.be + .reverted + }) }) }) diff --git a/integration-tests/test/shared/utils.ts b/integration-tests/test/shared/utils.ts index 48ca55a5c41b..170a4013710c 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 { Watcher } from '@eth-optimism/core-utils' +import { remove0x, Watcher } from '@eth-optimism/core-utils' import { Contract, Wallet, @@ -12,6 +12,7 @@ import { providers, BigNumberish, BigNumber, + utils, } from 'ethers' import { cleanEnv, str, num } from 'envalid' @@ -100,3 +101,8 @@ export const fundUser = async ( } export const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms)) + +const abiCoder = new utils.AbiCoder() +export const encodeSolidityRevertMessage = (_reason: string): string => { + return '0x08c379a0' + remove0x(abiCoder.encode(['string'], [_reason])) +} diff --git a/l2geth/accounts/abi/abi.go b/l2geth/accounts/abi/abi.go index 194df46af5c2..2febc38261f2 100644 --- a/l2geth/accounts/abi/abi.go +++ b/l2geth/accounts/abi/abi.go @@ -19,10 +19,12 @@ package abi import ( "bytes" "encoding/json" + "errors" "fmt" "io" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" ) // The ABI holds information about a contract's context and available @@ -192,3 +194,25 @@ func (abi *ABI) EventByID(topic common.Hash) (*Event, error) { } return nil, fmt.Errorf("no event with id: %#x", topic.Hex()) } + +// RevertSelector is a special function selector for revert reason unpacking. +var RevertSelector = crypto.Keccak256([]byte("Error(string)"))[:4] + +// UnpackRevert resolves the abi-encoded revert reason. According to the solidity +// docs https://docs.soliditylang.org/en/v0.8.4/control-structures.html#revert, +// the provided revert reason is abi-encoded as if it were a call to a function +// `Error(string)`. So it's a special tool for it. +func UnpackRevert(data []byte) (string, error) { + if len(data) < 4 { + return "", errors.New("invalid data for unpacking") + } + if !bytes.Equal(data[:4], RevertSelector) { + return "", errors.New("invalid data for unpacking") + } + typ, _ := NewType("string", "", nil) + unpacked, err := (Arguments{{Type: typ}}).UnpackValues(data[4:]) + if err != nil { + return "", err + } + return unpacked[0].(string), nil +} diff --git a/l2geth/core/state_transition.go b/l2geth/core/state_transition.go index d0106680f52c..d5e839a757dc 100644 --- a/l2geth/core/state_transition.go +++ b/l2geth/core/state_transition.go @@ -252,7 +252,7 @@ func (st *StateTransition) TransitionDb() (ret []byte, usedGas uint64, failed bo l1MessageSender = msg.L1MessageSender().Hex() } if st.evm.EthCallSender == nil { - log.Debug("Applying transaction", "ID", st.evm.Id, "from", sender.Address().Hex(), "to", to, "nonce", msg.Nonce(), "gasPrice", msg.GasPrice().Uint64(), "gasLimit", msg.Gas(), "l1MessageSender", l1MessageSender, "data", hexutil.Encode(msg.Data())) + log.Debug("Applying transaction", "ID", st.evm.Id, "from", sender.Address().Hex(), "to", to, "nonce", msg.Nonce(), "gasPrice", msg.GasPrice().Uint64(), "gasLimit", msg.Gas(), "value", msg.Value().Uint64(), "l1MessageSender", l1MessageSender, "data", hexutil.Encode(msg.Data())) } } diff --git a/l2geth/core/state_transition_ovm.go b/l2geth/core/state_transition_ovm.go index 0f7b698d6b57..adba0fb257df 100644 --- a/l2geth/core/state_transition_ovm.go +++ b/l2geth/core/state_transition_ovm.go @@ -148,7 +148,7 @@ func modMessage( from, to, msg.Nonce(), - msg.Value(), + common.Big0, gasLimit, msg.GasPrice(), data, diff --git a/l2geth/core/types/transaction_signing.go b/l2geth/core/types/transaction_signing.go index a22e7fd99a9b..842fedbd03d6 100644 --- a/l2geth/core/types/transaction_signing.go +++ b/l2geth/core/types/transaction_signing.go @@ -17,67 +17,16 @@ package types import ( - "bytes" "crypto/ecdsa" - "encoding/binary" "errors" "fmt" "math/big" - "strings" - "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/params" - "golang.org/x/crypto/sha3" ) -var codec abi.ABI - -func init() { - const abidata = ` - [ - { - "type": "function", - "name": "encode", - "constant": true, - "inputs": [ - { - "name": "nonce", - "type": "uint256" - }, - { - "name": "gasLimit", - "type": "uint256" - }, - { - "name": "gasPrice", - "type": "uint256" - }, - { - "name": "chainId", - "type": "uint256" - }, - { - "name": "to", - "type": "address" - }, - { - "name": "data", - "type": "bytes" - } - ] - } - ] - ` - - var err error - codec, err = abi.JSON(strings.NewReader(abidata)) - if err != nil { - panic(fmt.Errorf("unable to create Eth Sign abi reader: %v", err)) - } -} - var ( ErrInvalidChainId = errors.New("invalid chain id for signer") ) @@ -91,7 +40,16 @@ type sigCache struct { // MakeSigner returns a Signer based on the given chain config and block number. func MakeSigner(config *params.ChainConfig, blockNumber *big.Int) Signer { - return NewOVMSigner(config.ChainID) + var signer Signer + switch { + case config.IsEIP155(blockNumber): + signer = NewEIP155Signer(config.ChainID) + case config.IsHomestead(blockNumber): + signer = HomesteadSigner{} + default: + signer = FrontierSigner{} + } + return signer } // SignTx signs the transaction using the given signer and private key @@ -144,97 +102,6 @@ type Signer interface { Equal(Signer) bool } -// OVMSigner implements Signers using the EIP155 rules along with a new -// `eth_sign` based signature hash. -type OVMSigner struct { - EIP155Signer -} - -func NewOVMSigner(chainId *big.Int) OVMSigner { - signer := NewEIP155Signer(chainId) - return OVMSigner{signer} -} - -func (s OVMSigner) Equal(s2 Signer) bool { - ovm, ok := s2.(OVMSigner) - return ok && ovm.chainId.Cmp(s.chainId) == 0 -} - -// Hash returns the hash to be signed by the sender. -// It does not uniquely identify the transaction. -func (s OVMSigner) Hash(tx *Transaction) common.Hash { - if tx.IsEthSignSighash() { - msg := s.OVMSignerTemplateSighashPreimage(tx) - - hasher := sha3.NewLegacyKeccak256() - hasher.Write(msg[:]) - digest := hasher.Sum(nil) - - return common.BytesToHash(digest) - } - - return rlpHash([]interface{}{ - tx.data.AccountNonce, - tx.data.Price, - tx.data.GasLimit, - tx.data.Recipient, - tx.data.Amount, - tx.data.Payload, - s.chainId, uint(0), uint(0), - }) -} - -// Sender will ecrecover the public key that created the signature -// and then hash the public key to create an address. In the -// case of L1ToL2 transactions, Layer One did the authentication -// for us so there is no signature involved. The concept of a "from" -// is only required for bookkeeping within this codebase -func (s OVMSigner) Sender(tx *Transaction) (common.Address, error) { - qo := tx.QueueOrigin() - if qo != nil && qo.Uint64() == uint64(QueueOriginL1ToL2) { - return common.Address{}, nil - } - if !tx.Protected() { - return HomesteadSigner{}.Sender(tx) - } - if tx.ChainId().Cmp(s.chainId) != 0 { - return common.Address{}, ErrInvalidChainId - } - V := new(big.Int).Sub(tx.data.V, s.chainIdMul) - V.Sub(V, big8) - return recoverPlain(s.Hash(tx), tx.data.R, tx.data.S, V, true) -} - -// OVMSignerTemplateSighashPreimage creates the preimage for the `eth_sign` like -// signature hash. The transaction is `ABI.encodePacked`. -func (s OVMSigner) OVMSignerTemplateSighashPreimage(tx *Transaction) []byte { - data := []interface{}{ - big.NewInt(int64(tx.data.AccountNonce)), - big.NewInt(int64(tx.data.GasLimit)), - tx.data.Price, - s.chainId, - *tx.data.Recipient, - tx.data.Payload, - } - - ret, err := codec.Pack("encode", data...) - if err != nil { - panic(fmt.Errorf("unable to pack Eth Sign data: %v", err)) - } - - hasher := sha3.NewLegacyKeccak256() - // Slice off the function selector before hashing - hasher.Write(ret[4:]) - digest := hasher.Sum(nil) - - preimage := new(bytes.Buffer) - prefix := []byte("\x19Ethereum Signed Message:\n32") - binary.Write(preimage, binary.BigEndian, prefix) - binary.Write(preimage, binary.BigEndian, digest) - - return preimage.Bytes() -} - // EIP155Transaction implements Signer using the EIP155 rules. type EIP155Signer struct { chainId, chainIdMul *big.Int diff --git a/l2geth/core/types/transaction_signing_test.go b/l2geth/core/types/transaction_signing_test.go index f0102710b132..689fc38a9b66 100644 --- a/l2geth/core/types/transaction_signing_test.go +++ b/l2geth/core/types/transaction_signing_test.go @@ -136,100 +136,3 @@ func TestChainId(t *testing.T) { t.Error("expected no error") } } - -func TestOVMSigner(t *testing.T) { - key, _ := defaultTestKey() - - tx := NewTransaction(0, common.Address{}, new(big.Int), 0, new(big.Int), nil) - txMeta := NewTransactionMeta(nil, 0, nil, SighashEthSign, QueueOriginSequencer, nil, nil, nil) - tx.SetTransactionMeta(txMeta) - - var err error - tx, err = SignTx(tx, NewOVMSigner(big.NewInt(1)), key) - if err != nil { - t.Fatal(err) - } - - _, err = Sender(NewOVMSigner(big.NewInt(2)), tx) - if err != ErrInvalidChainId { - t.Error("expected error:", ErrInvalidChainId) - } - - _, err = Sender(NewOVMSigner(big.NewInt(1)), tx) - if err != nil { - t.Error("expected no error") - } -} - -func TestOVMSignerHash(t *testing.T) { - signer := NewOVMSigner(big.NewInt(1)) - - txNil := NewTransaction(0, common.Address{}, new(big.Int), 0, new(big.Int), nil) - txEIP155 := NewTransaction(0, common.Address{}, new(big.Int), 0, new(big.Int), nil) - - hashNil := signer.Hash(txNil) - hashEIP155 := signer.Hash(txEIP155) - if hashNil != hashEIP155 { - t.Errorf("Signature hashes should be equal: %s != %s", hashNil.Hex(), hashEIP155.Hex()) - } - - // The signature hash should be different when using `SighashEthSign` - txEthSign := NewTransaction(0, common.Address{}, new(big.Int), 0, new(big.Int), nil) - txMeta := NewTransactionMeta(nil, 0, nil, SighashEthSign, QueueOriginSequencer, nil, nil, nil) - txEthSign.SetTransactionMeta(txMeta) - - hashEthSign := signer.Hash(txEthSign) - if hashEIP155 == hashEthSign { - t.Errorf("Signature hashes should not be equal: %s == %s", hashEIP155.Hex(), hashEthSign.Hex()) - } -} - -func TestOVMSignerSender(t *testing.T) { - // Create a keypair to sign transactions with and the corresponding address - // from the public key. - key, _ := crypto.GenerateKey() - addr := crypto.PubkeyToAddress(key.PublicKey) - - // This test makes sure that both the EIP155 and EthSign signature hash - // codepaths work when using the OVMSigner. - signer := NewOVMSigner(big.NewInt(1)) - var err error - - // Create a transaction with EIP155 signature hash, sign the transaction, - // recover the address and assert that the address matches the key. - txEIP155 := NewTransaction(0, addr, new(big.Int), 0, new(big.Int), nil) - - txEIP155, err = SignTx(txEIP155, signer, key) - if err != nil { - t.Errorf("No error expected") - } - - recEIP155, err := signer.Sender(txEIP155) - if err != nil { - t.Errorf("No error expected") - } - - if addr != recEIP155 { - t.Errorf("Recovered address doesn't match. Got %s, expected %s", recEIP155.Hex(), addr.Hex()) - } - - // Create a transaction with EthSign signature hash, sign the transaction, - // recover the address and assert that the address matches the key. - txEthSign := NewTransaction(0, addr, new(big.Int), 0, new(big.Int), nil) - txMeta := NewTransactionMeta(nil, 0, nil, SighashEthSign, QueueOriginSequencer, nil, nil, nil) - txEthSign.SetTransactionMeta(txMeta) - - txEthSign, err = SignTx(txEthSign, signer, key) - if err != nil { - t.Errorf("No error expected") - } - - recEthSign, err := signer.Sender(txEthSign) - if err != nil { - t.Errorf("No error expected") - } - - if addr != recEthSign { - t.Errorf("Recovered address doesn't match. Got %s, expected %s", recEthSign.Hex(), addr.Hex()) - } -} diff --git a/l2geth/core/types/transaction_test.go b/l2geth/core/types/transaction_test.go index 8ed4da8204c8..f7d108379b67 100644 --- a/l2geth/core/types/transaction_test.go +++ b/l2geth/core/types/transaction_test.go @@ -208,7 +208,7 @@ func TestTransactionJSON(t *testing.T) { if err != nil { t.Fatalf("could not generate key: %v", err) } - signer := NewOVMSigner(common.Big1) + signer := NewEIP155Signer(common.Big1) transactions := make([]*Transaction, 0, 50) for i := uint64(0); i < 25; i++ { diff --git a/l2geth/core/vm/evm.go b/l2geth/core/vm/evm.go index d7811e6b660c..aacf774db1cb 100644 --- a/l2geth/core/vm/evm.go +++ b/l2geth/core/vm/evm.go @@ -17,13 +17,15 @@ package vm import ( - "bytes" "crypto/rand" "encoding/hex" + "fmt" "math/big" + "strings" "sync/atomic" "time" + "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/crypto" @@ -32,10 +34,66 @@ import ( "github.com/ethereum/go-ethereum/rollup/dump" ) +// codec is a decoder for the return values of the execution manager. It decodes +// (bool, bytes) from the bytes that are returned from both +// `ExecutionManager.run()` and `ExecutionManager.simulateMessage()` +var codec abi.ABI + +// innerData represents the results returned from the ExecutionManager +// that are wrapped in `bytes` +type innerData struct { + Success bool `abi:"_success"` + ReturnData []byte `abi:"_returndata"` +} + +// runReturnData represents the actual return data of the ExecutionManager. +// It wraps (bool, bytes) in an ABI encoded bytes +type runReturnData struct { + ReturnData []byte `abi:"_returndata"` +} + // Will be removed when we update EM to return data in `run`. var deadPrefix, fortyTwoPrefix, zeroPrefix []byte func init() { + const abidata = ` + [ + { + "type": "function", + "name": "call", + "constant": true, + "inputs": [], + "outputs": [ + { + "name": "_success", + "type": "bool" + }, + { + "name": "_returndata", + "type": "bytes" + } + ] + }, + { + "type": "function", + "name": "blob", + "constant": true, + "inputs": [], + "outputs": [ + { + "name": "_returndata", + "type": "bytes" + } + ] + } + ] +` + + var err error + codec, err = abi.JSON(strings.NewReader(abidata)) + if err != nil { + panic(fmt.Errorf("unable to create abi decoder: %v", err)) + } deadPrefix = hexutil.MustDecode("0xdeaddeaddeaddeaddeaddeaddeaddeaddead") zeroPrefix = hexutil.MustDecode("0x000000000000000000000000000000000000") fortyTwoPrefix = hexutil.MustDecode("0x420000000000000000000000000000000000") @@ -133,13 +191,10 @@ type Context struct { Difficulty *big.Int // Provides information for DIFFICULTY // OVM_ADDITION - EthCallSender *common.Address - OriginalTargetAddress *common.Address - OriginalTargetResult []byte - OriginalTargetReached bool - OvmExecutionManager dump.OvmDumpAccount - OvmStateManager dump.OvmDumpAccount - OvmSafetyChecker dump.OvmDumpAccount + EthCallSender *common.Address + OvmExecutionManager dump.OvmDumpAccount + OvmStateManager dump.OvmDumpAccount + OvmSafetyChecker dump.OvmDumpAccount } // EVM is the Ethereum Virtual Machine base object and provides @@ -251,34 +306,6 @@ func (evm *EVM) Interpreter() Interpreter { // the necessary steps to create accounts and reverses the state in case of an // execution error or failed value transfer. func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas uint64, value *big.Int) (ret []byte, leftOverGas uint64, err error) { - var isTarget = false - if UsingOVM { - // OVM_ENABLED - if evm.depth == 0 { - // We're inside a new transaction, so make sure to wipe these variables beforehand. - evm.Context.OriginalTargetAddress = nil - evm.Context.OriginalTargetResult = []byte("00") - evm.Context.OriginalTargetReached = false - } - - if caller.Address() == evm.Context.OvmExecutionManager.Address && - !bytes.HasPrefix(addr.Bytes(), deadPrefix) && - !bytes.HasPrefix(addr.Bytes(), zeroPrefix) && - !bytes.HasPrefix(addr.Bytes(), fortyTwoPrefix) && - evm.Context.OriginalTargetAddress == nil { - // Whew. Okay, so: we consider ourselves to be at a "target" as long as we were called - // by the execution manager, and we're not a precompile or "dead" address. - evm.Context.OriginalTargetAddress = &addr - evm.Context.OriginalTargetReached = true - isTarget = true - } - // Handle eth_call - if evm.Context.EthCallSender != nil && (caller.Address() == common.Address{}) { - evm.Context.OriginalTargetReached = true - isTarget = true - } - } - if evm.vmConfig.NoRecursion && evm.depth > 0 { return nil, gas, nil } @@ -356,61 +383,39 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas if UsingOVM { // OVM_ENABLED - - if isTarget { - // If this was our target contract, store the result so that it can be later re-inserted - // into the user-facing return data (as seen below). - evm.Context.OriginalTargetResult = ret - } - if evm.depth == 0 { // We're back at the root-level message call, so we'll need to modify the return data // sent to us by the OVM_ExecutionManager to instead be the intended return data. - if !evm.Context.OriginalTargetReached { - // If we didn't get to the target contract, then our execution somehow failed - // (perhaps due to insufficient gas). Just return an error that represents this. - ret = common.FromHex("0x") - err = ErrOvmExecutionFailed - } else if len(evm.Context.OriginalTargetResult) >= 96 { - // We expect that EOA contracts return at least 96 bytes of data, where the first - // 32 bytes are the boolean success value and the next 64 bytes are unnecessary - // ABI encoding data. The actual return data starts at the 96th byte and can be - // empty. - success := evm.Context.OriginalTargetResult[:32] - ret = evm.Context.OriginalTargetResult[96:] - - if !bytes.Equal(success, AbiBytesTrue) && !bytes.Equal(success, AbiBytesFalse) { - // If the first 32 bytes not either are the ABI encoding of "true" or "false", - // then the user hasn't correctly ABI encoded the result. We return the null - // hex string as a default here (an annoying default that would convince most - // people to just use the standard form). - ret = common.FromHex("0x") - } else if bytes.Equal(success, AbiBytesFalse) { - // If the first 32 bytes are the ABI encoding of "false", then we need to add an - // artificial error that represents the revert. - err = errExecutionReverted + // Attempt to decode the returndata as as ExecutionManager.run when + // it is not an `eth_call` and as ExecutionManager.simulateMessage + // when it is an `eth_call`. If the data is not decodable as ABI + // encoded bytes, then return nothing. If the data is able to be + // decoded as bytes, then attempt to decode as (bool, bytes) + isDecodable := true + returnData := runReturnData{} + if err := codec.Unpack(&returnData, "blob", ret); err != nil { + isDecodable = false + } - // We also currently need to add an extra four empty bytes to the return data - // to appease ethers.js. Our return correctly inserts the four specific bytes - // that represent a "string error" to clients, but somehow the returndata size - // is a multiple of 32 (when we expect size % 32 == 4). ethers.js checks that - // [size % 32 == 4] before trying to decode a string error result. Adding these - // four empty bytes tricks ethers into correctly decoding the error string. - // ovmTODO: Figure out how to actually deal with this. - // ovmTODO: This may actually be completely broken if the first four bytes of - // the return data are **not** the specific "string error" bytes. - ret = append(ret, make([]byte, 4)...) + switch isDecodable { + case true: + inner := innerData{} + // If this fails to decode, the nil values will be set in + // `inner`, meaning that it will be interpreted as reverted + // execution with empty returndata + _ = codec.Unpack(&inner, "call", returnData.ReturnData) + if !inner.Success { + err = errExecutionReverted } - } else { - // User hasn't conformed the standard format, just return "null" for the success - // (with no return data) to convince them to use the standard. - ret = common.FromHex("0x") + ret = inner.ReturnData + case false: + 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) } } diff --git a/l2geth/eth/api_backend.go b/l2geth/eth/api_backend.go index 1f1b0ae6ac84..a9b07a7cc562 100644 --- a/l2geth/eth/api_backend.go +++ b/l2geth/eth/api_backend.go @@ -297,20 +297,11 @@ func (b *EthAPIBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscri // a lock can be used around the remotes for when the sequencer is reorganizing. func (b *EthAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error { if b.UsingOVM { - // The value field is not rolled up so it must be set to 0 - if signedTx.Value().Cmp(new(big.Int)) != 0 { - return fmt.Errorf("Cannot send transaction with non-zero value. Use WETH.transfer()") - } - to := signedTx.To() if to != nil { if *to == (common.Address{}) { return errors.New("Cannot send transaction to zero address") } - // Prevent transactions from being submitted if the gas limit too high - if signedTx.Gas() >= b.gasLimit { - return fmt.Errorf("Transaction gasLimit (%d) is greater than max gasLimit (%d)", signedTx.Gas(), b.gasLimit) - } // Prevent QueueOriginSequencer transactions that are too large to // be included in a batch. The `MaxCallDataSize` should be set to // the layer one consensus max transaction size in bytes minus the @@ -320,6 +311,14 @@ 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.ApplyTransaction(signedTx) } diff --git a/l2geth/eth/api_backend_test.go b/l2geth/eth/api_backend_test.go deleted file mode 100644 index 7f84758c6c86..000000000000 --- a/l2geth/eth/api_backend_test.go +++ /dev/null @@ -1,41 +0,0 @@ -package eth - -import ( - "context" - "fmt" - "math/big" - "testing" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" -) - -func TestGasLimit(t *testing.T) { - backend := &EthAPIBackend{ - extRPCEnabled: false, - eth: nil, - gpo: nil, - verifier: false, - gasLimit: 0, - UsingOVM: true, - } - - nonce := uint64(0) - to := common.HexToAddress("0x5A0b54D5dc17e0AadC383d2db43B0a0D3E029c4c") - value := big.NewInt(0) - gasPrice := big.NewInt(0) - data := []byte{} - - // Set the gas limit to 1 so that the transaction will not be - // able to be added. - gasLimit := uint64(1) - tx := types.NewTransaction(nonce, to, value, gasLimit, gasPrice, data) - - err := backend.SendTx(context.Background(), tx) - if err == nil { - t.Fatal("Transaction with too large of gas limit accepted") - } - if err.Error() != fmt.Sprintf("Transaction gasLimit (%d) is greater than max gasLimit (%d)", gasLimit, backend.GasLimit()) { - t.Fatalf("Unexpected error type: %s", err) - } -} diff --git a/l2geth/internal/ethapi/api.go b/l2geth/internal/ethapi/api.go index 2f3f9940e082..64dc1b9d3814 100644 --- a/l2geth/internal/ethapi/api.go +++ b/l2geth/internal/ethapi/api.go @@ -27,6 +27,7 @@ import ( "github.com/davecgh/go-spew/spew" "github.com/ethereum/go-ethereum/accounts" + "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/accounts/keystore" "github.com/ethereum/go-ethereum/accounts/scwallet" "github.com/ethereum/go-ethereum/common" @@ -52,6 +53,8 @@ const ( defaultGasPrice = params.GWei ) +var errOVMUnsupported = errors.New("OVM: Unsupported RPC Method") + // PublicEthereumAPI provides an API to access Ethereum related information. // It offers only methods that operate on public data that is freely available to anyone. type PublicEthereumAPI struct { @@ -1043,6 +1046,9 @@ func DoEstimateGas(ctx context.Context, b Backend, args CallArgs, blockNrOrHash // 3. calculate the fee and normalize by the default gas price fee := core.CalculateRollupFee(*args.Data, uint64(gasUsed), dataPrice, executionPrice).Uint64() / defaultGasPrice + if fee < 21000 { + fee = 21000 + } return (hexutil.Uint64)(fee), nil } @@ -1082,19 +1088,21 @@ func legacyDoEstimateGas(ctx context.Context, b Backend, args CallArgs, blockNrO args.From = &common.Address{} } // Create a helper to check if a gas allowance results in an executable transaction - executable := func(gas uint64) bool { + executable := func(gas uint64) (bool, []byte) { args.Gas = (*hexutil.Uint64)(&gas) - _, _, failed, err := DoCall(ctx, b, args, blockNrOrHash, nil, vm.Config{}, 0, gasCap) + res, _, failed, err := DoCall(ctx, b, args, blockNrOrHash, nil, vm.Config{}, 0, gasCap) if err != nil || failed { - return false + return false, res } - return true + return true, res } // Execute the binary search and hone in on an executable gas limit for lo+1 < hi { mid := (hi + lo) / 2 - if !executable(mid) { + ok, _ := executable(mid) + + if !ok { lo = mid } else { hi = mid @@ -1102,7 +1110,16 @@ func legacyDoEstimateGas(ctx context.Context, b Backend, args CallArgs, blockNrO } // Reject the transaction as invalid if it still fails at the highest allowance if hi == cap { - if !executable(hi) { + ok, res := executable(hi) + if !ok { + if len(res) >= 4 && bytes.Equal(res[:4], abi.RevertSelector) { + reason, errUnpack := abi.UnpackRevert(res) + err := errors.New("execution reverted") + if errUnpack == nil { + err = fmt.Errorf("execution reverted: %v", reason) + } + return 0, err + } return 0, fmt.Errorf("gas required exceeds allowance (%d) or always failing transaction", cap) } } @@ -1286,7 +1303,10 @@ type RPCTransaction struct { // newRPCTransaction returns a transaction that will serialize to the RPC // representation, with the given location metadata set (if available). func newRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber uint64, index uint64) *RPCTransaction { - var signer types.Signer = types.NewOVMSigner(tx.ChainId()) + var signer types.Signer = types.FrontierSigner{} + if tx.Protected() { + signer = types.NewEIP155Signer(tx.ChainId()) + } from, _ := types.Sender(signer, tx) v, r, s := tx.RawSignatureValues() @@ -1514,7 +1534,7 @@ func (s *PublicTransactionPoolAPI) GetTransactionReceipt(ctx context.Context, ha var signer types.Signer = types.FrontierSigner{} if tx.Protected() { - signer = types.NewOVMSigner(tx.ChainId()) + signer = types.NewEIP155Signer(tx.ChainId()) } from, _ := types.Sender(signer, tx) @@ -1648,12 +1668,14 @@ 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) - txMeta := types.NewTransactionMeta(args.L1BlockNumber, 0, nil, types.SighashEIP155, types.QueueOriginSequencer, nil, nil, nil) + raw, _ := rlp.EncodeToBytes(tx) + txMeta := types.NewTransactionMeta(args.L1BlockNumber, 0, nil, types.SighashEIP155, 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) - txMeta := types.NewTransactionMeta(args.L1BlockNumber, 0, args.L1MessageSender, args.SignatureHashType, types.QueueOriginSequencer, nil, nil, nil) + raw, _ := rlp.EncodeToBytes(tx) + txMeta := types.NewTransactionMeta(args.L1BlockNumber, 0, args.L1MessageSender, args.SignatureHashType, types.QueueOriginSequencer, nil, nil, raw) tx.SetTransactionMeta(txMeta) return tx } @@ -1683,10 +1705,9 @@ func SubmitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (c // SendTransaction creates a transaction for the given argument, sign it and submit it to the // transaction pool. func (s *PublicTransactionPoolAPI) SendTransaction(ctx context.Context, args SendTxArgs) (common.Hash, error) { - if s.b.IsVerifier() { - return common.Hash{}, errors.New("Cannot send transaction in verifier mode") + if vm.UsingOVM { + return common.Hash{}, errOVMUnsupported } - // Look up the wallet containing the requested signer account := accounts.Account{Address: args.From} @@ -1719,6 +1740,9 @@ func (s *PublicTransactionPoolAPI) SendTransaction(ctx context.Context, args Sen // FillTransaction fills the defaults (nonce, gas, gasPrice) on a given unsigned transaction, // and returns it to the caller for further processing (signing + broadcast) func (s *PublicTransactionPoolAPI) FillTransaction(ctx context.Context, args SendTxArgs) (*SignTransactionResult, error) { + if vm.UsingOVM { + return nil, errOVMUnsupported + } // Set some sanity defaults and terminate on failure if err := args.setDefaults(ctx, s.b); err != nil { return nil, err @@ -1747,39 +1771,8 @@ func (s *PublicTransactionPoolAPI) SendRawTransaction(ctx context.Context, encod if err := rlp.DecodeBytes(encodedTx, tx); err != nil { return common.Hash{}, err } - - if new(big.Int).Mod(tx.GasPrice(), big.NewInt(1000000)).Cmp(big.NewInt(0)) != 0 { - return common.Hash{}, errors.New("Gas price must be a multiple of 1,000,000 wei") - } - // L1Timestamp and L1BlockNumber will be set by the miner - txMeta := types.NewTransactionMeta(nil, 0, nil, types.SighashEIP155, types.QueueOriginSequencer, nil, nil, nil) - tx.SetTransactionMeta(txMeta) - return SubmitTransaction(ctx, s.b, tx) -} - -// SendRawEthSignTransaction will add the signed transaction to the mempool. -// The signature hash was computed with `eth_sign`, meaning that the -// `abi.encodedPacked` transaction was prefixed with the string -// "Ethereum Signed Message". -func (s *PublicTransactionPoolAPI) SendRawEthSignTransaction(ctx context.Context, encodedTx hexutil.Bytes) (common.Hash, error) { - if s.b.IsVerifier() { - return common.Hash{}, errors.New("Cannot send raw ethsign transaction in verifier mode") - } - - if s.b.IsSyncing() { - return common.Hash{}, errors.New("Cannot send raw transaction while syncing") - } - - tx := new(types.Transaction) - if err := rlp.DecodeBytes(encodedTx, tx); err != nil { - return common.Hash{}, err - } - - if new(big.Int).Mod(tx.GasPrice(), big.NewInt(1000000)).Cmp(big.NewInt(0)) != 0 { - return common.Hash{}, errors.New("Gas price must be a multiple of 1,000,000 wei") - } - // L1Timestamp and L1BlockNumber will be set by the miner - txMeta := types.NewTransactionMeta(nil, 0, nil, types.SighashEthSign, types.QueueOriginSequencer, nil, nil, nil) + // L1Timestamp and L1BlockNumber will be set right before execution + txMeta := types.NewTransactionMeta(nil, 0, nil, types.SighashEIP155, types.QueueOriginSequencer, nil, nil, encodedTx) tx.SetTransactionMeta(txMeta) return SubmitTransaction(ctx, s.b, tx) } @@ -1794,6 +1787,9 @@ func (s *PublicTransactionPoolAPI) SendRawEthSignTransaction(ctx context.Context // // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign func (s *PublicTransactionPoolAPI) Sign(addr common.Address, data hexutil.Bytes) (hexutil.Bytes, error) { + if vm.UsingOVM { + return nil, errOVMUnsupported + } // Look up the wallet containing the requested signer account := accounts.Account{Address: addr} @@ -1819,6 +1815,9 @@ type SignTransactionResult struct { // The node needs to have the private key of the account corresponding with // the given from address and it needs to be unlocked. func (s *PublicTransactionPoolAPI) SignTransaction(ctx context.Context, args SendTxArgs) (*SignTransactionResult, error) { + if vm.UsingOVM { + return nil, errOVMUnsupported + } if args.Gas == nil { return nil, fmt.Errorf("gas not specified") } @@ -1859,7 +1858,7 @@ func (s *PublicTransactionPoolAPI) PendingTransactions() ([]*RPCTransaction, err for _, tx := range pending { var signer types.Signer = types.HomesteadSigner{} if tx.Protected() { - signer = types.NewOVMSigner(tx.ChainId()) + signer = types.NewEIP155Signer(tx.ChainId()) } from, _ := types.Sender(signer, tx) if _, exists := accounts[from]; exists { @@ -1887,7 +1886,7 @@ func (s *PublicTransactionPoolAPI) Resend(ctx context.Context, sendArgs SendTxAr for _, p := range pending { var signer types.Signer = types.HomesteadSigner{} if p.Protected() { - signer = types.NewOVMSigner(p.ChainId()) + signer = types.NewEIP155Signer(p.ChainId()) } wantSigHash := signer.Hash(matchTx) diff --git a/l2geth/miner/worker.go b/l2geth/miner/worker.go index 3ebc34e9d824..d152367f4d1e 100644 --- a/l2geth/miner/worker.go +++ b/l2geth/miner/worker.go @@ -646,7 +646,7 @@ func (w *worker) makeCurrent(parent *types.Block, header *types.Header) error { return err } env := &environment{ - signer: types.NewOVMSigner(w.chainConfig.ChainID), + signer: types.NewEIP155Signer(w.chainConfig.ChainID), state: state, ancestors: mapset.NewSet(), family: mapset.NewSet(), diff --git a/l2geth/rollup/client.go b/l2geth/rollup/client.go index 795c8d39453c..729848017bda 100644 --- a/l2geth/rollup/client.go +++ b/l2geth/rollup/client.go @@ -132,7 +132,7 @@ type RollupClient interface { // Client is an HTTP based RollupClient type Client struct { client *resty.Client - signer *types.OVMSigner + signer *types.EIP155Signer } // TransactionResponse represents the response from the remote server when @@ -154,7 +154,7 @@ func NewClient(url string, chainID *big.Int) *Client { client := resty.New() client.SetHostURL(url) client.SetHeader("User-Agent", "sequencer") - signer := types.NewOVMSigner(chainID) + signer := types.NewEIP155Signer(chainID) return &Client{ client: client, @@ -274,7 +274,7 @@ func (c *Client) GetLatestEnqueue() (*types.Transaction, error) { // batchedTransactionToTransaction converts a transaction into a // types.Transaction that can be consumed by the SyncService -func batchedTransactionToTransaction(res *transaction, signer *types.OVMSigner) (*types.Transaction, error) { +func batchedTransactionToTransaction(res *transaction, signer *types.EIP155Signer) (*types.Transaction, error) { // `nil` transactions are not found if res == nil { return nil, errElementNotFound @@ -289,18 +289,7 @@ func batchedTransactionToTransaction(res *transaction, signer *types.OVMSigner) } else { return nil, fmt.Errorf("Unknown queue origin: %s", res.QueueOrigin) } - // The transaction type must be EIP155 or EthSign. Throughout this - // codebase, it is referred to as "sighash type" but it could actually - // be generalized to transaction type. Right now the only different - // types use a different signature hashing scheme. - var sighashType types.SignatureHashType - if res.Type == EIP155 { - sighashType = types.SighashEIP155 - } else if res.Type == ETH_SIGN { - sighashType = types.SighashEthSign - } else { - return nil, fmt.Errorf("Unknown transaction type: %s", res.Type) - } + sighashType := types.SighashEIP155 // Transactions that have been decoded are // Queue Origin Sequencer transactions if res.Decoded != nil { @@ -542,7 +531,7 @@ func (c *Client) GetTransactionBatch(index uint64) (*Batch, []*types.Transaction // parseTransactionBatchResponse will turn a TransactionBatchResponse into a // Batch and its corresponding types.Transactions -func parseTransactionBatchResponse(txBatch *TransactionBatchResponse, signer *types.OVMSigner) (*Batch, []*types.Transaction, error) { +func parseTransactionBatchResponse(txBatch *TransactionBatchResponse, signer *types.EIP155Signer) (*Batch, []*types.Transaction, error) { if txBatch == nil { return nil, nil, nil } diff --git a/l2geth/rollup/sync_service.go b/l2geth/rollup/sync_service.go index d9b31237bb12..affd6f4dbeb8 100644 --- a/l2geth/rollup/sync_service.go +++ b/l2geth/rollup/sync_service.go @@ -1,7 +1,6 @@ package rollup import ( - "bytes" "context" "errors" "fmt" @@ -11,7 +10,6 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/event" @@ -707,7 +705,6 @@ func (s *SyncService) maybeApplyTransaction(tx *types.Transaction) error { // Lower level API used to apply a transaction, must only be used with // transactions that came from L1. func (s *SyncService) applyTransaction(tx *types.Transaction) error { - tx = fixType(tx) txs := types.Transactions{tx} s.txFeed.Send(core.NewTxsEvent{Txs: txs}) return nil @@ -745,114 +742,5 @@ func (s *SyncService) ApplyTransaction(tx *types.Transaction) error { tx.SetL1Timestamp(ts) tx.SetL1BlockNumber(bn) } - - // Set the raw transaction data in the meta - txRaw, err := getRawTransaction(tx) - if err != nil { - return fmt.Errorf("invalid transaction: %w", err) - } - meta := tx.GetMeta() - newMeta := types.NewTransactionMeta( - meta.L1BlockNumber, - meta.L1Timestamp, - meta.L1MessageSender, - meta.SignatureHashType, - types.QueueOrigin(meta.QueueOrigin.Uint64()), - meta.Index, - meta.QueueIndex, - txRaw, - ) - tx.SetTransactionMeta(newMeta) - return s.applyTransaction(tx) } - -func getRawTransaction(tx *types.Transaction) ([]byte, error) { - if tx == nil { - return nil, errors.New("Cannot process nil transaction") - } - v, r, s := tx.RawSignatureValues() - - // V parameter here will include the chain ID, so we need to recover the original V. If the V - // does not equal zero or one, we have an invalid parameter and need to throw an error. - // This is technically a duplicate check because it happens inside of - // `tx.AsMessage` as well. - v = new(big.Int).SetUint64(v.Uint64() - 35 - 2*tx.ChainId().Uint64()) - if v.Uint64() != 0 && v.Uint64() != 1 { - return nil, fmt.Errorf("invalid signature v parameter: %d", v.Uint64()) - } - - // Since we use a fixed encoding, we need to insert some placeholder address to represent that - // the user wants to create a contract (in this case, the zero address). - var target common.Address - if tx.To() == nil { - target = common.Address{} - } else { - target = *tx.To() - } - - // Divide the gas price by one million to compress it - // before it is send to the sequencer entrypoint. This is to save - // space on calldata. - gasPrice := new(big.Int).Div(tx.GasPrice(), new(big.Int).SetUint64(1000000)) - - // Sequencer uses a custom encoding structure -- - // We originally receive sequencer transactions encoded in this way, but we decode them before - // inserting into Geth so we can make transactions easily parseable. However, this means that - // we need to re-encode the transactions before executing them. - var data = new(bytes.Buffer) - data.WriteByte(getSignatureType(tx)) // 1 byte: 00 == EIP 155, 02 == ETH Sign Message - data.Write(fillBytes(r, 32)) // 32 bytes: Signature `r` parameter - data.Write(fillBytes(s, 32)) // 32 bytes: Signature `s` parameter - data.Write(fillBytes(v, 1)) // 1 byte: Signature `v` parameter - data.Write(fillBytes(new(big.Int).SetUint64(tx.Gas()), 3)) // 3 bytes: Gas limit - data.Write(fillBytes(gasPrice, 3)) // 3 bytes: Gas price - data.Write(fillBytes(new(big.Int).SetUint64(tx.Nonce()), 3)) // 3 bytes: Nonce - data.Write(target.Bytes()) // 20 bytes: Target address - data.Write(tx.Data()) - - return data.Bytes(), nil -} - -func fillBytes(x *big.Int, size int) []byte { - b := x.Bytes() - switch { - case len(b) > size: - panic("math/big: value won't fit requested size") - case len(b) == size: - return b - default: - buf := make([]byte, size) - copy(buf[size-len(b):], b) - return buf - } -} - -func getSignatureType(tx *types.Transaction) uint8 { - if tx.SignatureHashType() == 0 { - return 0 - } else if tx.SignatureHashType() == 1 { - return 2 - } else { - return 1 - } -} - -// This is a temporary fix to patch the enums being used in the raw data -func fixType(tx *types.Transaction) *types.Transaction { - meta := tx.GetMeta() - raw := meta.RawTransaction - if len(raw) == 0 { - log.Error("Transaction with no raw detected") - return tx - } - if raw[0] == 0x00 { - return tx - } else if raw[0] == 0x01 { - raw[0] = 0x02 - } - queueOrigin := types.QueueOrigin(meta.QueueOrigin.Uint64()) - fixed := types.NewTransactionMeta(meta.L1BlockNumber, meta.L1Timestamp, meta.L1MessageSender, meta.SignatureHashType, queueOrigin, meta.Index, meta.QueueIndex, raw) - tx.SetTransactionMeta(fixed) - return tx -} diff --git a/ops/docker-compose.yml b/ops/docker-compose.yml index 2ca1b5e64890..940069375bec 100644 --- a/ops/docker-compose.yml +++ b/ops/docker-compose.yml @@ -21,7 +21,7 @@ services: - ${L1CHAIN_HTTP_PORT:-9545}:8545 deployer: - depends_on: + depends_on: - l1_chain image: ethereumoptimism/deployer build: @@ -42,7 +42,7 @@ services: - ${DEPLOYER_PORT:-8080}:8081 dtl: - depends_on: + depends_on: - l1_chain - deployer - l2geth 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 58b546953248..74816818683d 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol @@ -7,8 +7,7 @@ pragma experimental ABIEncoderV2; import { iOVM_ECDSAContractAccount } from "../../iOVM/accounts/iOVM_ECDSAContractAccount.sol"; /* Library Imports */ -import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; -import { Lib_ECDSAUtils } from "../../libraries/utils/Lib_ECDSAUtils.sol"; +import { Lib_EIP155Tx } from "../../libraries/codec/Lib_EIP155Tx.sol"; import { Lib_ExecutionManagerWrapper } from "../../libraries/wrappers/Lib_ExecutionManagerWrapper.sol"; /* Contract Imports */ @@ -20,14 +19,21 @@ 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 - * providing eth_sign and EIP155 formatted transaction encodings. + * ovmCREATEEOA operation. It enables backwards compatibility with Ethereum's Layer 1, by + * providing EIP155 formatted transaction encodings. * * Compiler used: optimistic-solc * Runtime target: OVM */ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount { + /************* + * Libraries * + *************/ + + using Lib_EIP155Tx for Lib_EIP155Tx.EIP155Tx; + + /************* * Constants * *************/ @@ -44,20 +50,12 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount { /** * Executes a signed transaction. - * @param _transaction Signed EOA transaction. - * @param _signatureType Hashing scheme used for the transaction (e.g., ETH signed message). - * @param _v Signature `v` parameter. - * @param _r Signature `r` parameter. - * @param _s Signature `s` parameter. + * @param _encodedTransaction Signed EIP155 transaction. * @return Whether or not the call returned (rather than reverted). * @return Data returned by the call. */ function execute( - bytes memory _transaction, - Lib_OVMCodec.EOASignatureType _signatureType, - uint8 _v, - bytes32 _r, - bytes32 _s + bytes memory _encodedTransaction ) override public @@ -66,50 +64,30 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount { bytes memory ) { - bool isEthSign = _signatureType == Lib_OVMCodec.EOASignatureType.ETH_SIGNED_MESSAGE; + // 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. - // Need to make sure that the transaction nonce is right and bump it if so. require( - Lib_ECDSAUtils.recover( - _transaction, - isEthSign, - _v, - _r, - _s - ) == address(this), + transaction.sender() == address(this), "Signature provided for EOA transaction execution is invalid." ); - Lib_OVMCodec.EIP155Transaction memory decodedTx = Lib_OVMCodec.decodeEIP155Transaction( - _transaction, - isEthSign - ); - - // Grab the chain ID of the current network. - uint256 chainId; - assembly { - chainId := chainid() - } - - // Need to make sure that the transaction chainId is correct. - require( - decodedTx.chainId == chainId, - "Transaction chainId does not match expected OVM chainId." - ); - // Need to make sure that the transaction nonce is right. require( - decodedTx.nonce == Lib_ExecutionManagerWrapper.ovmGETNONCE(), + transaction.nonce == Lib_ExecutionManagerWrapper.ovmGETNONCE(), "Transaction nonce does not match the expected nonce." ); // TEMPORARY: Disable gas checks for mainnet. // // Need to make sure that the gas is sufficient to execute the transaction. // require( - // gasleft() >= SafeMath.add(decodedTx.gasLimit, EXECUTION_VALIDATION_GAS_OVERHEAD), + // gasleft() >= SafeMath.add(transaction.gasLimit, EXECUTION_VALIDATION_GAS_OVERHEAD), // "Gas is not sufficient to execute the transaction." // ); @@ -117,15 +95,21 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount { require( ovmETH.transfer( msg.sender, - SafeMath.mul(decodedTx.gasLimit, decodedTx.gasPrice) + SafeMath.mul(transaction.gasLimit, transaction.gasPrice) ), "Fee was not transferred to relayer." ); // Contract creations are signalled by sending a transaction to the zero address. - if (decodedTx.to == address(0)) { + if (transaction.isCreate) { + // TEMPORARY: Disable value transfer for contract creations. + require( + transaction.value == 0, + "Value transfer in contract creation not supported." + ); + (address created, bytes memory revertdata) = Lib_ExecutionManagerWrapper.ovmCREATE( - decodedTx.data + transaction.data ); // Return true if the contract creation succeeded, false w/ revertdata otherwise. @@ -140,7 +124,25 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount { // cases, but since this is a contract we'd end up bumping the nonce twice. Lib_ExecutionManagerWrapper.ovmINCREMENTNONCE(); - return decodedTx.to.call(decodedTx.data); + // 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( + ovmETH.transfer( + transaction.to, + transaction.value + ), + "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 02d809b717a6..d158d15d5b4e 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol @@ -16,12 +16,21 @@ import { Lib_Bytes32Utils } from "../../libraries/utils/Lib_Bytes32Utils.sol"; */ contract OVM_ProxyEOA { + /********** + * Events * + **********/ + + event Upgraded( + address indexed implementation + ); + + /************* * Constants * *************/ address constant DEFAULT_IMPLEMENTATION = 0x4200000000000000000000000000000000000003; - bytes32 constant IMPLEMENTATION_KEY = 0xdeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead; + bytes32 constant IMPLEMENTATION_KEY = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; //bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1); /********************* @@ -68,6 +77,7 @@ contract OVM_ProxyEOA { ); _setImplementation(_implementation); + emit Upgraded(_implementation); } /** 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 8039a895fe5a..1080e5691895 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 @@ -174,4 +174,25 @@ contract OVM_L1ETHGateway is iOVM_L1ETHGateway, OVM_CrossDomainEnabled, Lib_Addr (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/execution/OVM_ExecutionManager.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol index 14a55abf5d64..7fdfdfa1f944 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol @@ -162,11 +162,14 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { ) override external + returns ( + bytes memory + ) { // Make sure that run() is not re-enterable. This condition should always be satisfied // Once run has been called once, due to the behavior of _isValidInput(). if (transactionContext.ovmNUMBER != DEFAULT_UINT256) { - return; + return bytes(""); } // Store our OVM_StateManager instance (significantly easier than attempting to pass the @@ -194,7 +197,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { // reverts for INVALID_STATE_ACCESS. if (_isValidInput(_transaction) == false) { _resetContext(); - return; + return bytes(""); } // TEMPORARY: Gas metering is disabled for minnet. @@ -202,7 +205,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { // uint256 gasProvided = gasleft(); // Run the transaction, make sure to meter the gas usage. - ovmCALL( + (, bytes memory returndata) = ovmCALL( _transaction.gasLimit - gasMeterConfig.minTransactionGasLimit, _transaction.entrypoint, _transaction.data @@ -215,6 +218,8 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { // Wipe the execution context. _resetContext(); + + return returndata; } @@ -1877,7 +1882,6 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { ) external returns ( - bool, bytes memory ) { @@ -1894,18 +1898,19 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { if (isCreate) { (address created, bytes memory revertData) = ovmCREATE(_transaction.data); if (created == address(0)) { - return (false, revertData); + return abi.encode(false, revertData); } else { // The eth_call RPC endpoint for to = undefined will return the deployed bytecode // in the success case, differing from standard create messages. - return (true, Lib_EthUtils.getCode(created)); + return abi.encode(true, Lib_EthUtils.getCode(created)); } } else { - return ovmCALL( + (bool success, bytes memory returndata) = ovmCALL( _transaction.gasLimit, _transaction.entrypoint, _transaction.data ); + return abi.encode(success, 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 f02ea17ac668..0be33bd2b98a 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerEntrypoint.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_SequencerEntrypoint.sol @@ -2,13 +2,8 @@ // @unsupported: evm pragma solidity >0.5.0 <0.8.0; -/* Interface Imports */ -import { iOVM_ECDSAContractAccount } from "../../iOVM/accounts/iOVM_ECDSAContractAccount.sol"; - /* Library Imports */ -import { Lib_BytesUtils } from "../../libraries/utils/Lib_BytesUtils.sol"; -import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; -import { Lib_ECDSAUtils } from "../../libraries/utils/Lib_ECDSAUtils.sol"; +import { Lib_EIP155Tx } from "../../libraries/codec/Lib_EIP155Tx.sol"; import { Lib_ExecutionManagerWrapper } from "../../libraries/wrappers/Lib_ExecutionManagerWrapper.sol"; /** @@ -16,22 +11,16 @@ import { Lib_ExecutionManagerWrapper } from "../../libraries/wrappers/Lib_Execut * @dev The Sequencer Entrypoint is a predeploy which, despite its name, can in fact be called by * any account. It accepts a more efficient compressed calldata format, which it decompresses and * encodes to the standard EIP155 transaction format. - * This contract is the implementation referenced by the Proxy Sequencer Entrypoint, thus enabling - * the Optimism team to upgrade the decompression of calldata from the Sequencer. - * * Compiler used: optimistic-solc * Runtime target: OVM */ contract OVM_SequencerEntrypoint { - /********* - * Enums * - *********/ + /************* + * Libraries * + *************/ - enum TransactionType { - NATIVE_ETH_TRANSACTION, - ETH_SIGNED_MESSAGE - } + using Lib_EIP155Tx for Lib_EIP155Tx.EIP155Tx; /********************* @@ -39,104 +28,56 @@ contract OVM_SequencerEntrypoint { *********************/ /** - * Uses a custom "compressed" format to save on calldata gas: - * calldata[00:01]: transaction type (0 == EIP 155, 2 == Eth Sign Message) - * calldata[01:33]: signature "r" parameter - * calldata[33:65]: signature "s" parameter - * calldata[65:66]: signature "v" parameter - * calldata[66:69]: transaction gas limit - * calldata[69:72]: transaction gas price - * calldata[72:75]: transaction nonce - * calldata[75:95]: transaction target address - * calldata[95:XX]: transaction data + * Expects an RLP-encoded EIP155 transaction as input. See the EIP for a more detailed + * description of this transaction format: + * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md */ fallback() external { - TransactionType transactionType = _getTransactionType(Lib_BytesUtils.toUint8(msg.data, 0)); - - bytes32 r = Lib_BytesUtils.toBytes32(Lib_BytesUtils.slice(msg.data, 1, 32)); - bytes32 s = Lib_BytesUtils.toBytes32(Lib_BytesUtils.slice(msg.data, 33, 32)); - uint8 v = Lib_BytesUtils.toUint8(msg.data, 65); - - // Remainder is the transaction to execute. - bytes memory compressedTx = Lib_BytesUtils.slice(msg.data, 66); - bool isEthSignedMessage = transactionType == TransactionType.ETH_SIGNED_MESSAGE; - - // Grab the chain ID for the current network. - uint256 chainId; - assembly { - chainId := chainid() - } + // We use this twice, so it's more gas efficient to store a copy of it (barely). + bytes memory encodedTx = msg.data; - // Need to decompress and then re-encode the transaction based on the original encoding. - bytes memory encodedTx = Lib_OVMCodec.encodeEIP155Transaction( - Lib_OVMCodec.decompressEIP155Transaction( - compressedTx, - chainId - ), - isEthSignedMessage - ); - - address target = Lib_ECDSAUtils.recover( + // Decode the tx with the correct chain ID. + Lib_EIP155Tx.EIP155Tx memory transaction = Lib_EIP155Tx.decode( encodedTx, - isEthSignedMessage, - v, - r, - s + Lib_ExecutionManagerWrapper.ovmCHAINID() ); + // Value is computed on the fly. Keep it in the stack to save some gas. + address target = transaction.sender(); + bool isEmptyContract; assembly { isEmptyContract := iszero(extcodesize(target)) } + // If the account is empty, deploy the default EOA to that address. if (isEmptyContract) { - // ProxyEOA has not yet been deployed for this EOA. - bytes32 messageHash = Lib_ECDSAUtils.getMessageHash(encodedTx, isEthSignedMessage); - Lib_ExecutionManagerWrapper.ovmCREATEEOA(messageHash, v, r, s); + Lib_ExecutionManagerWrapper.ovmCREATEEOA( + transaction.hash(), + transaction.recoveryParam, + transaction.r, + transaction.s + ); } - Lib_OVMCodec.EOASignatureType sigtype; - if (isEthSignedMessage) { - sigtype = Lib_OVMCodec.EOASignatureType.ETH_SIGNED_MESSAGE; - } else { - sigtype = Lib_OVMCodec.EOASignatureType.EIP155_TRANSACTION; - } - - iOVM_ECDSAContractAccount(target).execute( - encodedTx, - sigtype, - v, - r, - s + // Forward the transaction over to the EOA. + (bool success, bytes memory returndata) = target.call( + abi.encodeWithSignature( + "execute(bytes)", + encodedTx + ) ); - } - - /********************** - * Internal Functions * - **********************/ - - /** - * Converts a uint256 into a TransactionType enum. - * @param _transactionType Transaction type index. - * @return _txType Transaction type enum value. - */ - function _getTransactionType( - uint8 _transactionType - ) - internal - returns ( - TransactionType _txType - ) - { - if (_transactionType == 0) { - return TransactionType.NATIVE_ETH_TRANSACTION; - } if (_transactionType == 2) { - return TransactionType.ETH_SIGNED_MESSAGE; + if (success) { + assembly { + return(add(returndata, 0x20), mload(returndata)) + } } else { - revert("Transaction type must be 0 or 2"); + assembly { + revert(add(returndata, 0x20), mload(returndata)) + } } } } 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 16c956580f85..2b2830577ccf 100644 --- a/packages/contracts/contracts/optimistic-ethereum/iOVM/accounts/iOVM_ECDSAContractAccount.sol +++ b/packages/contracts/contracts/optimistic-ethereum/iOVM/accounts/iOVM_ECDSAContractAccount.sol @@ -15,10 +15,11 @@ interface iOVM_ECDSAContractAccount { ********************/ function execute( - bytes memory _transaction, - Lib_OVMCodec.EOASignatureType _signatureType, - uint8 _v, - bytes32 _r, - bytes32 _s - ) external returns (bool _success, bytes memory _returndata); + bytes memory _encodedTransaction + ) + external + returns ( + bool, + bytes memory + ); } 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 9be045cfc748..0ecbc2274bf6 100644 --- a/packages/contracts/contracts/optimistic-ethereum/iOVM/execution/iOVM_ExecutionManager.sol +++ b/packages/contracts/contracts/optimistic-ethereum/iOVM/execution/iOVM_ExecutionManager.sol @@ -75,7 +75,7 @@ interface iOVM_ExecutionManager { function run( Lib_OVMCodec.Transaction calldata _transaction, address _txStateManager - ) external; + ) external returns (bytes memory); /******************* diff --git a/packages/contracts/contracts/optimistic-ethereum/libraries/codec/Lib_EIP155Tx.sol b/packages/contracts/contracts/optimistic-ethereum/libraries/codec/Lib_EIP155Tx.sol new file mode 100644 index 000000000000..d1f64819199e --- /dev/null +++ b/packages/contracts/contracts/optimistic-ethereum/libraries/codec/Lib_EIP155Tx.sol @@ -0,0 +1,203 @@ +// 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"; +import { Lib_RLPWriter } from "../rlp/Lib_RLPWriter.sol"; + +/** + * @title Lib_EIP155Tx + * @dev A simple library for dealing with the transaction type defined by EIP155: + * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md + */ +library Lib_EIP155Tx { + + /*********** + * Structs * + ***********/ + + // Struct representing an EIP155 transaction. See EIP link above for more information. + struct EIP155Tx { + // These fields correspond to the actual RLP-encoded fields specified by EIP155. + uint256 nonce; + uint256 gasPrice; + uint256 gasLimit; + address to; + uint256 value; + bytes data; + uint8 v; + bytes32 r; + bytes32 s; + + // Chain ID to associate this transaction with. Used all over the place, seemed easier to + // set this once when we create the transaction rather than providing it as an input to + // each function. I don't see a strong need to have a transaction with a mutable chain ID. + uint256 chainId; + + // The ECDSA "recovery parameter," should always be 0 or 1. EIP155 specifies that: + // `v = {0,1} + CHAIN_ID * 2 + 35` + // Where `{0,1}` is a stand in for our `recovery_parameter`. Now computing our formula for + // the recovery parameter: + // 1. `v = {0,1} + CHAIN_ID * 2 + 35` + // 2. `v = recovery_parameter + CHAIN_ID * 2 + 35` + // 3. `v - CHAIN_ID * 2 - 35 = recovery_parameter` + // So we're left with the final formula: + // `recovery_parameter = v - CHAIN_ID * 2 - 35` + // NOTE: This variable is a uint8 because `v` is inherently limited to a uint8. If we + // 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; + + // 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; + } + + // Lets us use nicer syntax. + using Lib_EIP155Tx for EIP155Tx; + + + /********************** + * Internal Functions * + **********************/ + + /** + * Decodes an EIP155 transaction and attaches a given Chain ID. + * Transaction *must* be RLP-encoded. + * @param _encoded RLP-encoded EIP155 transaction. + * @param _chainId Chain ID to assocaite with this transaction. + * @return Parsed transaction. + */ + function decode( + bytes memory _encoded, + uint256 _chainId + ) + internal + pure + returns ( + EIP155Tx memory + ) + { + Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_encoded); + + // Note formula above about how recoveryParam is computed. + uint8 v = uint8(Lib_RLPReader.readUint256(decoded[6])); + uint8 recoveryParam = uint8(v - 2 * _chainId - 35); + + // Recovery param being anything other than 0 or 1 indicates that we have the wrong chain + // ID. + require( + recoveryParam < 2, + "Lib_EIP155Tx: Transaction signed with wrong chain ID" + ); + + // Creations can be detected by looking at the byte length here. + bool isCreate = Lib_RLPReader.readBytes(decoded[3]).length == 0; + + return EIP155Tx({ + nonce: Lib_RLPReader.readUint256(decoded[0]), + gasPrice: Lib_RLPReader.readUint256(decoded[1]), + gasLimit: Lib_RLPReader.readUint256(decoded[2]), + to: Lib_RLPReader.readAddress(decoded[3]), + value: Lib_RLPReader.readUint256(decoded[4]), + data: Lib_RLPReader.readBytes(decoded[5]), + v: v, + r: Lib_RLPReader.readBytes32(decoded[7]), + s: Lib_RLPReader.readBytes32(decoded[8]), + chainId: _chainId, + recoveryParam: recoveryParam, + isCreate: isCreate + }); + } + + /** + * Encodes an EIP155 transaction into RLP. + * @param _transaction EIP155 transaction to encode. + * @param _includeSignature Whether or not to encode the signature. + * @return RLP-encoded transaction. + */ + function encode( + EIP155Tx memory _transaction, + bool _includeSignature + ) + internal + pure + returns ( + bytes memory + ) + { + bytes[] memory raw = new bytes[](9); + + raw[0] = Lib_RLPWriter.writeUint(_transaction.nonce); + raw[1] = Lib_RLPWriter.writeUint(_transaction.gasPrice); + raw[2] = Lib_RLPWriter.writeUint(_transaction.gasLimit); + + // We write the encoding of empty bytes when the transaction is a creation, *not* the zero + // address as one might assume. + if (_transaction.isCreate) { + raw[3] = Lib_RLPWriter.writeBytes(''); + } else { + raw[3] = Lib_RLPWriter.writeAddress(_transaction.to); + } + + raw[4] = Lib_RLPWriter.writeUint(_transaction.value); + raw[5] = Lib_RLPWriter.writeBytes(_transaction.data); + + if (_includeSignature) { + raw[6] = Lib_RLPWriter.writeUint(_transaction.v); + raw[7] = Lib_RLPWriter.writeBytes32(_transaction.r); + raw[8] = Lib_RLPWriter.writeBytes32(_transaction.s); + } else { + // Chain ID *is* included in the unsigned transaction. + raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId); + raw[7] = Lib_RLPWriter.writeBytes(''); + raw[8] = Lib_RLPWriter.writeBytes(''); + } + + return Lib_RLPWriter.writeList(raw); + } + + /** + * Computes the hash of an EIP155 transaction. Assumes that you don't want to include the + * signature in this hash because that's a very uncommon usecase. If you really want to include + * the signature, just encode with the signature and take the hash yourself. + */ + function hash( + EIP155Tx memory _transaction + ) + internal + pure + returns ( + bytes32 + ) + { + return keccak256( + _transaction.encode(false) + ); + } + + /** + * Computes the sender of an EIP155 transaction. + * @param _transaction EIP155 transaction to get a sender for. + * @return Address corresponding to the private key that signed this transaction. + */ + function sender( + EIP155Tx memory _transaction + ) + internal + pure + returns ( + address + ) + { + return ecrecover( + _transaction.hash(), + _transaction.recoveryParam + 27, + _transaction.r, + _transaction.s + ); + } +} diff --git a/packages/contracts/contracts/optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol b/packages/contracts/contracts/optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol index f52cf1d88967..cea8f8c6d0b2 100644 --- a/packages/contracts/contracts/optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol +++ b/packages/contracts/contracts/optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol @@ -17,11 +17,6 @@ library Lib_OVMCodec { * Enums * *********/ - enum EOASignatureType { - EIP155_TRANSACTION, - ETH_SIGNED_MESSAGE - } - enum QueueOrigin { SEQUENCER_QUEUE, L1TOL2_QUEUE @@ -85,144 +80,11 @@ library Lib_OVMCodec { uint40 blockNumber; } - struct EIP155Transaction { - uint256 nonce; - uint256 gasPrice; - uint256 gasLimit; - address to; - uint256 value; - bytes data; - uint256 chainId; - } - /********************** * Internal Functions * **********************/ - /** - * Decodes an EOA transaction (i.e., native Ethereum RLP encoding). - * @param _transaction Encoded EOA transaction. - * @return Transaction decoded into a struct. - */ - function decodeEIP155Transaction( - bytes memory _transaction, - bool _isEthSignedMessage - ) - internal - pure - returns ( - EIP155Transaction memory - ) - { - if (_isEthSignedMessage) { - ( - uint256 _nonce, - uint256 _gasLimit, - uint256 _gasPrice, - uint256 _chainId, - address _to, - bytes memory _data - ) = abi.decode( - _transaction, - (uint256, uint256, uint256, uint256, address ,bytes) - ); - return EIP155Transaction({ - nonce: _nonce, - gasPrice: _gasPrice, - gasLimit: _gasLimit, - to: _to, - value: 0, - data: _data, - chainId: _chainId - }); - } else { - Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_transaction); - - return EIP155Transaction({ - nonce: Lib_RLPReader.readUint256(decoded[0]), - gasPrice: Lib_RLPReader.readUint256(decoded[1]), - gasLimit: Lib_RLPReader.readUint256(decoded[2]), - to: Lib_RLPReader.readAddress(decoded[3]), - value: Lib_RLPReader.readUint256(decoded[4]), - data: Lib_RLPReader.readBytes(decoded[5]), - chainId: Lib_RLPReader.readUint256(decoded[6]) - }); - } - } - - /** - * Decompresses a compressed EIP155 transaction. - * @param _transaction Compressed EIP155 transaction bytes. - * @param _chainId Chain ID this transaction was signed with. - * @return Transaction parsed into a struct. - */ - function decompressEIP155Transaction( - bytes memory _transaction, - uint256 _chainId - ) - internal - returns ( - EIP155Transaction memory - ) - { - return EIP155Transaction({ - gasLimit: Lib_BytesUtils.toUint24(_transaction, 0), - gasPrice: uint256(Lib_BytesUtils.toUint24(_transaction, 3)) * 1000000, - nonce: Lib_BytesUtils.toUint24(_transaction, 6), - to: Lib_BytesUtils.toAddress(_transaction, 9), - data: Lib_BytesUtils.slice(_transaction, 29), - chainId: _chainId, - value: 0 - }); - } - - /** - * Encodes an EOA transaction back into the original transaction. - * @param _transaction EIP155transaction to encode. - * @param _isEthSignedMessage Whether or not this was an eth signed message. - * @return Encoded transaction. - */ - function encodeEIP155Transaction( - EIP155Transaction memory _transaction, - bool _isEthSignedMessage - ) - internal - pure - returns ( - bytes memory - ) - { - if (_isEthSignedMessage) { - return abi.encode( - _transaction.nonce, - _transaction.gasLimit, - _transaction.gasPrice, - _transaction.chainId, - _transaction.to, - _transaction.data - ); - } else { - bytes[] memory raw = new bytes[](9); - - raw[0] = Lib_RLPWriter.writeUint(_transaction.nonce); - raw[1] = Lib_RLPWriter.writeUint(_transaction.gasPrice); - raw[2] = Lib_RLPWriter.writeUint(_transaction.gasLimit); - if (_transaction.to == address(0)) { - raw[3] = Lib_RLPWriter.writeBytes(''); - } else { - raw[3] = Lib_RLPWriter.writeAddress(_transaction.to); - } - raw[4] = Lib_RLPWriter.writeUint(0); - raw[5] = Lib_RLPWriter.writeBytes(_transaction.data); - raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId); - raw[7] = Lib_RLPWriter.writeBytes(bytes('')); - raw[8] = Lib_RLPWriter.writeBytes(bytes('')); - - return Lib_RLPWriter.writeList(raw); - } - } - /** * Encodes a standard OVM transaction. * @param _transaction OVM transaction to encode. diff --git a/packages/contracts/contracts/optimistic-ethereum/libraries/rlp/Lib_RLPWriter.sol b/packages/contracts/contracts/optimistic-ethereum/libraries/rlp/Lib_RLPWriter.sol index c4f3e26dc9fc..694f256cbbc0 100644 --- a/packages/contracts/contracts/optimistic-ethereum/libraries/rlp/Lib_RLPWriter.sol +++ b/packages/contracts/contracts/optimistic-ethereum/libraries/rlp/Lib_RLPWriter.sol @@ -89,6 +89,23 @@ library Lib_RLPWriter { return writeBytes(abi.encodePacked(_in)); } + /** + * RLP encodes a bytes32 value. + * @param _in The bytes32 to encode. + * @return _out The RLP encoded bytes32 in bytes. + */ + function writeBytes32( + bytes32 _in + ) + internal + pure + returns ( + bytes memory _out + ) + { + return writeBytes(abi.encodePacked(_in)); + } + /** * RLP encodes a uint. * @param _in The uint256 to encode. diff --git a/packages/contracts/contracts/optimistic-ethereum/libraries/utils/Lib_ECDSAUtils.sol b/packages/contracts/contracts/optimistic-ethereum/libraries/utils/Lib_ECDSAUtils.sol deleted file mode 100644 index 9d973758b920..000000000000 --- a/packages/contracts/contracts/optimistic-ethereum/libraries/utils/Lib_ECDSAUtils.sol +++ /dev/null @@ -1,98 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >0.5.0 <0.8.0; - -/** - * @title Lib_ECDSAUtils - */ -library Lib_ECDSAUtils { - - /************************************** - * Internal Functions: ECDSA Recovery * - **************************************/ - - /** - * Recovers a signed address given a message and signature. - * @param _message Message that was originally signed. - * @param _isEthSignedMessage Whether or not the user used the `Ethereum Signed Message` prefix. - * @param _v Signature `v` parameter. - * @param _r Signature `r` parameter. - * @param _s Signature `s` parameter. - * @return _sender Signer address. - */ - function recover( - bytes memory _message, - bool _isEthSignedMessage, - uint8 _v, - bytes32 _r, - bytes32 _s - ) - internal - pure - returns ( - address _sender - ) - { - bytes32 messageHash = getMessageHash(_message, _isEthSignedMessage); - - return ecrecover( - messageHash, - _v + 27, - _r, - _s - ); - } - - function getMessageHash( - bytes memory _message, - bool _isEthSignedMessage - ) - internal - pure - returns (bytes32) { - if (_isEthSignedMessage) { - return getEthSignedMessageHash(_message); - } - return getNativeMessageHash(_message); - } - - - /************************************* - * Private Functions: ECDSA Recovery * - *************************************/ - - /** - * Gets the native message hash (simple keccak256) for a message. - * @param _message Message to hash. - * @return _messageHash Native message hash. - */ - function getNativeMessageHash( - bytes memory _message - ) - private - pure - returns ( - bytes32 _messageHash - ) - { - return keccak256(_message); - } - - /** - * Gets the hash of a message with the `Ethereum Signed Message` prefix. - * @param _message Message to hash. - * @return _messageHash Prefixed message hash. - */ - function getEthSignedMessageHash( - bytes memory _message - ) - private - pure - returns ( - bytes32 _messageHash - ) - { - bytes memory prefix = "\x19Ethereum Signed Message:\n32"; - bytes32 messageHash = keccak256(_message); - return keccak256(abi.encodePacked(prefix, messageHash)); - } -} \ No newline at end of file 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 4ac7b377b7e9..80fa0a86d851 100644 --- a/packages/contracts/contracts/optimistic-ethereum/libraries/wrappers/Lib_ExecutionManagerWrapper.sol +++ b/packages/contracts/contracts/optimistic-ethereum/libraries/wrappers/Lib_ExecutionManagerWrapper.sol @@ -118,6 +118,25 @@ library Lib_ExecutionManagerWrapper { return abi.decode(returndata, (address)); } + /** + * Calls the ovmCHAINID opcode. + * @return Chain ID of the current network. + */ + function ovmCHAINID() + internal + returns ( + uint256 + ) + { + bytes memory returndata = _safeExecutionManagerInteraction( + abi.encodeWithSignature( + "ovmCHAINID()" + ) + ); + + return abi.decode(returndata, (uint256)); + } + /********************* * Private Functions * diff --git a/packages/contracts/contracts/test-libraries/codec/TestLib_EIP155Tx.sol b/packages/contracts/contracts/test-libraries/codec/TestLib_EIP155Tx.sol new file mode 100644 index 000000000000..6019b8695f8c --- /dev/null +++ b/packages/contracts/contracts/test-libraries/codec/TestLib_EIP155Tx.sol @@ -0,0 +1,71 @@ +// SPDX-License-Identifier: MIT +pragma solidity >0.5.0 <0.8.0; +pragma experimental ABIEncoderV2; + +/* Library Imports */ +import { Lib_EIP155Tx } from "../../optimistic-ethereum/libraries/codec/Lib_EIP155Tx.sol"; + +/** + * @title TestLib_EIP155Tx + */ +contract TestLib_EIP155Tx { + function decode( + bytes memory _encoded, + uint256 _chainId + ) + public + pure + returns ( + Lib_EIP155Tx.EIP155Tx memory + ) + { + return Lib_EIP155Tx.decode( + _encoded, + _chainId + ); + } + + function encode( + Lib_EIP155Tx.EIP155Tx memory _transaction, + bool _includeSignature + ) + public + pure + returns ( + bytes memory + ) + { + return Lib_EIP155Tx.encode( + _transaction, + _includeSignature + ); + } + + function hash( + Lib_EIP155Tx.EIP155Tx memory _transaction + ) + public + pure + returns ( + bytes32 + ) + { + return Lib_EIP155Tx.hash( + _transaction + ); + } + + function sender( + Lib_EIP155Tx.EIP155Tx memory _transaction + ) + public + pure + returns ( + address + ) + { + return Lib_EIP155Tx.sender( + _transaction + ); + } +} diff --git a/packages/contracts/contracts/test-libraries/codec/TestLib_OVMCodec.sol b/packages/contracts/contracts/test-libraries/codec/TestLib_OVMCodec.sol index d162c1216e0e..04c4e5879ca5 100644 --- a/packages/contracts/contracts/test-libraries/codec/TestLib_OVMCodec.sol +++ b/packages/contracts/contracts/test-libraries/codec/TestLib_OVMCodec.sol @@ -9,20 +9,6 @@ import { Lib_OVMCodec } from "../../optimistic-ethereum/libraries/codec/Lib_OVMC * @title TestLib_OVMCodec */ contract TestLib_OVMCodec { - - function decodeEIP155Transaction( - bytes memory _transaction, - bool _isEthSignedMessage - ) - public - pure - returns ( - Lib_OVMCodec.EIP155Transaction memory _decoded - ) - { - return Lib_OVMCodec.decodeEIP155Transaction(_transaction, _isEthSignedMessage); - } - function encodeTransaction( Lib_OVMCodec.Transaction memory _transaction ) @@ -46,19 +32,4 @@ contract TestLib_OVMCodec { { return Lib_OVMCodec.hashTransaction(_transaction); } - - function decompressEIP155Transaction( - bytes memory _transaction, - uint256 _chainId - ) - public - returns ( - Lib_OVMCodec.EIP155Transaction memory _decompressed - ) - { - return Lib_OVMCodec.decompressEIP155Transaction( - _transaction, - _chainId - ); - } } diff --git a/packages/contracts/contracts/test-libraries/utils/TestLib_ECDSAUtils.sol b/packages/contracts/contracts/test-libraries/utils/TestLib_ECDSAUtils.sol deleted file mode 100644 index 4b66bf7f0ec8..000000000000 --- a/packages/contracts/contracts/test-libraries/utils/TestLib_ECDSAUtils.sol +++ /dev/null @@ -1,33 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >0.5.0 <0.8.0; - -/* Library Imports */ -import { Lib_ECDSAUtils } from "../../optimistic-ethereum/libraries/utils/Lib_ECDSAUtils.sol"; - -/** - * @title TestLib_ECDSAUtils - */ -contract TestLib_ECDSAUtils { - - function recover( - bytes memory _message, - bool _isEthSignedMessage, - uint8 _v, - bytes32 _r, - bytes32 _s - ) - public - pure - returns ( - address _sender - ) - { - return Lib_ECDSAUtils.recover( - _message, - _isEthSignedMessage, - _v, - _r, - _s - ); - } -} diff --git a/packages/contracts/deployments/README.md b/packages/contracts/deployments/README.md index d7916ccf4249..616ac2fcacb8 100644 --- a/packages/contracts/deployments/README.md +++ b/packages/contracts/deployments/README.md @@ -49,6 +49,7 @@ Network : __mainnet (chain id: 1)__ |Proxy__OVM_L1ETHGateway|[0xF20C38fCdDF0C790319Fd7431d17ea0c2bC9959c](https://etherscan.io/address/0xF20C38fCdDF0C790319Fd7431d17ea0c2bC9959c)| |mockOVM_BondManager|[0x99EDa8472E93Aa28E5470eEDEc6e32081E14DaFC](https://etherscan.io/address/0x99EDa8472E93Aa28E5470eEDEc6e32081E14DaFC)| --- + ## KOVAN Network : __kovan (chain id: 42)__ @@ -72,4 +73,3 @@ Network : __kovan (chain id: 42)__ |Proxy__OVM_L1CrossDomainMessenger|[0x48062eD9b6488EC41c4CfbF2f568D7773819d8C9](https://kovan.etherscan.io/address/0x48062eD9b6488EC41c4CfbF2f568D7773819d8C9)| |Proxy__OVM_L1ETHGateway|[0xf3902e50dA095bD2e954AB320E8eafDA6152dFDa](https://kovan.etherscan.io/address/0xf3902e50dA095bD2e954AB320E8eafDA6152dFDa)| |mockOVM_BondManager|[0x77e244ec49014cFb9c4572453568eCC3AbB70A2d](https://kovan.etherscan.io/address/0x77e244ec49014cFb9c4572453568eCC3AbB70A2d)| ---- diff --git a/packages/contracts/deployments/goerli-v3/.chainId b/packages/contracts/deployments/goerli-v3/.chainId new file mode 100644 index 000000000000..7813681f5b41 --- /dev/null +++ b/packages/contracts/deployments/goerli-v3/.chainId @@ -0,0 +1 @@ +5 \ No newline at end of file diff --git a/packages/contracts/deployments/goerli-v3/Lib_AddressManager.json b/packages/contracts/deployments/goerli-v3/Lib_AddressManager.json new file mode 100644 index 000000000000..dcffd711c9de --- /dev/null +++ b/packages/contracts/deployments/goerli-v3/Lib_AddressManager.json @@ -0,0 +1,230 @@ +{ + "address": "0xE3d08F0D900A2D53cB794cf82d7127764BcC3092", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "_name", + "type": "string" + }, + { + "indexed": false, + "internalType": "address", + "name": "_newAddress", + "type": "address" + } + ], + "name": "AddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + } + ], + "name": "getAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + }, + { + "internalType": "address", + "name": "_address", + "type": "address" + } + ], + "name": "setAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x8449a49f743929a260b94925095e1a7a33d42a5a58a92910e6ac9aa7b309ec67", + "receipt": { + "to": null, + "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", + "contractAddress": "0xE3d08F0D900A2D53cB794cf82d7127764BcC3092", + "transactionIndex": 14, + "gasUsed": "427277", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000010000000000000000000000000002000000000000000000000000000001000000000100000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000100000000000000000000000000000000000000000000000000000000000010000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x8afc36c046678b1417a5f68af6d0c5ea406e27e7d485ebfd00a47420d00ab9fe", + "transactionHash": "0x8449a49f743929a260b94925095e1a7a33d42a5a58a92910e6ac9aa7b309ec67", + "logs": [ + { + "transactionIndex": 14, + "blockNumber": 4694083, + "transactionHash": "0x8449a49f743929a260b94925095e1a7a33d42a5a58a92910e6ac9aa7b309ec67", + "address": "0xE3d08F0D900A2D53cB794cf82d7127764BcC3092", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000004107438c1b1579f258af9d1ac06194c4a0f55040" + ], + "data": "0x", + "logIndex": 19, + "blockHash": "0x8afc36c046678b1417a5f68af6d0c5ea406e27e7d485ebfd00a47420d00ab9fe" + } + ], + "blockNumber": 4694083, + "cumulativeGasUsed": "1932419", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "dde656dd41f49cad9eac9bc7065fd6a7", + "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 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\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50600061001b61006a565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35061006e565b3390565b6106508061007d6000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063715018a61461005c5780638da5cb5b146100665780639b2ea4bd1461008a578063bf40fac11461013b578063f2fde38b146101e1575b600080fd5b610064610207565b005b61006e6102c5565b604080516001600160a01b039092168252519081900360200190f35b610064600480360360408110156100a057600080fd5b8101906020810181356401000000008111156100bb57600080fd5b8201836020820111156100cd57600080fd5b803590602001918460018302840111640100000000831117156100ef57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550505090356001600160a01b031691506102d49050565b61006e6004803603602081101561015157600080fd5b81019060208101813564010000000081111561016c57600080fd5b82018360208201111561017e57600080fd5b803590602001918460018302840111640100000000831117156101a057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610436945050505050565b610064600480360360208110156101f757600080fd5b50356001600160a01b0316610465565b61020f610579565b6001600160a01b03166102206102c5565b6001600160a01b03161461027b576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b6102dc610579565b6001600160a01b03166102ed6102c5565b6001600160a01b031614610348576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b80600160006103568561057d565b815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507f188466739ff00cc68bfb2367d23ae4b855264264fe1624caa8884399af23454c82826040518080602001836001600160a01b03168152602001828103825284818151815260200191508051906020019080838360005b838110156103f75781810151838201526020016103df565b50505050905090810190601f1680156104245780820380516001836020036101000a031916815260200191505b50935050505060405180910390a15050565b6000600160006104458461057d565b81526020810191909152604001600020546001600160a01b031692915050565b61046d610579565b6001600160a01b031661047e6102c5565b6001600160a01b0316146104d9576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03811661051e5760405162461bcd60e51b81526004018080602001828103825260268152602001806105f56026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b6000816040516020018082805190602001908083835b602083106105b25780518252601f199092019160209182019101610593565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405160208183030381529060405280519060200120905091905056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a26469706673582212209107a301dfba06b8649cc1baf4f5d6df1fb45110fdd8dc25d143490e81f3587e64736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c8063715018a61461005c5780638da5cb5b146100665780639b2ea4bd1461008a578063bf40fac11461013b578063f2fde38b146101e1575b600080fd5b610064610207565b005b61006e6102c5565b604080516001600160a01b039092168252519081900360200190f35b610064600480360360408110156100a057600080fd5b8101906020810181356401000000008111156100bb57600080fd5b8201836020820111156100cd57600080fd5b803590602001918460018302840111640100000000831117156100ef57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550505090356001600160a01b031691506102d49050565b61006e6004803603602081101561015157600080fd5b81019060208101813564010000000081111561016c57600080fd5b82018360208201111561017e57600080fd5b803590602001918460018302840111640100000000831117156101a057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610436945050505050565b610064600480360360208110156101f757600080fd5b50356001600160a01b0316610465565b61020f610579565b6001600160a01b03166102206102c5565b6001600160a01b03161461027b576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b6102dc610579565b6001600160a01b03166102ed6102c5565b6001600160a01b031614610348576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b80600160006103568561057d565b815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507f188466739ff00cc68bfb2367d23ae4b855264264fe1624caa8884399af23454c82826040518080602001836001600160a01b03168152602001828103825284818151815260200191508051906020019080838360005b838110156103f75781810151838201526020016103df565b50505050905090810190601f1680156104245780820380516001836020036101000a031916815260200191505b50935050505060405180910390a15050565b6000600160006104458461057d565b81526020810191909152604001600020546001600160a01b031692915050565b61046d610579565b6001600160a01b031661047e6102c5565b6001600160a01b0316146104d9576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03811661051e5760405162461bcd60e51b81526004018080602001828103825260268152602001806105f56026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b6000816040516020018082805190602001908083835b602083106105b25780518252601f199092019160209182019101610593565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405160208183030381529060405280519060200120905091905056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a26469706673582212209107a301dfba06b8649cc1baf4f5d6df1fb45110fdd8dc25d143490e81f3587e64736f6c63430007060033", + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 7, + "contract": "contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol:Lib_AddressManager", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 11992, + "contract": "contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol:Lib_AddressManager", + "label": "addresses", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes32,t_address)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_address)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => address)", + "numberOfBytes": "32", + "value": "t_address" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/goerli-v3/OVM_CanonicalTransactionChain.json b/packages/contracts/deployments/goerli-v3/OVM_CanonicalTransactionChain.json new file mode 100644 index 000000000000..281829c73d04 --- /dev/null +++ b/packages/contracts/deployments/goerli-v3/OVM_CanonicalTransactionChain.json @@ -0,0 +1,819 @@ +{ + "address": "0x266534680e632Ce9425d8E5a991C43B3531C7818", + "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" + } + ], + "transactionHash": "0xa941e4eaa556a63515c59c7d42dd116f55905a41650c676535d6c70bd1d4f891", + "receipt": { + "to": null, + "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", + "contractAddress": "0x266534680e632Ce9425d8E5a991C43B3531C7818", + "transactionIndex": 2, + "gasUsed": "2831002", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xd7a64d9499678352843045d842ca0ed199d25bcb576e34c7fd3c3cf8989ce836", + "transactionHash": "0xa941e4eaa556a63515c59c7d42dd116f55905a41650c676535d6c70bd1d4f891", + "logs": [], + "blockNumber": 4694099, + "cumulativeGasUsed": "3503418", + "status": 1, + "byzantium": true + }, + "args": [ + "0xE3d08F0D900A2D53cB794cf82d7127764BcC3092", + 2592000, + 172800, + 9000000 + ], + "solcInputHash": "dde656dd41f49cad9eac9bc7065fd6a7", + "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 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/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", + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 12055, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol:OVM_CanonicalTransactionChain", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12048" + }, + { + "astId": 2189, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol:OVM_CanonicalTransactionChain", + "label": "forceInclusionPeriodSeconds", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 2191, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol:OVM_CanonicalTransactionChain", + "label": "forceInclusionPeriodBlocks", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 2193, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol:OVM_CanonicalTransactionChain", + "label": "maxTransactionGasLimit", + "offset": 0, + "slot": "3", + "type": "t_uint256" + } + ], + "types": { + "t_contract(Lib_AddressManager)12048": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/goerli-v3/OVM_ChainStorageContainer:CTC:batches.json b/packages/contracts/deployments/goerli-v3/OVM_ChainStorageContainer:CTC:batches.json new file mode 100644 index 000000000000..5e148d5feb95 --- /dev/null +++ b/packages/contracts/deployments/goerli-v3/OVM_ChainStorageContainer:CTC:batches.json @@ -0,0 +1,453 @@ +{ + "address": "0x7b439CD647b76F45252858C19093a53b4c5FD4B4", + "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" + } + ], + "transactionHash": "0xccaaa6192d2aa73dae4313be6a950378b1b5d86850e6494dec408f625a0713b3", + "receipt": { + "to": null, + "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", + "contractAddress": "0x7b439CD647b76F45252858C19093a53b4c5FD4B4", + "transactionIndex": 7, + "gasUsed": "970990", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x0689af29938844183d2d0c03d93df4c01f711064da67936dc6b2b77310b729b6", + "transactionHash": "0xccaaa6192d2aa73dae4313be6a950378b1b5d86850e6494dec408f625a0713b3", + "logs": [], + "blockNumber": 4694091, + "cumulativeGasUsed": "2858675", + "status": 1, + "byzantium": true + }, + "args": [ + "0xE3d08F0D900A2D53cB794cf82d7127764BcC3092", + "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", + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 12055, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12048" + }, + { + "astId": 3712, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "owner", + "offset": 0, + "slot": "1", + "type": "t_string_storage" + }, + { + "astId": 3714, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "buffer", + "offset": 0, + "slot": "2", + "type": "t_struct(RingBuffer)17101_storage" + } + ], + "types": { + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(Lib_AddressManager)12048": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + }, + "t_mapping(t_uint256,t_bytes32)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bytes32)", + "numberOfBytes": "32", + "value": "t_bytes32" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(Buffer)17090_storage": { + "encoding": "inplace", + "label": "struct Lib_RingBuffer.Buffer", + "members": [ + { + "astId": 17085, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "length", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 17089, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "buf", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint256,t_bytes32)" + } + ], + "numberOfBytes": "64" + }, + "t_struct(RingBuffer)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", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/goerli-v3/OVM_ChainStorageContainer:CTC:queue.json b/packages/contracts/deployments/goerli-v3/OVM_ChainStorageContainer:CTC:queue.json new file mode 100644 index 000000000000..c75f6255c10d --- /dev/null +++ b/packages/contracts/deployments/goerli-v3/OVM_ChainStorageContainer:CTC:queue.json @@ -0,0 +1,453 @@ +{ + "address": "0xeD5fF8cFFba09fa5fF3104a63bA321733c4553d9", + "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" + } + ], + "transactionHash": "0xc18d4e89a763706311175193d4f75a4677a551fb0d8c2ee18f4157192460084f", + "receipt": { + "to": null, + "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", + "contractAddress": "0xeD5fF8cFFba09fa5fF3104a63bA321733c4553d9", + "transactionIndex": 4, + "gasUsed": "970990", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x9fa346bec2f0265f5d068bef12fcde397f7f3a0e808ecdda6516881286575e60", + "transactionHash": "0xc18d4e89a763706311175193d4f75a4677a551fb0d8c2ee18f4157192460084f", + "logs": [], + "blockNumber": 4694093, + "cumulativeGasUsed": "1626532", + "status": 1, + "byzantium": true + }, + "args": [ + "0xE3d08F0D900A2D53cB794cf82d7127764BcC3092", + "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", + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 12055, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12048" + }, + { + "astId": 3712, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "owner", + "offset": 0, + "slot": "1", + "type": "t_string_storage" + }, + { + "astId": 3714, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "buffer", + "offset": 0, + "slot": "2", + "type": "t_struct(RingBuffer)17101_storage" + } + ], + "types": { + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(Lib_AddressManager)12048": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + }, + "t_mapping(t_uint256,t_bytes32)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bytes32)", + "numberOfBytes": "32", + "value": "t_bytes32" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(Buffer)17090_storage": { + "encoding": "inplace", + "label": "struct Lib_RingBuffer.Buffer", + "members": [ + { + "astId": 17085, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "length", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 17089, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "buf", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint256,t_bytes32)" + } + ], + "numberOfBytes": "64" + }, + "t_struct(RingBuffer)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", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/goerli-v3/OVM_ChainStorageContainer:SCC:batches.json b/packages/contracts/deployments/goerli-v3/OVM_ChainStorageContainer:SCC:batches.json new file mode 100644 index 000000000000..2920cf0e81d5 --- /dev/null +++ b/packages/contracts/deployments/goerli-v3/OVM_ChainStorageContainer:SCC:batches.json @@ -0,0 +1,453 @@ +{ + "address": "0x2A622E327D7A204b39355202d41BD9B752C8df54", + "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" + } + ], + "transactionHash": "0x60b610c9b4ebbbbfb38e22d209b0d25a52527cb323941014114a4a2c362e2863", + "receipt": { + "to": null, + "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", + "contractAddress": "0x2A622E327D7A204b39355202d41BD9B752C8df54", + "transactionIndex": 3, + "gasUsed": "970930", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xa654708146fc0e44c144ff624caea84d6cf5519c3421882cacb260ca6823123b", + "transactionHash": "0x60b610c9b4ebbbbfb38e22d209b0d25a52527cb323941014114a4a2c362e2863", + "logs": [], + "blockNumber": 4694097, + "cumulativeGasUsed": "1184521", + "status": 1, + "byzantium": true + }, + "args": [ + "0xE3d08F0D900A2D53cB794cf82d7127764BcC3092", + "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", + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 12055, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12048" + }, + { + "astId": 3712, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "owner", + "offset": 0, + "slot": "1", + "type": "t_string_storage" + }, + { + "astId": 3714, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "buffer", + "offset": 0, + "slot": "2", + "type": "t_struct(RingBuffer)17101_storage" + } + ], + "types": { + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(Lib_AddressManager)12048": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + }, + "t_mapping(t_uint256,t_bytes32)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bytes32)", + "numberOfBytes": "32", + "value": "t_bytes32" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(Buffer)17090_storage": { + "encoding": "inplace", + "label": "struct Lib_RingBuffer.Buffer", + "members": [ + { + "astId": 17085, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "length", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 17089, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "buf", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint256,t_bytes32)" + } + ], + "numberOfBytes": "64" + }, + "t_struct(RingBuffer)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", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/goerli-v3/OVM_ExecutionManager.json b/packages/contracts/deployments/goerli-v3/OVM_ExecutionManager.json new file mode 100644 index 000000000000..ede173c71acb --- /dev/null +++ b/packages/contracts/deployments/goerli-v3/OVM_ExecutionManager.json @@ -0,0 +1,1269 @@ +{ + "address": "0x45B459295d6b08D7dA3B9daae541D5F75E1CF818", + "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" + } + ], + "transactionHash": "0xcda10869e171175332a8b2722029f315fe9742242599f6884958af3273c49fa0", + "receipt": { + "to": null, + "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", + "contractAddress": "0x45B459295d6b08D7dA3B9daae541D5F75E1CF818", + "transactionIndex": 2, + "gasUsed": "2937053", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x35f0b7509eaacd23e211fd8242c268f94c1ab83a2e08567e65d82911da0364c4", + "transactionHash": "0xcda10869e171175332a8b2722029f315fe9742242599f6884958af3273c49fa0", + "logs": [], + "blockNumber": 4694112, + "cumulativeGasUsed": "3078528", + "status": 1, + "byzantium": true + }, + "args": [ + "0xE3d08F0D900A2D53cB794cf82d7127764BcC3092", + { + "minTransactionGasLimit": 50000, + "maxTransactionGasLimit": 9000000, + "maxGasPerQueuePerEpoch": 250000000, + "secondsPerEpoch": 0 + }, + { + "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", + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 12055, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12048" + }, + { + "astId": 4430, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmSafetyChecker", + "offset": 0, + "slot": "1", + "type": "t_contract(iOVM_SafetyChecker)10535" + }, + { + "astId": 4432, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmStateManager", + "offset": 0, + "slot": "2", + "type": "t_contract(iOVM_StateManager)10767" + }, + { + "astId": 4434, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "gasMeterConfig", + "offset": 0, + "slot": "3", + "type": "t_struct(GasMeterConfig)10318_storage" + }, + { + "astId": 4436, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "globalContext", + "offset": 0, + "slot": "7", + "type": "t_struct(GlobalContext)10321_storage" + }, + { + "astId": 4438, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "transactionContext", + "offset": 0, + "slot": "8", + "type": "t_struct(TransactionContext)10334_storage" + }, + { + "astId": 4440, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "messageContext", + "offset": 0, + "slot": "14", + "type": "t_struct(MessageContext)10344_storage" + }, + { + "astId": 4442, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "transactionRecord", + "offset": 0, + "slot": "16", + "type": "t_struct(TransactionRecord)10337_storage" + }, + { + "astId": 4444, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "messageRecord", + "offset": 0, + "slot": "17", + "type": "t_struct(MessageRecord)10347_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(Lib_AddressManager)12048": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + }, + "t_contract(iOVM_SafetyChecker)10535": { + "encoding": "inplace", + "label": "contract iOVM_SafetyChecker", + "numberOfBytes": "20" + }, + "t_contract(iOVM_StateManager)10767": { + "encoding": "inplace", + "label": "contract iOVM_StateManager", + "numberOfBytes": "20" + }, + "t_enum(QueueOrigin)11688": { + "encoding": "inplace", + "label": "enum Lib_OVMCodec.QueueOrigin", + "numberOfBytes": "1" + }, + "t_struct(GasMeterConfig)10318_storage": { + "encoding": "inplace", + "label": "struct iOVM_ExecutionManager.GasMeterConfig", + "members": [ + { + "astId": 10311, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "minTransactionGasLimit", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 10313, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "maxTransactionGasLimit", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 10315, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "maxGasPerQueuePerEpoch", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 10317, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "secondsPerEpoch", + "offset": 0, + "slot": "3", + "type": "t_uint256" + } + ], + "numberOfBytes": "128" + }, + "t_struct(GlobalContext)10321_storage": { + "encoding": "inplace", + "label": "struct iOVM_ExecutionManager.GlobalContext", + "members": [ + { + "astId": 10320, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmCHAINID", + "offset": 0, + "slot": "0", + "type": "t_uint256" + } + ], + "numberOfBytes": "32" + }, + "t_struct(MessageContext)10344_storage": { + "encoding": "inplace", + "label": "struct iOVM_ExecutionManager.MessageContext", + "members": [ + { + "astId": 10339, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmCALLER", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 10341, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmADDRESS", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 10343, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "isStatic", + "offset": 20, + "slot": "1", + "type": "t_bool" + } + ], + "numberOfBytes": "64" + }, + "t_struct(MessageRecord)10347_storage": { + "encoding": "inplace", + "label": "struct iOVM_ExecutionManager.MessageRecord", + "members": [ + { + "astId": 10346, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "nuisanceGasLeft", + "offset": 0, + "slot": "0", + "type": "t_uint256" + } + ], + "numberOfBytes": "32" + }, + "t_struct(TransactionContext)10334_storage": { + "encoding": "inplace", + "label": "struct iOVM_ExecutionManager.TransactionContext", + "members": [ + { + "astId": 10323, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmL1QUEUEORIGIN", + "offset": 0, + "slot": "0", + "type": "t_enum(QueueOrigin)11688" + }, + { + "astId": 10325, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmTIMESTAMP", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 10327, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmNUMBER", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 10329, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmGASLIMIT", + "offset": 0, + "slot": "3", + "type": "t_uint256" + }, + { + "astId": 10331, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmTXGASLIMIT", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 10333, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmL1TXORIGIN", + "offset": 0, + "slot": "5", + "type": "t_address" + } + ], + "numberOfBytes": "192" + }, + "t_struct(TransactionRecord)10337_storage": { + "encoding": "inplace", + "label": "struct iOVM_ExecutionManager.TransactionRecord", + "members": [ + { + "astId": 10336, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmGasRefund", + "offset": 0, + "slot": "0", + "type": "t_uint256" + } + ], + "numberOfBytes": "32" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/goerli-v3/OVM_FraudVerifier.json b/packages/contracts/deployments/goerli-v3/OVM_FraudVerifier.json new file mode 100644 index 000000000000..7cd7890026ec --- /dev/null +++ b/packages/contracts/deployments/goerli-v3/OVM_FraudVerifier.json @@ -0,0 +1,576 @@ +{ + "address": "0xfA590cE7fE1d80D4b286e23f3f6e9f9357D6A90b", + "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" + } + ], + "transactionHash": "0x189c405d4c429a074b507c5110b14ce1d2397becac20fad4a768c3def9c0ccd7", + "receipt": { + "to": null, + "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", + "contractAddress": "0xfA590cE7fE1d80D4b286e23f3f6e9f9357D6A90b", + "transactionIndex": 0, + "gasUsed": "1386998", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x36e6b6bab1d2fceb4b01f6fb56cbe0fe566f9d3cbcc66d80bf6072e3be43033a", + "transactionHash": "0x189c405d4c429a074b507c5110b14ce1d2397becac20fad4a768c3def9c0ccd7", + "logs": [], + "blockNumber": 4694114, + "cumulativeGasUsed": "1386998", + "status": 1, + "byzantium": true + }, + "args": [ + "0xE3d08F0D900A2D53cB794cf82d7127764BcC3092" + ], + "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", + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 12055, + "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_FraudVerifier.sol:OVM_FraudVerifier", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12048" + }, + { + "astId": 8646, + "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)" + } + ], + "types": { + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(Lib_AddressManager)12048": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + }, + "t_contract(iOVM_StateTransitioner)11217": { + "encoding": "inplace", + "label": "contract iOVM_StateTransitioner", + "numberOfBytes": "20" + }, + "t_mapping(t_bytes32,t_contract(iOVM_StateTransitioner)11217)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => contract iOVM_StateTransitioner)", + "numberOfBytes": "32", + "value": "t_contract(iOVM_StateTransitioner)11217" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/goerli-v3/OVM_L1CrossDomainMessenger.json b/packages/contracts/deployments/goerli-v3/OVM_L1CrossDomainMessenger.json new file mode 100644 index 000000000000..503ab92b97a2 --- /dev/null +++ b/packages/contracts/deployments/goerli-v3/OVM_L1CrossDomainMessenger.json @@ -0,0 +1,514 @@ +{ + "address": "0x27BdfF69C72d29493bfD2152DbE28657f8Ddd5df", + "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" + } + ], + "transactionHash": "0x75714a6d9ca51a7b21d8556ab605cee562224d7f13670f3b703043433f8b0ac5", + "receipt": { + "to": null, + "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", + "contractAddress": "0x27BdfF69C72d29493bfD2152DbE28657f8Ddd5df", + "transactionIndex": 3, + "gasUsed": "2236734", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x10ae1fc56166e1992c7ece059bf38b711ed5a1f696335fd2f2b9dc82c3d56495", + "transactionHash": "0x75714a6d9ca51a7b21d8556ab605cee562224d7f13670f3b703043433f8b0ac5", + "logs": [], + "blockNumber": 4694106, + "cumulativeGasUsed": "3135625", + "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", + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 571, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "_status", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 619, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "relayedMessages", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes32,t_bool)" + }, + { + "astId": 623, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "successfulMessages", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_bytes32,t_bool)" + }, + { + "astId": 627, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "sentMessages", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_bytes32,t_bool)" + }, + { + "astId": 629, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "messageNonce", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 632, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "xDomainMsgSender", + "offset": 0, + "slot": "5", + "type": "t_address" + }, + { + "astId": 12055, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "libAddressManager", + "offset": 0, + "slot": "6", + "type": "t_contract(Lib_AddressManager)12048" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(Lib_AddressManager)12048": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + }, + "t_mapping(t_bytes32,t_bool)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/goerli-v3/OVM_L1ETHGateway.json b/packages/contracts/deployments/goerli-v3/OVM_L1ETHGateway.json new file mode 100644 index 000000000000..4f0be1fd795e --- /dev/null +++ b/packages/contracts/deployments/goerli-v3/OVM_L1ETHGateway.json @@ -0,0 +1,293 @@ +{ + "address": "0x746E840b94cC75921D1cb620b83CFd0C658B2852", + "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": "0x3880c009c976f21e54efda94e4cea27d6ac934b7e2cccae7f84187b2654eea57", + "receipt": { + "to": null, + "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", + "contractAddress": "0x746E840b94cC75921D1cb620b83CFd0C658B2852", + "transactionIndex": 6, + "gasUsed": "609964", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xce3b66ca48656384c99d18e47e91b59ba8c45887e83a7326236dc21acef3b142", + "transactionHash": "0x3880c009c976f21e54efda94e4cea27d6ac934b7e2cccae7f84187b2654eea57", + "logs": [], + "blockNumber": 4694128, + "cumulativeGasUsed": "1124104", + "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\":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": 11243, + "contract": "contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ETHGateway.sol:OVM_L1ETHGateway", + "label": "messenger", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 12055, + "contract": "contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ETHGateway.sol:OVM_L1ETHGateway", + "label": "libAddressManager", + "offset": 0, + "slot": "1", + "type": "t_contract(Lib_AddressManager)12048" + }, + { + "astId": 1907, + "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)12048": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/goerli-v3/OVM_L1MultiMessageRelayer.json b/packages/contracts/deployments/goerli-v3/OVM_L1MultiMessageRelayer.json new file mode 100644 index 000000000000..8ce0f27457d5 --- /dev/null +++ b/packages/contracts/deployments/goerli-v3/OVM_L1MultiMessageRelayer.json @@ -0,0 +1,234 @@ +{ + "address": "0x737557d97f7f2ccb0263C4b55f0D735D52c2D385", + "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" + } + ], + "transactionHash": "0x4980c4690dc98b1cf4e24b20fc822b96a70e062195daeb603abaca93e5344003", + "receipt": { + "to": null, + "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", + "contractAddress": "0x737557d97f7f2ccb0263C4b55f0D735D52c2D385", + "transactionIndex": 2, + "gasUsed": "606489", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x0df30adfabcfa2a632c8bc3fbd23be38c9ae56ca684651653924bac5734e5bd4", + "transactionHash": "0x4980c4690dc98b1cf4e24b20fc822b96a70e062195daeb603abaca93e5344003", + "logs": [], + "blockNumber": 4694125, + "cumulativeGasUsed": "1039312", + "status": 1, + "byzantium": true + }, + "args": [ + "0xE3d08F0D900A2D53cB794cf82d7127764BcC3092" + ], + "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", + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 12055, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1MultiMessageRelayer.sol:OVM_L1MultiMessageRelayer", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12048" + } + ], + "types": { + "t_contract(Lib_AddressManager)12048": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/goerli-v3/OVM_SafetyChecker.json b/packages/contracts/deployments/goerli-v3/OVM_SafetyChecker.json new file mode 100644 index 000000000000..deb7cad8fb54 --- /dev/null +++ b/packages/contracts/deployments/goerli-v3/OVM_SafetyChecker.json @@ -0,0 +1,74 @@ +{ + "address": "0x71D4ea896C9a2D4a973CC5c7E347B6707691ECa0", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "_bytecode", + "type": "bytes" + } + ], + "name": "isBytecodeSafe", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0x71b7c1e6832ad929f7d8f28c89efcd535b888c667cc23b7afb74b7f3cb9989be", + "receipt": { + "to": null, + "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", + "contractAddress": "0x71D4ea896C9a2D4a973CC5c7E347B6707691ECa0", + "transactionIndex": 10, + "gasUsed": "243548", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xc547b5d6b5db90aa7a21312706d22b72125e2883d5ff3ad54698673644e3a14c", + "transactionHash": "0x71b7c1e6832ad929f7d8f28c89efcd535b888c667cc23b7afb74b7f3cb9989be", + "logs": [], + "blockNumber": 4694122, + "cumulativeGasUsed": "839321", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "dde656dd41f49cad9eac9bc7065fd6a7", + "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", + "devdoc": { + "details": "The Safety Checker verifies that contracts deployed on L2 do not contain any \"unsafe\" operations. An operation is considered unsafe if it would access state variables which are specific to the environment (ie. L1 or L2) in which it is executed, as this could be used to \"escape the sandbox\" of the OVM, resulting in non-deterministic fraud proofs. That is, an attacker would be able to \"prove fraud\" on an honestly applied transaction. Note that a \"safe\" contract requires opcodes to appear in a particular pattern; omission of \"unsafe\" opcodes is necessary, but not sufficient. Compiler used: solc Runtime target: EVM", + "kind": "dev", + "methods": { + "isBytecodeSafe(bytes)": { + "params": { + "_bytecode": "The bytecode to safety check." + }, + "returns": { + "_0": "`true` if the bytecode is safe, `false` otherwise." + } + } + }, + "title": "OVM_SafetyChecker", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "isBytecodeSafe(bytes)": { + "notice": "Returns whether or not all of the provided bytecode is safe." + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/goerli-v3/OVM_StateCommitmentChain.json b/packages/contracts/deployments/goerli-v3/OVM_StateCommitmentChain.json new file mode 100644 index 000000000000..41eeda6cca39 --- /dev/null +++ b/packages/contracts/deployments/goerli-v3/OVM_StateCommitmentChain.json @@ -0,0 +1,529 @@ +{ + "address": "0x5c3e321947C99698027108351ee736823Bd157D8", + "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" + } + ], + "transactionHash": "0xf44aee1847653102e234b3e1acdcc3ec12b328f99e68a9b6fbe90045f4b5c846", + "receipt": { + "to": null, + "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", + "contractAddress": "0x5c3e321947C99698027108351ee736823Bd157D8", + "transactionIndex": 0, + "gasUsed": "1630165", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x6a15b236bd608f28fb33fcaef422933c3bcf9ae108a761d68d1a2f03e2c1ae85", + "transactionHash": "0xf44aee1847653102e234b3e1acdcc3ec12b328f99e68a9b6fbe90045f4b5c846", + "logs": [], + "blockNumber": 4694101, + "cumulativeGasUsed": "1630165", + "status": 1, + "byzantium": true + }, + "args": [ + "0xE3d08F0D900A2D53cB794cf82d7127764BcC3092", + 30, + 999999999 + ], + "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", + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 12055, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol:OVM_StateCommitmentChain", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12048" + }, + { + "astId": 3924, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol:OVM_StateCommitmentChain", + "label": "FRAUD_PROOF_WINDOW", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 3926, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol:OVM_StateCommitmentChain", + "label": "SEQUENCER_PUBLISH_WINDOW", + "offset": 0, + "slot": "2", + "type": "t_uint256" + } + ], + "types": { + "t_contract(Lib_AddressManager)12048": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/goerli-v3/OVM_StateManagerFactory.json b/packages/contracts/deployments/goerli-v3/OVM_StateManagerFactory.json new file mode 100644 index 000000000000..60ed24301637 --- /dev/null +++ b/packages/contracts/deployments/goerli-v3/OVM_StateManagerFactory.json @@ -0,0 +1,74 @@ +{ + "address": "0x8E63CD1CfDBe5d34a7a91B97E0A2AeA23D0e585D", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "create", + "outputs": [ + { + "internalType": "contract iOVM_StateManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xd689eba5b8fd84816f3fbe9c3be710705e27741e22403240dace3f0a68a50f55", + "receipt": { + "to": null, + "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", + "contractAddress": "0x8E63CD1CfDBe5d34a7a91B97E0A2AeA23D0e585D", + "transactionIndex": 2, + "gasUsed": "1170970", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xb974189ddc2d16744bedca25c14ff6d9963b3ca5eb813d432444cc1211b17c57", + "transactionHash": "0xd689eba5b8fd84816f3fbe9c3be710705e27741e22403240dace3f0a68a50f55", + "logs": [], + "blockNumber": 4694117, + "cumulativeGasUsed": "1355204", + "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", + "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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/goerli-v3/OVM_StateTransitionerFactory.json b/packages/contracts/deployments/goerli-v3/OVM_StateTransitionerFactory.json new file mode 100644 index 000000000000..6b841b9de7f1 --- /dev/null +++ b/packages/contracts/deployments/goerli-v3/OVM_StateTransitionerFactory.json @@ -0,0 +1,163 @@ +{ + "address": "0x543021950Af9250443EEdc681755e0bdBd3Fc81d", + "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" + } + ], + "transactionHash": "0xa0d4c463ca8c4e28f45f626748821c6ee6ea8c1bfa3177994122a305513d981a", + "receipt": { + "to": null, + "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", + "contractAddress": "0x543021950Af9250443EEdc681755e0bdBd3Fc81d", + "transactionIndex": 2, + "gasUsed": "4129040", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xa51e77d2c41ef20f84a04f6744fdab9d62baa0e0455d7c0ceec6bfacbe379ed2", + "transactionHash": "0xa0d4c463ca8c4e28f45f626748821c6ee6ea8c1bfa3177994122a305513d981a", + "logs": [], + "blockNumber": 4694120, + "cumulativeGasUsed": "4262813", + "status": 1, + "byzantium": true + }, + "args": [ + "0xE3d08F0D900A2D53cB794cf82d7127764BcC3092" + ], + "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", + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 12055, + "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_StateTransitionerFactory.sol:OVM_StateTransitionerFactory", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12048" + } + ], + "types": { + "t_contract(Lib_AddressManager)12048": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/goerli-v3/Proxy__OVM_L1CrossDomainMessenger.json b/packages/contracts/deployments/goerli-v3/Proxy__OVM_L1CrossDomainMessenger.json new file mode 100644 index 000000000000..52dce9d3c9a2 --- /dev/null +++ b/packages/contracts/deployments/goerli-v3/Proxy__OVM_L1CrossDomainMessenger.json @@ -0,0 +1,118 @@ +{ + "address": "0xFec83764acDeEc2ac338d4cc1f12bBE3cCDf551E", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_libAddressManager", + "type": "address" + }, + { + "internalType": "string", + "name": "_implementationName", + "type": "string" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "stateMutability": "payable", + "type": "fallback" + } + ], + "transactionHash": "0xc796492651cfcf9c1e77eabc558db2473ee567fe03e3dbb6c8c7bccdd0a6cea9", + "receipt": { + "to": null, + "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", + "contractAddress": "0xFec83764acDeEc2ac338d4cc1f12bBE3cCDf551E", + "transactionIndex": 6, + "gasUsed": "225024", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xb3e0b0bffed18d30c6a9891532f9ac5f2c4b018603682fc6547b0a166c00e935", + "transactionHash": "0xc796492651cfcf9c1e77eabc558db2473ee567fe03e3dbb6c8c7bccdd0a6cea9", + "logs": [], + "blockNumber": 4694109, + "cumulativeGasUsed": "4216864", + "status": 1, + "byzantium": true + }, + "args": [ + "0xE3d08F0D900A2D53cB794cf82d7127764BcC3092", + "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", + "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": 12092, + "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": 12096, + "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)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_contract(Lib_AddressManager)12048": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_contract(Lib_AddressManager)12048)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => contract Lib_AddressManager)", + "numberOfBytes": "32", + "value": "t_contract(Lib_AddressManager)12048" + }, + "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/goerli-v3/Proxy__OVM_L1ETHGateway.json b/packages/contracts/deployments/goerli-v3/Proxy__OVM_L1ETHGateway.json new file mode 100644 index 000000000000..67b28f004bcb --- /dev/null +++ b/packages/contracts/deployments/goerli-v3/Proxy__OVM_L1ETHGateway.json @@ -0,0 +1,118 @@ +{ + "address": "0xA721CF3e39E5cB4CfEEc0e32EE05B3D05AA9aE39", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_libAddressManager", + "type": "address" + }, + { + "internalType": "string", + "name": "_implementationName", + "type": "string" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "stateMutability": "payable", + "type": "fallback" + } + ], + "transactionHash": "0x3d4a30fba0bff5ac4443bc0060601b94df8c87840eb11dc8e586adc03e4e804e", + "receipt": { + "to": null, + "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", + "contractAddress": "0xA721CF3e39E5cB4CfEEc0e32EE05B3D05AA9aE39", + "transactionIndex": 1, + "gasUsed": "224904", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xcffaf68b69cbb4498ca1c7d9727b3f74c6221de283657cc7ca5e7abb62b7fedc", + "transactionHash": "0x3d4a30fba0bff5ac4443bc0060601b94df8c87840eb11dc8e586adc03e4e804e", + "logs": [], + "blockNumber": 4694131, + "cumulativeGasUsed": "323310", + "status": 1, + "byzantium": true + }, + "args": [ + "0xE3d08F0D900A2D53cB794cf82d7127764BcC3092", + "OVM_L1ETHGateway" + ], + "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", + "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": 12092, + "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": 12096, + "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)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_contract(Lib_AddressManager)12048": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_contract(Lib_AddressManager)12048)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => contract Lib_AddressManager)", + "numberOfBytes": "32", + "value": "t_contract(Lib_AddressManager)12048" + }, + "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/goerli-v3/mockOVM_BondManager.json b/packages/contracts/deployments/goerli-v3/mockOVM_BondManager.json new file mode 100644 index 000000000000..013c9656cb3f --- /dev/null +++ b/packages/contracts/deployments/goerli-v3/mockOVM_BondManager.json @@ -0,0 +1,242 @@ +{ + "address": "0x35a7735F9f517d071d5cFf89D11Ab4488bc5Df8C", + "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" + } + ], + "transactionHash": "0xd3ec4ca65af45c592fff0d78013702b253b1b3c8e1d1c76ccf17180dfa1f32ab", + "receipt": { + "to": null, + "from": "0x4107438C1b1579f258AF9d1AC06194C4a0F55040", + "contractAddress": "0x35a7735F9f517d071d5cFf89D11Ab4488bc5Df8C", + "transactionIndex": 3, + "gasUsed": "298498", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x07330e15f5aa83781291ad50e573aa2edc5cb158477fcb8df5e1d0ddbd38415d", + "transactionHash": "0xd3ec4ca65af45c592fff0d78013702b253b1b3c8e1d1c76ccf17180dfa1f32ab", + "logs": [], + "blockNumber": 4694104, + "cumulativeGasUsed": "1677808", + "status": 1, + "byzantium": true + }, + "args": [ + "0xE3d08F0D900A2D53cB794cf82d7127764BcC3092" + ], + "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", + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 12055, + "contract": "contracts/optimistic-ethereum/mockOVM/verification/mockOVM_BondManager.sol:mockOVM_BondManager", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12048" + } + ], + "types": { + "t_contract(Lib_AddressManager)12048": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/goerli-v3/solcInputs/dde656dd41f49cad9eac9bc7065fd6a7.json b/packages/contracts/deployments/goerli-v3/solcInputs/dde656dd41f49cad9eac9bc7065fd6a7.json new file mode 100644 index 000000000000..8e5b0ba17232 --- /dev/null +++ b/packages/contracts/deployments/goerli-v3/solcInputs/dde656dd41f49cad9eac9bc7065fd6a7.json @@ -0,0 +1,290 @@ +{ + "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/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/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_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" + }, + "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/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/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" + }, + "@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/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/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/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/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" + }, + "@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" + }, + "@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" + }, + "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" + }, + "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/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/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/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/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/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/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/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/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/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/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/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/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/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 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/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" + }, + "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/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_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/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_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" + }, + "@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 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" + }, + "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_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" + }, + "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/* 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" + }, + "@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/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/**\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 } 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" + }, + "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/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/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 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/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_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" + } + }, + "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-v3/.chainId b/packages/contracts/deployments/kovan-v3/.chainId new file mode 100644 index 000000000000..f70d7bba4ae1 --- /dev/null +++ b/packages/contracts/deployments/kovan-v3/.chainId @@ -0,0 +1 @@ +42 \ No newline at end of file diff --git a/packages/contracts/deployments/kovan-v3/Lib_AddressManager.json b/packages/contracts/deployments/kovan-v3/Lib_AddressManager.json new file mode 100644 index 000000000000..6f254b77797c --- /dev/null +++ b/packages/contracts/deployments/kovan-v3/Lib_AddressManager.json @@ -0,0 +1,230 @@ +{ + "address": "0xd56F695e73286ac252A37593DD4E7c14270eC1Df", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "_name", + "type": "string" + }, + { + "indexed": false, + "internalType": "address", + "name": "_newAddress", + "type": "address" + } + ], + "name": "AddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + } + ], + "name": "getAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + }, + { + "internalType": "address", + "name": "_address", + "type": "address" + } + ], + "name": "setAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x3f80c75882bf9b2b74d3153cdc8d205e473891a8056604c361c32822f88a1a04", + "receipt": { + "to": null, + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0xd56F695e73286ac252A37593DD4E7c14270eC1Df", + "transactionIndex": 5, + "gasUsed": "425977", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000001000000000000000000000000020000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000000000000000080000000000000000000000000000000000000010000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000020000080000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x570e3192ef23218091f6ad7d48a122cd3d4dc06792cb1c4f6523bdbbe3d88b0c", + "transactionHash": "0x3f80c75882bf9b2b74d3153cdc8d205e473891a8056604c361c32822f88a1a04", + "logs": [ + { + "transactionIndex": 5, + "blockNumber": 24572757, + "transactionHash": "0x3f80c75882bf9b2b74d3153cdc8d205e473891a8056604c361c32822f88a1a04", + "address": "0xd56F695e73286ac252A37593DD4E7c14270eC1Df", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000018394b52d3cb931dfa76f63251919d051953413d" + ], + "data": "0x", + "logIndex": 10, + "blockHash": "0x570e3192ef23218091f6ad7d48a122cd3d4dc06792cb1c4f6523bdbbe3d88b0c" + } + ], + "blockNumber": 24572757, + "cumulativeGasUsed": "863778", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "5ee8e508e2c54cb5ac6783b4855b1558", + "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 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\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50600061001b61006a565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35061006e565b3390565b6106508061007d6000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063715018a61461005c5780638da5cb5b146100665780639b2ea4bd1461008a578063bf40fac11461013b578063f2fde38b146101e1575b600080fd5b610064610207565b005b61006e6102c5565b604080516001600160a01b039092168252519081900360200190f35b610064600480360360408110156100a057600080fd5b8101906020810181356401000000008111156100bb57600080fd5b8201836020820111156100cd57600080fd5b803590602001918460018302840111640100000000831117156100ef57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550505090356001600160a01b031691506102d49050565b61006e6004803603602081101561015157600080fd5b81019060208101813564010000000081111561016c57600080fd5b82018360208201111561017e57600080fd5b803590602001918460018302840111640100000000831117156101a057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610436945050505050565b610064600480360360208110156101f757600080fd5b50356001600160a01b0316610465565b61020f610579565b6001600160a01b03166102206102c5565b6001600160a01b03161461027b576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b6102dc610579565b6001600160a01b03166102ed6102c5565b6001600160a01b031614610348576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b80600160006103568561057d565b815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507f188466739ff00cc68bfb2367d23ae4b855264264fe1624caa8884399af23454c82826040518080602001836001600160a01b03168152602001828103825284818151815260200191508051906020019080838360005b838110156103f75781810151838201526020016103df565b50505050905090810190601f1680156104245780820380516001836020036101000a031916815260200191505b50935050505060405180910390a15050565b6000600160006104458461057d565b81526020810191909152604001600020546001600160a01b031692915050565b61046d610579565b6001600160a01b031661047e6102c5565b6001600160a01b0316146104d9576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03811661051e5760405162461bcd60e51b81526004018080602001828103825260268152602001806105f56026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b6000816040516020018082805190602001908083835b602083106105b25780518252601f199092019160209182019101610593565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405160208183030381529060405280519060200120905091905056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a26469706673582212209107a301dfba06b8649cc1baf4f5d6df1fb45110fdd8dc25d143490e81f3587e64736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c8063715018a61461005c5780638da5cb5b146100665780639b2ea4bd1461008a578063bf40fac11461013b578063f2fde38b146101e1575b600080fd5b610064610207565b005b61006e6102c5565b604080516001600160a01b039092168252519081900360200190f35b610064600480360360408110156100a057600080fd5b8101906020810181356401000000008111156100bb57600080fd5b8201836020820111156100cd57600080fd5b803590602001918460018302840111640100000000831117156100ef57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550505090356001600160a01b031691506102d49050565b61006e6004803603602081101561015157600080fd5b81019060208101813564010000000081111561016c57600080fd5b82018360208201111561017e57600080fd5b803590602001918460018302840111640100000000831117156101a057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610436945050505050565b610064600480360360208110156101f757600080fd5b50356001600160a01b0316610465565b61020f610579565b6001600160a01b03166102206102c5565b6001600160a01b03161461027b576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b6102dc610579565b6001600160a01b03166102ed6102c5565b6001600160a01b031614610348576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b80600160006103568561057d565b815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507f188466739ff00cc68bfb2367d23ae4b855264264fe1624caa8884399af23454c82826040518080602001836001600160a01b03168152602001828103825284818151815260200191508051906020019080838360005b838110156103f75781810151838201526020016103df565b50505050905090810190601f1680156104245780820380516001836020036101000a031916815260200191505b50935050505060405180910390a15050565b6000600160006104458461057d565b81526020810191909152604001600020546001600160a01b031692915050565b61046d610579565b6001600160a01b031661047e6102c5565b6001600160a01b0316146104d9576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03811661051e5760405162461bcd60e51b81526004018080602001828103825260268152602001806105f56026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b6000816040516020018082805190602001908083835b602083106105b25780518252601f199092019160209182019101610593565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405160208183030381529060405280519060200120905091905056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a26469706673582212209107a301dfba06b8649cc1baf4f5d6df1fb45110fdd8dc25d143490e81f3587e64736f6c63430007060033", + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 664, + "contract": "contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol:Lib_AddressManager", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 12737, + "contract": "contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol:Lib_AddressManager", + "label": "addresses", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes32,t_address)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_address)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => address)", + "numberOfBytes": "32", + "value": "t_address" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/kovan-v3/OVM_CanonicalTransactionChain.json b/packages/contracts/deployments/kovan-v3/OVM_CanonicalTransactionChain.json new file mode 100644 index 000000000000..16c213ccae63 --- /dev/null +++ b/packages/contracts/deployments/kovan-v3/OVM_CanonicalTransactionChain.json @@ -0,0 +1,819 @@ +{ + "address": "0x895eabB95D684c15fa46Dc00a6b7557450083DEF", + "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" + } + ], + "transactionHash": "0x87f51aeb050ec2c556d14cdc38b30125a66e88689373f727d2f03debbc1313fd", + "receipt": { + "to": null, + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0x895eabB95D684c15fa46Dc00a6b7557450083DEF", + "transactionIndex": 1, + "gasUsed": "2823402", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x611066b262d0e72ca9d3d3d00a26327bc03a751fe0ffa189133486a0bd7e3eac", + "transactionHash": "0x87f51aeb050ec2c556d14cdc38b30125a66e88689373f727d2f03debbc1313fd", + "logs": [], + "blockNumber": 24572808, + "cumulativeGasUsed": "2868217", + "status": 1, + "byzantium": true + }, + "args": [ + "0xd56F695e73286ac252A37593DD4E7c14270eC1Df", + 2592000, + 172800, + 9000000 + ], + "solcInputHash": "5ee8e508e2c54cb5ac6783b4855b1558", + "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 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/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", + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 12800, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol:OVM_CanonicalTransactionChain", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12793" + }, + { + "astId": 2943, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol:OVM_CanonicalTransactionChain", + "label": "forceInclusionPeriodSeconds", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 2945, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol:OVM_CanonicalTransactionChain", + "label": "forceInclusionPeriodBlocks", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 2947, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol:OVM_CanonicalTransactionChain", + "label": "maxTransactionGasLimit", + "offset": 0, + "slot": "3", + "type": "t_uint256" + } + ], + "types": { + "t_contract(Lib_AddressManager)12793": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/kovan-v3/OVM_ChainStorageContainer:CTC:batches.json b/packages/contracts/deployments/kovan-v3/OVM_ChainStorageContainer:CTC:batches.json new file mode 100644 index 000000000000..7d6a67f2d39f --- /dev/null +++ b/packages/contracts/deployments/kovan-v3/OVM_ChainStorageContainer:CTC:batches.json @@ -0,0 +1,453 @@ +{ + "address": "0xeb335a8A5e8bA008cF7Cb02D5C3432f4fDB576da", + "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" + } + ], + "transactionHash": "0x787b44347630217940635c7c654bb383c4f85dba4727578dff104e50dbea79dc", + "receipt": { + "to": null, + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0xeb335a8A5e8bA008cF7Cb02D5C3432f4fDB576da", + "transactionIndex": 0, + "gasUsed": "968390", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x8ea3e9319a68cca7fb784f92017ee846c2eb68c34308a6f8970dfd2dd7999eb1", + "transactionHash": "0x787b44347630217940635c7c654bb383c4f85dba4727578dff104e50dbea79dc", + "logs": [], + "blockNumber": 24572785, + "cumulativeGasUsed": "968390", + "status": 1, + "byzantium": true + }, + "args": [ + "0xd56F695e73286ac252A37593DD4E7c14270eC1Df", + "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", + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 12800, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12793" + }, + { + "astId": 4466, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "owner", + "offset": 0, + "slot": "1", + "type": "t_string_storage" + }, + { + "astId": 4468, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "buffer", + "offset": 0, + "slot": "2", + "type": "t_struct(RingBuffer)17846_storage" + } + ], + "types": { + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(Lib_AddressManager)12793": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + }, + "t_mapping(t_uint256,t_bytes32)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bytes32)", + "numberOfBytes": "32", + "value": "t_bytes32" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(Buffer)17835_storage": { + "encoding": "inplace", + "label": "struct Lib_RingBuffer.Buffer", + "members": [ + { + "astId": 17830, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "length", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 17834, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "buf", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint256,t_bytes32)" + } + ], + "numberOfBytes": "64" + }, + "t_struct(RingBuffer)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", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/kovan-v3/OVM_ChainStorageContainer:CTC:queue.json b/packages/contracts/deployments/kovan-v3/OVM_ChainStorageContainer:CTC:queue.json new file mode 100644 index 000000000000..663815c631ef --- /dev/null +++ b/packages/contracts/deployments/kovan-v3/OVM_ChainStorageContainer:CTC:queue.json @@ -0,0 +1,453 @@ +{ + "address": "0x207fa9Aa7Dee9AA790A8DF64778D3E3B6273BC90", + "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" + } + ], + "transactionHash": "0x131733524a44e43d5ae59ec1eba4fe60c893da9cc9f38e501d35a5b3c8cf1310", + "receipt": { + "to": null, + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0x207fa9Aa7Dee9AA790A8DF64778D3E3B6273BC90", + "transactionIndex": 1, + "gasUsed": "968390", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x3f742457c998e215c0a89528d46d770ba3f2c9d49f791673bc07501ede825f8d", + "transactionHash": "0x131733524a44e43d5ae59ec1eba4fe60c893da9cc9f38e501d35a5b3c8cf1310", + "logs": [], + "blockNumber": 24572792, + "cumulativeGasUsed": "1010846", + "status": 1, + "byzantium": true + }, + "args": [ + "0xd56F695e73286ac252A37593DD4E7c14270eC1Df", + "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", + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 12800, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12793" + }, + { + "astId": 4466, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "owner", + "offset": 0, + "slot": "1", + "type": "t_string_storage" + }, + { + "astId": 4468, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "buffer", + "offset": 0, + "slot": "2", + "type": "t_struct(RingBuffer)17846_storage" + } + ], + "types": { + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(Lib_AddressManager)12793": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + }, + "t_mapping(t_uint256,t_bytes32)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bytes32)", + "numberOfBytes": "32", + "value": "t_bytes32" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(Buffer)17835_storage": { + "encoding": "inplace", + "label": "struct Lib_RingBuffer.Buffer", + "members": [ + { + "astId": 17830, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "length", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 17834, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "buf", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint256,t_bytes32)" + } + ], + "numberOfBytes": "64" + }, + "t_struct(RingBuffer)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", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/kovan-v3/OVM_ChainStorageContainer:SCC:batches.json b/packages/contracts/deployments/kovan-v3/OVM_ChainStorageContainer:SCC:batches.json new file mode 100644 index 000000000000..c0192021dfa1 --- /dev/null +++ b/packages/contracts/deployments/kovan-v3/OVM_ChainStorageContainer:SCC:batches.json @@ -0,0 +1,453 @@ +{ + "address": "0xFE1CE27173676A6850ECF4e0536D7C468A4dAfa0", + "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" + } + ], + "transactionHash": "0x9a6bad52721e26c2993afcc88ee94280ebde659d16dde1800520e2f23d8a993e", + "receipt": { + "to": null, + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0xFE1CE27173676A6850ECF4e0536D7C468A4dAfa0", + "transactionIndex": 2, + "gasUsed": "968330", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x7f062788bcd72681fe2d1681ec3b1a30f6c5093d76e50ef210302436ee01a5d9", + "transactionHash": "0x9a6bad52721e26c2993afcc88ee94280ebde659d16dde1800520e2f23d8a993e", + "logs": [], + "blockNumber": 24572799, + "cumulativeGasUsed": "1044174", + "status": 1, + "byzantium": true + }, + "args": [ + "0xd56F695e73286ac252A37593DD4E7c14270eC1Df", + "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", + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 12800, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12793" + }, + { + "astId": 4466, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "owner", + "offset": 0, + "slot": "1", + "type": "t_string_storage" + }, + { + "astId": 4468, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "buffer", + "offset": 0, + "slot": "2", + "type": "t_struct(RingBuffer)17846_storage" + } + ], + "types": { + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(Lib_AddressManager)12793": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + }, + "t_mapping(t_uint256,t_bytes32)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bytes32)", + "numberOfBytes": "32", + "value": "t_bytes32" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(Buffer)17835_storage": { + "encoding": "inplace", + "label": "struct Lib_RingBuffer.Buffer", + "members": [ + { + "astId": 17830, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "length", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 17834, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "buf", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint256,t_bytes32)" + } + ], + "numberOfBytes": "64" + }, + "t_struct(RingBuffer)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", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/kovan-v3/OVM_ExecutionManager.json b/packages/contracts/deployments/kovan-v3/OVM_ExecutionManager.json new file mode 100644 index 000000000000..2a066f76e002 --- /dev/null +++ b/packages/contracts/deployments/kovan-v3/OVM_ExecutionManager.json @@ -0,0 +1,1269 @@ +{ + "address": "0xa2EB1961183a04157fF707Fa2Be2249e149c8FAB", + "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" + } + ], + "transactionHash": "0x8da706bbdc66066481106f6452161e0f6ad95f928a10f6a86b7175a52f2057c5", + "receipt": { + "to": null, + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0xa2EB1961183a04157fF707Fa2Be2249e149c8FAB", + "transactionIndex": 1, + "gasUsed": "2901234", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xe33c92c8c1fef82666476fb549221769ae5c6ec66490489f8c123a07b6a0d115", + "transactionHash": "0x8da706bbdc66066481106f6452161e0f6ad95f928a10f6a86b7175a52f2057c5", + "logs": [], + "blockNumber": 24572845, + "cumulativeGasUsed": "3041792", + "status": 1, + "byzantium": true + }, + "args": [ + "0xd56F695e73286ac252A37593DD4E7c14270eC1Df", + { + "minTransactionGasLimit": 50000, + "maxTransactionGasLimit": 9000000, + "maxGasPerQueuePerEpoch": 250000000, + "secondsPerEpoch": 0 + }, + { + "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", + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 12800, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12793" + }, + { + "astId": 5184, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmSafetyChecker", + "offset": 0, + "slot": "1", + "type": "t_contract(iOVM_SafetyChecker)11280" + }, + { + "astId": 5186, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmStateManager", + "offset": 0, + "slot": "2", + "type": "t_contract(iOVM_StateManager)11512" + }, + { + "astId": 5188, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "gasMeterConfig", + "offset": 0, + "slot": "3", + "type": "t_struct(GasMeterConfig)11063_storage" + }, + { + "astId": 5190, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "globalContext", + "offset": 0, + "slot": "7", + "type": "t_struct(GlobalContext)11066_storage" + }, + { + "astId": 5192, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "transactionContext", + "offset": 0, + "slot": "8", + "type": "t_struct(TransactionContext)11079_storage" + }, + { + "astId": 5194, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "messageContext", + "offset": 0, + "slot": "14", + "type": "t_struct(MessageContext)11089_storage" + }, + { + "astId": 5196, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "transactionRecord", + "offset": 0, + "slot": "16", + "type": "t_struct(TransactionRecord)11082_storage" + }, + { + "astId": 5198, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "messageRecord", + "offset": 0, + "slot": "17", + "type": "t_struct(MessageRecord)11092_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(Lib_AddressManager)12793": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + }, + "t_contract(iOVM_SafetyChecker)11280": { + "encoding": "inplace", + "label": "contract iOVM_SafetyChecker", + "numberOfBytes": "20" + }, + "t_contract(iOVM_StateManager)11512": { + "encoding": "inplace", + "label": "contract iOVM_StateManager", + "numberOfBytes": "20" + }, + "t_enum(QueueOrigin)12433": { + "encoding": "inplace", + "label": "enum Lib_OVMCodec.QueueOrigin", + "numberOfBytes": "1" + }, + "t_struct(GasMeterConfig)11063_storage": { + "encoding": "inplace", + "label": "struct iOVM_ExecutionManager.GasMeterConfig", + "members": [ + { + "astId": 11056, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "minTransactionGasLimit", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 11058, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "maxTransactionGasLimit", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 11060, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "maxGasPerQueuePerEpoch", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 11062, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "secondsPerEpoch", + "offset": 0, + "slot": "3", + "type": "t_uint256" + } + ], + "numberOfBytes": "128" + }, + "t_struct(GlobalContext)11066_storage": { + "encoding": "inplace", + "label": "struct iOVM_ExecutionManager.GlobalContext", + "members": [ + { + "astId": 11065, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmCHAINID", + "offset": 0, + "slot": "0", + "type": "t_uint256" + } + ], + "numberOfBytes": "32" + }, + "t_struct(MessageContext)11089_storage": { + "encoding": "inplace", + "label": "struct iOVM_ExecutionManager.MessageContext", + "members": [ + { + "astId": 11084, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmCALLER", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 11086, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmADDRESS", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 11088, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "isStatic", + "offset": 20, + "slot": "1", + "type": "t_bool" + } + ], + "numberOfBytes": "64" + }, + "t_struct(MessageRecord)11092_storage": { + "encoding": "inplace", + "label": "struct iOVM_ExecutionManager.MessageRecord", + "members": [ + { + "astId": 11091, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "nuisanceGasLeft", + "offset": 0, + "slot": "0", + "type": "t_uint256" + } + ], + "numberOfBytes": "32" + }, + "t_struct(TransactionContext)11079_storage": { + "encoding": "inplace", + "label": "struct iOVM_ExecutionManager.TransactionContext", + "members": [ + { + "astId": 11068, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmL1QUEUEORIGIN", + "offset": 0, + "slot": "0", + "type": "t_enum(QueueOrigin)12433" + }, + { + "astId": 11070, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmTIMESTAMP", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 11072, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmNUMBER", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 11074, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmGASLIMIT", + "offset": 0, + "slot": "3", + "type": "t_uint256" + }, + { + "astId": 11076, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmTXGASLIMIT", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 11078, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmL1TXORIGIN", + "offset": 0, + "slot": "5", + "type": "t_address" + } + ], + "numberOfBytes": "192" + }, + "t_struct(TransactionRecord)11082_storage": { + "encoding": "inplace", + "label": "struct iOVM_ExecutionManager.TransactionRecord", + "members": [ + { + "astId": 11081, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmGasRefund", + "offset": 0, + "slot": "0", + "type": "t_uint256" + } + ], + "numberOfBytes": "32" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/kovan-v3/OVM_FraudVerifier.json b/packages/contracts/deployments/kovan-v3/OVM_FraudVerifier.json new file mode 100644 index 000000000000..dafeec721864 --- /dev/null +++ b/packages/contracts/deployments/kovan-v3/OVM_FraudVerifier.json @@ -0,0 +1,576 @@ +{ + "address": "0x4B2F74938Ddb8742C33b46aD1a402c85e9dABC44", + "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" + } + ], + "transactionHash": "0xb8082579bad0f835bc920bd0a9914c2579d22b880631c0d48e905bc30c4dc913", + "receipt": { + "to": null, + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0x4B2F74938Ddb8742C33b46aD1a402c85e9dABC44", + "transactionIndex": 2, + "gasUsed": "1385698", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x064d3a146603fa300614898ab7c1d631f1f7bdda0144fa855991c6da4ce5103b", + "transactionHash": "0xb8082579bad0f835bc920bd0a9914c2579d22b880631c0d48e905bc30c4dc913", + "logs": [], + "blockNumber": 24572850, + "cumulativeGasUsed": "1633498", + "status": 1, + "byzantium": true + }, + "args": [ + "0xd56F695e73286ac252A37593DD4E7c14270eC1Df" + ], + "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", + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 12800, + "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_FraudVerifier.sol:OVM_FraudVerifier", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12793" + }, + { + "astId": 9391, + "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)" + } + ], + "types": { + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(Lib_AddressManager)12793": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + }, + "t_contract(iOVM_StateTransitioner)11962": { + "encoding": "inplace", + "label": "contract iOVM_StateTransitioner", + "numberOfBytes": "20" + }, + "t_mapping(t_bytes32,t_contract(iOVM_StateTransitioner)11962)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => contract iOVM_StateTransitioner)", + "numberOfBytes": "32", + "value": "t_contract(iOVM_StateTransitioner)11962" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/kovan-v3/OVM_L1CrossDomainMessenger.json b/packages/contracts/deployments/kovan-v3/OVM_L1CrossDomainMessenger.json new file mode 100644 index 000000000000..ceb42bc0a576 --- /dev/null +++ b/packages/contracts/deployments/kovan-v3/OVM_L1CrossDomainMessenger.json @@ -0,0 +1,798 @@ +{ + "address": "0xa9D9045E4A753c856Fc0053369E780f23559E0A1", + "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" + } + ], + "transactionHash": "0x1fb0b55a40eda69d78843a052c4874a608d32099c0bea4eefd52a100543ae5ed", + "receipt": { + "to": null, + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0xa9D9045E4A753c856Fc0053369E780f23559E0A1", + "transactionIndex": 0, + "gasUsed": "2795220", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xea435110780744f5598fc90e58d58c96add2c612a30faface1580cf6aaf66882", + "transactionHash": "0x1fb0b55a40eda69d78843a052c4874a608d32099c0bea4eefd52a100543ae5ed", + "logs": [], + "blockNumber": 24572827, + "cumulativeGasUsed": "2795220", + "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", + "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 + }, + "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, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "libAddressManager", + "offset": 0, + "slot": "5", + "type": "t_contract(Lib_AddressManager)12793" + }, + { + "astId": 137, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "_initialized", + "offset": 20, + "slot": "5", + "type": "t_bool" + }, + { + "astId": 140, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "_initializing", + "offset": 21, + "slot": "5", + "type": "t_bool" + }, + { + "astId": 484, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "__gap", + "offset": 0, + "slot": "6", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 10, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "_owner", + "offset": 0, + "slot": "56", + "type": "t_address" + }, + { + "astId": 129, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "__gap", + "offset": 0, + "slot": "57", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 506, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "_paused", + "offset": 0, + "slot": "106", + "type": "t_bool" + }, + { + "astId": 597, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "__gap", + "offset": 0, + "slot": "107", + "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": "156", + "type": "t_uint256" + }, + { + "astId": 655, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "__gap", + "offset": 0, + "slot": "157", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 1436, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "blockedMessages", + "offset": 0, + "slot": "206", + "type": "t_mapping(t_bytes32,t_bool)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "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", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(Lib_AddressManager)12793": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + }, + "t_mapping(t_bytes32,t_bool)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/kovan-v3/OVM_L1ETHGateway.json b/packages/contracts/deployments/kovan-v3/OVM_L1ETHGateway.json new file mode 100644 index 000000000000..71e3eabd74fb --- /dev/null +++ b/packages/contracts/deployments/kovan-v3/OVM_L1ETHGateway.json @@ -0,0 +1,293 @@ +{ + "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-v3/OVM_L1MultiMessageRelayer.json b/packages/contracts/deployments/kovan-v3/OVM_L1MultiMessageRelayer.json new file mode 100644 index 000000000000..62ca79e117c0 --- /dev/null +++ b/packages/contracts/deployments/kovan-v3/OVM_L1MultiMessageRelayer.json @@ -0,0 +1,234 @@ +{ + "address": "0x942b1B1CaF9e7654318CbfCfD1bca6727C716638", + "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" + } + ], + "transactionHash": "0xd93f806d3c8503f36c537f09883e9165dd32239e00b881f705a3441e13a3d510", + "receipt": { + "to": null, + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0x942b1B1CaF9e7654318CbfCfD1bca6727C716638", + "transactionIndex": 1, + "gasUsed": "605189", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xc85c83fe27b2839cc9aee380d27e1fab4612af37f0d80a87aea6047caec2a0e1", + "transactionHash": "0xd93f806d3c8503f36c537f09883e9165dd32239e00b881f705a3441e13a3d510", + "logs": [], + "blockNumber": 24572884, + "cumulativeGasUsed": "674512", + "status": 1, + "byzantium": true + }, + "args": [ + "0xd56F695e73286ac252A37593DD4E7c14270eC1Df" + ], + "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", + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 12800, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1MultiMessageRelayer.sol:OVM_L1MultiMessageRelayer", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12793" + } + ], + "types": { + "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-v3/OVM_SafetyChecker.json b/packages/contracts/deployments/kovan-v3/OVM_SafetyChecker.json new file mode 100644 index 000000000000..aa5d39e753ea --- /dev/null +++ b/packages/contracts/deployments/kovan-v3/OVM_SafetyChecker.json @@ -0,0 +1,74 @@ +{ + "address": "0xf0FaB0ce35a6d3F82b0B42f09A2734065908dB6a", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "_bytecode", + "type": "bytes" + } + ], + "name": "isBytecodeSafe", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0x3db100815c1e0b4b185f3eca0541d88c95348ba8e6a7beba8d0a96f6437544c3", + "receipt": { + "to": null, + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0xf0FaB0ce35a6d3F82b0B42f09A2734065908dB6a", + "transactionIndex": 1, + "gasUsed": "243548", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xb26ad9738f8cc5da3a4e95a3e73bb4b26ca317503fa696d4dc1acdf8d12c63db", + "transactionHash": "0x3db100815c1e0b4b185f3eca0541d88c95348ba8e6a7beba8d0a96f6437544c3", + "logs": [], + "blockNumber": 24572875, + "cumulativeGasUsed": "288408", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "5ee8e508e2c54cb5ac6783b4855b1558", + "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", + "devdoc": { + "details": "The Safety Checker verifies that contracts deployed on L2 do not contain any \"unsafe\" operations. An operation is considered unsafe if it would access state variables which are specific to the environment (ie. L1 or L2) in which it is executed, as this could be used to \"escape the sandbox\" of the OVM, resulting in non-deterministic fraud proofs. That is, an attacker would be able to \"prove fraud\" on an honestly applied transaction. Note that a \"safe\" contract requires opcodes to appear in a particular pattern; omission of \"unsafe\" opcodes is necessary, but not sufficient. Compiler used: solc Runtime target: EVM", + "kind": "dev", + "methods": { + "isBytecodeSafe(bytes)": { + "params": { + "_bytecode": "The bytecode to safety check." + }, + "returns": { + "_0": "`true` if the bytecode is safe, `false` otherwise." + } + } + }, + "title": "OVM_SafetyChecker", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "isBytecodeSafe(bytes)": { + "notice": "Returns whether or not all of the provided bytecode is safe." + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/kovan-v3/OVM_StateCommitmentChain.json b/packages/contracts/deployments/kovan-v3/OVM_StateCommitmentChain.json new file mode 100644 index 000000000000..1e3467717475 --- /dev/null +++ b/packages/contracts/deployments/kovan-v3/OVM_StateCommitmentChain.json @@ -0,0 +1,529 @@ +{ + "address": "0xdB1367bB36C34618778D492725C3eD11B508aC54", + "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" + } + ], + "transactionHash": "0x8c4c4052dc351f960e93b01fdd1e39be3b8dab99459b1be05254609d70df6c9f", + "receipt": { + "to": null, + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0xdB1367bB36C34618778D492725C3eD11B508aC54", + "transactionIndex": 1, + "gasUsed": "1624653", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x82d155659e443e841339b8422848b42afa81a4fcb8e285c6e423b3e266ee431b", + "transactionHash": "0x8c4c4052dc351f960e93b01fdd1e39be3b8dab99459b1be05254609d70df6c9f", + "logs": [], + "blockNumber": 24572817, + "cumulativeGasUsed": "1667041", + "status": 1, + "byzantium": true + }, + "args": [ + "0xd56F695e73286ac252A37593DD4E7c14270eC1Df", + 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", + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 12800, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol:OVM_StateCommitmentChain", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12793" + }, + { + "astId": 4678, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol:OVM_StateCommitmentChain", + "label": "FRAUD_PROOF_WINDOW", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 4680, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol:OVM_StateCommitmentChain", + "label": "SEQUENCER_PUBLISH_WINDOW", + "offset": 0, + "slot": "2", + "type": "t_uint256" + } + ], + "types": { + "t_contract(Lib_AddressManager)12793": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/kovan-v3/OVM_StateManagerFactory.json b/packages/contracts/deployments/kovan-v3/OVM_StateManagerFactory.json new file mode 100644 index 000000000000..bda9b91247e6 --- /dev/null +++ b/packages/contracts/deployments/kovan-v3/OVM_StateManagerFactory.json @@ -0,0 +1,74 @@ +{ + "address": "0x3b96673C9e24D362501e87B239F60543e20beD50", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "create", + "outputs": [ + { + "internalType": "contract iOVM_StateManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x9926548d5337a7b624a7c7aa3d4ea80c4e9a2fc3afaef0bfc634b19145bb56c1", + "receipt": { + "to": null, + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0x3b96673C9e24D362501e87B239F60543e20beD50", + "transactionIndex": 1, + "gasUsed": "1170970", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x20e3b8b73d8c3667eed92aa3bc04339f6a2c45f7d7bc3e7887163bed2bde2240", + "transactionHash": "0x9926548d5337a7b624a7c7aa3d4ea80c4e9a2fc3afaef0bfc634b19145bb56c1", + "logs": [], + "blockNumber": 24572858, + "cumulativeGasUsed": "1215716", + "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", + "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 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/kovan-v3/OVM_StateTransitionerFactory.json b/packages/contracts/deployments/kovan-v3/OVM_StateTransitionerFactory.json new file mode 100644 index 000000000000..8c6de8d67c0c --- /dev/null +++ b/packages/contracts/deployments/kovan-v3/OVM_StateTransitionerFactory.json @@ -0,0 +1,163 @@ +{ + "address": "0xd6eDb16a89A2EE4484fa8fdCDb11B8B5633c3687", + "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" + } + ], + "transactionHash": "0x36cca1310ad53537bb898174d480b15209ef5ad4c1be506c4516c6de43a39de9", + "receipt": { + "to": null, + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0xd6eDb16a89A2EE4484fa8fdCDb11B8B5633c3687", + "transactionIndex": 0, + "gasUsed": "4127740", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x6d044d596657c12c5311fc0306f862a5f678a150f15ef785ab4546deb6f0e3b7", + "transactionHash": "0x36cca1310ad53537bb898174d480b15209ef5ad4c1be506c4516c6de43a39de9", + "logs": [], + "blockNumber": 24572864, + "cumulativeGasUsed": "4127740", + "status": 1, + "byzantium": true + }, + "args": [ + "0xd56F695e73286ac252A37593DD4E7c14270eC1Df" + ], + "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", + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 12800, + "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_StateTransitionerFactory.sol:OVM_StateTransitionerFactory", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12793" + } + ], + "types": { + "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-v3/Proxy__OVM_L1CrossDomainMessenger.json b/packages/contracts/deployments/kovan-v3/Proxy__OVM_L1CrossDomainMessenger.json new file mode 100644 index 000000000000..c42f5d0bf155 --- /dev/null +++ b/packages/contracts/deployments/kovan-v3/Proxy__OVM_L1CrossDomainMessenger.json @@ -0,0 +1,118 @@ +{ + "address": "0x78b88FD62FBdBf67b9C5C6528CF84E9d30BB28e0", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_libAddressManager", + "type": "address" + }, + { + "internalType": "string", + "name": "_implementationName", + "type": "string" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "stateMutability": "payable", + "type": "fallback" + } + ], + "transactionHash": "0xd175bdbcd00f66a7b3a247bf2d0c3719912b845f4898cfe6e09062cc7c33849f", + "receipt": { + "to": null, + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0x78b88FD62FBdBf67b9C5C6528CF84E9d30BB28e0", + "transactionIndex": 1, + "gasUsed": "222424", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x1e1bc36b9553544c99025041f703c41760904c63ad443300a44e9ef0e2be7f56", + "transactionHash": "0xd175bdbcd00f66a7b3a247bf2d0c3719912b845f4898cfe6e09062cc7c33849f", + "logs": [], + "blockNumber": 24572837, + "cumulativeGasUsed": "252381", + "status": 1, + "byzantium": true + }, + "args": [ + "0xd56F695e73286ac252A37593DD4E7c14270eC1Df", + "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", + "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 diff --git a/packages/contracts/deployments/kovan-v3/Proxy__OVM_L1ETHGateway.json b/packages/contracts/deployments/kovan-v3/Proxy__OVM_L1ETHGateway.json new file mode 100644 index 000000000000..65948c09a9c2 --- /dev/null +++ b/packages/contracts/deployments/kovan-v3/Proxy__OVM_L1ETHGateway.json @@ -0,0 +1,118 @@ +{ + "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 diff --git a/packages/contracts/deployments/kovan-v3/mockOVM_BondManager.json b/packages/contracts/deployments/kovan-v3/mockOVM_BondManager.json new file mode 100644 index 000000000000..4ef5baaa33b7 --- /dev/null +++ b/packages/contracts/deployments/kovan-v3/mockOVM_BondManager.json @@ -0,0 +1,242 @@ +{ + "address": "0x8ECe272C9f83041bcb1Cd57AC49Ca6494776bE01", + "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" + } + ], + "transactionHash": "0x51934b4913fc6cb446cb9b81b11c91393e8a00eb70ba44ac7fa1361fb8119deb", + "receipt": { + "to": null, + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0x8ECe272C9f83041bcb1Cd57AC49Ca6494776bE01", + "transactionIndex": 1, + "gasUsed": "297198", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xd12c9c8a22bc6d6e515104cc5c8473933eb037f559f8ab725149f9dee9d5f25f", + "transactionHash": "0x51934b4913fc6cb446cb9b81b11c91393e8a00eb70ba44ac7fa1361fb8119deb", + "logs": [], + "blockNumber": 24572822, + "cumulativeGasUsed": "595662", + "status": 1, + "byzantium": true + }, + "args": [ + "0xd56F695e73286ac252A37593DD4E7c14270eC1Df" + ], + "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", + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 12800, + "contract": "contracts/optimistic-ethereum/mockOVM/verification/mockOVM_BondManager.sol:mockOVM_BondManager", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12793" + } + ], + "types": { + "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-v3/solcInputs/5ee8e508e2c54cb5ac6783b4855b1558.json b/packages/contracts/deployments/kovan-v3/solcInputs/5ee8e508e2c54cb5ac6783b4855b1558.json new file mode 100644 index 000000000000..91f1b8042e7f --- /dev/null +++ b/packages/contracts/deployments/kovan-v3/solcInputs/5ee8e508e2c54cb5ac6783b4855b1558.json @@ -0,0 +1,308 @@ +{ + "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/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/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_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" + }, + "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/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/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" + }, + "@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/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/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/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/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" + }, + "@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" + }, + "@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" + }, + "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" + }, + "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/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/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/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/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/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/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/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/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/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/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/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/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/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 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/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" + }, + "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/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_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/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_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" + }, + "@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 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" + }, + "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_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" + }, + "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/**\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" + }, + "@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_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" + }, + "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" + }, + "@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 /********************\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" + }, + "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 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/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_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" + } + }, + "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/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts b/packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts index 521b172b8b62..c3a09d32c4ff 100644 --- a/packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts +++ b/packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts @@ -8,15 +8,15 @@ import { fromHexString, toHexString } from '@eth-optimism/core-utils' /* Internal Imports */ import { - serializeNativeTransaction, - signNativeTransaction, + NON_ZERO_ADDRESS, DEFAULT_EIP155_TX, - serializeEthSignTransaction, - signEthSignMessage, decodeSolidityError, - NON_ZERO_ADDRESS, } from '../../../helpers' -import { getContractFactory, predeploys } from '../../../../src' +import { + getContractFactory, + getContractInterface, + predeploys, +} from '../../../../src' const callPredeploy = async ( Helper_PredeployCaller: Contract, @@ -41,6 +41,8 @@ const callPredeploy = async ( ) } +const iOVM_ETH = getContractInterface('OVM_ETH') + describe('OVM_ECDSAContractAccount', () => { let wallet: Wallet let badWallet: Wallet @@ -99,11 +101,18 @@ describe('OVM_ECDSAContractAccount', () => { // 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)), - }) + + 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 { @@ -122,43 +131,14 @@ describe('OVM_ECDSAContractAccount', () => { describe('fallback()', () => { it(`should successfully execute an EIP155Transaction`, async () => { - const message = serializeNativeTransaction(DEFAULT_EIP155_TX) - const sig = await signNativeTransaction(wallet, DEFAULT_EIP155_TX) - - await callPredeploy( - Helper_PredeployCaller, - OVM_ECDSAContractAccount, - 'execute', - [ - message, - 0, // isEthSignedMessage - `0x${sig.v}`, //v - `0x${sig.r}`, //r - `0x${sig.s}`, //s - ] - ) - - // 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) - }) - - it(`should successfully execute an ETHSignedTransaction`, async () => { - const message = serializeEthSignTransaction(DEFAULT_EIP155_TX) - const sig = await signEthSignMessage(wallet, DEFAULT_EIP155_TX) + const transaction = DEFAULT_EIP155_TX + const encodedTransaction = await wallet.signTransaction(transaction) await callPredeploy( Helper_PredeployCaller, OVM_ECDSAContractAccount, 'execute', - [ - message, - 1, //isEthSignedMessage - `0x${sig.v}`, //v - `0x${sig.r}`, //r - `0x${sig.s}`, //s - ] + [encodedTransaction] ) // The ovmCALL is the 2nd call because the first call transfers the fee. @@ -168,43 +148,33 @@ describe('OVM_ECDSAContractAccount', () => { }) it(`should ovmCREATE if EIP155Transaction.to is zero address`, async () => { - const createTx = { ...DEFAULT_EIP155_TX, to: '' } - const message = serializeNativeTransaction(createTx) - const sig = await signNativeTransaction(wallet, createTx) + const transaction = { ...DEFAULT_EIP155_TX, to: '' } + const encodedTransaction = await wallet.signTransaction(transaction) await callPredeploy( Helper_PredeployCaller, OVM_ECDSAContractAccount, 'execute', - [ - message, - 0, //isEthSignedMessage - `0x${sig.v}`, //v - `0x${sig.r}`, //r - `0x${sig.s}`, //s - ] + [encodedTransaction] ) const ovmCREATE: any = Mock__OVM_ExecutionManager.smocked.ovmCREATE.calls[0] - expect(ovmCREATE._bytecode).to.equal(createTx.data) + expect(ovmCREATE._bytecode).to.equal(transaction.data) }) it(`should revert on invalid signature`, async () => { - const message = serializeNativeTransaction(DEFAULT_EIP155_TX) - const sig = await signNativeTransaction(badWallet, DEFAULT_EIP155_TX) + const transaction = DEFAULT_EIP155_TX + const encodedTransaction = ethers.utils.serializeTransaction( + transaction, + '0x' + '00'.repeat(65) + ) await callPredeploy( Helper_PredeployCaller, OVM_ECDSAContractAccount, 'execute', - [ - message, - 0, //isEthSignedMessage - `0x${sig.v}`, //v - `0x${sig.r}`, //r - `0x${sig.s}`, //s - ] + [encodedTransaction] ) const ovmREVERT: any = Mock__OVM_ExecutionManager.smocked.ovmREVERT.calls[0] @@ -214,24 +184,14 @@ describe('OVM_ECDSAContractAccount', () => { }) it(`should revert on incorrect nonce`, async () => { - const alteredNonceTx = { - ...DEFAULT_EIP155_TX, - nonce: 99, - } - const message = serializeNativeTransaction(alteredNonceTx) - const sig = await signNativeTransaction(wallet, alteredNonceTx) + const transaction = { ...DEFAULT_EIP155_TX, nonce: 99 } + const encodedTransaction = await wallet.signTransaction(transaction) await callPredeploy( Helper_PredeployCaller, OVM_ECDSAContractAccount, 'execute', - [ - message, - 0, //isEthSignedMessage - `0x${sig.v}`, //v - `0x${sig.r}`, //r - `0x${sig.s}`, //s - ] + [encodedTransaction] ) const ovmREVERT: any = Mock__OVM_ExecutionManager.smocked.ovmREVERT.calls[0] @@ -241,52 +201,32 @@ describe('OVM_ECDSAContractAccount', () => { }) it(`should revert on incorrect chainId`, async () => { - const alteredChainIdTx = { - ...DEFAULT_EIP155_TX, - chainId: 421, - } - const message = serializeNativeTransaction(alteredChainIdTx) - const sig = await signNativeTransaction(wallet, alteredChainIdTx) + const transaction = { ...DEFAULT_EIP155_TX, chainId: 421 } + const encodedTransaction = await wallet.signTransaction(transaction) await callPredeploy( Helper_PredeployCaller, OVM_ECDSAContractAccount, 'execute', - [ - message, - 0, //isEthSignedMessage - `0x${sig.v}`, //v - `0x${sig.r}`, //r - `0x${sig.s}`, //s - ] + [encodedTransaction] ) const ovmREVERT: any = Mock__OVM_ExecutionManager.smocked.ovmREVERT.calls[0] expect(decodeSolidityError(ovmREVERT._data)).to.equal( - 'Transaction chainId does not match expected OVM chainId.' + 'Lib_EIP155Tx: Transaction signed with wrong chain ID' ) }) // TEMPORARY: Skip gas checks for minnet. it.skip(`should revert on insufficient gas`, async () => { - const alteredInsufficientGasTx = { - ...DEFAULT_EIP155_TX, - gasLimit: 200000000, - } - const message = serializeNativeTransaction(alteredInsufficientGasTx) - const sig = await signNativeTransaction(wallet, alteredInsufficientGasTx) + const transaction = { ...DEFAULT_EIP155_TX, gasLimit: 200000000 } + const encodedTransaction = await wallet.signTransaction(transaction) await callPredeploy( Helper_PredeployCaller, OVM_ECDSAContractAccount, 'execute', - [ - message, - 0, //isEthSignedMessage - `0x${sig.v}`, //v - `0x${sig.r}`, //r - `0x${sig.s}`, //s - ], + [encodedTransaction], 40000000 ) @@ -298,11 +238,12 @@ describe('OVM_ECDSAContractAccount', () => { }) it(`should revert if fee is not transferred to the relayer`, async () => { - const message = serializeNativeTransaction(DEFAULT_EIP155_TX) - const sig = await signNativeTransaction(wallet, DEFAULT_EIP155_TX) + const transaction = DEFAULT_EIP155_TX + const encodedTransaction = await wallet.signTransaction(transaction) + Mock__OVM_ExecutionManager.smocked.ovmCALL.will.return.with( (gasLimit, target, data) => { - if (target === '0x4200000000000000000000000000000000000006') { + if (target === predeploys.OVM_ETH) { return [ true, '0x0000000000000000000000000000000000000000000000000000000000000000', @@ -317,13 +258,7 @@ describe('OVM_ECDSAContractAccount', () => { Helper_PredeployCaller, OVM_ECDSAContractAccount, 'execute', - [ - message, - 0, //isEthSignedMessage - `0x${sig.v}`, //v - `0x${sig.r}`, //r - `0x${sig.s}`, //s - ], + [encodedTransaction], 40000000 ) @@ -333,5 +268,109 @@ describe('OVM_ECDSAContractAccount', () => { '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 + ) + + // 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, + ]) + ) + }) + + 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'] + } + } + ) + + 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.' + ) + }) + + 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.' + ) + }) + + it(`should revert if trying to send value with non-empty transaction data`, 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.' + ) + }) }) }) 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 2d9f00f9939d..b292372f5024 100644 --- a/packages/contracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts +++ b/packages/contracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts @@ -94,7 +94,7 @@ describe('OVM_ProxyEOA', () => { }) describe('upgrade()', () => { const implSlotKey = - '0xdeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead' + '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) 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 f76f55e9b693..98d64620cfad 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 @@ -8,7 +8,7 @@ import { smockit, MockContract } from '@eth-optimism/smock' /* Internal Imports */ import { NON_ZERO_ADDRESS, makeAddressManager } from '../../../../helpers' -const L1_ETH_GATEWAY_NAME = 'Proxy__OVM_L1CrossDomainMessenger' +const L1_MESSENGER_NAME = 'Proxy__OVM_L1CrossDomainMessenger' const ERR_INVALID_MESSENGER = 'OVM_XCHAIN: messenger contract unauthenticated' const ERR_INVALID_X_DOMAIN_MSG_SENDER = @@ -82,7 +82,7 @@ describe('OVM_L1ETHGateway', () => { it('onlyFromCrossDomainAccount: should revert on calls from the right crossDomainMessenger, but wrong xDomainMessageSender (ie. not the L2ETHGateway)', async () => { await AddressManager.setAddress( - L1_ETH_GATEWAY_NAME, + L1_MESSENGER_NAME, Mock__OVM_L1CrossDomainMessenger.address ) @@ -163,7 +163,7 @@ describe('OVM_L1ETHGateway', () => { await ethers.getContractFactory('OVM_L1CrossDomainMessenger') ) await AddressManager.setAddress( - L1_ETH_GATEWAY_NAME, + L1_MESSENGER_NAME, Mock__OVM_L1CrossDomainMessenger.address ) @@ -256,4 +256,41 @@ describe('OVM_L1ETHGateway', () => { expect(depositCallToMessenger._gasLimit).to.equal(finalizeDepositGasLimit) }) }) + 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/execution/OVM_ExecutionManager.gas-spec.ts b/packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager.gas-spec.ts index eff4c61fdf9c..c6fdaa0577b2 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 = 105_000 + const benchmark: number = 106_000 expect(gasCost).to.be.lte(benchmark) expect(gasCost).to.be.gte( benchmark - 1_000, 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 02f613ce3aa8..6406943a6cd0 100644 --- a/packages/contracts/test/contracts/OVM/precompiles/OVM_SequencerEntrypoint.spec.ts +++ b/packages/contracts/test/contracts/OVM/precompiles/OVM_SequencerEntrypoint.spec.ts @@ -7,15 +7,8 @@ import { smockit, MockContract } from '@eth-optimism/smock' import { fromHexString, toHexString } from '@eth-optimism/core-utils' /* Internal Imports */ +import { DEFAULT_EIP155_TX } from '../../../helpers' import { getContractInterface, getContractFactory } from '../../../../src' -import { - encodeSequencerCalldata, - signNativeTransaction, - signEthSignMessage, - DEFAULT_EIP155_TX, - serializeNativeTransaction, - serializeEthSignTransaction, -} from '../../../helpers' describe('OVM_SequencerEntrypoint', () => { let wallet: Wallet @@ -94,141 +87,69 @@ describe('OVM_SequencerEntrypoint', () => { }) describe('fallback()', async () => { - it('should call EIP155 if the transaction type is 0', async () => { - const calldata = await encodeSequencerCalldata( - wallet, - DEFAULT_EIP155_TX, - 0 - ) + it('should call EIP155', async () => { + const transaction = DEFAULT_EIP155_TX + const encodedTransaction = await wallet.signTransaction(transaction) + await Helper_PredeployCaller.callPredeploy( OVM_SequencerEntrypoint.address, - calldata + encodedTransaction ) - const encodedTx = serializeNativeTransaction(DEFAULT_EIP155_TX) - const sig = await signNativeTransaction(wallet, DEFAULT_EIP155_TX) - const expectedEOACalldata = iOVM_ECDSAContractAccount.encodeFunctionData( 'execute', - [ - encodedTx, - 0, //isEthSignedMessage - `0x${sig.v}`, //v - `0x${sig.r}`, //r - `0x${sig.s}`, //s - ] + [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) }) - it('should send correct calldata if tx is a create and the transaction type is 0', async () => { - const createTx = { ...DEFAULT_EIP155_TX, to: '' } - const calldata = await encodeSequencerCalldata(wallet, createTx, 0) + 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, - calldata + encodedTransaction ) - const encodedTx = serializeNativeTransaction(createTx) - const sig = await signNativeTransaction(wallet, createTx) - const expectedEOACalldata = iOVM_ECDSAContractAccount.encodeFunctionData( 'execute', - [ - encodedTx, - 0, //isEthSignedMessage - `0x${sig.v}`, //v - `0x${sig.r}`, //r - `0x${sig.s}`, //s - ] + [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) }) - for (let i = 0; i < 3; i += 2) { - it(`should call ovmCreateEOA when tx type is ${i} and ovmEXTCODESIZE returns 0`, async () => { - let firstCheck = true - Mock__OVM_ExecutionManager.smocked.ovmEXTCODESIZE.will.return.with( - () => { - if (firstCheck) { - firstCheck = false - return 0 - } else { - return 1 - } - } - ) - const calldata = await encodeSequencerCalldata( - wallet, - DEFAULT_EIP155_TX, - i - ) - await Helper_PredeployCaller.callPredeploy( - OVM_SequencerEntrypoint.address, - calldata - ) - 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 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 + } }) - } - it('should submit ETHSignedTypedData if TransactionType is 2', async () => { - const calldata = await encodeSequencerCalldata( - wallet, - DEFAULT_EIP155_TX, - 2 - ) + const transaction = DEFAULT_EIP155_TX + const encodedTransaction = await wallet.signTransaction(transaction) + await Helper_PredeployCaller.callPredeploy( OVM_SequencerEntrypoint.address, - calldata - ) - - const encodedTx = serializeEthSignTransaction(DEFAULT_EIP155_TX) - const sig = await signEthSignMessage(wallet, DEFAULT_EIP155_TX) - - const expectedEOACalldata = iOVM_ECDSAContractAccount.encodeFunctionData( - 'execute', - [ - encodedTx, - 1, //isEthSignedMessage - `0x${sig.v}`, //v - `0x${sig.r}`, //r - `0x${sig.s}`, //s - ] + 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) - }) - it('should revert if TransactionType is >2', async () => { - const calldata = '0x03' - await expect( - Helper_PredeployCaller.callPredeploy( - OVM_SequencerEntrypoint.address, - calldata - ) - ).to.be.reverted - }) + 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, + }) - it('should revert if TransactionType is 1', async () => { - const calldata = '0x01' - await expect( - Helper_PredeployCaller.callPredeploy( - OVM_SequencerEntrypoint.address, - calldata - ) - ).to.be.reverted + expect(eoaAddress).to.equal(await wallet.getAddress()) }) }) }) diff --git a/packages/contracts/test/contracts/libraries/codec/Lib_EIP155Tx.spec.ts b/packages/contracts/test/contracts/libraries/codec/Lib_EIP155Tx.spec.ts new file mode 100644 index 000000000000..021f14edcb19 --- /dev/null +++ b/packages/contracts/test/contracts/libraries/codec/Lib_EIP155Tx.spec.ts @@ -0,0 +1,15 @@ +/* tslint:disable:no-empty */ +import '../../../setup' + +/* Internal Imports */ +import { Lib_EIP155Tx_TEST_JSON } from '../../../data' +import { runJsonTest } from '../../../helpers' + +// Currently running tests from here: +// https://github.com/ethereumjs/ethereumjs-tx/blob/master/test/ttTransactionTestEip155VitaliksTests.json + +describe('Lib_EIP155Tx', () => { + describe('JSON tests', () => { + runJsonTest('TestLib_EIP155Tx', Lib_EIP155Tx_TEST_JSON) + }) +}) diff --git a/packages/contracts/test/contracts/libraries/utils/Lib_ECDSAUtils.spec.ts b/packages/contracts/test/contracts/libraries/utils/Lib_ECDSAUtils.spec.ts deleted file mode 100644 index baf3c5a999b2..000000000000 --- a/packages/contracts/test/contracts/libraries/utils/Lib_ECDSAUtils.spec.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* Internal Imports */ -import { Lib_ECDSAUtils_TEST_JSON } from '../../../data' -import { runJsonTest } from '../../../helpers' - -describe('Lib_ECDSAUtils', () => { - describe('JSON tests', () => { - runJsonTest('TestLib_ECDSAUtils', Lib_ECDSAUtils_TEST_JSON) - }) -}) diff --git a/packages/contracts/test/data/index.ts b/packages/contracts/test/data/index.ts index 8a4a1f7e65b8..5c9103f5c2d5 100644 --- a/packages/contracts/test/data/index.ts +++ b/packages/contracts/test/data/index.ts @@ -2,8 +2,8 @@ export { tests as Lib_RLPWriter_TEST_JSON } from './json/libraries/rlp/Lib_RLPWr export { tests as Lib_RLPReader_TEST_JSON } from './json/libraries/rlp/Lib_RLPReader.test.json' export { tests as Lib_Bytes32Utils_TEST_JSON } from './json/libraries/utils/Lib_Bytes32Utils.test.json' export { tests as Lib_BytesUtils_TEST_JSON } from './json/libraries/utils/Lib_BytesUtils.test.json' -export { tests as Lib_ECDSAUtils_TEST_JSON } from './json/libraries/utils/Lib_ECDSAUtils.test.json' export { tests as Lib_MerkleTrie_TEST_JSON } from './json/libraries/trie/Lib_MerkleTrie.test.json' +export { tests as Lib_EIP155Tx_TEST_JSON } from './json/libraries/codec/Lib_EIP155Tx.test.json' export { tests as Lib_OVMCodec_TEST_JSON } from './json/libraries/codec/Lib_OVMCodec.test.json' export { tests as CREATE2_TEST_JSON } from './json/create2.test.json' export { tests as SAFETY_CHECKER_TEST_JSON } from './json/safety-checker.test.json' diff --git a/packages/contracts/test/data/json/libraries/codec/Lib_EIP155Tx.test.json b/packages/contracts/test/data/json/libraries/codec/Lib_EIP155Tx.test.json new file mode 100644 index 000000000000..a7536ad4fa3b --- /dev/null +++ b/packages/contracts/test/data/json/libraries/codec/Lib_EIP155Tx.test.json @@ -0,0 +1,725 @@ +{ + "tests": { + "decode": { + "vitalik test 0": { + "in": [ + "0xf864808504a817c800825208943535353535353535353535353535353535353535808025a0044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116da0044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", + 1 + ], + "out": [ + [ + "0x00", + "0x04a817c800", + "0x5208", + "0x3535353535353535353535353535353535353535", + "0x00", + "0x", + "0x25", + "0x044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", + "0x044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", + "0x01", + "0x00", + false + ] + ] + }, + "vitalik test 1": { + "in": [ + "0xf867088504a817c8088302e2489435353535353535353535353535353535353535358202008025a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c12a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10", + 1 + ], + "out": [ + [ + "0x08", + "0x04a817c808", + "0x02e248", + "0x3535353535353535353535353535353535353535", + "0x0200", + "0x", + "0x25", + "0x64b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c12", + "0x64b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10", + "0x01", + "0x00", + false + ] + ] + }, + "vitalik test 2": { + "in": [ + "0xf867098504a817c809830334509435353535353535353535353535353535353535358202d98025a052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afba052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afb", + 1 + ], + "out": [ + [ + "0x09", + "0x04a817c809", + "0x033450", + "0x3535353535353535353535353535353535353535", + "0x02d9", + "0x", + "0x25", + "0x52f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afb", + "0x52f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afb", + "0x01", + "0x00", + false + ] + ] + }, + "vitalik test 3": { + "in": [ + "0xf864018504a817c80182a410943535353535353535353535353535353535353535018025a0489efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bcaa0489efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6", + 1 + ], + "out": [ + [ + "0x01", + "0x04a817c801", + "0xa410", + "0x3535353535353535353535353535353535353535", + "0x01", + "0x", + "0x25", + "0x489efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bca", + "0x489efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6", + "0x01", + "0x00", + false + ] + ] + }, + "vitalik test 4": { + "in": [ + "0xf864028504a817c80282f618943535353535353535353535353535353535353535088025a02d7c5bef027816a800da1736444fb58a807ef4c9603b7848673f7e3a68eb14a5a02d7c5bef027816a800da1736444fb58a807ef4c9603b7848673f7e3a68eb14a5", + 1 + ], + "out": [ + [ + "0x02", + "0x04a817c802", + "0xf618", + "0x3535353535353535353535353535353535353535", + "0x08", + "0x", + "0x25", + "0x2d7c5bef027816a800da1736444fb58a807ef4c9603b7848673f7e3a68eb14a5", + "0x2d7c5bef027816a800da1736444fb58a807ef4c9603b7848673f7e3a68eb14a5", + "0x01", + "0x00", + false + ] + ] + }, + "vitalik test 5": { + "in": [ + "0xf865038504a817c803830148209435353535353535353535353535353535353535351b8025a02a80e1ef1d7842f27f2e6be0972bb708b9a135c38860dbe73c27c3486c34f4e0a02a80e1ef1d7842f27f2e6be0972bb708b9a135c38860dbe73c27c3486c34f4de", + 1 + ], + "out": [ + [ + "0x03", + "0x04a817c803", + "0x014820", + "0x3535353535353535353535353535353535353535", + "0x1b", + "0x", + "0x25", + "0x2a80e1ef1d7842f27f2e6be0972bb708b9a135c38860dbe73c27c3486c34f4e0", + "0x2a80e1ef1d7842f27f2e6be0972bb708b9a135c38860dbe73c27c3486c34f4de", + "0x01", + "0x00", + false + ] + ] + }, + "vitalik test 6": { + "in": [ + "0xf865048504a817c80483019a28943535353535353535353535353535353535353535408025a013600b294191fc92924bb3ce4b969c1e7e2bab8f4c93c3fc6d0a51733df3c063a013600b294191fc92924bb3ce4b969c1e7e2bab8f4c93c3fc6d0a51733df3c060", + 1 + ], + "out": [ + [ + "0x04", + "0x04a817c804", + "0x019a28", + "0x3535353535353535353535353535353535353535", + "0x40", + "0x", + "0x25", + "0x13600b294191fc92924bb3ce4b969c1e7e2bab8f4c93c3fc6d0a51733df3c063", + "0x13600b294191fc92924bb3ce4b969c1e7e2bab8f4c93c3fc6d0a51733df3c060", + "0x01", + "0x00", + false + ] + ] + }, + "vitalik test 7": { + "in": [ + "0xf865058504a817c8058301ec309435353535353535353535353535353535353535357d8025a04eebf77a833b30520287ddd9478ff51abbdffa30aa90a8d655dba0e8a79ce0c1a04eebf77a833b30520287ddd9478ff51abbdffa30aa90a8d655dba0e8a79ce0c1", + 1 + ], + "out": [ + [ + "0x05", + "0x04a817c805", + "0x01ec30", + "0x3535353535353535353535353535353535353535", + "0x7d", + "0x", + "0x25", + "0x4eebf77a833b30520287ddd9478ff51abbdffa30aa90a8d655dba0e8a79ce0c1", + "0x4eebf77a833b30520287ddd9478ff51abbdffa30aa90a8d655dba0e8a79ce0c1", + "0x01", + "0x00", + false + ] + ] + }, + "vitalik test 8": { + "in": [ + "0xf865058504a817c8058301ec309435353535353535353535353535353535353535357d8025a04eebf77a833b30520287ddd9478ff51abbdffa30aa90a8d655dba0e8a79ce0c1a04eebf77a833b30520287ddd9478ff51abbdffa30aa90a8d655dba0e8a79ce0c1", + 1 + ], + "out": [ + [ + "0x05", + "0x04a817c805", + "0x01ec30", + "0x3535353535353535353535353535353535353535", + "0x7d", + "0x", + "0x25", + "0x4eebf77a833b30520287ddd9478ff51abbdffa30aa90a8d655dba0e8a79ce0c1", + "0x4eebf77a833b30520287ddd9478ff51abbdffa30aa90a8d655dba0e8a79ce0c1", + "0x01", + "0x00", + false + ] + ] + }, + "vitalik test 9": { + "in": [ + "0xf866068504a817c80683023e3894353535353535353535353535353535353535353581d88025a06455bf8ea6e7463a1046a0b52804526e119b4bf5136279614e0b1e8e296a4e2fa06455bf8ea6e7463a1046a0b52804526e119b4bf5136279614e0b1e8e296a4e2d", + 1 + ], + "out": [ + [ + "0x06", + "0x04a817c806", + "0x023e38", + "0x3535353535353535353535353535353535353535", + "0xd8", + "0x", + "0x25", + "0x6455bf8ea6e7463a1046a0b52804526e119b4bf5136279614e0b1e8e296a4e2f", + "0x6455bf8ea6e7463a1046a0b52804526e119b4bf5136279614e0b1e8e296a4e2d", + "0x01", + "0x00", + false + ] + ] + }, + "vitalik test 10": { + "in": [ + "0xf867078504a817c807830290409435353535353535353535353535353535353535358201578025a052f1a9b320cab38e5da8a8f97989383aab0a49165fc91c737310e4f7e9821021a052f1a9b320cab38e5da8a8f97989383aab0a49165fc91c737310e4f7e9821021", + 1 + ], + "out": [ + [ + "0x07", + "0x04a817c807", + "0x029040", + "0x3535353535353535353535353535353535353535", + "0x0157", + "0x", + "0x25", + "0x52f1a9b320cab38e5da8a8f97989383aab0a49165fc91c737310e4f7e9821021", + "0x52f1a9b320cab38e5da8a8f97989383aab0a49165fc91c737310e4f7e9821021", + "0x01", + "0x00", + false + ] + ] + } + }, + "encode": { + "vitalik test 0": { + "in": [ + [ + "0x00", + "0x04a817c800", + "0x5208", + "0x3535353535353535353535353535353535353535", + "0x00", + "0x", + "0x25", + "0x044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", + "0x044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", + "0x01", + "0x00", + false + ], + true + ], + "out": [ + "0xf864808504a817c800825208943535353535353535353535353535353535353535808025a0044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116da0044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d" + ] + }, + "vitalik test 1": { + "in": [ + [ + "0x08", + "0x04a817c808", + "0x02e248", + "0x3535353535353535353535353535353535353535", + "0x0200", + "0x", + "0x25", + "0x64b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c12", + "0x64b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10", + "0x01", + "0x00", + false + ], + true + ], + "out": [ + "0xf867088504a817c8088302e2489435353535353535353535353535353535353535358202008025a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c12a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10" + ] + }, + "vitalik test 2": { + "in": [ + [ + "0x09", + "0x04a817c809", + "0x033450", + "0x3535353535353535353535353535353535353535", + "0x02d9", + "0x", + "0x25", + "0x52f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afb", + "0x52f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afb", + "0x01", + "0x00", + false + ], + true + ], + "out": [ + "0xf867098504a817c809830334509435353535353535353535353535353535353535358202d98025a052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afba052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afb" + ] + }, + "vitalik test 3": { + "in": [ + [ + "0x01", + "0x04a817c801", + "0xa410", + "0x3535353535353535353535353535353535353535", + "0x01", + "0x", + "0x25", + "0x489efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bca", + "0x489efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6", + "0x01", + "0x00", + false + ], + true + ], + "out": [ + "0xf864018504a817c80182a410943535353535353535353535353535353535353535018025a0489efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bcaa0489efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6" + ] + }, + "vitalik test 4": { + "in": [ + [ + "0x02", + "0x04a817c802", + "0xf618", + "0x3535353535353535353535353535353535353535", + "0x08", + "0x", + "0x25", + "0x2d7c5bef027816a800da1736444fb58a807ef4c9603b7848673f7e3a68eb14a5", + "0x2d7c5bef027816a800da1736444fb58a807ef4c9603b7848673f7e3a68eb14a5", + "0x01", + "0x00", + false + ], + true + ], + "out": [ + "0xf864028504a817c80282f618943535353535353535353535353535353535353535088025a02d7c5bef027816a800da1736444fb58a807ef4c9603b7848673f7e3a68eb14a5a02d7c5bef027816a800da1736444fb58a807ef4c9603b7848673f7e3a68eb14a5" + ] + }, + "vitalik test 5": { + "in": [ + [ + "0x03", + "0x04a817c803", + "0x014820", + "0x3535353535353535353535353535353535353535", + "0x1b", + "0x", + "0x25", + "0x2a80e1ef1d7842f27f2e6be0972bb708b9a135c38860dbe73c27c3486c34f4e0", + "0x2a80e1ef1d7842f27f2e6be0972bb708b9a135c38860dbe73c27c3486c34f4de", + "0x01", + "0x00", + false + ], + true + ], + "out": [ + "0xf865038504a817c803830148209435353535353535353535353535353535353535351b8025a02a80e1ef1d7842f27f2e6be0972bb708b9a135c38860dbe73c27c3486c34f4e0a02a80e1ef1d7842f27f2e6be0972bb708b9a135c38860dbe73c27c3486c34f4de" + ] + }, + "vitalik test 6": { + "in": [ + [ + "0x04", + "0x04a817c804", + "0x019a28", + "0x3535353535353535353535353535353535353535", + "0x40", + "0x", + "0x25", + "0x13600b294191fc92924bb3ce4b969c1e7e2bab8f4c93c3fc6d0a51733df3c063", + "0x13600b294191fc92924bb3ce4b969c1e7e2bab8f4c93c3fc6d0a51733df3c060", + "0x01", + "0x00", + false + ], + true + ], + "out": [ + "0xf865048504a817c80483019a28943535353535353535353535353535353535353535408025a013600b294191fc92924bb3ce4b969c1e7e2bab8f4c93c3fc6d0a51733df3c063a013600b294191fc92924bb3ce4b969c1e7e2bab8f4c93c3fc6d0a51733df3c060" + ] + }, + "vitalik test 7": { + "in": [ + [ + "0x05", + "0x04a817c805", + "0x01ec30", + "0x3535353535353535353535353535353535353535", + "0x7d", + "0x", + "0x25", + "0x4eebf77a833b30520287ddd9478ff51abbdffa30aa90a8d655dba0e8a79ce0c1", + "0x4eebf77a833b30520287ddd9478ff51abbdffa30aa90a8d655dba0e8a79ce0c1", + "0x01", + "0x00", + false + ], + true + ], + "out": [ + "0xf865058504a817c8058301ec309435353535353535353535353535353535353535357d8025a04eebf77a833b30520287ddd9478ff51abbdffa30aa90a8d655dba0e8a79ce0c1a04eebf77a833b30520287ddd9478ff51abbdffa30aa90a8d655dba0e8a79ce0c1" + ] + }, + "vitalik test 8": { + "in": [ + [ + "0x05", + "0x04a817c805", + "0x01ec30", + "0x3535353535353535353535353535353535353535", + "0x7d", + "0x", + "0x25", + "0x4eebf77a833b30520287ddd9478ff51abbdffa30aa90a8d655dba0e8a79ce0c1", + "0x4eebf77a833b30520287ddd9478ff51abbdffa30aa90a8d655dba0e8a79ce0c1", + "0x01", + "0x00", + false + ], + true + ], + "out": [ + "0xf865058504a817c8058301ec309435353535353535353535353535353535353535357d8025a04eebf77a833b30520287ddd9478ff51abbdffa30aa90a8d655dba0e8a79ce0c1a04eebf77a833b30520287ddd9478ff51abbdffa30aa90a8d655dba0e8a79ce0c1" + ] + }, + "vitalik test 9": { + "in": [ + [ + "0x06", + "0x04a817c806", + "0x023e38", + "0x3535353535353535353535353535353535353535", + "0xd8", + "0x", + "0x25", + "0x6455bf8ea6e7463a1046a0b52804526e119b4bf5136279614e0b1e8e296a4e2f", + "0x6455bf8ea6e7463a1046a0b52804526e119b4bf5136279614e0b1e8e296a4e2d", + "0x01", + "0x00", + false + ], + true + ], + "out": [ + "0xf866068504a817c80683023e3894353535353535353535353535353535353535353581d88025a06455bf8ea6e7463a1046a0b52804526e119b4bf5136279614e0b1e8e296a4e2fa06455bf8ea6e7463a1046a0b52804526e119b4bf5136279614e0b1e8e296a4e2d" + ] + }, + "vitalik test 10": { + "in": [ + [ + "0x07", + "0x04a817c807", + "0x029040", + "0x3535353535353535353535353535353535353535", + "0x0157", + "0x", + "0x25", + "0x52f1a9b320cab38e5da8a8f97989383aab0a49165fc91c737310e4f7e9821021", + "0x52f1a9b320cab38e5da8a8f97989383aab0a49165fc91c737310e4f7e9821021", + "0x01", + "0x00", + false + ], + true + ], + "out": [ + "0xf867078504a817c807830290409435353535353535353535353535353535353535358201578025a052f1a9b320cab38e5da8a8f97989383aab0a49165fc91c737310e4f7e9821021a052f1a9b320cab38e5da8a8f97989383aab0a49165fc91c737310e4f7e9821021" + ] + } + }, + "sender": { + "vitalik test 0": { + "in": [ + [ + "0x00", + "0x04a817c800", + "0x5208", + "0x3535353535353535353535353535353535353535", + "0x00", + "0x", + "0x25", + "0x044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", + "0x044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", + "0x01", + "0x00", + false + ] + ], + "out": [ + "0xf0f6f18bca1b28cd68e4357452947e021241e9ce" + ] + }, + "vitalik test 1": { + "in": [ + [ + "0x08", + "0x04a817c808", + "0x02e248", + "0x3535353535353535353535353535353535353535", + "0x0200", + "0x", + "0x25", + "0x64b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c12", + "0x64b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10", + "0x01", + "0x00", + false + ] + ], + "out": [ + "0x9bddad43f934d313c2b79ca28a432dd2b7281029" + ] + }, + "vitalik test 2": { + "in": [ + [ + "0x09", + "0x04a817c809", + "0x033450", + "0x3535353535353535353535353535353535353535", + "0x02d9", + "0x", + "0x25", + "0x52f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afb", + "0x52f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afb", + "0x01", + "0x00", + false + ] + ], + "out": [ + "0x3c24d7329e92f84f08556ceb6df1cdb0104ca49f" + ] + }, + "vitalik test 3": { + "in": [ + [ + "0x01", + "0x04a817c801", + "0xa410", + "0x3535353535353535353535353535353535353535", + "0x01", + "0x", + "0x25", + "0x489efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bca", + "0x489efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6", + "0x01", + "0x00", + false + ] + ], + "out": [ + "0x23ef145a395ea3fa3deb533b8a9e1b4c6c25d112" + ] + }, + "vitalik test 4": { + "in": [ + [ + "0x02", + "0x04a817c802", + "0xf618", + "0x3535353535353535353535353535353535353535", + "0x08", + "0x", + "0x25", + "0x2d7c5bef027816a800da1736444fb58a807ef4c9603b7848673f7e3a68eb14a5", + "0x2d7c5bef027816a800da1736444fb58a807ef4c9603b7848673f7e3a68eb14a5", + "0x01", + "0x00", + false + ] + ], + "out": [ + "0x2e485e0c23b4c3c542628a5f672eeab0ad4888be" + ] + }, + "vitalik test 5": { + "in": [ + [ + "0x03", + "0x04a817c803", + "0x014820", + "0x3535353535353535353535353535353535353535", + "0x1b", + "0x", + "0x25", + "0x2a80e1ef1d7842f27f2e6be0972bb708b9a135c38860dbe73c27c3486c34f4e0", + "0x2a80e1ef1d7842f27f2e6be0972bb708b9a135c38860dbe73c27c3486c34f4de", + "0x01", + "0x00", + false + ] + ], + "out": [ + "0x82a88539669a3fd524d669e858935de5e5410cf0" + ] + }, + "vitalik test 6": { + "in": [ + [ + "0x04", + "0x04a817c804", + "0x019a28", + "0x3535353535353535353535353535353535353535", + "0x40", + "0x", + "0x25", + "0x13600b294191fc92924bb3ce4b969c1e7e2bab8f4c93c3fc6d0a51733df3c063", + "0x13600b294191fc92924bb3ce4b969c1e7e2bab8f4c93c3fc6d0a51733df3c060", + "0x01", + "0x00", + false + ] + ], + "out": [ + "0xf9358f2538fd5ccfeb848b64a96b743fcc930554" + ] + }, + "vitalik test 7": { + "in": [ + [ + "0x05", + "0x04a817c805", + "0x01ec30", + "0x3535353535353535353535353535353535353535", + "0x7d", + "0x", + "0x25", + "0x4eebf77a833b30520287ddd9478ff51abbdffa30aa90a8d655dba0e8a79ce0c1", + "0x4eebf77a833b30520287ddd9478ff51abbdffa30aa90a8d655dba0e8a79ce0c1", + "0x01", + "0x00", + false + ] + ], + "out": [ + "0xa8f7aba377317440bc5b26198a363ad22af1f3a4" + ] + }, + "vitalik test 8": { + "in": [ + [ + "0x05", + "0x04a817c805", + "0x01ec30", + "0x3535353535353535353535353535353535353535", + "0x7d", + "0x", + "0x25", + "0x4eebf77a833b30520287ddd9478ff51abbdffa30aa90a8d655dba0e8a79ce0c1", + "0x4eebf77a833b30520287ddd9478ff51abbdffa30aa90a8d655dba0e8a79ce0c1", + "0x01", + "0x00", + false + ] + ], + "out": [ + "0xa8f7aba377317440bc5b26198a363ad22af1f3a4" + ] + }, + "vitalik test 9": { + "in": [ + [ + "0x06", + "0x04a817c806", + "0x023e38", + "0x3535353535353535353535353535353535353535", + "0xd8", + "0x", + "0x25", + "0x6455bf8ea6e7463a1046a0b52804526e119b4bf5136279614e0b1e8e296a4e2f", + "0x6455bf8ea6e7463a1046a0b52804526e119b4bf5136279614e0b1e8e296a4e2d", + "0x01", + "0x00", + false + ] + ], + "out": [ + "0xf1f571dc362a0e5b2696b8e775f8491d3e50de35" + ] + }, + "vitalik test 10": { + "in": [ + [ + "0x07", + "0x04a817c807", + "0x029040", + "0x3535353535353535353535353535353535353535", + "0x0157", + "0x", + "0x25", + "0x52f1a9b320cab38e5da8a8f97989383aab0a49165fc91c737310e4f7e9821021", + "0x52f1a9b320cab38e5da8a8f97989383aab0a49165fc91c737310e4f7e9821021", + "0x01", + "0x00", + false + ] + ], + "out": [ + "0xd37922162ab7cea97c97a87551ed02c9a38b7332" + ] + } + } + } +} diff --git a/packages/contracts/test/data/json/libraries/codec/Lib_OVMCodec.test.json b/packages/contracts/test/data/json/libraries/codec/Lib_OVMCodec.test.json index 6808dcef02d4..a55ce0122c21 100644 --- a/packages/contracts/test/data/json/libraries/codec/Lib_OVMCodec.test.json +++ b/packages/contracts/test/data/json/libraries/codec/Lib_OVMCodec.test.json @@ -1,23 +1,4 @@ { "tests": { - "decompressEIP155Transaction": { - "decompression": { - "in": [ - "0x0001f4000064000064121212121212121212121212121212121212121299999999999999999999", - 420 - ], - "out": [ - [ - 100, - 100000000, - 500, - "0x1212121212121212121212121212121212121212", - 0, - "0x99999999999999999999", - 420 - ] - ] - } - } } } diff --git a/packages/contracts/test/data/json/libraries/utils/Lib_ECDSAUtils.test.json b/packages/contracts/test/data/json/libraries/utils/Lib_ECDSAUtils.test.json deleted file mode 100644 index 40f15819442f..000000000000 --- a/packages/contracts/test/data/json/libraries/utils/Lib_ECDSAUtils.test.json +++ /dev/null @@ -1,126 +0,0 @@ -{ - "tests": { - "recover": { - "standard hash, valid signature": { - "in": [ - "0xf83d80808094121212121212121212121212121212121212121280a0bc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a6c8080", - false, - "0x01", - "0x057bf1c0edf0a9002a79f8c9b39683f6453a18e73e02364270a2b6ee8117f11a", - "0x5f8181365a222c7b05a84c29a29754e6a925952d3bf4bd65a6259ef37ee048e3" - ], - "out": [ - "0x17ec8597ff92C3F44523bDc65BF0f1bE632917ff" - ] - }, - "standard hash, invalid v parameter": { - "in": [ - "0xf83d80808094121212121212121212121212121212121212121280a0bc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a6c8080", - false, - "0xfc", - "0x057bf1c0edf0a9002a79f8c9b39683f6453a18e73e02364270a2b6ee8117f11a", - "0x5f8181365a222c7b05a84c29a29754e6a925952d3bf4bd65a6259ef37ee048e3" - ], - "out": [ - "0x0000000000000000000000000000000000000000" - ] - }, - "standard hash, invalid r parameter": { - "in": [ - "0xf83d80808094121212121212121212121212121212121212121280a0bc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a6c8080", - false, - "0x01", - "0x0000000000000000000000000000000000000000000000000000000000000000", - "0x5f8181365a222c7b05a84c29a29754e6a925952d3bf4bd65a6259ef37ee048e3" - ], - "out": [ - "0x0000000000000000000000000000000000000000" - ] - }, - "standard hash, invalid s parameter": { - "in": [ - "0xf83d80808094121212121212121212121212121212121212121280a0bc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a6c8080", - false, - "0x01", - "0x057bf1c0edf0a9002a79f8c9b39683f6453a18e73e02364270a2b6ee8117f11a", - "0x0000000000000000000000000000000000000000000000000000000000000000" - ], - "out": [ - "0x0000000000000000000000000000000000000000" - ] - }, - "standard hash, invalid message": { - "in": [ - "0x0000000000000000000000000000000000000000000000000000000000000000", - false, - "0x01", - "0x057bf1c0edf0a9002a79f8c9b39683f6453a18e73e02364270a2b6ee8117f11a", - "0x5f8181365a222c7b05a84c29a29754e6a925952d3bf4bd65a6259ef37ee048e3" - ], - "out": [ - "0x1397890fcfC2D7563Aa01cE93A217b9809D3447B" - ] - }, - "eth signed message hash, valid signature": { - "in": [ - "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000121212121212121212121212121212121212121200000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000020bc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a", - true, - "0x01", - "0xe5a2edb71b6d76a8aacd59467d3063fd455ca13a4e9cb57da6f25849d40e4e2a", - "0x5465373d68d521845e3ffd2baf4c51f3d21c990914c09490b32ffc0b322dbf98" - ], - "out": [ - "0x17ec8597ff92C3F44523bDc65BF0f1bE632917ff" - ] - }, - "eth signed message hash, invalid v parameter": { - "in": [ - "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000121212121212121212121212121212121212121200000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000020bc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a", - true, - "0x1c", - "0xe5a2edb71b6d76a8aacd59467d3063fd455ca13a4e9cb57da6f25849d40e4e2a", - "0x5465373d68d521845e3ffd2baf4c51f3d21c990914c09490b32ffc0b322dbf98" - ], - "out": [ - "0x0000000000000000000000000000000000000000" - ] - }, - "eth signed message hash, invalid r parameter": { - "in": [ - "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000121212121212121212121212121212121212121200000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000020bc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a", - true, - "0x01", - "0x0000000000000000000000000000000000000000000000000000000000000000", - "0x5465373d68d521845e3ffd2baf4c51f3d21c990914c09490b32ffc0b322dbf98" - ], - "out": [ - "0x0000000000000000000000000000000000000000" - ] - }, - "eth signed message hash, invalid s parameter": { - "in": [ - "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000121212121212121212121212121212121212121200000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000020bc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a", - true, - "0x01", - "0xe5a2edb71b6d76a8aacd59467d3063fd455ca13a4e9cb57da6f25849d40e4e2a", - "0x0000000000000000000000000000000000000000000000000000000000000000" - ], - "out": [ - "0x0000000000000000000000000000000000000000" - ] - }, - "eth signed message hash, invalid message": { - "in": [ - "0x0000000000000000000000000000000000000000000000000000000000000000", - true, - "0x01", - "0xe5a2edb71b6d76a8aacd59467d3063fd455ca13a4e9cb57da6f25849d40e4e2a", - "0x5465373d68d521845e3ffd2baf4c51f3d21c990914c09490b32ffc0b322dbf98" - ], - "out": [ - "0xf8bd1421f9D28C8F58f33B25a6faB16F3f89b749" - ] - } - } - } -} diff --git a/packages/contracts/test/helpers/codec/encoding.ts b/packages/contracts/test/helpers/codec/encoding.ts index f7e16531fcd6..7f384930b4b9 100644 --- a/packages/contracts/test/helpers/codec/encoding.ts +++ b/packages/contracts/test/helpers/codec/encoding.ts @@ -37,115 +37,3 @@ export const getRawSignedComponents = (signed: string): any[] => { export const getSignedComponents = (signed: string): any[] => { return ethers.utils.RLP.decode(signed).slice(-3) } - -export const encodeCompactTransaction = (transaction: any): string => { - const nonce = ethers.utils.zeroPad(transaction.nonce, 3) - const gasLimit = ethers.utils.zeroPad(transaction.gasLimit, 3) - if (transaction.gasPrice % 1000000 !== 0) - throw Error('gas price must be a multiple of 1000000') - const compressedGasPrice: any = transaction.gasPrice / 1000000 - const gasPrice = ethers.utils.zeroPad(compressedGasPrice, 3) - const to = !transaction.to.length - ? fromHexString(constants.AddressZero) - : fromHexString(transaction.to) - const data = fromHexString(transaction.data) - - return Buffer.concat([ - Buffer.from(gasLimit), - Buffer.from(gasPrice), - Buffer.from(nonce), - Buffer.from(to), - data, - ]).toString('hex') -} - -export const serializeEthSignTransaction = ( - transaction: EIP155Transaction -): string => { - return ethers.utils.defaultAbiCoder.encode( - ['uint256', 'uint256', 'uint256', 'uint256', 'address', 'bytes'], - [ - transaction.nonce, - transaction.gasLimit, - transaction.gasPrice, - transaction.chainId, - transaction.to, - transaction.data, - ] - ) -} - -export const serializeNativeTransaction = ( - transaction: EIP155Transaction -): string => { - return ethers.utils.serializeTransaction(transaction) -} - -export const signEthSignMessage = async ( - wallet: Wallet, - transaction: EIP155Transaction -): Promise => { - const serializedTransaction = serializeEthSignTransaction(transaction) - const transactionHash = ethers.utils.keccak256(serializedTransaction) - const transactionHashBytes = ethers.utils.arrayify(transactionHash) - const transactionSignature = await wallet.signMessage(transactionHashBytes) - - const messageHash = ethers.utils.hashMessage(transactionHashBytes) - const [v, r, s] = getRawSignedComponents(transactionSignature).map( - (component) => { - return remove0x(component) - } - ) - return { - messageHash, - v: '0' + (parseInt(v, 16) - 27), - r, - s, - } -} - -export const signNativeTransaction = async ( - wallet: Wallet, - transaction: EIP155Transaction -): Promise => { - const serializedTransaction = serializeNativeTransaction(transaction) - const transactionSignature = await wallet.signTransaction(transaction) - - const messageHash = ethers.utils.keccak256(serializedTransaction) - const [v, r, s] = getSignedComponents(transactionSignature).map( - (component) => { - return remove0x(component) - } - ) - return { - messageHash, - v: '0' + (parseInt(v, 16) - transaction.chainId * 2 - 8 - 27), - r, - s, - } -} - -export const signTransaction = async ( - wallet: Wallet, - transaction: EIP155Transaction, - transactionType: number -): Promise => { - return transactionType === 2 - ? signEthSignMessage(wallet, transaction) //ETH Signed tx - : signNativeTransaction(wallet, transaction) //Create EOA tx or EIP155 tx -} - -export const encodeSequencerCalldata = async ( - wallet: Wallet, - transaction: EIP155Transaction, - transactionType: number -) => { - const sig = await signTransaction(wallet, transaction, transactionType) - const encodedTransaction = encodeCompactTransaction(transaction) - const dataPrefix = `0x0${transactionType}${sig.r}${sig.s}${sig.v}` - const calldata = - transactionType === 1 - ? `${dataPrefix}${remove0x(sig.messageHash)}` // Create EOA tx - : `${dataPrefix}${encodedTransaction}` // EIP155 tx or ETH Signed Tx - return calldata -} diff --git a/packages/contracts/test/helpers/test-runner/json-test-runner.ts b/packages/contracts/test/helpers/test-runner/json-test-runner.ts index 0380ee849f06..b08676cc0842 100644 --- a/packages/contracts/test/helpers/test-runner/json-test-runner.ts +++ b/packages/contracts/test/helpers/test-runner/json-test-runner.ts @@ -4,10 +4,14 @@ import { expect } from '../../setup' import { ethers } from 'hardhat' import { Contract, BigNumber } from 'ethers' -const bigNumberify = (arr) => { +const bigNumberify = (arr: any[]) => { return arr.map((el: any) => { if (typeof el === 'number') { return BigNumber.from(el) + } else if (typeof el === 'string' && /^\d+n$/gm.test(el)) { + return BigNumber.from(el.slice(0, el.length - 1)) + } else if (typeof el === 'string' && el.length > 2 && el.startsWith('0x')) { + return BigNumber.from(el.toLowerCase()) } else if (Array.isArray(el)) { return bigNumberify(el) } else { @@ -31,7 +35,7 @@ export const runJsonTest = (contractName: string, json: any): void => { .reverted } else { expect( - await contract.functions[functionName](...test.in) + bigNumberify(await contract.functions[functionName](...test.in)) ).to.deep.equal(bigNumberify(test.out)) } }) 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 c755898eec93..c829f755cf8e 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 @@ -243,36 +243,31 @@ const maybeDecodeSequencerBatchTransaction = ( decoded: DecodedSequencerBatchTransaction | null type: 'EIP155' | 'ETH_SIGN' | null } => { - let decoded = null - let type = null - try { - const txType = transaction.slice(0, 1).readUInt8() - if (txType === TxType.EIP155) { - type = 'EIP155' - decoded = ctcCoder.eip155TxData.decode(transaction.toString('hex')) - } else if (txType === TxType.EthSign) { - type = 'ETH_SIGN' - decoded = ctcCoder.ethSignTxData.decode(transaction.toString('hex')) - } else if (txType === TxType.EthSign2) { - type = 'ETH_SIGN' - decoded = ctcCoder.ethSign2TxData.decode(transaction.toString('hex')) - } else { - throw new Error(`Unknown sequencer transaction type.`) - } - // Temporary fix to propagate the value - decoded.value = '0x0' - // Validate the transaction - if (!validateBatchTransaction(type, decoded)) { - decoded = null + const decodedTx = ethers.utils.parseTransaction(transaction) + + return { + type: 'EIP155', + decoded: { + nonce: BigNumber.from(decodedTx.nonce).toNumber(), + gasPrice: BigNumber.from(decodedTx.gasPrice).toNumber(), + gasLimit: BigNumber.from(decodedTx.gasLimit).toNumber(), + value: toRpcHexString(decodedTx.value), + target: toHexString(decodedTx.to), // Maybe null this out for creations? + data: toHexString(decodedTx.data), + sig: { + v: BigNumber.from(decodedTx.v).toNumber(), + r: toHexString(decodedTx.r), + s: toHexString(decodedTx.s), + }, + type: 0, // EIP155 legacy holdover. + }, } } catch (err) { - // Do nothing - } - - return { - decoded, - type, + return { + decoded: null, + type: null, + } } } diff --git a/packages/data-transport-layer/src/services/server/service.ts b/packages/data-transport-layer/src/services/server/service.ts index 63a76164d42e..6ad577c1a67f 100644 --- a/packages/data-transport-layer/src/services/server/service.ts +++ b/packages/data-transport-layer/src/services/server/service.ts @@ -218,7 +218,8 @@ export class L1TransportServer extends BaseService { break case 'l2': currentL2Block = await this.state.db.getLatestUnconfirmedTransaction() - highestL2BlockNumber = await this.state.db.getHighestSyncedUnconfirmedBlock() + highestL2BlockNumber = + (await this.state.db.getHighestSyncedUnconfirmedBlock()) - 1 break default: throw new Error(`Unknown transaction backend ${backend}`) 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 1cb6b36acfff..edd91577070f 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 @@ -136,65 +136,6 @@ describe('Event Handlers: OVM_CanonicalTransactionChain.SequencerBatchAppended', '10B99425FB53AD7D40A939205C0F7B35CBB89AB4D67E7AE64BDAC5F1073943B4', batchExtraData: '', } - it('should correctly parse a mainnet transaction', async () => { - const input1: [any, SequencerBatchAppendedExtraData] = [ - { - args: { - _startingQueueIndex: ethers.constants.Zero, - _numQueueElements: ethers.constants.Zero, - _totalElements: ethers.constants.Zero, - }, - }, - { - l1TransactionData, - ...exampleExtraData, - }, - ] - - const output1 = await handleEventsSequencerBatchAppended.parseEvent( - ...input1 - ) - - const batchEntry = output1.transactionBatchEntry - expect(batchEntry.index).to.eq(exampleExtraData.batchIndex.toNumber()) - expect(batchEntry.root).to.eq(exampleExtraData.batchRoot) - expect(batchEntry.size).to.eq(exampleExtraData.batchSize.toNumber()) - expect(batchEntry.prevTotalElements).to.eq( - exampleExtraData.prevTotalElements.toNumber() - ) - expect(batchEntry.extraData).to.eq(exampleExtraData.batchExtraData) - expect(batchEntry.blockNumber).to.eq(exampleExtraData.blockNumber) - expect(batchEntry.timestamp).to.eq(exampleExtraData.timestamp) - expect(batchEntry.submitter).to.eq(exampleExtraData.submitter) - expect(batchEntry.l1TransactionHash).to.eq( - exampleExtraData.l1TransactionHash - ) - - // Expected transaction entry results based on mainnet data - // Source: https://ethtx.info/mainnet/0x6effe006836b841205ace4d99d7ae1b74ee96aac499a3f358b97fccd32ee9af2 - const txEntries = output1.transactionEntries - expect(txEntries).to.have.length(101) - expect(txEntries.every((t) => t.queueOrigin === 'sequencer' || 'l1')).to - .be.true - - // Sequencer transactions are decoded, but l1 transactions are not - txEntries.forEach((tx, i) => { - if (tx.queueOrigin === 'l1') { - expect(tx.decoded).to.be.null - } else { - const l2Tx = blocksOnL2[i].transactions[0] - expect(tx.decoded.data).to.equal(l2Tx.data) - expect(tx.decoded.target).to.equal(l2Tx.to.toLowerCase()) - expect(tx.decoded.nonce).to.equal(l2Tx.nonce) - expect(tx.decoded.gasLimit).to.equal( - BigNumber.from(l2Tx.gasLimit.hex).toNumber() - ) - expect(tx.decoded.gasPrice).to.equal( - BigNumber.from(l2Tx.gasPrice.hex).toNumber() - ) - } - }) - }) it('should error on malformed transaction data', async () => { const input1: [any, SequencerBatchAppendedExtraData] = [